refactor(billing): always infer billing_id from org_id in transaction and invoice RPCs #1303
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