Skip to main content

amazon_spapi/models/vendor_shipments/
shipment.rs

1/*
2 * Selling Partner API for Retail Procurement Shipments
3 *
4 * The Selling Partner API for Retail Procurement Shipments provides programmatic access to retail shipping data for vendors.
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/// Shipment : A list of one or more shipments with respective details.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Shipment {
17    /// Unique Transportation ID created by Vendor (Should not be used over the last 365 days).
18    #[serde(rename = "vendorShipmentIdentifier")]
19    pub vendor_shipment_identifier: String,
20    /// Indicates the type of transportation request (for example, `New` or `Cancel`). Each `transactionType` has a unique set of operations and there are corresponding details to be populated for each operation.
21    #[serde(rename = "transactionType")]
22    pub transaction_type: TransactionType,
23    /// The buyer Reference Number is a unique identifier generated by buyer for all Collect/WePay shipments when you submit a transportation request. This field is mandatory for Collect/WePay shipments.
24    #[serde(rename = "buyerReferenceNumber", skip_serializing_if = "Option::is_none")]
25    pub buyer_reference_number: Option<String>,
26    /// Date on which the transportation request was submitted.
27    #[serde(rename = "transactionDate")]
28    pub transaction_date: String,
29    /// Indicates the current shipment status.
30    #[serde(rename = "currentShipmentStatus", skip_serializing_if = "Option::is_none")]
31    pub current_shipment_status: Option<CurrentShipmentStatus>,
32    /// Date and time when the last status was updated.
33    #[serde(rename = "currentshipmentStatusDate", skip_serializing_if = "Option::is_none")]
34    pub currentshipment_status_date: Option<String>,
35    /// Indicates the list of current shipment status details and when the last update was received from carrier this is available on shipment Details response.
36    #[serde(rename = "shipmentStatusDetails", skip_serializing_if = "Option::is_none")]
37    pub shipment_status_details: Option<Vec<models::vendor_shipments::ShipmentStatusDetails>>,
38    /// The date and time of the shipment request created by vendor.
39    #[serde(rename = "shipmentCreateDate", skip_serializing_if = "Option::is_none")]
40    pub shipment_create_date: Option<String>,
41    /// The date and time of the departure of the shipment from the vendor's location. Vendors are requested to send ASNs within 30 minutes of departure from their warehouse/distribution center or at least 6 hours prior to the appointment time at the Buyer destination warehouse, whichever is sooner. Shipped date mentioned in the shipment confirmation should not be in the future.
42    #[serde(rename = "shipmentConfirmDate", skip_serializing_if = "Option::is_none")]
43    pub shipment_confirm_date: Option<String>,
44    /// The date and time of the package label created for the shipment by buyer.
45    #[serde(rename = "packageLabelCreateDate", skip_serializing_if = "Option::is_none")]
46    pub package_label_create_date: Option<String>,
47    /// Specifies if payment is Collect (WePay) or Prepaid (TheyPay). Required.
48    #[serde(rename = "shipmentFreightTerm", skip_serializing_if = "Option::is_none")]
49    pub shipment_freight_term: Option<ShipmentFreightTerm>,
50    #[serde(rename = "sellingParty")]
51    pub selling_party: Box<models::vendor_shipments::PartyIdentification>,
52    #[serde(rename = "shipFromParty")]
53    pub ship_from_party: Box<models::vendor_shipments::PartyIdentification>,
54    #[serde(rename = "shipToParty")]
55    pub ship_to_party: Box<models::vendor_shipments::PartyIdentification>,
56    #[serde(rename = "shipmentMeasurements", skip_serializing_if = "Option::is_none")]
57    pub shipment_measurements: Option<Box<models::vendor_shipments::TransportShipmentMeasurements>>,
58    #[serde(rename = "collectFreightPickupDetails", skip_serializing_if = "Option::is_none")]
59    pub collect_freight_pickup_details: Option<Box<models::vendor_shipments::CollectFreightPickupDetails>>,
60    /// Indicates the purchase orders involved for the transportation request. This group is an array create 1 for each PO and list their corresponding items. This information is used for deciding the route,truck allocation and storage efficiently. This is a mandatory information for Buyer performing transportation from vendor warehouse (WePay/Collect)
61    #[serde(rename = "purchaseOrders", skip_serializing_if = "Option::is_none")]
62    pub purchase_orders: Option<Vec<models::vendor_shipments::PurchaseOrders>>,
63    #[serde(rename = "importDetails", skip_serializing_if = "Option::is_none")]
64    pub import_details: Option<Box<models::vendor_shipments::ImportDetails>>,
65    /// A list of the items in this transportation and their associated inner container details. If any of the item detail fields are common at a carton or a pallet level, provide them at the corresponding carton or pallet level.
66    #[serde(rename = "containers", skip_serializing_if = "Option::is_none")]
67    pub containers: Option<Vec<models::vendor_shipments::Containers>>,
68    #[serde(rename = "transportationDetails", skip_serializing_if = "Option::is_none")]
69    pub transportation_details: Option<Box<models::vendor_shipments::TransportationDetails>>,
70}
71
72impl Shipment {
73    /// A list of one or more shipments with respective details.
74    pub fn new(vendor_shipment_identifier: String, transaction_type: TransactionType, transaction_date: String, selling_party: models::vendor_shipments::PartyIdentification, ship_from_party: models::vendor_shipments::PartyIdentification, ship_to_party: models::vendor_shipments::PartyIdentification) -> Shipment {
75        Shipment {
76            vendor_shipment_identifier,
77            transaction_type,
78            buyer_reference_number: None,
79            transaction_date,
80            current_shipment_status: None,
81            currentshipment_status_date: None,
82            shipment_status_details: None,
83            shipment_create_date: None,
84            shipment_confirm_date: None,
85            package_label_create_date: None,
86            shipment_freight_term: None,
87            selling_party: Box::new(selling_party),
88            ship_from_party: Box::new(ship_from_party),
89            ship_to_party: Box::new(ship_to_party),
90            shipment_measurements: None,
91            collect_freight_pickup_details: None,
92            purchase_orders: None,
93            import_details: None,
94            containers: None,
95            transportation_details: None,
96        }
97    }
98}
99/// Indicates the type of transportation request (for example, `New` or `Cancel`). Each `transactionType` has a unique set of operations and there are corresponding details to be populated for each operation.
100#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
101pub enum TransactionType {
102    #[serde(rename = "New")]
103    New,
104    #[serde(rename = "Cancel")]
105    Cancel,
106}
107
108impl Default for TransactionType {
109    fn default() -> TransactionType {
110        Self::New
111    }
112}
113/// Indicates the current shipment status.
114#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
115pub enum CurrentShipmentStatus {
116    #[serde(rename = "Created")]
117    Created,
118    #[serde(rename = "TransportationRequested")]
119    TransportationRequested,
120    #[serde(rename = "CarrierAssigned")]
121    CarrierAssigned,
122    #[serde(rename = "Shipped")]
123    Shipped,
124}
125
126impl Default for CurrentShipmentStatus {
127    fn default() -> CurrentShipmentStatus {
128        Self::Created
129    }
130}
131/// Specifies if payment is Collect (WePay) or Prepaid (TheyPay). Required.
132#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
133pub enum ShipmentFreightTerm {
134    #[serde(rename = "Collect")]
135    Collect,
136    #[serde(rename = "Prepaid")]
137    Prepaid,
138}
139
140impl Default for ShipmentFreightTerm {
141    fn default() -> ShipmentFreightTerm {
142        Self::Collect
143    }
144}
145