-
Notifications
You must be signed in to change notification settings - Fork 39
refactor(billing): always infer billing_id from org_id in transaction and invoice RPCs #1303
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
Merged
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
rohilsurana
approved these changes
Nov 28, 2025
Pull Request Test Coverage Report for Build 19759183894Details
💛 - Coveralls |
Deprecate billing_id parameter in 4 RPCs: - ListBillingTransactionsRequest - TotalDebitedTransactionsRequest (BREAKING: changed from required to optional) - ListInvoicesRequest - GetUpcomingInvoiceRequest Backend will infer billing_id from org_id since each organization has only one active billing account. Updated PROTON_COMMIT to d40c501dac9958d86c945b02f0288fcaf6d6a4e3.
…nvoice RPCs Update handlers for 4 RPCs to always infer billing_id from org_id: - ListBillingTransactions - TotalDebitedTransactions - ListInvoices - GetUpcomingInvoice Changes: - Use customerService.GetByOrgID() to fetch billing account ID - Return empty list/response when billing account doesn't exist (ErrNotFound) - Return bad request for invalid org_id (ErrInvalidUUID, ErrInvalidID) - Deprecated billing_id parameter is ignored - Add org_id to error log lines for better debugging
…oice RPCs Remove ensureBillingAccountBelongToOrg checks from authorization interceptors for 4 RPCs: - ListBillingTransactions - TotalDebitedTransactions - ListInvoices - GetUpcomingInvoice Since billing_id is now always inferred from org_id by handlers, the separate validation that billing_id belongs to org_id is redundant.
Update test cases for ListBillingTransactions, TotalDebitedTransactions, ListInvoices, and GetUpcomingInvoice to mock customerService and test the new behavior where billing_id is inferred from org_id. Changes: - Add customerService mock to all test cases - Update test requests to use org_id instead of billing_id - Add test cases for when billing account is not found - Update test struct definitions to include customerSetup function - Update test runners to initialize customerService mock 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
a90016b to
74b0ed2
Compare
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 transaction and invoice RPCs by always inferring
billing_idfromorg_id. Since each organization can have only one active billing account, passingbilling_idseparatelyis redundant.
Changes
RPCs Updated
This PR updates 4 billing-related RPCs:
ListBillingTransactionsTotalDebitedTransactionsListInvoicesGetUpcomingInvoiceImplementation Details
Proto Changes (raystack/proton#437)
billing_idparameter in all 4 request messagesbilling_idoptional withignore_empty: truevalidation (was required inTotalDebitedTransactions)Handler Changes
customerService.GetByOrgID()to fetch billing account IDbilling_idparameter is ignored if providedErrNotFound)org_id(ErrInvalidUUID,ErrInvalidID)org_idto error log lines for better debuggingAuthorization Changes
ensureBillingAccountBelongToOrgchecks from Connect authorization interceptorsbilling_idis always inferred fromorg_id, separate validation is no longer neededMigration Guide
For API Clients
billing_idparameter when calling these RPCsbilling_id, it will be ignored and inferred fromorg_idinsteadorg_idis always providedTesting
Related