1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
// ======================================
// This file was automatically generated.
// ======================================
use crate::ids::{ClimateOrderId};
use crate::params::{Expandable, Metadata, Object, Timestamp};
use crate::resources::{ClimateProduct, ClimateSupplier, Currency};
use serde::{Deserialize, Serialize};
/// The resource representing a Stripe "ClimateRemovalsOrders".
///
/// For more details see <https://stripe.com/docs/api/climate/order/object>
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ClimateOrder {
/// Unique identifier for the object.
pub id: ClimateOrderId,
/// Total amount of [Frontier](https://frontierclimate.com/)'s service fees in the currency's smallest unit.
pub amount_fees: i64,
/// Total amount of the carbon removal in the currency's smallest unit.
pub amount_subtotal: i64,
/// Total amount of the order including fees in the currency's smallest unit.
pub amount_total: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub beneficiary: Option<ClimateRemovalsBeneficiary>,
/// Time at which the order was canceled.
///
/// Measured in seconds since the Unix epoch.
pub canceled_at: Option<Timestamp>,
/// Reason for the cancellation of this order.
pub cancellation_reason: Option<ClimateOrderCancellationReason>,
/// For delivered orders, a URL to a delivery certificate for the order.
pub certificate: Option<String>,
/// Time at which the order was confirmed.
///
/// Measured in seconds since the Unix epoch.
pub confirmed_at: Option<Timestamp>,
/// Time at which the object was created.
///
/// Measured in seconds since the Unix epoch.
pub created: Timestamp,
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order.
pub currency: Currency,
/// Time at which the order's expected_delivery_year was delayed.
///
/// Measured in seconds since the Unix epoch.
pub delayed_at: Option<Timestamp>,
/// Time at which the order was delivered.
///
/// Measured in seconds since the Unix epoch.
pub delivered_at: Option<Timestamp>,
/// Details about the delivery of carbon removal for this order.
pub delivery_details: Vec<ClimateRemovalsOrderDeliveries>,
/// The year this order is expected to be delivered.
pub expected_delivery_year: i64,
/// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
pub livemode: bool,
/// 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.
pub metadata: Metadata,
/// Quantity of carbon removal that is included in this order.
pub metric_tons: String,
/// Unique ID for the Climate `Product` this order is purchasing.
pub product: Expandable<ClimateProduct>,
/// Time at which the order's product was substituted for a different product.
///
/// Measured in seconds since the Unix epoch.
pub product_substituted_at: Option<Timestamp>,
/// The current status of this order.
pub status: ClimateOrderStatus,
}
impl Object for ClimateOrder {
type Id = ClimateOrderId;
fn id(&self) -> Self::Id {
self.id.clone()
}
fn object(&self) -> &'static str {
"climate.order"
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ClimateRemovalsBeneficiary {
/// Publicly displayable name for the end beneficiary of carbon removal.
pub public_name: String,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ClimateRemovalsOrderDeliveries {
/// Time at which the delivery occurred.
///
/// Measured in seconds since the Unix epoch.
pub delivered_at: Timestamp,
/// Specific location of this delivery.
pub location: Option<ClimateRemovalsLocation>,
/// Quantity of carbon removal supplied by this delivery.
pub metric_tons: String,
/// Once retired, a URL to the registry entry for the tons from this delivery.
pub registry_url: Option<String>,
pub supplier: ClimateSupplier,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ClimateRemovalsLocation {
/// The city where the supplier is located.
pub city: Option<String>,
/// Two-letter ISO code representing the country where the supplier is located.
pub country: String,
/// The geographic latitude where the supplier is located.
pub latitude: Option<f64>,
/// The geographic longitude where the supplier is located.
pub longitude: Option<f64>,
/// The state/county/province/region where the supplier is located.
pub region: Option<String>,
}
/// An enum representing the possible values of an `ClimateOrder`'s `cancellation_reason` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ClimateOrderCancellationReason {
Expired,
ProductUnavailable,
Requested,
}
impl ClimateOrderCancellationReason {
pub fn as_str(self) -> &'static str {
match self {
ClimateOrderCancellationReason::Expired => "expired",
ClimateOrderCancellationReason::ProductUnavailable => "product_unavailable",
ClimateOrderCancellationReason::Requested => "requested",
}
}
}
impl AsRef<str> for ClimateOrderCancellationReason {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for ClimateOrderCancellationReason {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for ClimateOrderCancellationReason {
fn default() -> Self {
Self::Expired
}
}
/// An enum representing the possible values of an `ClimateOrder`'s `status` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ClimateOrderStatus {
AwaitingFunds,
Canceled,
Confirmed,
Delivered,
Open,
}
impl ClimateOrderStatus {
pub fn as_str(self) -> &'static str {
match self {
ClimateOrderStatus::AwaitingFunds => "awaiting_funds",
ClimateOrderStatus::Canceled => "canceled",
ClimateOrderStatus::Confirmed => "confirmed",
ClimateOrderStatus::Delivered => "delivered",
ClimateOrderStatus::Open => "open",
}
}
}
impl AsRef<str> for ClimateOrderStatus {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for ClimateOrderStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for ClimateOrderStatus {
fn default() -> Self {
Self::AwaitingFunds
}
}