diff --git a/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_list_invoices.proto b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_list_invoices.proto index ae0f65f0..f7cfcd87 100644 --- a/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_list_invoices.proto +++ b/proto/sentry_protos/billing/v1/services/contract/v1/endpoint_list_invoices.proto @@ -20,6 +20,9 @@ message ListInvoicesRequest { // When true, omit invoices with hide_from_customer_receipts=true so the // response (and total) match what customers should see on receipts. bool customer_receipts_only = 4; + + // When set, only off-cycle invoices requested by this client are returned. + optional string client_id = 5; } message ListInvoicesResponse { diff --git a/proto/sentry_protos/billing/v1/services/seer_feature_billing/v1/endpoint_auto_top_up_seer_wallet.proto b/proto/sentry_protos/billing/v1/services/seer_feature_billing/v1/endpoint_auto_top_up_seer_wallet.proto new file mode 100644 index 00000000..53626a98 --- /dev/null +++ b/proto/sentry_protos/billing/v1/services/seer_feature_billing/v1/endpoint_auto_top_up_seer_wallet.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package sentry_protos.billing.v1.services.seer_feature_billing.v1; + +import "google/protobuf/timestamp.proto"; + +// Buys the organization's configured top-up when its Seer wallet balance is +// below the auto top-up threshold. Safe to repeat: calls with a current_ts in +// the same five-minute window bill at most once. +message AutoTopUpSeerWalletRequest { + uint64 organization_id = 1; + google.protobuf.Timestamp current_ts = 2; +} + +message AutoTopUpSeerWalletResponse { + enum Outcome { + OUTCOME_UNSPECIFIED = 0; + // No auto top-up config, or it is disabled. + OUTCOME_NOT_ENABLED = 1; + // The current contract has no Seer wallet. + OUTCOME_NO_WALLET = 2; + OUTCOME_ABOVE_THRESHOLD = 3; + // Another top-up for the organization holds the charge lock. + OUTCOME_LOCKED = 4; + // The last top-up invoice is unpaid, including when its charge failed. + // Top-ups resume once the customer pays it. + OUTCOME_INVOICE_PENDING = 5; + OUTCOME_BILLED = 6; + } + Outcome outcome = 1; + // Set when outcome is OUTCOME_BILLED. + optional uint64 invoice_id = 2; + // Whether the top-up invoice was paid. Only meaningful when outcome is + // OUTCOME_BILLED. + bool paid = 3; +} diff --git a/proto/sentry_protos/billing/v1/services/seer_wallet_config/v1/endpoint_list_auto_top_up_organizations.proto b/proto/sentry_protos/billing/v1/services/seer_wallet_config/v1/endpoint_list_auto_top_up_organizations.proto new file mode 100644 index 00000000..acd4e1f7 --- /dev/null +++ b/proto/sentry_protos/billing/v1/services/seer_wallet_config/v1/endpoint_list_auto_top_up_organizations.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package sentry_protos.billing.v1.services.seer_wallet_config.v1; + +// Lists the organizations whose auto top-up is enabled, in ascending +// organization_id order. +message ListAutoTopUpOrganizationsRequest { + // Only organizations with a larger id are returned. Pass the last id of the + // previous page to read the next one. + uint64 after_organization_id = 1; + // Must be positive. + uint32 max_items = 2; +} + +message ListAutoTopUpOrganizationsResponse { + repeated uint64 organization_ids = 1; + // True when more organizations follow the last one returned. + bool truncated = 2; +} 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 554659ce..026bb6bc 100644 --- a/rust/src/sentry_protos.billing.v1.services.contract.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.contract.v1.rs @@ -1103,7 +1103,7 @@ pub struct GetUninvoicedContractsResponse { #[prost(uint64, repeated, tag = "3")] pub contract_ids: ::prost::alloc::vec::Vec, } -#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct ListInvoicesRequest { /// Only invoices owned by this organization are returned. #[prost(uint64, tag = "1")] @@ -1121,6 +1121,9 @@ pub struct ListInvoicesRequest { /// response (and total) match what customers should see on receipts. #[prost(bool, tag = "4")] pub customer_receipts_only: bool, + /// When set, only off-cycle invoices requested by this client are returned. + #[prost(string, optional, tag = "5")] + pub client_id: ::core::option::Option<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListInvoicesResponse { diff --git a/rust/src/sentry_protos.billing.v1.services.seer_feature_billing.v1.rs b/rust/src/sentry_protos.billing.v1.services.seer_feature_billing.v1.rs index 4454e214..8f1efde9 100644 --- a/rust/src/sentry_protos.billing.v1.services.seer_feature_billing.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.seer_feature_billing.v1.rs @@ -1,4 +1,85 @@ // This file is @generated by prost-build. +/// Buys the organization's configured top-up when its Seer wallet balance is +/// below the auto top-up threshold. Safe to repeat: calls with a current_ts in +/// the same five-minute window bill at most once. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct AutoTopUpSeerWalletRequest { + #[prost(uint64, tag = "1")] + pub organization_id: u64, + #[prost(message, optional, tag = "2")] + pub current_ts: ::core::option::Option<::prost_types::Timestamp>, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct AutoTopUpSeerWalletResponse { + #[prost(enumeration = "auto_top_up_seer_wallet_response::Outcome", tag = "1")] + pub outcome: i32, + /// Set when outcome is OUTCOME_BILLED. + #[prost(uint64, optional, tag = "2")] + pub invoice_id: ::core::option::Option, + /// Whether the top-up invoice was paid. Only meaningful when outcome is + /// OUTCOME_BILLED. + #[prost(bool, tag = "3")] + pub paid: bool, +} +/// Nested message and enum types in `AutoTopUpSeerWalletResponse`. +pub mod auto_top_up_seer_wallet_response { + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Outcome { + Unspecified = 0, + /// No auto top-up config, or it is disabled. + NotEnabled = 1, + /// The current contract has no Seer wallet. + NoWallet = 2, + AboveThreshold = 3, + /// Another top-up for the organization holds the charge lock. + Locked = 4, + /// The last top-up invoice is unpaid, including when its charge failed. + /// Top-ups resume once the customer pays it. + InvoicePending = 5, + Billed = 6, + } + impl Outcome { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "OUTCOME_UNSPECIFIED", + Self::NotEnabled => "OUTCOME_NOT_ENABLED", + Self::NoWallet => "OUTCOME_NO_WALLET", + Self::AboveThreshold => "OUTCOME_ABOVE_THRESHOLD", + Self::Locked => "OUTCOME_LOCKED", + Self::InvoicePending => "OUTCOME_INVOICE_PENDING", + Self::Billed => "OUTCOME_BILLED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "OUTCOME_UNSPECIFIED" => Some(Self::Unspecified), + "OUTCOME_NOT_ENABLED" => Some(Self::NotEnabled), + "OUTCOME_NO_WALLET" => Some(Self::NoWallet), + "OUTCOME_ABOVE_THRESHOLD" => Some(Self::AboveThreshold), + "OUTCOME_LOCKED" => Some(Self::Locked), + "OUTCOME_INVOICE_PENDING" => Some(Self::InvoicePending), + "OUTCOME_BILLED" => Some(Self::Billed), + _ => None, + } + } + } +} #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct CheckSeerCreditsRequest { #[prost(uint64, tag = "1")] diff --git a/rust/src/sentry_protos.billing.v1.services.seer_wallet_config.v1.rs b/rust/src/sentry_protos.billing.v1.services.seer_wallet_config.v1.rs index 8b5175a6..d8b3ac77 100644 --- a/rust/src/sentry_protos.billing.v1.services.seer_wallet_config.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.seer_wallet_config.v1.rs @@ -46,6 +46,26 @@ pub struct GetSeerWalletConfigResponse { #[prost(message, optional, tag = "1")] pub config: ::core::option::Option, } +/// Lists the organizations whose auto top-up is enabled, in ascending +/// organization_id order. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ListAutoTopUpOrganizationsRequest { + /// Only organizations with a larger id are returned. Pass the last id of the + /// previous page to read the next one. + #[prost(uint64, tag = "1")] + pub after_organization_id: u64, + /// Must be positive. + #[prost(uint32, tag = "2")] + pub max_items: u32, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ListAutoTopUpOrganizationsResponse { + #[prost(uint64, repeated, tag = "1")] + pub organization_ids: ::prost::alloc::vec::Vec, + /// True when more organizations follow the last one returned. + #[prost(bool, tag = "2")] + pub truncated: bool, +} /// Creates the organization's config, or replaces the sections the request /// sets. A section left unset keeps its stored value, so the auto top-up and /// spend settings can be saved independently.