amazon-spapi 2.0.3

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

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

/// InvoiceDetail : Represents the details of an invoice, including invoice number, date, parties involved, payment terms, totals, taxes, charges, and line items.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct InvoiceDetail {
    /// The unique invoice number.
    #[serde(rename = "invoiceNumber")]
    pub invoice_number: String,
    /// Invoice date.
    #[serde(rename = "invoiceDate")]
    pub invoice_date: String,
    /// An additional unique reference number used for regulatory or other purposes.
    #[serde(rename = "referenceNumber", skip_serializing_if = "Option::is_none")]
    pub reference_number: Option<String>,
    #[serde(rename = "remitToParty")]
    pub remit_to_party: Box<models::vendor_direct_fulfillment_payments_v1::PartyIdentification>,
    #[serde(rename = "shipFromParty")]
    pub ship_from_party: Box<models::vendor_direct_fulfillment_payments_v1::PartyIdentification>,
    #[serde(rename = "billToParty", skip_serializing_if = "Option::is_none")]
    pub bill_to_party: Option<Box<models::vendor_direct_fulfillment_payments_v1::PartyIdentification>>,
    /// Ship-to country code.
    #[serde(rename = "shipToCountryCode", skip_serializing_if = "Option::is_none")]
    pub ship_to_country_code: Option<String>,
    /// The payment terms for the invoice.
    #[serde(rename = "paymentTermsCode", skip_serializing_if = "Option::is_none")]
    pub payment_terms_code: Option<String>,
    #[serde(rename = "invoiceTotal")]
    pub invoice_total: Box<models::vendor_direct_fulfillment_payments_v1::Money>,
    /// Individual tax details per line item.
    #[serde(rename = "taxTotals", skip_serializing_if = "Option::is_none")]
    pub tax_totals: Option<Vec<models::vendor_direct_fulfillment_payments_v1::TaxDetail>>,
    /// Additional details provided by the selling party, for tax-related or other purposes.
    #[serde(rename = "additionalDetails", skip_serializing_if = "Option::is_none")]
    pub additional_details: Option<Vec<models::vendor_direct_fulfillment_payments_v1::AdditionalDetails>>,
    /// Total charge amount details for all line items.
    #[serde(rename = "chargeDetails", skip_serializing_if = "Option::is_none")]
    pub charge_details: Option<Vec<models::vendor_direct_fulfillment_payments_v1::ChargeDetails>>,
    /// Provides the details of the items in this invoice.
    #[serde(rename = "items")]
    pub items: Vec<models::vendor_direct_fulfillment_payments_v1::InvoiceItem>,
}

impl InvoiceDetail {
    /// Represents the details of an invoice, including invoice number, date, parties involved, payment terms, totals, taxes, charges, and line items.
    pub fn new(invoice_number: String, invoice_date: String, remit_to_party: models::vendor_direct_fulfillment_payments_v1::PartyIdentification, ship_from_party: models::vendor_direct_fulfillment_payments_v1::PartyIdentification, invoice_total: models::vendor_direct_fulfillment_payments_v1::Money, items: Vec<models::vendor_direct_fulfillment_payments_v1::InvoiceItem>) -> InvoiceDetail {
        InvoiceDetail {
            invoice_number,
            invoice_date,
            reference_number: None,
            remit_to_party: Box::new(remit_to_party),
            ship_from_party: Box::new(ship_from_party),
            bill_to_party: None,
            ship_to_country_code: None,
            payment_terms_code: None,
            invoice_total: Box::new(invoice_total),
            tax_totals: None,
            additional_details: None,
            charge_details: None,
            items,
        }
    }
}