refactor(billing): fetch billing history via the generated OpenAPI SDK#3515
Open
baktun14 wants to merge 2 commits into
Open
refactor(billing): fetch billing history via the generated OpenAPI SDK#3515baktun14 wants to merge 2 commits into
baktun14 wants to merge 2 commits into
Conversation
Replace the hand-written StripeService.getCustomerTransactions call in the billing-history query with the generated api.v1.listStripeTransactions client, so its request/response types follow the API contract instead of being kept in sync by hand. Regenerate console-api-types for the transactions endpoint (offset pagination and the current response shape), derive the view's transaction type from the generated paths, and switch the query's error handling to ApiError. CSV export stays on the hand-written client. Ref CON-747
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesStripe transaction migration
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3515 +/- ##
==========================================
- Coverage 74.10% 73.12% -0.99%
==========================================
Files 1141 1051 -90
Lines 29707 27357 -2350
Branches 7437 6977 -460
==========================================
- Hits 22015 20005 -2010
+ Misses 6796 6486 -310
+ Partials 896 866 -30
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
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
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.
Why
The frontend has two parallel ways to call the billing API: the hand-maintained HTTP SDK and the SDK generated from the API's OpenAPI contract. The billing-history transaction list still went through the hand-maintained client, so its request/response types were kept in sync by hand. This recently caused silent drift: the billing-history work changed the
/v1/stripe/transactionscontract (offset pagination, new transaction fields, a total count) while the generated types stayed on the old cursor-based shape. Sourcing this query from the generated SDK makes the frontend types follow the contract automatically.Closes CON-747
What
Migrates the billing-history transaction list to fetch through the generated OpenAPI SDK (
api.v1.listStripeTransactions) instead of the hand-maintainedStripeService.getCustomerTransactions, matching howuseDefaultPaymentMethodQueryalready works. The fetch migration itself is behavior-neutral (billing history loads, paginates, and date-filters exactly as before).console-api-typesfor the transactions endpoint (offset pagination + current response shape). The generated diff is scoped to that endpoint only; pre-existing drift onmain(trial202response,confirmStripeTransaction.idempotencyKey) is intentionally left for a separate fullsdk:gensweep.pathsand re-exported from@src/queries, replacing the hand-maintainedBillingTransactionfor this flow.confirmPaymentinvalidation usesapi.v1.listStripeTransactions.getKey(); query error handling switched fromaxios.isAxiosErrortoApiError/extractApiErrorMessage.getPaymentTransactionsKeyquery-key helper.py-1→py-0.5) so the pills read less chunky.Summary by CodeRabbit