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
/*
 * Selling Partner API for Retail Procurement Payments
 *
 * The Selling Partner API for Retail Procurement Payments provides programmatic access to vendors payments data.
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

/// PaymentTerms : Terms of the payment for the invoice. The basis of the payment terms is the invoice date.



#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct PaymentTerms {
    /// The payment term type for the invoice.
    #[serde(default, rename = "type", skip_serializing_if = "Option::is_none")]
    pub _type: Option<Type>,
    /// 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 = "discountPercent", skip_serializing_if = "Option::is_none")]
    pub discount_percent: Option<String>,
    /// The number of calendar days from the Base date (Invoice date) until the discount is no longer valid.
    #[serde(default, rename = "discountDueDays", skip_serializing_if = "Option::is_none")]
    pub discount_due_days: Option<f32>,
    /// The number of calendar days from the base date (invoice date) until the total amount on the invoice is due.
    #[serde(default, rename = "netDueDays", skip_serializing_if = "Option::is_none")]
    pub net_due_days: Option<f32>,
}

impl PaymentTerms {
    /// Terms of the payment for the invoice. The basis of the payment terms is the invoice date.
    pub fn new() -> PaymentTerms {
        PaymentTerms {
            _type: None,
            discount_percent: None,
            discount_due_days: None,
            net_due_days: None,
        }
    }
}

/// The payment term type for the invoice.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "Basic")]
    Basic,
    #[serde(rename = "EndOfMonth")]
    EndOfMonth,
    #[serde(rename = "FixedDate")]
    FixedDate,
    #[serde(rename = "Proximo")]
    Proximo,
    #[serde(rename = "PaymentDueUponReceiptOfInvoice")]
    PaymentDueUponReceiptOfInvoice,
    #[serde(rename = "LetterofCredit")]
    LetterofCredit,
}

impl Default for Type {
    fn default() -> Type {
        Self::Basic
    }
}