sentry_protos 0.31.0

Rust bindings for sentry-protos
Documentation
// This file is @generated by prost-build.
/// Canonical projection of a stored platform charge. Returned by charge
/// service endpoints that need to expose the persisted charge state to
/// callers.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlatformCharge {
    #[prost(string, tag = "1")]
    pub stripe_id: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub organization_id: u64,
    /// Unset when the charge is not associated with an invoice (e.g. ad-hoc
    /// charges created outside the invoicing flow).
    #[prost(uint64, optional, tag = "3")]
    pub invoice_id: ::core::option::Option<u64>,
    #[prost(bool, tag = "4")]
    pub paid: bool,
    #[prost(uint64, tag = "5")]
    pub amount: u64,
    #[prost(string, optional, tag = "6")]
    pub failure_code: ::core::option::Option<::prost::alloc::string::String>,
    /// DEPRECATED: Source of truth for refund state is `refunds` below.
    /// Consumers should check `len(refunds) > 0` (or
    /// `sum(refunds\[*\].amount_cents) == amount`) instead. Left in the proto
    /// because `sentry-protos` policy disallows field deletion. Not
    /// populated by current producers.
    #[deprecated]
    #[prost(bool, tag = "7")]
    pub refunded: bool,
    /// DEPRECATED: Source of truth for refund amount is the sum of
    /// `refunds\[*\].amount_cents` below. Left in the proto because
    /// `sentry-protos` policy disallows field deletion. Not populated by
    /// current producers.
    #[deprecated]
    #[prost(uint64, tag = "8")]
    pub amount_refunded: u64,
    #[prost(string, optional, tag = "9")]
    pub card_last_4: ::core::option::Option<::prost::alloc::string::String>,
    /// Recorded refunds against this charge, ordered by `date_added_st`
    /// ascending. Source of truth for refund state on a charge -- consumers
    /// sum `refunds\[*\].amount_cents` if they need the aggregate, and
    /// `len(refunds) > 0` (or sum == amount) signals "refunded."
    #[prost(message, repeated, tag = "10")]
    pub refunds: ::prost::alloc::vec::Vec<PlatformRefund>,
}
/// Canonical projection of a stored platform refund. One row per recorded
/// refund against a `PlatformCharge`.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PlatformRefund {
    /// Stripe id of the refund (e.g. "re_xxx").
    #[prost(string, tag = "1")]
    pub stripe_id: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub organization_id: u64,
    /// Refund amount in cents.
    #[prost(uint64, tag = "3")]
    pub amount_cents: u64,
    /// Stripe-supplied refund reason. Unset when Stripe did not provide one.
    #[prost(string, optional, tag = "4")]
    pub reason: ::core::option::Option<::prost::alloc::string::String>,
    /// 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 {
    #[prost(enumeration = "ChargeMethod", tag = "1")]
    pub charge_method: i32,
    #[prost(uint64, tag = "2")]
    pub amount_cents: u64,
    #[prost(string, optional, tag = "3")]
    pub description: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(uint64, tag = "4")]
    pub organization_id: u64,
    #[prost(message, optional, tag = "5")]
    pub current_ts: ::core::option::Option<::prost_types::Timestamp>,
    #[prost(string, optional, tag = "6")]
    pub invoice_id: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "7")]
    pub invoice_guid: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(message, optional, tag = "8")]
    pub payment_config: ::core::option::Option<
        super::super::super::common::v1::PaymentConfig,
    >,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CaptureChargeResponse {
    #[prost(bool, tag = "1")]
    pub paid: bool,
    #[prost(string, optional, tag = "2")]
    pub failure_code: ::core::option::Option<::prost::alloc::string::String>,
}
/// How the charge should be executed against the payment provider.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ChargeMethod {
    /// Default zero value. Requests with this value must be rejected so
    /// that an unset charge_method is never silently treated as an active
    /// billing choice.
    Unspecified = 0,
    /// Record the charge against our DB models without contacting any
    /// external payment provider. Payment is expected to be collected
    /// externally.
    None = 1,
    /// Call the Stripe API to bill the customer for this charge.
    Stripe = 2,
}
impl ChargeMethod {
    /// 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 => "CHARGE_METHOD_UNSPECIFIED",
            Self::None => "CHARGE_METHOD_NONE",
            Self::Stripe => "CHARGE_METHOD_STRIPE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "CHARGE_METHOD_UNSPECIFIED" => Some(Self::Unspecified),
            "CHARGE_METHOD_NONE" => Some(Self::None),
            "CHARGE_METHOD_STRIPE" => Some(Self::Stripe),
            _ => None,
        }
    }
}
/// Reads the stored platform charge for a given Stripe charge id. Returns an
/// unset `charge` when no platform charge exists for the id; callers can use
/// this to distinguish charges owned by the billing platform from charges
/// owned by the legacy billing path.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetChargeByStripeIdRequest {
    #[prost(string, tag = "1")]
    pub stripe_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetChargeByStripeIdResponse {
    /// Unset when no platform charge with the given stripe_id exists.
    #[prost(message, optional, tag = "1")]
    pub charge: ::core::option::Option<PlatformCharge>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Charge {
    #[prost(uint64, tag = "1")]
    pub amount_cents: u64,
    #[prost(bool, tag = "2")]
    pub paid: bool,
    #[prost(string, optional, tag = "3")]
    pub failure_code: ::core::option::Option<::prost::alloc::string::String>,
}
/// No pagination on this request because there are expected to be only a handful
/// of attempted charges per invoice.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListChargesForInvoiceRequest {
    #[prost(uint64, tag = "1")]
    pub invoice_id: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListChargesForInvoiceResponse {
    #[prost(message, repeated, tag = "1")]
    pub charges: ::prost::alloc::vec::Vec<Charge>,
}
/// 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<PlatformRefund>,
}
/// 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
/// `amount_refunded` / `refunded` state on the stored `PlatformCharge`.
/// Called by the presentation layer that owns the `charge.refunded`
/// webhook handler; the charge service does not call Stripe in this path
/// (Stripe initiated the refund).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecordChargeRefundsRequest {
    #[prost(message, optional, tag = "1")]
    pub stripe_charge: ::core::option::Option<
        super::super::super::common::v1::StripeCharge,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecordChargeRefundsResponse {
    /// Unset when no platform charge exists for `stripe_charge.id`. Callers
    /// use this to distinguish platform charges from legacy charges. When set,
    /// `charge.refunds` carries the platform refund rows that were recorded
    /// or already existed, ordered by `date_added_st` ascending.
    #[prost(message, optional, tag = "1")]
    pub charge: ::core::option::Option<PlatformCharge>,
}
/// Synchronizes a stored platform charge with the latest snapshot from
/// Stripe. The charge is identified by `stripe_charge.id`. Fields like
/// `paid`, `failure_code` and refund state are copied onto the stored
/// record so the database reflects the current payment-provider state.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateChargeRequest {
    #[prost(message, optional, tag = "1")]
    pub stripe_charge: ::core::option::Option<
        super::super::super::common::v1::StripeCharge,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateChargeResponse {
    /// Unset when no platform charge with the given stripe_id exists.
    #[prost(message, optional, tag = "1")]
    pub charge: ::core::option::Option<PlatformCharge>,
}