feat(checkout): add delete of checkout records by billing account - #1841
Conversation
Checkout rows hold a foreign key to the billing customer row, and nothing could remove them, which blocked the hard delete of a billing account. Sessions on the billing provider are not touched; they expire on their own. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe checkout interfaces now support deleting records by customer ID. The PostgreSQL repository executes the customer-filtered deletion with timeout and error wrapping. The service delegates the operation without modifying provider-side sessions. ChangesCheckout record deletion
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
End-to-end testing of the whole stackPosting here because this is the PR that lands on Tested at the tip of the stack, which contains all six PRs: #1841 → #1842 → #1843 → #1844 → #1838 → #1839. That covers checkout delete, credit delete, kyc delete, the retryable subscription teardown, the deleter changes, and the new checkout audit records. Run against a real Stripe test-mode account, so every provider call actually went to Stripe. No mock and no recorded cassettes. Setup
Results
Extra checks:
What the retry case showedI forced a realistic mid-teardown failure with a trigger on
Audit record contentsEach Two issues found, neither introduced by this stack1. A refused delete looks like a crash to the caller. When the invoice guard blocks a delete, the client gets: {"code":"internal","message":"internal server error"}The real reason never reaches the caller. 2. Credit ledger rows on the system account stay behind. Each usage debit writes two rows: one on the customer account and one on the system account ( |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Part of #1835. Bottom of the org-delete cleanup stack.
Checkout rows hold a foreign key to the billing customer row, and nothing could remove them. That FK is what blocks the hard delete of a billing account during org delete.
Changes
DeleteByCustomerIDon the checkout Postgres repository.DeleteByCustomeron the checkout service.No behavior change: nothing calls these yet. The deleter starts using them later in the stack. Checkout sessions on the billing provider are not touched; they expire on their own.
🤖 Generated with Claude Code