stripe/model/tax_transaction.rs
1use serde::{Serialize, Deserialize};
2use super::{
3 TaxProductResourceCustomerDetails, TaxProductResourceTaxTransactionLineItemList,
4};
5/**A Tax Transaction records the tax collected from or refunded to your customer.
6
7Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom#tax-transaction)*/
8#[derive(Debug, Clone, Serialize, Deserialize, Default)]
9pub struct TaxTransaction {
10 ///Time at which the object was created. Measured in seconds since the Unix epoch.
11 pub created: i64,
12 ///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).
13 pub currency: String,
14 ///The ID of an existing [Customer](https://stripe.com/docs/api/customers/object) used for the resource.
15 #[serde(skip_serializing_if = "Option::is_none")]
16 pub customer: Option<String>,
17 ///
18 pub customer_details: TaxProductResourceCustomerDetails,
19 ///Unique identifier for the transaction.
20 pub id: String,
21 ///The tax collected or refunded, by line item.
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub line_items: Option<TaxProductResourceTaxTransactionLineItemList>,
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 ///Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
27 #[serde(skip_serializing_if = "Option::is_none")]
28 pub metadata: Option<serde_json::Value>,
29 ///String representing the object's type. Objects of the same type share the same value.
30 pub object: String,
31 ///A custom unique identifier, such as 'myOrder_123'.
32 pub reference: String,
33 ///If `type=reversal`, contains information about what was reversed.
34 #[serde(skip_serializing_if = "Option::is_none")]
35 pub reversal: Option<serde_json::Value>,
36 ///The shipping cost details for the transaction.
37 #[serde(skip_serializing_if = "Option::is_none")]
38 pub shipping_cost: Option<serde_json::Value>,
39 ///Timestamp of date at which the tax rules and rates in effect applies for the calculation.
40 pub tax_date: i64,
41 ///If `reversal`, this transaction reverses an earlier transaction.
42 #[serde(rename = "type")]
43 pub type_: String,
44}
45impl std::fmt::Display for TaxTransaction {
46 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
47 write!(f, "{}", serde_json::to_string(self).unwrap())
48 }
49}