diff --git a/Cargo.lock b/Cargo.lock index 8eaa8294..ede3194c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -717,7 +717,7 @@ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "sentry_protos" -version = "0.27.1" +version = "0.28.0" dependencies = [ "prost", "prost-types", diff --git a/proto/sentry_protos/billing/v1/services/charge/v1/charge.proto b/proto/sentry_protos/billing/v1/services/charge/v1/charge.proto index 0035d24b..69a1cba8 100644 --- a/proto/sentry_protos/billing/v1/services/charge/v1/charge.proto +++ b/proto/sentry_protos/billing/v1/services/charge/v1/charge.proto @@ -45,4 +45,9 @@ message PlatformRefund { optional string reason = 4; // Unix epoch seconds when the refund was recorded by the platform. int64 date_added_st = 5; + // Stripe id of the ``PlatformCharge`` this refund applies to. Mirrors + // Stripe's own ``refund.charge`` wire field. Lets callers disambiguate + // refunds in flat responses like ``ListRefundsByInvoiceResponse`` when + // an invoice has more than one charge (e.g. retries, partial capture). + string stripe_charge_id = 6; } diff --git a/proto/sentry_protos/billing/v1/services/charge/v1/endpoint_list_refunds.proto b/proto/sentry_protos/billing/v1/services/charge/v1/endpoint_list_refunds.proto new file mode 100644 index 00000000..ecbb641e --- /dev/null +++ b/proto/sentry_protos/billing/v1/services/charge/v1/endpoint_list_refunds.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package sentry_protos.billing.v1.services.charge.v1; + +import "sentry_protos/billing/v1/services/charge/v1/charge.proto"; + +// Lists every recorded refund associated with the charges for a single +// platform invoice. Callers in the presentation layer use this to render +// invoice-level refund state without crossing the charge service boundary. +message ListRefundsByInvoiceRequest { + uint64 invoice_id = 1; +} + +message ListRefundsByInvoiceResponse { + // Refunds ordered by ``date_added_st`` ascending. Empty when the invoice + // has no refunds. + repeated PlatformRefund refunds = 1; +} diff --git a/rust/src/sentry_protos.billing.v1.services.charge.v1.rs b/rust/src/sentry_protos.billing.v1.services.charge.v1.rs index 36e20b94..07f1219c 100644 --- a/rust/src/sentry_protos.billing.v1.services.charge.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.charge.v1.rs @@ -60,6 +60,12 @@ pub struct PlatformRefund { /// Unix epoch seconds when the refund was recorded by the platform. #[prost(int64, tag = "5")] pub date_added_st: i64, + /// Stripe id of the `PlatformCharge` this refund applies to. Mirrors + /// Stripe's own `refund.charge` wire field. Lets callers disambiguate + /// refunds in flat responses like `ListRefundsByInvoiceResponse` when + /// an invoice has more than one charge (e.g. retries, partial capture). + #[prost(string, tag = "6")] + pub stripe_charge_id: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct CaptureChargeRequest { @@ -162,6 +168,21 @@ pub struct ListChargesForInvoiceResponse { #[prost(message, repeated, tag = "1")] pub charges: ::prost::alloc::vec::Vec, } +/// Lists every recorded refund associated with the charges for a single +/// platform invoice. Callers in the presentation layer use this to render +/// invoice-level refund state without crossing the charge service boundary. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ListRefundsByInvoiceRequest { + #[prost(uint64, tag = "1")] + pub invoice_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListRefundsByInvoiceResponse { + /// Refunds ordered by `date_added_st` ascending. Empty when the invoice + /// has no refunds. + #[prost(message, repeated, tag = "1")] + pub refunds: ::prost::alloc::vec::Vec, +} /// Records platform refunds for a Stripe charge from a webhook payload. /// Mirrors the contents of `stripe_charge.refunds` as `PlatformRefund` /// rows idempotently keyed by Stripe refund id, and syncs the aggregate