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
#![deny(clippy::all)]
#![forbid(unsafe_code)]
mod country;
use chrono::prelude::*;
use chrono::NaiveDate;
pub use country::Country;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Order {
pub id: i64,
#[serde(rename = "orderNumber")]
pub order_id: String,
pub origin: String,
pub locale: String,
pub custom_status: String,
pub date: String,
pub date_time: DateTime<Utc>,
pub payment_method: String,
pub payment_method_name: String,
pub payment_instructions: Option<String>,
pub invoice_number: Option<String>,
pub invoice_date: Option<NaiveDate>,
pub currency: String,
pub shipping_method: String,
pub shipping_method_name: String,
pub subtotal: String,
pub subtotal_cents: i64,
pub shipping: String,
pub shipping_cents: i64,
pub tax: Option<String>,
pub tax_cents: Option<i64>,
pub total: String,
pub total_cents: i64,
pub email: String,
pub invoice_address: Address,
pub shipping_address: Address,
pub line_items: Vec<LineItem>,
pub shipment: Option<serde_json::Value>,
pub token: String,
pub today: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LineItem {
pub id: i64,
pub sku: String,
pub url: String,
pub name: String,
pub quantity: i32,
pub price: String,
pub price_cents: i64,
pub taxrate: i32,
pub total: String,
pub total_cents: i64,
pub options: Vec<LineItemOption>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LineItemOption {
pub sku: String,
pub name: String,
pub value: String,
pub price: String,
pub price_cents: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Address {
pub recipient: String,
pub line1: String,
pub line2: String,
pub postal_code: String,
pub city: String,
pub province_code: Option<String>,
pub province_name: Option<String>,
pub country_code: Country,
pub country_name: String,
pub phone: Option<String>,
pub vat: Option<String>,
}