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
/*
 * Selling Partner API for Direct Fulfillment Payments
 *
 * The Selling Partner API for Direct Fulfillment Payments provides programmatic access to a direct fulfillment vendor's invoice data.
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

/// TaxDetail : Details of tax amount applied.



#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct TaxDetail {
    /// Type of the tax applied.
    #[serde(default, rename = "taxType")]
    pub tax_type: TaxType,
    /// A decimal number with no loss of precision. Useful when precision loss is unacceptable, as with currencies. Follows RFC7159 for number representation. <br>**Pattern** : `^-?(0|([1-9]\\d*))(\\.\\d+)?([eE][+-]?\\d+)?$`.
    #[serde(default, rename = "taxRate", skip_serializing_if = "Option::is_none")]
    pub tax_rate: Option<String>,
    #[serde(default, rename = "taxAmount")]
    pub tax_amount: Box<crate::models::Money>,
    #[serde(default, rename = "taxableAmount", skip_serializing_if = "Option::is_none")]
    pub taxable_amount: Option<Box<crate::models::Money>>,
}

impl TaxDetail {
    /// Details of tax amount applied.
    pub fn new(tax_type: TaxType, tax_amount: crate::models::Money) -> TaxDetail {
        TaxDetail {
            tax_type,
            tax_rate: None,
            tax_amount: Box::new(tax_amount),
            taxable_amount: None,
        }
    }
}

/// Type of the tax applied.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TaxType {
    #[serde(rename = "CGST")]
    CGST,
    #[serde(rename = "SGST")]
    SGST,
    #[serde(rename = "CESS")]
    CESS,
    #[serde(rename = "UTGST")]
    UTGST,
    #[serde(rename = "IGST")]
    IGST,
    #[serde(rename = "MwSt.")]
    MwSt,
    #[serde(rename = "PST")]
    PST,
    #[serde(rename = "TVA")]
    TVA,
    #[serde(rename = "VAT")]
    VAT,
    #[serde(rename = "GST")]
    GST,
    #[serde(rename = "ST")]
    ST,
    #[serde(rename = "Consumption")]
    Consumption,
    #[serde(rename = "MutuallyDefined")]
    MutuallyDefined,
    #[serde(rename = "DomesticVAT")]
    DomesticVAT,
}

impl Default for TaxType {
    fn default() -> TaxType {
        Self::CGST
    }
}