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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
/*
 * Selling Partner API for Orders
 *
 * The Selling Partner API for Orders helps you programmatically retrieve order information. These APIs let you develop fast, flexible, custom applications in areas like order synchronization, order research, and demand-based decision support tools.
 *
 * The version of the OpenAPI document: v0
 * 
 * Generated by: https://openapi-generator.tech
 */

/// Order : Order information.



#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Order {
    /// An Amazon-defined order identifier, in 3-7-7 format.
    #[serde(default, rename = "AmazonOrderId")]
    pub amazon_order_id: String,
    /// A seller-defined order identifier.
    #[serde(default, rename = "SellerOrderId", skip_serializing_if = "Option::is_none")]
    pub seller_order_id: Option<String>,
    /// The date when the order was created.
    #[serde(default, rename = "PurchaseDate")]
    pub purchase_date: String,
    /// The date when the order was last updated.  __Note__: LastUpdateDate is returned with an incorrect date for orders that were last updated before 2009-04-01.
    #[serde(default, rename = "LastUpdateDate")]
    pub last_update_date: String,
    /// The current order status.
    #[serde(default, rename = "OrderStatus")]
    pub order_status: OrderStatus,
    /// Whether the order was fulfilled by Amazon (AFN) or by the seller (MFN).
    #[serde(default, rename = "FulfillmentChannel", skip_serializing_if = "Option::is_none")]
    pub fulfillment_channel: Option<FulfillmentChannel>,
    /// The sales channel of the first item in the order.
    #[serde(default, rename = "SalesChannel", skip_serializing_if = "Option::is_none")]
    pub sales_channel: Option<String>,
    /// The order channel of the first item in the order.
    #[serde(default, rename = "OrderChannel", skip_serializing_if = "Option::is_none")]
    pub order_channel: Option<String>,
    /// The shipment service level of the order.
    #[serde(default, rename = "ShipServiceLevel", skip_serializing_if = "Option::is_none")]
    pub ship_service_level: Option<String>,
    #[serde(default, rename = "OrderTotal", skip_serializing_if = "Option::is_none")]
    pub order_total: Option<Box<crate::models::Money>>,
    /// The number of items shipped.
    #[serde(default, rename = "NumberOfItemsShipped", skip_serializing_if = "Option::is_none")]
    pub number_of_items_shipped: Option<i32>,
    /// The number of items unshipped.
    #[serde(default, rename = "NumberOfItemsUnshipped", skip_serializing_if = "Option::is_none")]
    pub number_of_items_unshipped: Option<i32>,
    /// A list of payment execution detail items.
    #[serde(default, rename = "PaymentExecutionDetail", skip_serializing_if = "Option::is_none")]
    pub payment_execution_detail: Option<Vec<crate::models::PaymentExecutionDetailItem>>,
    /// The payment method for the order. This property is limited to Cash On Delivery (COD) and Convenience Store (CVS) payment methods. Unless you need the specific COD payment information provided by the PaymentExecutionDetailItem object, we recommend using the PaymentMethodDetails property to get payment method information.
    #[serde(default, rename = "PaymentMethod", skip_serializing_if = "Option::is_none")]
    pub payment_method: Option<PaymentMethod>,
    /// A list of payment method detail items.
    #[serde(default, rename = "PaymentMethodDetails", skip_serializing_if = "Option::is_none")]
    pub payment_method_details: Option<Vec<String>>,
    /// The identifier for the marketplace where the order was placed.
    #[serde(default, rename = "MarketplaceId", skip_serializing_if = "Option::is_none")]
    pub marketplace_id: Option<String>,
    /// The shipment service level category of the order.  Possible values: Expedited, FreeEconomy, NextDay, SameDay, SecondDay, Scheduled, Standard.
    #[serde(default, rename = "ShipmentServiceLevelCategory", skip_serializing_if = "Option::is_none")]
    pub shipment_service_level_category: Option<String>,
    #[serde(default, rename = "EasyShipShipmentStatus", skip_serializing_if = "Option::is_none")]
    pub easy_ship_shipment_status: Option<crate::models::EasyShipShipmentStatus>,
    /// Custom ship label for Checkout by Amazon (CBA).
    #[serde(default, rename = "CbaDisplayableShippingLabel", skip_serializing_if = "Option::is_none")]
    pub cba_displayable_shipping_label: Option<String>,
    /// The type of the order.
    #[serde(default, rename = "OrderType", skip_serializing_if = "Option::is_none")]
    pub order_type: Option<OrderType>,
    /// The start of the time period within which you have committed to ship the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders.  __Note__: EarliestShipDate might not be returned for orders placed before February 1, 2013.
    #[serde(default, rename = "EarliestShipDate", skip_serializing_if = "Option::is_none")]
    pub earliest_ship_date: Option<String>,
    /// The end of the time period within which you have committed to ship the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders.  __Note__: LatestShipDate might not be returned for orders placed before February 1, 2013.
    #[serde(default, rename = "LatestShipDate", skip_serializing_if = "Option::is_none")]
    pub latest_ship_date: Option<String>,
    /// The start of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders.
    #[serde(default, rename = "EarliestDeliveryDate", skip_serializing_if = "Option::is_none")]
    pub earliest_delivery_date: Option<String>,
    /// The end of the time period within which you have committed to fulfill the order. In ISO 8601 date time format. Returned only for seller-fulfilled orders that do not have a PendingAvailability, Pending, or Canceled status.
    #[serde(default, rename = "LatestDeliveryDate", skip_serializing_if = "Option::is_none")]
    pub latest_delivery_date: Option<String>,
    /// When true, the order is an Amazon Business order. An Amazon Business order is an order where the buyer is a Verified Business Buyer.
    #[serde(default, rename = "IsBusinessOrder", skip_serializing_if = "Option::is_none")]
    pub is_business_order: Option<bool>,
    /// When true, the order is a seller-fulfilled Amazon Prime order.
    #[serde(default, rename = "IsPrime", skip_serializing_if = "Option::is_none")]
    pub is_prime: Option<bool>,
    /// When true, the order has a Premium Shipping Service Level Agreement. For more information about Premium Shipping orders, see \"Premium Shipping Options\" in the Seller Central Help for your marketplace.
    #[serde(default, rename = "IsPremiumOrder", skip_serializing_if = "Option::is_none")]
    pub is_premium_order: Option<bool>,
    /// When true, the order is a GlobalExpress order.
    #[serde(default, rename = "IsGlobalExpressEnabled", skip_serializing_if = "Option::is_none")]
    pub is_global_express_enabled: Option<bool>,
    /// The order ID value for the order that is being replaced. Returned only if IsReplacementOrder = true.
    #[serde(default, rename = "ReplacedOrderId", skip_serializing_if = "Option::is_none")]
    pub replaced_order_id: Option<String>,
    /// When true, this is a replacement order.
    #[serde(default, rename = "IsReplacementOrder", skip_serializing_if = "Option::is_none")]
    pub is_replacement_order: Option<bool>,
    /// Indicates the date by which the seller must respond to the buyer with an estimated ship date. Returned only for Sourcing on Demand orders.
    #[serde(default, rename = "PromiseResponseDueDate", skip_serializing_if = "Option::is_none")]
    pub promise_response_due_date: Option<String>,
    /// When true, the estimated ship date is set for the order. Returned only for Sourcing on Demand orders.
    #[serde(default, rename = "IsEstimatedShipDateSet", skip_serializing_if = "Option::is_none")]
    pub is_estimated_ship_date_set: Option<bool>,
    /// When true, the item within this order was bought and re-sold by Amazon Business EU SARL (ABEU). By buying and instantly re-selling your items, ABEU becomes the seller of record, making your inventory available for sale to customers who would not otherwise purchase from a third-party seller.
    #[serde(default, rename = "IsSoldByAB", skip_serializing_if = "Option::is_none")]
    pub is_sold_by_ab: Option<bool>,
    /// When true, the item within this order was bought and re-sold by Amazon Business EU SARL (ABEU). By buying and instantly re-selling your items, ABEU becomes the seller of record, making your inventory available for sale to customers who would not otherwise purchase from a third-party seller.
    #[serde(default, rename = "IsIBA", skip_serializing_if = "Option::is_none")]
    pub is_iba: Option<bool>,
    #[serde(default, rename = "DefaultShipFromLocationAddress", skip_serializing_if = "Option::is_none")]
    pub default_ship_from_location_address: Option<Box<crate::models::Address>>,
    /// The buyer's invoicing preference. Available only in the TR marketplace.
    #[serde(default, rename = "BuyerInvoicePreference", skip_serializing_if = "Option::is_none")]
    pub buyer_invoice_preference: Option<BuyerInvoicePreference>,
    #[serde(default, rename = "BuyerTaxInformation", skip_serializing_if = "Option::is_none")]
    pub buyer_tax_information: Option<Box<crate::models::BuyerTaxInformation>>,
    #[serde(default, rename = "FulfillmentInstruction", skip_serializing_if = "Option::is_none")]
    pub fulfillment_instruction: Option<Box<crate::models::FulfillmentInstruction>>,
    /// When true, this order is marked to be picked up from a store rather than delivered.
    #[serde(default, rename = "IsISPU", skip_serializing_if = "Option::is_none")]
    pub is_ispu: Option<bool>,
    /// When true, this order is marked to be delivered to an Access Point. The access location is chosen by the customer. Access Points include Amazon Hub Lockers, Amazon Hub Counters, and pickup points operated by carriers.
    #[serde(default, rename = "IsAccessPointOrder", skip_serializing_if = "Option::is_none")]
    pub is_access_point_order: Option<bool>,
    #[serde(default, rename = "MarketplaceTaxInfo", skip_serializing_if = "Option::is_none")]
    pub marketplace_tax_info: Option<Box<crate::models::MarketplaceTaxInfo>>,
    /// The seller’s friendly name registered in the marketplace.
    #[serde(default, rename = "SellerDisplayName", skip_serializing_if = "Option::is_none")]
    pub seller_display_name: Option<String>,
    #[serde(default, rename = "ShippingAddress", skip_serializing_if = "Option::is_none")]
    pub shipping_address: Option<Box<crate::models::Address>>,
    #[serde(default, rename = "BuyerInfo", skip_serializing_if = "Option::is_none")]
    pub buyer_info: Option<Box<crate::models::BuyerInfo>>,
    #[serde(default, rename = "AutomatedShippingSettings", skip_serializing_if = "Option::is_none")]
    pub automated_shipping_settings: Option<Box<crate::models::AutomatedShippingSettings>>,
    /// Whether the order contains regulated items which may require additional approval steps before being fulfilled.
    #[serde(default, rename = "HasRegulatedItems", skip_serializing_if = "Option::is_none")]
    pub has_regulated_items: Option<bool>,
    #[serde(default, rename = "ElectronicInvoiceStatus", skip_serializing_if = "Option::is_none")]
    pub electronic_invoice_status: Option<crate::models::ElectronicInvoiceStatus>,
}

impl Order {
    /// Order information.
    pub fn new(amazon_order_id: String, purchase_date: String, last_update_date: String, order_status: OrderStatus) -> Order {
        Order {
            amazon_order_id,
            seller_order_id: None,
            purchase_date,
            last_update_date,
            order_status,
            fulfillment_channel: None,
            sales_channel: None,
            order_channel: None,
            ship_service_level: None,
            order_total: None,
            number_of_items_shipped: None,
            number_of_items_unshipped: None,
            payment_execution_detail: None,
            payment_method: None,
            payment_method_details: None,
            marketplace_id: None,
            shipment_service_level_category: None,
            easy_ship_shipment_status: None,
            cba_displayable_shipping_label: None,
            order_type: None,
            earliest_ship_date: None,
            latest_ship_date: None,
            earliest_delivery_date: None,
            latest_delivery_date: None,
            is_business_order: None,
            is_prime: None,
            is_premium_order: None,
            is_global_express_enabled: None,
            replaced_order_id: None,
            is_replacement_order: None,
            promise_response_due_date: None,
            is_estimated_ship_date_set: None,
            is_sold_by_ab: None,
            is_iba: None,
            default_ship_from_location_address: None,
            buyer_invoice_preference: None,
            buyer_tax_information: None,
            fulfillment_instruction: None,
            is_ispu: None,
            is_access_point_order: None,
            marketplace_tax_info: None,
            seller_display_name: None,
            shipping_address: None,
            buyer_info: None,
            automated_shipping_settings: None,
            has_regulated_items: None,
            electronic_invoice_status: None,
        }
    }
}

/// The current order status.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum OrderStatus {
    #[serde(rename = "Pending")]
    Pending,
    #[serde(rename = "Unshipped")]
    Unshipped,
    #[serde(rename = "PartiallyShipped")]
    PartiallyShipped,
    #[serde(rename = "Shipped")]
    Shipped,
    #[serde(rename = "Canceled")]
    Canceled,
    #[serde(rename = "Unfulfillable")]
    Unfulfillable,
    #[serde(rename = "InvoiceUnconfirmed")]
    InvoiceUnconfirmed,
    #[serde(rename = "PendingAvailability")]
    PendingAvailability,
}

impl Default for OrderStatus {
    fn default() -> OrderStatus {
        Self::Pending
    }
}
/// Whether the order was fulfilled by Amazon (AFN) or by the seller (MFN).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum FulfillmentChannel {
    #[serde(rename = "MFN")]
    MFN,
    #[serde(rename = "AFN")]
    AFN,
}

impl Default for FulfillmentChannel {
    fn default() -> FulfillmentChannel {
        Self::MFN
    }
}
/// The payment method for the order. This property is limited to Cash On Delivery (COD) and Convenience Store (CVS) payment methods. Unless you need the specific COD payment information provided by the PaymentExecutionDetailItem object, we recommend using the PaymentMethodDetails property to get payment method information.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PaymentMethod {
    #[serde(rename = "COD")]
    COD,
    #[serde(rename = "CVS")]
    CVS,
    #[serde(rename = "Other")]
    Other,
}

impl Default for PaymentMethod {
    fn default() -> PaymentMethod {
        Self::COD
    }
}
/// The type of the order.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum OrderType {
    #[serde(rename = "StandardOrder")]
    StandardOrder,
    #[serde(rename = "LongLeadTimeOrder")]
    LongLeadTimeOrder,
    #[serde(rename = "Preorder")]
    Preorder,
    #[serde(rename = "BackOrder")]
    BackOrder,
    #[serde(rename = "SourcingOnDemandOrder")]
    SourcingOnDemandOrder,
}

impl Default for OrderType {
    fn default() -> OrderType {
        Self::StandardOrder
    }
}
/// The buyer's invoicing preference. Available only in the TR marketplace.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum BuyerInvoicePreference {
    #[serde(rename = "INDIVIDUAL")]
    INDIVIDUAL,
    #[serde(rename = "BUSINESS")]
    BUSINESS,
}

impl Default for BuyerInvoicePreference {
    fn default() -> BuyerInvoicePreference {
        Self::INDIVIDUAL
    }
}