amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * 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
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// TaxDetails : Details of tax amount applied.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TaxDetails {
    /// Type of the tax applied.
    #[serde(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(rename = "taxRate", skip_serializing_if = "Option::is_none")]
    pub tax_rate: Option<String>,
    #[serde(rename = "taxAmount")]
    pub tax_amount: Box<models::vendor_invoices::Money>,
    #[serde(rename = "taxableAmount", skip_serializing_if = "Option::is_none")]
    pub taxable_amount: Option<Box<models::vendor_invoices::Money>>,
}

impl TaxDetails {
    /// Details of tax amount applied.
    pub fn new(tax_type: TaxType, tax_amount: models::vendor_invoices::Money) -> TaxDetails {
        TaxDetails {
            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.")]
    MwStPeriod,
    #[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
    }
}