-
Notifications
You must be signed in to change notification settings - Fork 39
refactor(billing): Billing simplification entitlement usage #1312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
whoAbhishekSah
wants to merge
4
commits into
main
Choose a base branch
from
billing_simplification_entitlement_usage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update PROTON_COMMIT to 4144445eb0f9cbd1a801a3d0aa5cfce4cc0ea551 which deprecates billing_id and project_id in entitlement and usage RPCs. Generated files updated: - proto/v1beta1/admin.pb.go - proto/v1beta1/frontier.pb.go - proto/apidocs.swagger.yaml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…e handlers Update handlers to always fetch billing_id from org_id, ignoring deprecated billing_id parameter completely: - CheckFeatureEntitlement: always use customerService.GetByOrgID() - CreateBillingUsage: always use customerService.GetByOrgID() - RevertBillingUsage: always use customerService.GetByOrgID() Remove billing_id validation from CreateBillingUsage authorization interceptor since billing_id is now always inferred in the handler. Error handling for GetByOrgID: - ErrNotFound: Return empty response for CheckFeatureEntitlement, CodeNotFound for others - ErrInvalidUUID, ErrInvalidID: Return CodeInvalidArgument - Other errors: Return CodeInternal with logging Benefits: - Simpler code with single path (no conditional logic) - More secure (users cannot provide arbitrary billing_ids) - Consistent behavior across all requests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Update tests to work with new implementation that always infers billing_id from org_id: CheckFeatureEntitlement tests: - Add customerService mock with GetByOrgID expectations - Change requests to use org_id instead of billing_id - Add test for ErrNotFound (returns empty response) - Add test for ErrInvalidUUID (returns invalid argument) CreateBillingUsage tests: - Add customerService mock with GetByOrgID expectations - Change all requests to use org_id instead of billing_id - All existing test cases now pass with customerService mocking All tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Pull Request Test Coverage Report for Build 19918211554Details
💛 - Coveralls |
Clean up struct field alignment and formatting. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Simplify billing entitlement and usage APIs by automatically inferring
billing_idfromorg_id. Clients now only need to provideorg_idwhen calling these RPCs.Changes
Proto Updates
billing_idandproject_idfields in:CheckFeatureEntitlementRequestCreateBillingUsageRequestRevertBillingUsageRequest4144445eb0f9cbd1a801a3d0aa5cfce4cc0ea551Backend Updates
All handlers now always fetch
billing_idfromorg_id:CheckFeatureEntitlement: UsescustomerService.GetByOrgID()CreateBillingUsage: UsescustomerService.GetByOrgID()RevertBillingUsage: UsescustomerService.GetByOrgID()Removed
ensureBillingAccountBelongToOrgvalidation fromCreateBillingUsageauthorization interceptor (now redundant).Error Handling
ErrNotFound: Empty response for CheckFeatureEntitlement, CodeNotFound for othersErrInvalidUUID/ErrInvalidID: CodeInvalidArgumentBenefits
org_id)billing_idBreaking Changes
None - deprecated fields are still accepted for backward compatibility but ignored.