stripe/model/
source_transaction.rs

1use serde::{Serialize, Deserialize};
2use super::{
3    SourceTransactionAchCreditTransferData, SourceTransactionChfCreditTransferData,
4    SourceTransactionGbpCreditTransferData, SourceTransactionPaperCheckData,
5    SourceTransactionSepaCreditTransferData,
6};
7/**Some payment methods have no required amount that a customer must send.
8Customers can be instructed to send any amount, and it can be made up of
9multiple transactions. As such, sources can have multiple associated
10transactions.*/
11#[derive(Debug, Clone, Serialize, Deserialize, Default)]
12pub struct SourceTransaction {
13    ///
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub ach_credit_transfer: Option<SourceTransactionAchCreditTransferData>,
16    ///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 your customer has pushed to the receiver.
17    pub amount: i64,
18    ///
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub chf_credit_transfer: Option<SourceTransactionChfCreditTransferData>,
21    ///Time at which the object was created. Measured in seconds since the Unix epoch.
22    pub created: i64,
23    ///Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
24    pub currency: String,
25    ///
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub gbp_credit_transfer: Option<SourceTransactionGbpCreditTransferData>,
28    ///Unique identifier for the object.
29    pub id: String,
30    ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
31    pub livemode: bool,
32    ///String representing the object's type. Objects of the same type share the same value.
33    pub object: String,
34    ///
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub paper_check: Option<SourceTransactionPaperCheckData>,
37    ///
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub sepa_credit_transfer: Option<SourceTransactionSepaCreditTransferData>,
40    ///The ID of the source this transaction is attached to.
41    pub source: String,
42    ///The status of the transaction, one of `succeeded`, `pending`, or `failed`.
43    pub status: String,
44    ///The type of source this transaction is attached to.
45    #[serde(rename = "type")]
46    pub type_: String,
47}
48impl std::fmt::Display for SourceTransaction {
49    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
50        write!(f, "{}", serde_json::to_string(self).unwrap())
51    }
52}