amazon_spapi/models/orders_v0/
order.rs

1/*
2 * Selling Partner API for Orders
3 *
4 * Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop fast, flexible, and custom applications to manage order synchronization, perform order research, and create demand-based decision support tools.   _Note:_ For the JP, AU, and SG marketplaces, the Orders API supports orders from 2016 onward. For all other marketplaces, the Orders API supports orders for the last two years (orders older than this don't show up in the response).
5 *
6 * The version of the OpenAPI document: v0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Order : Order information.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Order {
17    /// An Amazon-defined order identifier, in 3-7-7 format.
18    #[serde(rename = "AmazonOrderId")]
19    pub amazon_order_id: String,
20    /// A seller-defined order identifier.
21    #[serde(rename = "SellerOrderId", skip_serializing_if = "Option::is_none")]
22    pub seller_order_id: Option<String>,
23    /// The date when the order was created.
24    #[serde(rename = "PurchaseDate")]
25    pub purchase_date: String,
26    /// 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.
27    #[serde(rename = "LastUpdateDate")]
28    pub last_update_date: String,
29    /// The current order status.
30    #[serde(rename = "OrderStatus")]
31    pub order_status: OrderStatus,
32    /// Whether the order was fulfilled by Amazon (`AFN`) or by the seller (`MFN`).
33    #[serde(rename = "FulfillmentChannel", skip_serializing_if = "Option::is_none")]
34    pub fulfillment_channel: Option<FulfillmentChannel>,
35    /// The sales channel for the first item in the order.
36    #[serde(rename = "SalesChannel", skip_serializing_if = "Option::is_none")]
37    pub sales_channel: Option<String>,
38    /// The order channel for the first item in the order.
39    #[serde(rename = "OrderChannel", skip_serializing_if = "Option::is_none")]
40    pub order_channel: Option<String>,
41    /// The order's shipment service level.
42    #[serde(rename = "ShipServiceLevel", skip_serializing_if = "Option::is_none")]
43    pub ship_service_level: Option<String>,
44    #[serde(rename = "OrderTotal", skip_serializing_if = "Option::is_none")]
45    pub order_total: Option<Box<models::orders_v0::Money>>,
46    /// The number of items shipped.
47    #[serde(rename = "NumberOfItemsShipped", skip_serializing_if = "Option::is_none")]
48    pub number_of_items_shipped: Option<i32>,
49    /// The number of items unshipped.
50    #[serde(rename = "NumberOfItemsUnshipped", skip_serializing_if = "Option::is_none")]
51    pub number_of_items_unshipped: Option<i32>,
52    /// A list of payment execution detail items.
53    #[serde(rename = "PaymentExecutionDetail", skip_serializing_if = "Option::is_none")]
54    pub payment_execution_detail: Option<Vec<models::orders_v0::PaymentExecutionDetailItem>>,
55    /// The payment method for the order. This property is limited to COD and 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.
56    #[serde(rename = "PaymentMethod", skip_serializing_if = "Option::is_none")]
57    pub payment_method: Option<PaymentMethod>,
58    /// A list of payment method detail items.
59    #[serde(rename = "PaymentMethodDetails", skip_serializing_if = "Option::is_none")]
60    pub payment_method_details: Option<Vec<String>>,
61    /// The identifier for the marketplace where the order was placed.
62    #[serde(rename = "MarketplaceId", skip_serializing_if = "Option::is_none")]
63    pub marketplace_id: Option<String>,
64    /// The shipment service level category for the order.  **Possible values**: `Expedited`, `FreeEconomy`, `NextDay`, `Priority`, `SameDay`, `SecondDay`, `Scheduled`, and `Standard`.
65    #[serde(rename = "ShipmentServiceLevelCategory", skip_serializing_if = "Option::is_none")]
66    pub shipment_service_level_category: Option<String>,
67    #[serde(rename = "EasyShipShipmentStatus", skip_serializing_if = "Option::is_none")]
68    pub easy_ship_shipment_status: Option<models::orders_v0::EasyShipShipmentStatus>,
69    /// Custom ship label for Checkout by Amazon (CBA).
70    #[serde(rename = "CbaDisplayableShippingLabel", skip_serializing_if = "Option::is_none")]
71    pub cba_displayable_shipping_label: Option<String>,
72    /// The order's type.
73    #[serde(rename = "OrderType", skip_serializing_if = "Option::is_none")]
74    pub order_type: Option<OrderType>,
75    /// The start of the time period within which you have committed to ship the order. In [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. Only returned for seller-fulfilled orders.  __Note__: `EarliestShipDate` might not be returned for orders placed before February 1, 2013.
76    #[serde(rename = "EarliestShipDate", skip_serializing_if = "Option::is_none")]
77    pub earliest_ship_date: Option<String>,
78    /// The end of the time period within which you have committed to ship the order. In [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. Only returned for seller-fulfilled orders.  __Note__: `LatestShipDate` might not be returned for orders placed before February 1, 2013.
79    #[serde(rename = "LatestShipDate", skip_serializing_if = "Option::is_none")]
80    pub latest_ship_date: Option<String>,
81    /// The start of the time period within which you have committed to fulfill the order. In [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. Only returned for seller-fulfilled orders.
82    #[serde(rename = "EarliestDeliveryDate", skip_serializing_if = "Option::is_none")]
83    pub earliest_delivery_date: Option<String>,
84    /// The end of the time period within which you have committed to fulfill the order. In [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. Only returned for seller-fulfilled orders that do not have a `PendingAvailability`, `Pending`, or `Canceled` status.
85    #[serde(rename = "LatestDeliveryDate", skip_serializing_if = "Option::is_none")]
86    pub latest_delivery_date: Option<String>,
87    /// When true, the order is an Amazon Business order. An Amazon Business order is an order where the buyer is a Verified Business Buyer.
88    #[serde(rename = "IsBusinessOrder", skip_serializing_if = "Option::is_none")]
89    pub is_business_order: Option<bool>,
90    /// When true, the order is a seller-fulfilled Amazon Prime order.
91    #[serde(rename = "IsPrime", skip_serializing_if = "Option::is_none")]
92    pub is_prime: Option<bool>,
93    /// When true, the order has a Premium Shipping Service Level Agreement. For more information about Premium Shipping orders, refer to \"Premium Shipping Options\" in the Seller Central Help for your marketplace.
94    #[serde(rename = "IsPremiumOrder", skip_serializing_if = "Option::is_none")]
95    pub is_premium_order: Option<bool>,
96    /// When true, the order is a `GlobalExpress` order.
97    #[serde(rename = "IsGlobalExpressEnabled", skip_serializing_if = "Option::is_none")]
98    pub is_global_express_enabled: Option<bool>,
99    /// The order ID value for the order that is being replaced. Returned only if IsReplacementOrder = true.
100    #[serde(rename = "ReplacedOrderId", skip_serializing_if = "Option::is_none")]
101    pub replaced_order_id: Option<String>,
102    /// When true, this is a replacement order.
103    #[serde(rename = "IsReplacementOrder", skip_serializing_if = "Option::is_none")]
104    pub is_replacement_order: Option<bool>,
105    /// Indicates the date by which the seller must respond to the buyer with an estimated ship date. Only returned for Sourcing on Demand orders.
106    #[serde(rename = "PromiseResponseDueDate", skip_serializing_if = "Option::is_none")]
107    pub promise_response_due_date: Option<String>,
108    /// When true, the estimated ship date is set for the order. Only returned for Sourcing on Demand orders.
109    #[serde(rename = "IsEstimatedShipDateSet", skip_serializing_if = "Option::is_none")]
110    pub is_estimated_ship_date_set: Option<bool>,
111    /// 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.
112    #[serde(rename = "IsSoldByAB", skip_serializing_if = "Option::is_none")]
113    pub is_sold_by_ab: Option<bool>,
114    /// 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.
115    #[serde(rename = "IsIBA", skip_serializing_if = "Option::is_none")]
116    pub is_iba: Option<bool>,
117    #[serde(rename = "DefaultShipFromLocationAddress", skip_serializing_if = "Option::is_none")]
118    pub default_ship_from_location_address: Option<Box<models::orders_v0::Address>>,
119    /// The buyer's invoicing preference. Sellers can use this data to issue electronic invoices for orders in Turkey.  **Note**: This attribute is only available in the Turkey marketplace.
120    #[serde(rename = "BuyerInvoicePreference", skip_serializing_if = "Option::is_none")]
121    pub buyer_invoice_preference: Option<BuyerInvoicePreference>,
122    #[serde(rename = "BuyerTaxInformation", skip_serializing_if = "Option::is_none")]
123    pub buyer_tax_information: Option<Box<models::orders_v0::BuyerTaxInformation>>,
124    #[serde(rename = "FulfillmentInstruction", skip_serializing_if = "Option::is_none")]
125    pub fulfillment_instruction: Option<Box<models::orders_v0::FulfillmentInstruction>>,
126    /// When true, this order is marked to be picked up from a store rather than delivered.
127    #[serde(rename = "IsISPU", skip_serializing_if = "Option::is_none")]
128    pub is_ispu: Option<bool>,
129    /// 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.
130    #[serde(rename = "IsAccessPointOrder", skip_serializing_if = "Option::is_none")]
131    pub is_access_point_order: Option<bool>,
132    #[serde(rename = "MarketplaceTaxInfo", skip_serializing_if = "Option::is_none")]
133    pub marketplace_tax_info: Option<Box<models::orders_v0::MarketplaceTaxInfo>>,
134    /// The seller’s friendly name registered in the marketplace where the sale took place. Sellers can use this data to issue electronic invoices for orders in Brazil.  **Note**: This attribute is only available in the Brazil marketplace for the orders with `Pending` or `Unshipped` status.
135    #[serde(rename = "SellerDisplayName", skip_serializing_if = "Option::is_none")]
136    pub seller_display_name: Option<String>,
137    #[serde(rename = "ShippingAddress", skip_serializing_if = "Option::is_none")]
138    pub shipping_address: Option<Box<models::orders_v0::Address>>,
139    #[serde(rename = "BuyerInfo", skip_serializing_if = "Option::is_none")]
140    pub buyer_info: Option<Box<models::orders_v0::BuyerInfo>>,
141    #[serde(rename = "AutomatedShippingSettings", skip_serializing_if = "Option::is_none")]
142    pub automated_shipping_settings: Option<Box<models::orders_v0::AutomatedShippingSettings>>,
143    /// Whether the order contains regulated items which may require additional approval steps before being fulfilled.
144    #[serde(rename = "HasRegulatedItems", skip_serializing_if = "Option::is_none")]
145    pub has_regulated_items: Option<bool>,
146    #[serde(rename = "ElectronicInvoiceStatus", skip_serializing_if = "Option::is_none")]
147    pub electronic_invoice_status: Option<models::orders_v0::ElectronicInvoiceStatus>,
148}
149
150impl Order {
151    /// Order information.
152    pub fn new(amazon_order_id: String, purchase_date: String, last_update_date: String, order_status: OrderStatus) -> Order {
153        Order {
154            amazon_order_id,
155            seller_order_id: None,
156            purchase_date,
157            last_update_date,
158            order_status,
159            fulfillment_channel: None,
160            sales_channel: None,
161            order_channel: None,
162            ship_service_level: None,
163            order_total: None,
164            number_of_items_shipped: None,
165            number_of_items_unshipped: None,
166            payment_execution_detail: None,
167            payment_method: None,
168            payment_method_details: None,
169            marketplace_id: None,
170            shipment_service_level_category: None,
171            easy_ship_shipment_status: None,
172            cba_displayable_shipping_label: None,
173            order_type: None,
174            earliest_ship_date: None,
175            latest_ship_date: None,
176            earliest_delivery_date: None,
177            latest_delivery_date: None,
178            is_business_order: None,
179            is_prime: None,
180            is_premium_order: None,
181            is_global_express_enabled: None,
182            replaced_order_id: None,
183            is_replacement_order: None,
184            promise_response_due_date: None,
185            is_estimated_ship_date_set: None,
186            is_sold_by_ab: None,
187            is_iba: None,
188            default_ship_from_location_address: None,
189            buyer_invoice_preference: None,
190            buyer_tax_information: None,
191            fulfillment_instruction: None,
192            is_ispu: None,
193            is_access_point_order: None,
194            marketplace_tax_info: None,
195            seller_display_name: None,
196            shipping_address: None,
197            buyer_info: None,
198            automated_shipping_settings: None,
199            has_regulated_items: None,
200            electronic_invoice_status: None,
201        }
202    }
203}
204/// The current order status.
205#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
206pub enum OrderStatus {
207    #[serde(rename = "Pending")]
208    Pending,
209    #[serde(rename = "Unshipped")]
210    Unshipped,
211    #[serde(rename = "PartiallyShipped")]
212    PartiallyShipped,
213    #[serde(rename = "Shipped")]
214    Shipped,
215    #[serde(rename = "Canceled")]
216    Canceled,
217    #[serde(rename = "Unfulfillable")]
218    Unfulfillable,
219    #[serde(rename = "InvoiceUnconfirmed")]
220    InvoiceUnconfirmed,
221    #[serde(rename = "PendingAvailability")]
222    PendingAvailability,
223}
224
225impl Default for OrderStatus {
226    fn default() -> OrderStatus {
227        Self::Pending
228    }
229}
230/// Whether the order was fulfilled by Amazon (`AFN`) or by the seller (`MFN`).
231#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
232pub enum FulfillmentChannel {
233    #[serde(rename = "MFN")]
234    Mfn,
235    #[serde(rename = "AFN")]
236    Afn,
237}
238
239impl Default for FulfillmentChannel {
240    fn default() -> FulfillmentChannel {
241        Self::Mfn
242    }
243}
244/// The payment method for the order. This property is limited to COD and 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.
245#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
246pub enum PaymentMethod {
247    #[serde(rename = "COD")]
248    Cod,
249    #[serde(rename = "CVS")]
250    Cvs,
251    #[serde(rename = "Other")]
252    Other,
253}
254
255impl Default for PaymentMethod {
256    fn default() -> PaymentMethod {
257        Self::Cod
258    }
259}
260/// The order's type.
261#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
262pub enum OrderType {
263    #[serde(rename = "StandardOrder")]
264    StandardOrder,
265    #[serde(rename = "LongLeadTimeOrder")]
266    LongLeadTimeOrder,
267    #[serde(rename = "Preorder")]
268    Preorder,
269    #[serde(rename = "BackOrder")]
270    BackOrder,
271    #[serde(rename = "SourcingOnDemandOrder")]
272    SourcingOnDemandOrder,
273}
274
275impl Default for OrderType {
276    fn default() -> OrderType {
277        Self::StandardOrder
278    }
279}
280/// The buyer's invoicing preference. Sellers can use this data to issue electronic invoices for orders in Turkey.  **Note**: This attribute is only available in the Turkey marketplace.
281#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
282pub enum BuyerInvoicePreference {
283    #[serde(rename = "INDIVIDUAL")]
284    Individual,
285    #[serde(rename = "BUSINESS")]
286    Business,
287}
288
289impl Default for BuyerInvoicePreference {
290    fn default() -> BuyerInvoicePreference {
291        Self::Individual
292    }
293}
294