Skip to content

feat(credit): add delete of credit transactions by billing account - #1842

Open
whoAbhishekSah wants to merge 1 commit into
fix/checkout-delete-methodfrom
fix/credit-delete-method
Open

feat(credit): add delete of credit transactions by billing account#1842
whoAbhishekSah wants to merge 1 commit into
fix/checkout-delete-methodfrom
fix/credit-delete-method

Conversation

@whoAbhishekSah

Copy link
Copy Markdown
Member

Part of #1835. Stacked on the checkout delete PR.

Credit transactions also hold a foreign key to the billing customer row. Without a delete method, an account teardown would either orphan them or fail on the constraint.

Changes

  • DeleteByAccountID on the transactions Postgres repository.
  • DeleteByAccountID on the credit service.
  • Regenerated the transaction repository mock.

No behavior change: nothing calls these yet.

🤖 Generated with Claude Code

Credit transactions hold a foreign key to the billing customer row.
Without a way to remove them, a billing account teardown would leave
them orphaned or fail on the constraint. The method is meant for
account teardown.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9869bdc2-4ca9-4b0a-a4f3-63454da5369f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rohilsurana rohilsurana left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One inline note on the doc comment. Also, the PR description says credit transactions hold a foreign key to the billing customer row. billing_transactions.account_id has no REFERENCES constraint (see 20231012175641_create_billing_tables.up.sql). The delete is still worth having, since it avoids orphaned rows, but the description overstates the constraint. Worth updating so reviewers do not take the FK claim at face value.

Comment thread billing/credit/service.go
}

// DeleteByAccountID removes all credit transactions of a billing account. It is
// meant for account teardown; the deletion is recorded in audit records.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says the deletion is recorded in audit records, but nothing in the stack writes audit records for credit transactions. Only checkout deletes get them (#1839). Suggest dropping the sentence, or adding the audit record if it was intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants