diff --git a/Cargo.lock b/Cargo.lock index 11fd409c..0d35f961 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -717,7 +717,7 @@ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "sentry_protos" -version = "0.37.0" +version = "0.38.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 69a1cba8..bb03561b 100644 --- a/proto/sentry_protos/billing/v1/services/charge/v1/charge.proto +++ b/proto/sentry_protos/billing/v1/services/charge/v1/charge.proto @@ -31,6 +31,8 @@ message PlatformCharge { // sum ``refunds[*].amount_cents`` if they need the aggregate, and // ``len(refunds) > 0`` (or sum == amount) signals "refunded." repeated PlatformRefund refunds = 10; + // Unix epoch seconds when the charge row was created locally. + int64 date_added_st = 11; } // Canonical projection of a stored platform refund. One row per recorded diff --git a/proto/sentry_protos/billing/v1/services/charge/v1/endpoint_list_charges_for_invoice_ids.proto b/proto/sentry_protos/billing/v1/services/charge/v1/endpoint_list_charges_for_invoice_ids.proto new file mode 100644 index 00000000..087add16 --- /dev/null +++ b/proto/sentry_protos/billing/v1/services/charge/v1/endpoint_list_charges_for_invoice_ids.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package sentry_protos.billing.v1.services.charge.v1; + +import "sentry_protos/billing/v1/services/charge/v1/charge.proto"; + +// Lists PlatformCharges for a batch of invoice ids, refunds pre-attached. +message ListChargesForInvoiceIdsRequest { + repeated uint64 invoice_ids = 1; +} + +message ListChargesForInvoiceIdsResponse { + repeated PlatformCharge charges = 1; +} diff --git a/proto/sentry_protos/billing/v1/services/charge/v1/endpoint_list_charges_for_organization.proto b/proto/sentry_protos/billing/v1/services/charge/v1/endpoint_list_charges_for_organization.proto new file mode 100644 index 00000000..ca2e833d --- /dev/null +++ b/proto/sentry_protos/billing/v1/services/charge/v1/endpoint_list_charges_for_organization.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package sentry_protos.billing.v1.services.charge.v1; + +import "sentry_protos/billing/v1/services/charge/v1/charge.proto"; + +// Lists PlatformCharges for an organization, refunds pre-attached. +message ListChargesForOrganizationRequest { + uint64 organization_id = 1; +} + +message ListChargesForOrganizationResponse { + repeated PlatformCharge charges = 1; +} diff --git a/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_get_invoice_guids_for_ids.proto b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_get_invoice_guids_for_ids.proto new file mode 100644 index 00000000..94334039 --- /dev/null +++ b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_get_invoice_guids_for_ids.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package sentry_protos.billing.v1.services.contract.v1; + +// Batch-resolves PlatformInvoice ids to their guids. Missing ids are +// silently omitted from the response. +message GetInvoiceGuidsForIdsRequest { + repeated uint64 invoice_ids = 1; +} + +message GetInvoiceGuidsForIdsResponse { + map invoice_guids = 1; +} diff --git a/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_start_manual_payment.proto b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_start_manual_payment.proto new file mode 100644 index 00000000..e1e81eca --- /dev/null +++ b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_start_manual_payment.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package sentry_protos.billing.v1.services.contract.v1; + +// Atomically stamps manual_payment_started_at on an unpaid PlatformInvoice. +message StartManualPaymentRequest { + uint64 invoice_id = 1; +} + +message StartManualPaymentResponse { + // False when no row matched paid=false (invoice paid, missing, or raced). + bool updated = 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 07f1219c..4fc5f64f 100644 --- a/rust/src/sentry_protos.billing.v1.services.charge.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.charge.v1.rs @@ -41,6 +41,9 @@ pub struct PlatformCharge { /// `len(refunds) > 0` (or sum == amount) signals "refunded." #[prost(message, repeated, tag = "10")] pub refunds: ::prost::alloc::vec::Vec, + /// Unix epoch seconds when the charge row was created locally. + #[prost(int64, tag = "11")] + pub date_added_st: i64, } /// Canonical projection of a stored platform refund. One row per recorded /// refund against a `PlatformCharge`. @@ -168,6 +171,28 @@ pub struct ListChargesForInvoiceResponse { #[prost(message, repeated, tag = "1")] pub charges: ::prost::alloc::vec::Vec, } +/// Lists PlatformCharges for a batch of invoice ids, refunds pre-attached. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ListChargesForInvoiceIdsRequest { + #[prost(uint64, repeated, tag = "1")] + pub invoice_ids: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListChargesForInvoiceIdsResponse { + #[prost(message, repeated, tag = "1")] + pub charges: ::prost::alloc::vec::Vec, +} +/// Lists PlatformCharges for an organization, refunds pre-attached. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ListChargesForOrganizationRequest { + #[prost(uint64, tag = "1")] + pub organization_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListChargesForOrganizationResponse { + #[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. 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 65224b73..3d4853ac 100644 --- a/rust/src/sentry_protos.billing.v1.services.contract.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.contract.v1.rs @@ -472,6 +472,8 @@ pub struct ContractMetadata { pub billing_features: ::core::option::Option, #[prost(string, tag = "9")] pub package_uid: ::prost::alloc::string::String, + #[prost(uint64, optional, tag = "10")] + pub previous_id: ::core::option::Option, #[deprecated] #[prost(uint64, tag = "8")] pub package_id: u64, @@ -584,6 +586,18 @@ pub struct GetInvoiceResponse { #[prost(message, optional, tag = "1")] pub invoice: ::core::option::Option, } +/// Batch-resolves PlatformInvoice ids to their guids. Missing ids are +/// silently omitted from the response. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct GetInvoiceGuidsForIdsRequest { + #[prost(uint64, repeated, tag = "1")] + pub invoice_ids: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetInvoiceGuidsForIdsResponse { + #[prost(map = "uint64, string", tag = "1")] + pub invoice_guids: ::std::collections::HashMap, +} #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetUnchargedInvoicesRequest { /// Returns Invoices whose current billing period ends before this time and @@ -746,3 +760,15 @@ pub struct RolloverContractResponse { #[prost(uint64, tag = "4")] pub new_contract_id: u64, } +/// Atomically stamps manual_payment_started_at on an unpaid PlatformInvoice. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct StartManualPaymentRequest { + #[prost(uint64, tag = "1")] + pub invoice_id: u64, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct StartManualPaymentResponse { + /// False when no row matched paid=false (invoice paid, missing, or raced). + #[prost(bool, tag = "1")] + pub updated: bool, +}