From 695622bd93de90b9059756e38b017d5c3f42e654 Mon Sep 17 00:00:00 2001 From: Alberto Leal Date: Thu, 18 Jun 2026 16:03:20 -0400 Subject: [PATCH 1/2] chore(billing-platform): carry tax_transaction_code on contract create/rollover requests Adds an optional `tax_transaction_code` to CreateContractRequest (field 9) and RolloverContractRequest (field 7) so the contract service can record the tax provider's document reference on the invoice atomically with creation. This backs getsentry's atomic tax-linkage: today the platform persists the invoice and then writes the document reference in a separate best-effort call, which can fail and leave a charged invoice with no linked tax document. Carrying the reference in the create/rollover request lets the contract service write it in the same insert as the amount, removing that window. On CreateContractRequest field 9 sits after billing_type (7) and has_soft_cap (8); on RolloverContractRequest field 7 leaves field 6 free for the independent tax_pending flag. --- .../contract/v1/endpoint_create_contract.proto | 6 ++++++ .../contract/v1/endpoint_rollover_contract.proto | 6 ++++++ .../sentry_protos.billing.v1.services.contract.v1.rs | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_create_contract.proto b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_create_contract.proto index b1d439ee..ef6e4591 100644 --- a/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_create_contract.proto +++ b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_create_contract.proto @@ -25,6 +25,12 @@ message CreateContractRequest { // Whether usage past reserved volume is allowed (and billed) instead of // hard-stopping ingestion. bool has_soft_cap = 8; + + // The tax provider's reference for the tax document opened for this invoice. + // When set, the contract service records it on the created invoice as a + // pending tax transaction atomically with invoice creation. Unset means no + // tax document was opened. + optional string tax_transaction_code = 9; } message CreateContractResponse { diff --git a/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_rollover_contract.proto b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_rollover_contract.proto index fc4cdfd9..2a099050 100644 --- a/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_rollover_contract.proto +++ b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_rollover_contract.proto @@ -18,6 +18,12 @@ message RolloverContractRequest { // The pending change to apply to the new contract, if any. Unset means no // pending change is being applied during this rollover. optional sentry_protos.billing.v1.common.v1.PendingChange pending_change = 5; + + // The tax provider's reference for the tax document opened for this invoice. + // When set, the contract service records it on the new invoice as a pending + // tax transaction atomically with invoice creation, so the document can later + // be committed or voided. Unset means no tax document was opened. + optional string tax_transaction_code = 7; } message RolloverContractResponse { diff --git a/rust/src/sentry_protos.billing.v1.services.contract.v1.rs b/rust/src/sentry_protos.billing.v1.services.contract.v1.rs index 01e66f77..0aacb665 100644 --- a/rust/src/sentry_protos.billing.v1.services.contract.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.contract.v1.rs @@ -520,6 +520,12 @@ pub struct CreateContractRequest { /// hard-stopping ingestion. #[prost(bool, tag = "8")] pub has_soft_cap: bool, + /// The tax provider's reference for the tax document opened for this invoice. + /// When set, the contract service records it on the created invoice as a + /// pending tax transaction atomically with invoice creation. Unset means no + /// tax document was opened. + #[prost(string, optional, tag = "9")] + pub tax_transaction_code: ::core::option::Option<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct CreateContractResponse { @@ -722,6 +728,12 @@ pub struct RolloverContractRequest { pub pending_change: ::core::option::Option< super::super::super::common::v1::PendingChange, >, + /// The tax provider's reference for the tax document opened for this invoice. + /// When set, the contract service records it on the new invoice as a pending + /// tax transaction atomically with invoice creation, so the document can later + /// be committed or voided. Unset means no tax document was opened. + #[prost(string, optional, tag = "7")] + pub tax_transaction_code: ::core::option::Option<::prost::alloc::string::String>, } #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] pub struct RolloverContractResponse { From 2ef6002919536d6cca1d8bc8362a06fd4fdabf93 Mon Sep 17 00:00:00 2001 From: "getsantry[bot]" <66042841+getsantry[bot]@users.noreply.github.com> Date: Tue, 23 Jun 2026 00:18:33 +0000 Subject: [PATCH 2/2] chore: Regenerate Rust bindings --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 75841175..2ba72cf8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -717,7 +717,7 @@ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "sentry_protos" -version = "0.32.3" +version = "0.32.4" dependencies = [ "prost", "prost-types",