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
90
91
92
93
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Invoice {
#[serde(default, rename = "invoiceType")]
pub invoice_type: InvoiceType,
#[serde(default, rename = "id")]
pub id: String,
#[serde(default, rename = "referenceNumber", skip_serializing_if = "Option::is_none")]
pub reference_number: Option<String>,
#[serde(default, rename = "date")]
pub date: String,
#[serde(default, rename = "remitToParty")]
pub remit_to_party: Box<crate::models::PartyIdentification>,
#[serde(default, rename = "shipToParty", skip_serializing_if = "Option::is_none")]
pub ship_to_party: Option<Box<crate::models::PartyIdentification>>,
#[serde(default, rename = "shipFromParty", skip_serializing_if = "Option::is_none")]
pub ship_from_party: Option<Box<crate::models::PartyIdentification>>,
#[serde(default, rename = "billToParty", skip_serializing_if = "Option::is_none")]
pub bill_to_party: Option<Box<crate::models::PartyIdentification>>,
#[serde(default, rename = "paymentTerms", skip_serializing_if = "Option::is_none")]
pub payment_terms: Option<Box<crate::models::PaymentTerms>>,
#[serde(default, rename = "invoiceTotal")]
pub invoice_total: Box<crate::models::Money>,
#[serde(default, rename = "taxDetails", skip_serializing_if = "Option::is_none")]
pub tax_details: Option<Vec<crate::models::TaxDetails>>,
#[serde(default, rename = "additionalDetails", skip_serializing_if = "Option::is_none")]
pub additional_details: Option<Vec<crate::models::AdditionalDetails>>,
#[serde(default, rename = "chargeDetails", skip_serializing_if = "Option::is_none")]
pub charge_details: Option<Vec<crate::models::ChargeDetails>>,
#[serde(default, rename = "allowanceDetails", skip_serializing_if = "Option::is_none")]
pub allowance_details: Option<Vec<crate::models::AllowanceDetails>>,
#[serde(default, rename = "items", skip_serializing_if = "Option::is_none")]
pub items: Option<Vec<crate::models::InvoiceItem>>,
}
impl Invoice {
pub fn new(invoice_type: InvoiceType, id: String, date: String, remit_to_party: crate::models::PartyIdentification, invoice_total: crate::models::Money) -> Invoice {
Invoice {
invoice_type,
id,
reference_number: None,
date,
remit_to_party: Box::new(remit_to_party),
ship_to_party: None,
ship_from_party: None,
bill_to_party: None,
payment_terms: None,
invoice_total: Box::new(invoice_total),
tax_details: None,
additional_details: None,
charge_details: None,
allowance_details: None,
items: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum InvoiceType {
#[serde(rename = "Invoice")]
Invoice,
#[serde(rename = "CreditNote")]
CreditNote,
}
impl Default for InvoiceType {
fn default() -> InvoiceType {
Self::Invoice
}
}