amazon_spapi/models/vendor_invoices/
invoice.rs

1/*
2 * Selling Partner API for Retail Procurement Payments
3 *
4 * The Selling Partner API for Retail Procurement Payments provides programmatic access to vendors payments data.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Invoice : Represents an invoice or credit note document with details about the transaction, parties involved, and line items.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Invoice {
17    /// Identifies the type of invoice.
18    #[serde(rename = "invoiceType")]
19    pub invoice_type: InvoiceType,
20    /// Unique number relating to the charges defined in this document. This will be invoice number if the document type is Invoice or CreditNote number if the document type is Credit Note. Failure to provide this reference will result in a rejection.
21    #[serde(rename = "id")]
22    pub id: String,
23    /// An additional unique reference number used for regulatory or other purposes.
24    #[serde(rename = "referenceNumber", skip_serializing_if = "Option::is_none")]
25    pub reference_number: Option<String>,
26    /// Defines a date and time according to ISO8601.
27    #[serde(rename = "date")]
28    pub date: String,
29    #[serde(rename = "remitToParty")]
30    pub remit_to_party: Box<models::vendor_invoices::PartyIdentification>,
31    #[serde(rename = "shipToParty", skip_serializing_if = "Option::is_none")]
32    pub ship_to_party: Option<Box<models::vendor_invoices::PartyIdentification>>,
33    #[serde(rename = "shipFromParty", skip_serializing_if = "Option::is_none")]
34    pub ship_from_party: Option<Box<models::vendor_invoices::PartyIdentification>>,
35    #[serde(rename = "billToParty", skip_serializing_if = "Option::is_none")]
36    pub bill_to_party: Option<Box<models::vendor_invoices::PartyIdentification>>,
37    #[serde(rename = "paymentTerms", skip_serializing_if = "Option::is_none")]
38    pub payment_terms: Option<Box<models::vendor_invoices::PaymentTerms>>,
39    #[serde(rename = "invoiceTotal")]
40    pub invoice_total: Box<models::vendor_invoices::Money>,
41    /// Total tax amount details for all line items.
42    #[serde(rename = "taxDetails", skip_serializing_if = "Option::is_none")]
43    pub tax_details: Option<Vec<models::vendor_invoices::TaxDetails>>,
44    /// Additional details provided by the selling party, for tax related or other purposes.
45    #[serde(rename = "additionalDetails", skip_serializing_if = "Option::is_none")]
46    pub additional_details: Option<Vec<models::vendor_invoices::AdditionalDetails>>,
47    /// Total charge amount details for all line items.
48    #[serde(rename = "chargeDetails", skip_serializing_if = "Option::is_none")]
49    pub charge_details: Option<Vec<models::vendor_invoices::ChargeDetails>>,
50    /// Total allowance amount details for all line items.
51    #[serde(rename = "allowanceDetails", skip_serializing_if = "Option::is_none")]
52    pub allowance_details: Option<Vec<models::vendor_invoices::AllowanceDetails>>,
53    /// The list of invoice items.
54    #[serde(rename = "items", skip_serializing_if = "Option::is_none")]
55    pub items: Option<Vec<models::vendor_invoices::InvoiceItem>>,
56}
57
58impl Invoice {
59    /// Represents an invoice or credit note document with details about the transaction, parties involved, and line items.
60    pub fn new(invoice_type: InvoiceType, id: String, date: String, remit_to_party: models::vendor_invoices::PartyIdentification, invoice_total: models::vendor_invoices::Money) -> Invoice {
61        Invoice {
62            invoice_type,
63            id,
64            reference_number: None,
65            date,
66            remit_to_party: Box::new(remit_to_party),
67            ship_to_party: None,
68            ship_from_party: None,
69            bill_to_party: None,
70            payment_terms: None,
71            invoice_total: Box::new(invoice_total),
72            tax_details: None,
73            additional_details: None,
74            charge_details: None,
75            allowance_details: None,
76            items: None,
77        }
78    }
79}
80/// Identifies the type of invoice.
81#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
82pub enum InvoiceType {
83    #[serde(rename = "Invoice")]
84    Invoice,
85    #[serde(rename = "CreditNote")]
86    CreditNote,
87}
88
89impl Default for InvoiceType {
90    fn default() -> InvoiceType {
91        Self::Invoice
92    }
93}
94