Skip to content

chore(billing-platform): Add protos for the tax-transaction settlement endpoints#317

Draft
dashed wants to merge 1 commit into
mainfrom
aleal/feat/contract-tax-transaction-settlement
Draft

chore(billing-platform): Add protos for the tax-transaction settlement endpoints#317
dashed wants to merge 1 commit into
mainfrom
aleal/feat/contract-tax-transaction-settlement

Conversation

@dashed

@dashed dashed commented Jun 18, 2026

Copy link
Copy Markdown
Member

Adds the contract-service messages backing https://github.com/getsentry/getsentry/pull/20632 (tax-transaction settlement). That slice settles an invoice's provider-side tax document once the charge outcome is known: it commits the document (finalizes it into the vendor's filings) when the invoice is paid, and voids it when the dunning schedule is exhausted and the invoice is abandoned.

Three endpoints, one endpoint_*.proto per request/response pair (mirroring MarkInvoicePaid):

  • GetTaxTransaction — reads the tax-document linkage recorded on an invoice (external_reference, status, needs_retry) so settlement can decide whether to commit or void. external_reference and status are optional because a shadow or untaxed invoice carries no document; needs_retry is a bare bool (a null DB value reads as false).
  • MarkTaxTransactionCommitted / MarkTaxTransactionVoided — record the settled status. Each carries needs_retry so the reconciliation sweep can re-drive a vendor call that did not confirm, and returns updated (true if a matching invoice was found).

Plus a standalone TaxTransactionStatus enum (PENDING = 1, COMMITTED = 2, VOID = 3, with the proto3 UNSPECIFIED = 0 zero value), kept in its own file alongside the existing standalone type files (e.g. sku.proto) since the endpoint files are message-only.

These back ContractService methods that are currently prototyped with proto-free dataclasses (the dataclass-prototype pattern). The dataclasses are intentionally left in place here — migrating them onto these messages is a later step. SetPendingTaxTransaction (the pending-link slice) is already covered by #315.

Only the .proto sources are authored; the rust stubs are regenerated at build time and the python stubs build at package time.

…t endpoints

Adds the contract-service messages backing getsentry PR #20632
(tax-transaction settlement), where the platform commits an invoice's
provider-side tax document once the invoice is paid and voids it once the
dunning schedule is exhausted.

New messages, one endpoint_*.proto per request/response pair, mirroring
MarkInvoicePaid:
- GetTaxTransaction — reads the invoice's tax-document linkage (external
  reference, status, needs_retry) so settlement can decide commit vs void.
- MarkTaxTransactionCommitted / MarkTaxTransactionVoided — record the settled
  status, carrying needs_retry so the reconciliation sweep can re-drive a
  vendor call that did not confirm.

Plus a standalone TaxTransactionStatus enum (PENDING=1, COMMITTED=2, VOID=3,
with the proto3 UNSPECIFIED=0 zero value) matching the persisted statuses.

These back ContractService methods currently prototyped with proto-free
dataclasses; the dataclasses are intentionally left in place, and migrating
them to these messages is a later step. SetPendingTaxTransaction is already
covered by #315. Only the .proto sources are authored; the rust stubs are
regenerated and python stubs build at package time.
@github-actions

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow ci / buf-checks (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 18, 2026, 5:07 PM

@dashed dashed self-assigned this Jun 18, 2026
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.

1 participant