Repository navigation
feat(store): billing account delete hides the account's token transactions with the row - #1999
rohilsurana wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Coverage Report for CI Build 38886680511Coverage increased (+0.06%) to 55.526%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
4f3a2c0 to
88f48ee
Compare
be61aad to
49f5fe5
Compare
88f48ee to
55510df
Compare
49f5fe5 to
170adbe
Compare
55510df to
5a6a5bc
Compare
170adbe to
c2b82b8
Compare
…tions and reports the forfeit
…t calls the billing provider
c2b82b8 to
e625872
Compare
5a6a5bc to
0286c5f
Compare
| } | ||
|
|
||
| func (s *Service) logTokensForfeited(ctx context.Context, customer Customer, forfeit ForfeitedTokens) { | ||
| if err := audit.NewLogger(ctx, customer.OrgID).LogWithAttrs(audit.BillingTokensForfeitedEvent, audit.Target{ |
There was a problem hiding this comment.
this is not audit records, can we add audit records or is this event audit log intended?
Summary
Deleting a billing account now hides the account's token transactions. The delete also tells the caller how many tokens were forfeited.
An account that owes tokens cannot be deleted. The API answers with failed precondition.
When tokens are forfeited, an
app.billing.tokens.forfeitedaudit record is written.This PR is stacked on #1983.
Changes
HasLiveRecordsrepository method. A refused delete no longer leaves a deleted customer at Stripe.ErrHasTokenDebterror to failed precondition.billing/creditandcore/deleterare not changed.Technical Details
account_idis the customer id, never the system account.system.buy, kept between zero and the forfeited amount.Test Plan
go build ./...go veton the touched packagesgo test ./internal/store/postgres/ ./billing/... ./core/deleter/... ./internal/api/v1beta1connect/golangci-lint runon the touched packages, 0 issuesgofmton the changed filesSQL Safety