stripe/model/
quote.rs

1use serde::{Serialize, Deserialize};
2use super::{
3    InvoiceSettingQuoteSetting, QuotesResourceAutomaticTax, QuotesResourceComputed,
4    QuotesResourceListLineItems, QuotesResourceStatusTransitions,
5    QuotesResourceSubscriptionDataSubscriptionData, QuotesResourceTotalDetails,
6};
7/**A Quote is a way to model prices that you'd like to provide to a customer.
8Once accepted, it will automatically create an invoice, subscription or subscription schedule.*/
9#[derive(Debug, Clone, Serialize, Deserialize, Default)]
10pub struct Quote {
11    ///Total before any discounts or taxes are applied.
12    pub amount_subtotal: i64,
13    ///Total after discounts and taxes are applied.
14    pub amount_total: i64,
15    ///ID of the Connect Application that created the quote.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub application: Option<serde_json::Value>,
18    ///The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. Only applicable if there are no line items with recurring prices on the quote.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub application_fee_amount: Option<i64>,
21    ///A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub application_fee_percent: Option<f64>,
24    ///
25    pub automatic_tax: QuotesResourceAutomaticTax,
26    ///Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically`.
27    pub collection_method: String,
28    ///
29    pub computed: QuotesResourceComputed,
30    ///Time at which the object was created. Measured in seconds since the Unix epoch.
31    pub created: i64,
32    ///Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub currency: Option<String>,
35    ///The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub customer: Option<serde_json::Value>,
38    ///The tax rates applied to this quote.
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub default_tax_rates: Option<Vec<serde_json::Value>>,
41    ///A description that will be displayed on the quote PDF.
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub description: Option<String>,
44    ///The discounts applied to this quote.
45    pub discounts: Vec<serde_json::Value>,
46    ///The date on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch.
47    pub expires_at: i64,
48    ///A footer that will be displayed on the quote PDF.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub footer: Option<String>,
51    ///Details of the quote that was cloned. See the [cloning documentation](https://stripe.com/docs/quotes/clone) for more details.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub from_quote: Option<serde_json::Value>,
54    ///A header that will be displayed on the quote PDF.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub header: Option<String>,
57    ///Unique identifier for the object.
58    pub id: String,
59    ///The invoice that was created from this quote.
60    #[serde(skip_serializing_if = "Option::is_none")]
61    pub invoice: Option<serde_json::Value>,
62    ///
63    pub invoice_settings: InvoiceSettingQuoteSetting,
64    ///A list of items the customer is being quoted for.
65    #[serde(skip_serializing_if = "Option::is_none")]
66    pub line_items: Option<QuotesResourceListLineItems>,
67    ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
68    pub livemode: bool,
69    ///Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
70    pub metadata: serde_json::Value,
71    ///A unique number that identifies this particular quote. This number is assigned once the quote is [finalized](https://stripe.com/docs/quotes/overview#finalize).
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub number: Option<String>,
74    ///String representing the object's type. Objects of the same type share the same value.
75    pub object: String,
76    ///The account on behalf of which to charge. See the [Connect documentation](https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts) for details.
77    #[serde(skip_serializing_if = "Option::is_none")]
78    pub on_behalf_of: Option<serde_json::Value>,
79    ///The status of the quote.
80    pub status: String,
81    ///
82    pub status_transitions: QuotesResourceStatusTransitions,
83    ///The subscription that was created or updated from this quote.
84    #[serde(skip_serializing_if = "Option::is_none")]
85    pub subscription: Option<serde_json::Value>,
86    ///
87    pub subscription_data: QuotesResourceSubscriptionDataSubscriptionData,
88    ///The subscription schedule that was created or updated from this quote.
89    #[serde(skip_serializing_if = "Option::is_none")]
90    pub subscription_schedule: Option<serde_json::Value>,
91    ///ID of the test clock this quote belongs to.
92    #[serde(skip_serializing_if = "Option::is_none")]
93    pub test_clock: Option<serde_json::Value>,
94    ///
95    pub total_details: QuotesResourceTotalDetails,
96    ///The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices.
97    #[serde(skip_serializing_if = "Option::is_none")]
98    pub transfer_data: Option<serde_json::Value>,
99}
100impl std::fmt::Display for Quote {
101    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
102        write!(f, "{}", serde_json::to_string(self).unwrap())
103    }
104}