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
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct OrderDetails {
#[serde(default, rename = "customerOrderNumber")]
pub customer_order_number: String,
#[serde(default, rename = "orderDate")]
pub order_date: String,
#[serde(default, rename = "orderStatus", skip_serializing_if = "Option::is_none")]
pub order_status: Option<OrderStatus>,
#[serde(default, rename = "shipmentDetails")]
pub shipment_details: Box<crate::models::ShipmentDetails>,
#[serde(default, rename = "taxTotal", skip_serializing_if = "Option::is_none")]
pub tax_total: Option<Box<crate::models::OrderDetailsTaxTotal>>,
#[serde(default, rename = "sellingParty")]
pub selling_party: Box<crate::models::PartyIdentification>,
#[serde(default, rename = "shipFromParty")]
pub ship_from_party: Box<crate::models::PartyIdentification>,
#[serde(default, rename = "shipToParty")]
pub ship_to_party: Box<crate::models::Address>,
#[serde(default, rename = "billToParty")]
pub bill_to_party: Box<crate::models::PartyIdentification>,
#[serde(default, rename = "items")]
pub items: Vec<crate::models::OrderItem>,
}
impl OrderDetails {
pub fn new(customer_order_number: String, order_date: String, shipment_details: crate::models::ShipmentDetails, selling_party: crate::models::PartyIdentification, ship_from_party: crate::models::PartyIdentification, ship_to_party: crate::models::Address, bill_to_party: crate::models::PartyIdentification, items: Vec<crate::models::OrderItem>) -> OrderDetails {
OrderDetails {
customer_order_number,
order_date,
order_status: None,
shipment_details: Box::new(shipment_details),
tax_total: None,
selling_party: Box::new(selling_party),
ship_from_party: Box::new(ship_from_party),
ship_to_party: Box::new(ship_to_party),
bill_to_party: Box::new(bill_to_party),
items,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum OrderStatus {
#[serde(rename = "NEW")]
NEW,
#[serde(rename = "SHIPPED")]
SHIPPED,
#[serde(rename = "ACCEPTED")]
ACCEPTED,
#[serde(rename = "CANCELLED")]
CANCELLED,
}
impl Default for OrderStatus {
fn default() -> OrderStatus {
Self::NEW
}
}