stripe/model/source_mandate_notification.rs
1use serde::{Serialize, Deserialize};
2use super::{
3 Source, SourceMandateNotificationAcssDebitData,
4 SourceMandateNotificationBacsDebitData, SourceMandateNotificationSepaDebitData,
5};
6/**Source mandate notifications should be created when a notification related to
7a source mandate must be sent to the payer. They will trigger a webhook or
8deliver an email to the customer.*/
9#[derive(Debug, Clone, Serialize, Deserialize, Default)]
10pub struct SourceMandateNotification {
11 ///
12 #[serde(skip_serializing_if = "Option::is_none")]
13 pub acss_debit: Option<SourceMandateNotificationAcssDebitData>,
14 ///A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the amount associated with the mandate notification. The amount is expressed in the currency of the underlying source. Required if the notification type is `debit_initiated`.
15 #[serde(skip_serializing_if = "Option::is_none")]
16 pub amount: Option<i64>,
17 ///
18 #[serde(skip_serializing_if = "Option::is_none")]
19 pub bacs_debit: Option<SourceMandateNotificationBacsDebitData>,
20 ///Time at which the object was created. Measured in seconds since the Unix epoch.
21 pub created: i64,
22 ///Unique identifier for the object.
23 pub id: String,
24 ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
25 pub livemode: bool,
26 ///String representing the object's type. Objects of the same type share the same value.
27 pub object: String,
28 ///The reason of the mandate notification. Valid reasons are `mandate_confirmed` or `debit_initiated`.
29 pub reason: String,
30 ///
31 #[serde(skip_serializing_if = "Option::is_none")]
32 pub sepa_debit: Option<SourceMandateNotificationSepaDebitData>,
33 /**`Source` objects allow you to accept a variety of payment methods. They
34represent a customer's payment instrument, and can be used with the Stripe API
35just like a `Card` object: once chargeable, they can be charged, or can be
36attached to customers.
37
38Stripe doesn't recommend using the deprecated [Sources API](https://stripe.com/docs/api/sources).
39We recommend that you adopt the [PaymentMethods API](https://stripe.com/docs/api/payment_methods).
40This newer API provides access to our latest features and payment method types.
41
42Related guides: [Sources API](https://stripe.com/docs/sources) and [Sources & Customers](https://stripe.com/docs/sources/customers).*/
43 pub source: Source,
44 ///The status of the mandate notification. Valid statuses are `pending` or `submitted`.
45 pub status: String,
46 ///The type of source this mandate notification is attached to. Should be the source type identifier code for the payment method, such as `three_d_secure`.
47 #[serde(rename = "type")]
48 pub type_: String,
49}
50impl std::fmt::Display for SourceMandateNotification {
51 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
52 write!(f, "{}", serde_json::to_string(self).unwrap())
53 }
54}