stripe/model/credit_note_line_item.rs
1use serde::{Serialize, Deserialize};
2use super::{CreditNoteTaxAmount, DiscountsResourceDiscountAmount, TaxRate};
3///The credit note line item object
4#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5pub struct CreditNoteLineItem {
6 ///The integer amount in cents (or local equivalent) representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
7 pub amount: i64,
8 ///The integer amount in cents (or local equivalent) representing the amount being credited for this line item, excluding all tax and discounts.
9 #[serde(skip_serializing_if = "Option::is_none")]
10 pub amount_excluding_tax: Option<i64>,
11 ///Description of the item being credited.
12 #[serde(skip_serializing_if = "Option::is_none")]
13 pub description: Option<String>,
14 ///The integer amount in cents (or local equivalent) representing the discount being credited for this line item.
15 pub discount_amount: i64,
16 ///The amount of discount calculated per discount for this line item
17 pub discount_amounts: Vec<DiscountsResourceDiscountAmount>,
18 ///Unique identifier for the object.
19 pub id: String,
20 ///ID of the invoice line item being credited
21 #[serde(skip_serializing_if = "Option::is_none")]
22 pub invoice_line_item: Option<String>,
23 ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
24 pub livemode: bool,
25 ///String representing the object's type. Objects of the same type share the same value.
26 pub object: String,
27 ///The number of units of product being credited.
28 #[serde(skip_serializing_if = "Option::is_none")]
29 pub quantity: Option<i64>,
30 ///The amount of tax calculated per tax rate for this line item
31 pub tax_amounts: Vec<CreditNoteTaxAmount>,
32 ///The tax rates which apply to the line item.
33 pub tax_rates: Vec<TaxRate>,
34 ///The type of the credit note line item, one of `invoice_line_item` or `custom_line_item`. When the type is `invoice_line_item` there is an additional `invoice_line_item` property on the resource the value of which is the id of the credited line item on the invoice.
35 #[serde(rename = "type")]
36 pub type_: String,
37 ///The cost of each unit of product being credited.
38 #[serde(skip_serializing_if = "Option::is_none")]
39 pub unit_amount: Option<i64>,
40 ///Same as `unit_amount`, but contains a decimal value with at most 12 decimal places.
41 #[serde(skip_serializing_if = "Option::is_none")]
42 #[serde(with = "rust_decimal::serde::str_option")]
43 pub unit_amount_decimal: Option<rust_decimal::Decimal>,
44 ///The amount in cents (or local equivalent) representing the unit amount being credited for this line item, excluding all tax and discounts.
45 #[serde(skip_serializing_if = "Option::is_none")]
46 #[serde(with = "rust_decimal::serde::str_option")]
47 pub unit_amount_excluding_tax: Option<rust_decimal::Decimal>,
48}
49impl std::fmt::Display for CreditNoteLineItem {
50 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
51 write!(f, "{}", serde_json::to_string(self).unwrap())
52 }
53}