amazon_spapi/models/vendor_orders/
order_details.rs

1/*
2 * Selling Partner API for Retail Procurement Orders
3 *
4 * The Selling Partner API for Retail Procurement Orders provides programmatic access to vendor orders data.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// OrderDetails : Details of an order.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OrderDetails {
17    /// The date the purchase order was placed. Must be in ISO-8601 date/time format.
18    #[serde(rename = "purchaseOrderDate")]
19    pub purchase_order_date: String,
20    /// The date when purchase order was last changed by Amazon after the order was placed. This date will be greater than 'purchaseOrderDate'. This means the PO data was changed on that date and vendors are required to fulfill the  updated PO. The PO changes can be related to Item Quantity, Ship to Location, Ship Window etc. This field will not be present in orders that have not changed after creation. Must be in ISO-8601 date/time format.
21    #[serde(rename = "purchaseOrderChangedDate", skip_serializing_if = "Option::is_none")]
22    pub purchase_order_changed_date: Option<String>,
23    /// The date when current purchase order state was changed. Current purchase order state is available in the field 'purchaseOrderState'. Must be in ISO-8601 date/time format.
24    #[serde(rename = "purchaseOrderStateChangedDate")]
25    pub purchase_order_state_changed_date: String,
26    /// Type of purchase order.
27    #[serde(rename = "purchaseOrderType", skip_serializing_if = "Option::is_none")]
28    pub purchase_order_type: Option<PurchaseOrderType>,
29    #[serde(rename = "importDetails", skip_serializing_if = "Option::is_none")]
30    pub import_details: Option<Box<models::vendor_orders::ImportDetails>>,
31    /// If requested by the recipient, this field will contain a promotional/deal number. The discount code line is optional. It is used to obtain a price discount on items on the order.
32    #[serde(rename = "dealCode", skip_serializing_if = "Option::is_none")]
33    pub deal_code: Option<String>,
34    /// Payment method used.
35    #[serde(rename = "paymentMethod", skip_serializing_if = "Option::is_none")]
36    pub payment_method: Option<PaymentMethod>,
37    #[serde(rename = "buyingParty", skip_serializing_if = "Option::is_none")]
38    pub buying_party: Option<Box<models::vendor_orders::PartyIdentification>>,
39    #[serde(rename = "sellingParty", skip_serializing_if = "Option::is_none")]
40    pub selling_party: Option<Box<models::vendor_orders::PartyIdentification>>,
41    #[serde(rename = "shipToParty", skip_serializing_if = "Option::is_none")]
42    pub ship_to_party: Option<Box<models::vendor_orders::PartyIdentification>>,
43    #[serde(rename = "billToParty", skip_serializing_if = "Option::is_none")]
44    pub bill_to_party: Option<Box<models::vendor_orders::PartyIdentification>>,
45    /// Defines a date time interval according to ISO8601. Interval is separated by double hyphen (--).
46    #[serde(rename = "shipWindow", skip_serializing_if = "Option::is_none")]
47    pub ship_window: Option<String>,
48    /// Defines a date time interval according to ISO8601. Interval is separated by double hyphen (--).
49    #[serde(rename = "deliveryWindow", skip_serializing_if = "Option::is_none")]
50    pub delivery_window: Option<String>,
51    /// A list of items in this purchase order.
52    #[serde(rename = "items")]
53    pub items: Vec<models::vendor_orders::OrderItem>,
54}
55
56impl OrderDetails {
57    /// Details of an order.
58    pub fn new(purchase_order_date: String, purchase_order_state_changed_date: String, items: Vec<models::vendor_orders::OrderItem>) -> OrderDetails {
59        OrderDetails {
60            purchase_order_date,
61            purchase_order_changed_date: None,
62            purchase_order_state_changed_date,
63            purchase_order_type: None,
64            import_details: None,
65            deal_code: None,
66            payment_method: None,
67            buying_party: None,
68            selling_party: None,
69            ship_to_party: None,
70            bill_to_party: None,
71            ship_window: None,
72            delivery_window: None,
73            items,
74        }
75    }
76}
77/// Type of purchase order.
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum PurchaseOrderType {
80    #[serde(rename = "RegularOrder")]
81    RegularOrder,
82    #[serde(rename = "ConsignedOrder")]
83    ConsignedOrder,
84    #[serde(rename = "NewProductIntroduction")]
85    NewProductIntroduction,
86    #[serde(rename = "RushOrder")]
87    RushOrder,
88}
89
90impl Default for PurchaseOrderType {
91    fn default() -> PurchaseOrderType {
92        Self::RegularOrder
93    }
94}
95/// Payment method used.
96#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
97pub enum PaymentMethod {
98    #[serde(rename = "Invoice")]
99    Invoice,
100    #[serde(rename = "Consignment")]
101    Consignment,
102    #[serde(rename = "CreditCard")]
103    CreditCard,
104    #[serde(rename = "Prepaid")]
105    Prepaid,
106}
107
108impl Default for PaymentMethod {
109    fn default() -> PaymentMethod {
110        Self::Invoice
111    }
112}
113