stripe/model/
customer_cash_balance_transaction.rs

1use serde::{Serialize, Deserialize};
2use super::{
3    CustomerBalanceResourceCashBalanceTransactionResourceAdjustedForOverdraft,
4    CustomerBalanceResourceCashBalanceTransactionResourceAppliedToPaymentTransaction,
5    CustomerBalanceResourceCashBalanceTransactionResourceFundedTransaction,
6    CustomerBalanceResourceCashBalanceTransactionResourceRefundedFromPaymentTransaction,
7    CustomerBalanceResourceCashBalanceTransactionResourceTransferredToBalance,
8    CustomerBalanceResourceCashBalanceTransactionResourceUnappliedFromPaymentTransaction,
9};
10/**Customers with certain payments enabled have a cash balance, representing funds that were paid
11by the customer to a merchant, but have not yet been allocated to a payment. Cash Balance Transactions
12represent when funds are moved into or out of this balance. This includes funding by the customer, allocation
13to payments, and refunds to the customer.*/
14#[derive(Debug, Clone, Serialize, Deserialize, Default)]
15pub struct CustomerCashBalanceTransaction {
16    ///
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub adjusted_for_overdraft: Option<
19        CustomerBalanceResourceCashBalanceTransactionResourceAdjustedForOverdraft,
20    >,
21    ///
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub applied_to_payment: Option<
24        CustomerBalanceResourceCashBalanceTransactionResourceAppliedToPaymentTransaction,
25    >,
26    ///Time at which the object was created. Measured in seconds since the Unix epoch.
27    pub created: i64,
28    ///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).
29    pub currency: String,
30    ///The customer whose available cash balance changed as a result of this transaction.
31    pub customer: serde_json::Value,
32    ///The total available cash balance for the specified currency after this transaction was applied. Represented in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
33    pub ending_balance: i64,
34    ///
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub funded: Option<
37        CustomerBalanceResourceCashBalanceTransactionResourceFundedTransaction,
38    >,
39    ///Unique identifier for the object.
40    pub id: String,
41    ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
42    pub livemode: bool,
43    ///The amount by which the cash balance changed, represented in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). A positive value represents funds being added to the cash balance, a negative value represents funds being removed from the cash balance.
44    pub net_amount: i64,
45    ///String representing the object's type. Objects of the same type share the same value.
46    pub object: String,
47    ///
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub refunded_from_payment: Option<
50        CustomerBalanceResourceCashBalanceTransactionResourceRefundedFromPaymentTransaction,
51    >,
52    ///
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub transferred_to_balance: Option<
55        CustomerBalanceResourceCashBalanceTransactionResourceTransferredToBalance,
56    >,
57    ///The type of the cash balance transaction. New types may be added in future. See [Customer Balance](https://stripe.com/docs/payments/customer-balance#types) to learn more about these types.
58    #[serde(rename = "type")]
59    pub type_: String,
60    ///
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub unapplied_from_payment: Option<
63        CustomerBalanceResourceCashBalanceTransactionResourceUnappliedFromPaymentTransaction,
64    >,
65}
66impl std::fmt::Display for CustomerCashBalanceTransaction {
67    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
68        write!(f, "{}", serde_json::to_string(self).unwrap())
69    }
70}