pub struct Invoice {Show 37 fields
pub id: InvoiceId,
pub invoice_number: String,
pub customer_id: CustomerId,
pub order_id: Option<OrderId>,
pub status: InvoiceStatus,
pub invoice_type: InvoiceType,
pub invoice_date: DateTime<Utc>,
pub due_date: DateTime<Utc>,
pub payment_terms: Option<String>,
pub currency: CurrencyCode,
pub billing_name: Option<String>,
pub billing_email: Option<String>,
pub billing_address: Option<String>,
pub billing_city: Option<String>,
pub billing_state: Option<String>,
pub billing_postal_code: Option<String>,
pub billing_country: Option<String>,
pub subtotal: Decimal,
pub discount_amount: Decimal,
pub discount_percent: Option<Decimal>,
pub tax_amount: Decimal,
pub tax_rate: Option<Decimal>,
pub shipping_amount: Decimal,
pub total: Decimal,
pub amount_paid: Decimal,
pub balance_due: Decimal,
pub po_number: Option<String>,
pub notes: Option<String>,
pub terms: Option<String>,
pub footer: Option<String>,
pub sent_at: Option<DateTime<Utc>>,
pub viewed_at: Option<DateTime<Utc>>,
pub paid_at: Option<DateTime<Utc>>,
pub voided_at: Option<DateTime<Utc>>,
pub items: Vec<InvoiceItem>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
An invoice
Fields§
§id: InvoiceIdUnique ID
invoice_number: StringHuman-readable invoice number
customer_id: CustomerIdCustomer ID
order_id: Option<OrderId>Associated order ID (optional)
status: InvoiceStatusInvoice status
invoice_type: InvoiceTypeInvoice type
invoice_date: DateTime<Utc>Invoice date
due_date: DateTime<Utc>Due date
payment_terms: Option<String>Payment terms description
currency: CurrencyCodeCurrency code
billing_name: Option<String>Billing name
billing_email: Option<String>Billing email
billing_address: Option<String>Billing address
billing_city: Option<String>Billing city
billing_state: Option<String>Billing state
billing_postal_code: Option<String>Billing postal code
billing_country: Option<String>Billing country
subtotal: DecimalSubtotal (before tax/discounts)
discount_amount: DecimalDiscount amount
discount_percent: Option<Decimal>Discount percentage (if applicable)
tax_amount: DecimalTax amount
tax_rate: Option<Decimal>Tax rate (percentage)
shipping_amount: DecimalShipping/handling charges
total: DecimalTotal amount due
amount_paid: DecimalAmount paid
balance_due: DecimalBalance due
po_number: Option<String>Purchase order reference
notes: Option<String>Internal notes
terms: Option<String>Terms and conditions
Footer text
sent_at: Option<DateTime<Utc>>When invoice was sent
viewed_at: Option<DateTime<Utc>>When invoice was viewed
paid_at: Option<DateTime<Utc>>When invoice was paid in full
voided_at: Option<DateTime<Utc>>When invoice was voided
items: Vec<InvoiceItem>Line items
created_at: DateTime<Utc>When created
updated_at: DateTime<Utc>When last updated
Implementations§
Source§impl Invoice
impl Invoice
Sourcepub fn is_overdue(&self) -> bool
pub fn is_overdue(&self) -> bool
Check if the invoice is overdue
Sourcepub fn days_until_due(&self) -> i64
pub fn days_until_due(&self) -> i64
Get days until due (negative if overdue)
Sourcepub fn calculate_balance(&self) -> Decimal
pub fn calculate_balance(&self) -> Decimal
Calculate the balance due
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Invoice
impl<'de> Deserialize<'de> for Invoice
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Invoice, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Invoice, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Invoice
impl Serialize for Invoice
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Invoice
impl RefUnwindSafe for Invoice
impl Send for Invoice
impl Sync for Invoice
impl Unpin for Invoice
impl UnsafeUnpin for Invoice
impl UnwindSafe for Invoice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more