stripe/model/
climate_order.rs

1use serde::{Serialize, Deserialize};
2use super::{ClimateRemovalsBeneficiary, ClimateRemovalsOrderDeliveries};
3/**Orders represent your intent to purchase a particular Climate product. When you create an order, the
4payment is deducted from your merchant balance.*/
5#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6pub struct ClimateOrder {
7    ///Total amount of [Frontier](https://frontierclimate.com/)'s service fees in the currency's smallest unit.
8    pub amount_fees: i64,
9    ///Total amount of the carbon removal in the currency's smallest unit.
10    pub amount_subtotal: i64,
11    ///Total amount of the order including fees in the currency's smallest unit.
12    pub amount_total: i64,
13    ///
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub beneficiary: Option<ClimateRemovalsBeneficiary>,
16    ///Time at which the order was canceled. Measured in seconds since the Unix epoch.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub canceled_at: Option<i64>,
19    ///Reason for the cancellation of this order.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub cancellation_reason: Option<String>,
22    ///For delivered orders, a URL to a delivery certificate for the order.
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub certificate: Option<String>,
25    ///Time at which the order was confirmed. Measured in seconds since the Unix epoch.
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub confirmed_at: Option<i64>,
28    ///Time at which the object was created. Measured in seconds since the Unix epoch.
29    pub created: i64,
30    ///Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order.
31    pub currency: String,
32    ///Time at which the order's expected_delivery_year was delayed. Measured in seconds since the Unix epoch.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub delayed_at: Option<i64>,
35    ///Time at which the order was delivered. Measured in seconds since the Unix epoch.
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub delivered_at: Option<i64>,
38    ///Details about the delivery of carbon removal for this order.
39    pub delivery_details: Vec<ClimateRemovalsOrderDeliveries>,
40    ///The year this order is expected to be delivered.
41    pub expected_delivery_year: i64,
42    ///Unique identifier for the object.
43    pub id: String,
44    ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
45    pub livemode: bool,
46    ///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.
47    pub metadata: serde_json::Value,
48    ///Quantity of carbon removal that is included in this order.
49    #[serde(with = "rust_decimal::serde::str")]
50    pub metric_tons: rust_decimal::Decimal,
51    ///String representing the object's type. Objects of the same type share the same value.
52    pub object: String,
53    ///Unique ID for the Climate `Product` this order is purchasing.
54    pub product: serde_json::Value,
55    ///Time at which the order's product was substituted for a different product. Measured in seconds since the Unix epoch.
56    #[serde(skip_serializing_if = "Option::is_none")]
57    pub product_substituted_at: Option<i64>,
58    ///The current status of this order.
59    pub status: String,
60}
61impl std::fmt::Display for ClimateOrder {
62    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
63        write!(f, "{}", serde_json::to_string(self).unwrap())
64    }
65}