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};

/// AllowanceDetails : Monetary and tax details of the allowance.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AllowanceDetails {
    /// Type of the allowance applied.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Description of the allowance.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(rename = "allowanceAmount")]
    pub allowance_amount: Box<models::vendor_invoices::Money>,
    /// Tax amount details applied on this allowance.
    #[serde(rename = "taxDetails", skip_serializing_if = "Option::is_none")]
    pub tax_details: Option<Vec<models::vendor_invoices::TaxDetails>>,
}

impl AllowanceDetails {
    /// Monetary and tax details of the allowance.
    pub fn new(r#type: Type, allowance_amount: models::vendor_invoices::Money) -> AllowanceDetails {
        AllowanceDetails {
            r#type,
            description: None,
            allowance_amount: Box::new(allowance_amount),
            tax_details: None,
        }
    }
}
/// Type of the allowance applied.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "Discount")]
    Discount,
    #[serde(rename = "DiscountIncentive")]
    DiscountIncentive,
    #[serde(rename = "Defective")]
    Defective,
    #[serde(rename = "Promotional")]
    Promotional,
    #[serde(rename = "UnsaleableMerchandise")]
    UnsaleableMerchandise,
    #[serde(rename = "Special")]
    Special,
}

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