stripe/resources/generated/
customer.rs

1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use crate::client::{Client, Response};
6use crate::ids::{CouponId, CustomerId, PaymentMethodId, PaymentSourceId, PromotionCodeId};
7use crate::params::{
8    Deleted, Expand, Expandable, List, Metadata, Object, Paginable, RangeQuery, Timestamp,
9};
10use crate::resources::{
11    Address, CashBalance, Currency, Discount, InvoiceSettingRenderingOptions, PaymentMethod,
12    PaymentSource, PaymentSourceParams, Shipping, Subscription, TaxId, TestHelpersTestClock,
13};
14use serde::{Deserialize, Serialize};
15
16/// The resource representing a Stripe "Customer".
17///
18/// For more details see <https://stripe.com/docs/api/customers/object>
19#[derive(Clone, Debug, Default, Deserialize, Serialize)]
20pub struct Customer {
21    /// Unique identifier for the object.
22    pub id: CustomerId,
23
24    /// The customer's address.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub address: Option<Address>,
27
28    /// The current balance, if any, that's stored on the customer.
29    ///
30    /// If negative, the customer has credit to apply to their next invoice.
31    /// If positive, the customer has an amount owed that's added to their next invoice.
32    /// The balance only considers amounts that Stripe hasn't successfully applied to any invoice.
33    /// It doesn't reflect unpaid invoices.
34    /// This balance is only taken into account after invoices finalize.
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub balance: Option<i64>,
37
38    /// The current funds being held by Stripe on behalf of the customer.
39    ///
40    /// You can apply these funds towards payment intents when the source is "cash_balance".
41    /// The `settings[reconciliation_mode]` field describes if these funds apply to these payment intents manually or automatically.
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub cash_balance: Option<CashBalance>,
44
45    /// Time at which the object was created.
46    ///
47    /// Measured in seconds since the Unix epoch.
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub created: Option<Timestamp>,
50
51    /// Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) the customer can be charged in for recurring billing purposes.
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub currency: Option<Currency>,
54
55    /// ID of the default payment source for the customer.
56    ///
57    /// If you use payment methods created through the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) field instead.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub default_source: Option<Expandable<PaymentSource>>,
60
61    // Always true for a deleted object
62    #[serde(default)]
63    pub deleted: bool,
64
65    /// Tracks the most recent state change on any invoice belonging to the customer.
66    ///
67    /// Paying an invoice or marking it uncollectible via the API will set this field to false.
68    /// An automatic payment failure or passing the `invoice.due_date` will set this field to `true`.  If an invoice becomes uncollectible by [dunning](https://stripe.com/docs/billing/automatic-collection), `delinquent` doesn't reset to `false`.  If you care whether the customer has paid their most recent subscription invoice, use `subscription.status` instead.
69    /// Paying or marking uncollectible any customer invoice regardless of whether it is the latest invoice for a subscription will always set this field to `false`.
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub delinquent: Option<bool>,
72
73    /// An arbitrary string attached to the object.
74    ///
75    /// Often useful for displaying to users.
76    #[serde(skip_serializing_if = "Option::is_none")]
77    pub description: Option<String>,
78
79    /// Describes the current discount active on the customer, if there is one.
80    #[serde(skip_serializing_if = "Option::is_none")]
81    pub discount: Option<Discount>,
82
83    /// The customer's email address.
84    #[serde(skip_serializing_if = "Option::is_none")]
85    pub email: Option<String>,
86
87    /// The current multi-currency balances, if any, that's stored on the customer.
88    ///
89    /// If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency.
90    /// If negative, the customer has an amount owed that's added to their next invoice denominated in that currency.
91    /// These balances don't apply to unpaid invoices.
92    /// They solely track amounts that Stripe hasn't successfully applied to any invoice.
93    /// Stripe only applies a balance in a specific currency to an invoice after that invoice (which is in the same currency) finalizes.
94    #[serde(skip_serializing_if = "Option::is_none")]
95    pub invoice_credit_balance: Option<i64>,
96
97    /// The prefix for the customer used to generate unique invoice numbers.
98    #[serde(skip_serializing_if = "Option::is_none")]
99    pub invoice_prefix: Option<String>,
100
101    #[serde(skip_serializing_if = "Option::is_none")]
102    pub invoice_settings: Option<InvoiceSettingCustomerSetting>,
103
104    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
105    #[serde(skip_serializing_if = "Option::is_none")]
106    pub livemode: Option<bool>,
107
108    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
109    ///
110    /// This can be useful for storing additional information about the object in a structured format.
111    #[serde(skip_serializing_if = "Option::is_none")]
112    pub metadata: Option<Metadata>,
113
114    /// The customer's full name or business name.
115    #[serde(skip_serializing_if = "Option::is_none")]
116    pub name: Option<String>,
117
118    /// The suffix of the customer's next invoice number (for example, 0001).
119    #[serde(skip_serializing_if = "Option::is_none")]
120    pub next_invoice_sequence: Option<i64>,
121
122    /// The customer's phone number.
123    #[serde(skip_serializing_if = "Option::is_none")]
124    pub phone: Option<String>,
125
126    /// The customer's preferred locales (languages), ordered by preference.
127    #[serde(skip_serializing_if = "Option::is_none")]
128    pub preferred_locales: Option<Vec<String>>,
129
130    /// Mailing and shipping address for the customer.
131    ///
132    /// Appears on invoices emailed to this customer.
133    #[serde(skip_serializing_if = "Option::is_none")]
134    pub shipping: Option<Shipping>,
135
136    /// The customer's payment sources, if any.
137    #[serde(default)]
138    pub sources: List<PaymentSource>,
139
140    /// The customer's current subscriptions, if any.
141    #[serde(skip_serializing_if = "Option::is_none")]
142    pub subscriptions: Option<List<Subscription>>,
143
144    #[serde(skip_serializing_if = "Option::is_none")]
145    pub tax: Option<CustomerTax>,
146
147    /// Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`.
148    ///
149    /// When set to `reverse`, invoice and receipt PDFs include the following text: **"Reverse charge"**.
150    #[serde(skip_serializing_if = "Option::is_none")]
151    pub tax_exempt: Option<CustomerTaxExempt>,
152
153    /// The customer's tax IDs.
154    #[serde(skip_serializing_if = "Option::is_none")]
155    pub tax_ids: Option<List<TaxId>>,
156
157    /// ID of the test clock that this customer belongs to.
158    #[serde(skip_serializing_if = "Option::is_none")]
159    pub test_clock: Option<Expandable<TestHelpersTestClock>>,
160}
161
162impl Customer {
163    /// Returns a list of your customers.
164    ///
165    /// The customers are returned sorted by creation date, with the most recent customers appearing first.
166    pub fn list(client: &Client, params: &ListCustomers<'_>) -> Response<List<Customer>> {
167        client.get_query("/customers", params)
168    }
169
170    /// Creates a new customer object.
171    pub fn create(client: &Client, params: CreateCustomer<'_>) -> Response<Customer> {
172        #[allow(clippy::needless_borrows_for_generic_args)]
173        client.post_form("/customers", &params)
174    }
175
176    /// Retrieves a Customer object.
177    pub fn retrieve(client: &Client, id: &CustomerId, expand: &[&str]) -> Response<Customer> {
178        client.get_query(&format!("/customers/{}", id), Expand { expand })
179    }
180
181    /// Updates the specified customer by setting the values of the parameters passed.
182    ///
183    /// Any parameters not provided will be left unchanged.
184    /// For example, if you pass the **source** parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges in the future.
185    /// When you update a customer to a new valid card source by passing the **source** parameter: for each of the customer’s current subscriptions, if the subscription bills automatically and is in the `past_due` state, then the latest open invoice for the subscription with automatic collection enabled will be retried.
186    /// This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice.
187    /// Changing the **default_source** for a customer will not trigger this behavior.  This request accepts mostly the same arguments as the customer creation call.
188    pub fn update(
189        client: &Client,
190        id: &CustomerId,
191        params: UpdateCustomer<'_>,
192    ) -> Response<Customer> {
193        #[allow(clippy::needless_borrows_for_generic_args)]
194        client.post_form(&format!("/customers/{}", id), &params)
195    }
196
197    /// Permanently deletes a customer.
198    ///
199    /// It cannot be undone.
200    /// Also immediately cancels any active subscriptions on the customer.
201    pub fn delete(client: &Client, id: &CustomerId) -> Response<Deleted<CustomerId>> {
202        client.delete(&format!("/customers/{}", id))
203    }
204}
205
206impl Object for Customer {
207    type Id = CustomerId;
208    fn id(&self) -> Self::Id {
209        self.id.clone()
210    }
211    fn object(&self) -> &'static str {
212        "customer"
213    }
214}
215
216#[derive(Clone, Debug, Default, Deserialize, Serialize)]
217pub struct CustomerTax {
218    /// Surfaces if automatic tax computation is possible given the current customer location information.
219    pub automatic_tax: CustomerTaxAutomaticTax,
220
221    /// A recent IP address of the customer used for tax reporting and tax location inference.
222    pub ip_address: Option<String>,
223
224    /// The customer's location as identified by Stripe Tax.
225    pub location: Option<CustomerTaxLocation>,
226}
227
228#[derive(Clone, Debug, Default, Deserialize, Serialize)]
229pub struct CustomerTaxLocation {
230    /// The customer's country as identified by Stripe Tax.
231    pub country: String,
232
233    /// The data source used to infer the customer's location.
234    pub source: CustomerTaxLocationSource,
235
236    /// The customer's state, county, province, or region as identified by Stripe Tax.
237    pub state: Option<String>,
238}
239
240#[derive(Clone, Debug, Default, Deserialize, Serialize)]
241pub struct InvoiceSettingCustomerSetting {
242    /// Default custom fields to be displayed on invoices for this customer.
243    pub custom_fields: Option<Vec<InvoiceSettingCustomField>>,
244
245    /// ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices.
246    pub default_payment_method: Option<Expandable<PaymentMethod>>,
247
248    /// Default footer to be displayed on invoices for this customer.
249    pub footer: Option<String>,
250
251    /// Default options for invoice PDF rendering for this customer.
252    pub rendering_options: Option<InvoiceSettingRenderingOptions>,
253}
254
255#[derive(Clone, Debug, Default, Deserialize, Serialize)]
256pub struct InvoiceSettingCustomField {
257    /// The name of the custom field.
258    pub name: String,
259
260    /// The value of the custom field.
261    pub value: String,
262}
263
264/// The parameters for `Customer::create`.
265#[derive(Clone, Debug, Serialize, Default)]
266pub struct CreateCustomer<'a> {
267    /// The customer's address.
268    #[serde(skip_serializing_if = "Option::is_none")]
269    pub address: Option<Address>,
270
271    /// An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices.
272    ///
273    /// A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
274    #[serde(skip_serializing_if = "Option::is_none")]
275    pub balance: Option<i64>,
276
277    /// Balance information and default balance settings for this customer.
278    #[serde(skip_serializing_if = "Option::is_none")]
279    pub cash_balance: Option<CreateCustomerCashBalance>,
280
281    #[serde(skip_serializing_if = "Option::is_none")]
282    pub coupon: Option<CouponId>,
283
284    /// An arbitrary string that you can attach to a customer object.
285    ///
286    /// It is displayed alongside the customer in the dashboard.
287    #[serde(skip_serializing_if = "Option::is_none")]
288    pub description: Option<&'a str>,
289
290    /// Customer's email address.
291    ///
292    /// It's displayed alongside the customer in your dashboard and can be useful for searching and tracking.
293    /// This may be up to *512 characters*.
294    #[serde(skip_serializing_if = "Option::is_none")]
295    pub email: Option<&'a str>,
296
297    /// Specifies which fields in the response should be expanded.
298    #[serde(skip_serializing_if = "Expand::is_empty")]
299    pub expand: &'a [&'a str],
300
301    /// The prefix for the customer used to generate unique invoice numbers.
302    ///
303    /// Must be 3–12 uppercase letters or numbers.
304    #[serde(skip_serializing_if = "Option::is_none")]
305    pub invoice_prefix: Option<&'a str>,
306
307    /// Default invoice settings for this customer.
308    #[serde(skip_serializing_if = "Option::is_none")]
309    pub invoice_settings: Option<CustomerInvoiceSettings>,
310
311    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
312    ///
313    /// This can be useful for storing additional information about the object in a structured format.
314    /// Individual keys can be unset by posting an empty value to them.
315    /// All keys can be unset by posting an empty value to `metadata`.
316    #[serde(skip_serializing_if = "Option::is_none")]
317    pub metadata: Option<Metadata>,
318
319    /// The customer's full name or business name.
320    #[serde(skip_serializing_if = "Option::is_none")]
321    pub name: Option<&'a str>,
322
323    /// The sequence to be used on the customer's next invoice.
324    ///
325    /// Defaults to 1.
326    #[serde(skip_serializing_if = "Option::is_none")]
327    pub next_invoice_sequence: Option<i64>,
328
329    #[serde(skip_serializing_if = "Option::is_none")]
330    pub payment_method: Option<PaymentMethodId>,
331
332    /// The customer's phone number.
333    #[serde(skip_serializing_if = "Option::is_none")]
334    pub phone: Option<&'a str>,
335
336    /// Customer's preferred languages, ordered by preference.
337    #[serde(skip_serializing_if = "Option::is_none")]
338    pub preferred_locales: Option<Vec<String>>,
339
340    /// The API ID of a promotion code to apply to the customer.
341    ///
342    /// The customer will have a discount applied on all recurring payments.
343    /// Charges you create through the API will not have the discount.
344    #[serde(skip_serializing_if = "Option::is_none")]
345    pub promotion_code: Option<PromotionCodeId>,
346
347    /// The customer's shipping information.
348    ///
349    /// Appears on invoices emailed to this customer.
350    #[serde(skip_serializing_if = "Option::is_none")]
351    pub shipping: Option<CreateCustomerShipping>,
352
353    #[serde(skip_serializing_if = "Option::is_none")]
354    pub source: Option<PaymentSourceParams>,
355
356    /// Tax details about the customer.
357    #[serde(skip_serializing_if = "Option::is_none")]
358    pub tax: Option<CreateCustomerTax>,
359
360    /// The customer's tax exemption.
361    ///
362    /// One of `none`, `exempt`, or `reverse`.
363    #[serde(skip_serializing_if = "Option::is_none")]
364    pub tax_exempt: Option<CustomerTaxExemptFilter>,
365
366    /// The customer's tax IDs.
367    #[serde(skip_serializing_if = "Option::is_none")]
368    pub tax_id_data: Option<Vec<TaxIdData>>,
369
370    /// ID of the test clock to attach to the customer.
371    #[serde(skip_serializing_if = "Option::is_none")]
372    pub test_clock: Option<&'a str>,
373
374    #[serde(skip_serializing_if = "Option::is_none")]
375    pub validate: Option<bool>,
376}
377
378impl<'a> CreateCustomer<'a> {
379    pub fn new() -> Self {
380        CreateCustomer {
381            address: Default::default(),
382            balance: Default::default(),
383            cash_balance: Default::default(),
384            coupon: Default::default(),
385            description: Default::default(),
386            email: Default::default(),
387            expand: Default::default(),
388            invoice_prefix: Default::default(),
389            invoice_settings: Default::default(),
390            metadata: Default::default(),
391            name: Default::default(),
392            next_invoice_sequence: Default::default(),
393            payment_method: Default::default(),
394            phone: Default::default(),
395            preferred_locales: Default::default(),
396            promotion_code: Default::default(),
397            shipping: Default::default(),
398            source: Default::default(),
399            tax: Default::default(),
400            tax_exempt: Default::default(),
401            tax_id_data: Default::default(),
402            test_clock: Default::default(),
403            validate: Default::default(),
404        }
405    }
406}
407
408/// The parameters for `Customer::list`.
409#[derive(Clone, Debug, Serialize, Default)]
410pub struct ListCustomers<'a> {
411    #[serde(skip_serializing_if = "Option::is_none")]
412    pub created: Option<RangeQuery<Timestamp>>,
413
414    /// A case-sensitive filter on the list based on the customer's `email` field.
415    ///
416    /// The value must be a string.
417    #[serde(skip_serializing_if = "Option::is_none")]
418    pub email: Option<&'a str>,
419
420    /// A cursor for use in pagination.
421    ///
422    /// `ending_before` is an object ID that defines your place in the list.
423    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
424    #[serde(skip_serializing_if = "Option::is_none")]
425    pub ending_before: Option<CustomerId>,
426
427    /// Specifies which fields in the response should be expanded.
428    #[serde(skip_serializing_if = "Expand::is_empty")]
429    pub expand: &'a [&'a str],
430
431    /// A limit on the number of objects to be returned.
432    ///
433    /// Limit can range between 1 and 100, and the default is 10.
434    #[serde(skip_serializing_if = "Option::is_none")]
435    pub limit: Option<u64>,
436
437    /// A cursor for use in pagination.
438    ///
439    /// `starting_after` is an object ID that defines your place in the list.
440    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
441    #[serde(skip_serializing_if = "Option::is_none")]
442    pub starting_after: Option<CustomerId>,
443
444    /// Provides a list of customers that are associated with the specified test clock.
445    ///
446    /// The response will not include customers with test clocks if this parameter is not set.
447    #[serde(skip_serializing_if = "Option::is_none")]
448    pub test_clock: Option<&'a str>,
449}
450
451impl<'a> ListCustomers<'a> {
452    pub fn new() -> Self {
453        ListCustomers {
454            created: Default::default(),
455            email: Default::default(),
456            ending_before: Default::default(),
457            expand: Default::default(),
458            limit: Default::default(),
459            starting_after: Default::default(),
460            test_clock: Default::default(),
461        }
462    }
463}
464impl Paginable for ListCustomers<'_> {
465    type O = Customer;
466    fn set_last(&mut self, item: Self::O) {
467        self.starting_after = Some(item.id());
468    }
469}
470/// The parameters for `Customer::update`.
471#[derive(Clone, Debug, Serialize, Default)]
472pub struct UpdateCustomer<'a> {
473    /// The customer's address.
474    #[serde(skip_serializing_if = "Option::is_none")]
475    pub address: Option<Address>,
476
477    /// An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices.
478    ///
479    /// A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
480    #[serde(skip_serializing_if = "Option::is_none")]
481    pub balance: Option<i64>,
482
483    /// Balance information and default balance settings for this customer.
484    #[serde(skip_serializing_if = "Option::is_none")]
485    pub cash_balance: Option<UpdateCustomerCashBalance>,
486
487    #[serde(skip_serializing_if = "Option::is_none")]
488    pub coupon: Option<CouponId>,
489
490    /// If you are using payment methods created via the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method) parameter.
491    ///
492    /// Provide the ID of a payment source already attached to this customer to make it this customer's default payment source.
493    ///
494    /// If you want to add a new payment source and make it the default, see the [source](https://stripe.com/docs/api/customers/update#update_customer-source) property.
495    #[serde(skip_serializing_if = "Option::is_none")]
496    pub default_source: Option<PaymentSourceId>,
497
498    /// An arbitrary string that you can attach to a customer object.
499    ///
500    /// It is displayed alongside the customer in the dashboard.
501    #[serde(skip_serializing_if = "Option::is_none")]
502    pub description: Option<&'a str>,
503
504    /// Customer's email address.
505    ///
506    /// It's displayed alongside the customer in your dashboard and can be useful for searching and tracking.
507    /// This may be up to *512 characters*.
508    #[serde(skip_serializing_if = "Option::is_none")]
509    pub email: Option<&'a str>,
510
511    /// Specifies which fields in the response should be expanded.
512    #[serde(skip_serializing_if = "Expand::is_empty")]
513    pub expand: &'a [&'a str],
514
515    /// The prefix for the customer used to generate unique invoice numbers.
516    ///
517    /// Must be 3–12 uppercase letters or numbers.
518    #[serde(skip_serializing_if = "Option::is_none")]
519    pub invoice_prefix: Option<&'a str>,
520
521    /// Default invoice settings for this customer.
522    #[serde(skip_serializing_if = "Option::is_none")]
523    pub invoice_settings: Option<CustomerInvoiceSettings>,
524
525    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
526    ///
527    /// This can be useful for storing additional information about the object in a structured format.
528    /// Individual keys can be unset by posting an empty value to them.
529    /// All keys can be unset by posting an empty value to `metadata`.
530    #[serde(skip_serializing_if = "Option::is_none")]
531    pub metadata: Option<Metadata>,
532
533    /// The customer's full name or business name.
534    #[serde(skip_serializing_if = "Option::is_none")]
535    pub name: Option<&'a str>,
536
537    /// The sequence to be used on the customer's next invoice.
538    ///
539    /// Defaults to 1.
540    #[serde(skip_serializing_if = "Option::is_none")]
541    pub next_invoice_sequence: Option<i64>,
542
543    /// The customer's phone number.
544    #[serde(skip_serializing_if = "Option::is_none")]
545    pub phone: Option<&'a str>,
546
547    /// Customer's preferred languages, ordered by preference.
548    #[serde(skip_serializing_if = "Option::is_none")]
549    pub preferred_locales: Option<Vec<String>>,
550
551    /// The API ID of a promotion code to apply to the customer.
552    ///
553    /// The customer will have a discount applied on all recurring payments.
554    /// Charges you create through the API will not have the discount.
555    #[serde(skip_serializing_if = "Option::is_none")]
556    pub promotion_code: Option<PromotionCodeId>,
557
558    /// The customer's shipping information.
559    ///
560    /// Appears on invoices emailed to this customer.
561    #[serde(skip_serializing_if = "Option::is_none")]
562    pub shipping: Option<UpdateCustomerShipping>,
563
564    #[serde(skip_serializing_if = "Option::is_none")]
565    pub source: Option<PaymentSourceParams>,
566
567    /// Tax details about the customer.
568    #[serde(skip_serializing_if = "Option::is_none")]
569    pub tax: Option<UpdateCustomerTax>,
570
571    /// The customer's tax exemption.
572    ///
573    /// One of `none`, `exempt`, or `reverse`.
574    #[serde(skip_serializing_if = "Option::is_none")]
575    pub tax_exempt: Option<CustomerTaxExemptFilter>,
576
577    #[serde(skip_serializing_if = "Option::is_none")]
578    pub validate: Option<bool>,
579}
580
581impl<'a> UpdateCustomer<'a> {
582    pub fn new() -> Self {
583        UpdateCustomer {
584            address: Default::default(),
585            balance: Default::default(),
586            cash_balance: Default::default(),
587            coupon: Default::default(),
588            default_source: Default::default(),
589            description: Default::default(),
590            email: Default::default(),
591            expand: Default::default(),
592            invoice_prefix: Default::default(),
593            invoice_settings: Default::default(),
594            metadata: Default::default(),
595            name: Default::default(),
596            next_invoice_sequence: Default::default(),
597            phone: Default::default(),
598            preferred_locales: Default::default(),
599            promotion_code: Default::default(),
600            shipping: Default::default(),
601            source: Default::default(),
602            tax: Default::default(),
603            tax_exempt: Default::default(),
604            validate: Default::default(),
605        }
606    }
607}
608
609#[derive(Clone, Debug, Default, Deserialize, Serialize)]
610pub struct CreateCustomerCashBalance {
611    /// Settings controlling the behavior of the customer's cash balance,
612    /// such as reconciliation of funds received.
613    #[serde(skip_serializing_if = "Option::is_none")]
614    pub settings: Option<CreateCustomerCashBalanceSettings>,
615}
616
617#[derive(Clone, Debug, Default, Deserialize, Serialize)]
618pub struct CreateCustomerShipping {
619    /// Customer shipping address.
620    pub address: CreateCustomerShippingAddress,
621
622    /// Customer name.
623    pub name: String,
624
625    /// Customer phone (including extension).
626    #[serde(skip_serializing_if = "Option::is_none")]
627    pub phone: Option<String>,
628}
629
630#[derive(Clone, Debug, Default, Deserialize, Serialize)]
631pub struct CreateCustomerTax {
632    /// A recent IP address of the customer used for tax reporting and tax location inference.
633    ///
634    /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated.
635    /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
636    #[serde(skip_serializing_if = "Option::is_none")]
637    pub ip_address: Option<String>,
638
639    /// A flag that indicates when Stripe should validate the customer tax location.
640    ///
641    /// Defaults to `deferred`.
642    #[serde(skip_serializing_if = "Option::is_none")]
643    pub validate_location: Option<CreateCustomerTaxValidateLocation>,
644}
645
646#[derive(Clone, Debug, Default, Deserialize, Serialize)]
647pub struct CustomerInvoiceSettings {
648    /// The list of up to 4 default custom fields to be displayed on invoices for this customer.
649    ///
650    /// When updating, pass an empty string to remove previously-defined fields.
651    #[serde(skip_serializing_if = "Option::is_none")]
652    pub custom_fields: Option<Vec<CustomerInvoiceSettingsCustomFields>>,
653
654    /// ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices.
655    #[serde(skip_serializing_if = "Option::is_none")]
656    pub default_payment_method: Option<String>,
657
658    /// Default footer to be displayed on invoices for this customer.
659    #[serde(skip_serializing_if = "Option::is_none")]
660    pub footer: Option<String>,
661
662    /// Default options for invoice PDF rendering for this customer.
663    #[serde(skip_serializing_if = "Option::is_none")]
664    pub rendering_options: Option<CustomerInvoiceSettingsRenderingOptions>,
665}
666
667#[derive(Clone, Debug, Default, Deserialize, Serialize)]
668pub struct TaxIdData {
669    /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`.
670    #[serde(rename = "type")]
671    pub type_: TaxIdType,
672
673    /// Value of the tax ID.
674    pub value: String,
675}
676
677#[derive(Clone, Debug, Default, Deserialize, Serialize)]
678pub struct UpdateCustomerCashBalance {
679    /// Settings controlling the behavior of the customer's cash balance,
680    /// such as reconciliation of funds received.
681    #[serde(skip_serializing_if = "Option::is_none")]
682    pub settings: Option<UpdateCustomerCashBalanceSettings>,
683}
684
685#[derive(Clone, Debug, Default, Deserialize, Serialize)]
686pub struct UpdateCustomerShipping {
687    /// Customer shipping address.
688    pub address: UpdateCustomerShippingAddress,
689
690    /// Customer name.
691    pub name: String,
692
693    /// Customer phone (including extension).
694    #[serde(skip_serializing_if = "Option::is_none")]
695    pub phone: Option<String>,
696}
697
698#[derive(Clone, Debug, Default, Deserialize, Serialize)]
699pub struct UpdateCustomerTax {
700    /// A recent IP address of the customer used for tax reporting and tax location inference.
701    ///
702    /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated.
703    /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
704    #[serde(skip_serializing_if = "Option::is_none")]
705    pub ip_address: Option<String>,
706
707    /// A flag that indicates when Stripe should validate the customer tax location.
708    ///
709    /// Defaults to `deferred`.
710    #[serde(skip_serializing_if = "Option::is_none")]
711    pub validate_location: Option<UpdateCustomerTaxValidateLocation>,
712}
713
714#[derive(Clone, Debug, Default, Deserialize, Serialize)]
715pub struct CreateCustomerCashBalanceSettings {
716    /// Controls how funds transferred by the customer are applied to payment intents and invoices.
717    ///
718    /// Valid options are `automatic`, `manual`, or `merchant_default`.
719    /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
720    #[serde(skip_serializing_if = "Option::is_none")]
721    pub reconciliation_mode: Option<CreateCustomerCashBalanceSettingsReconciliationMode>,
722}
723
724#[derive(Clone, Debug, Default, Deserialize, Serialize)]
725pub struct CreateCustomerShippingAddress {
726    /// City, district, suburb, town, or village.
727    #[serde(skip_serializing_if = "Option::is_none")]
728    pub city: Option<String>,
729
730    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
731    #[serde(skip_serializing_if = "Option::is_none")]
732    pub country: Option<String>,
733
734    /// Address line 1 (e.g., street, PO Box, or company name).
735    #[serde(skip_serializing_if = "Option::is_none")]
736    pub line1: Option<String>,
737
738    /// Address line 2 (e.g., apartment, suite, unit, or building).
739    #[serde(skip_serializing_if = "Option::is_none")]
740    pub line2: Option<String>,
741
742    /// ZIP or postal code.
743    #[serde(skip_serializing_if = "Option::is_none")]
744    pub postal_code: Option<String>,
745
746    /// State, county, province, or region.
747    #[serde(skip_serializing_if = "Option::is_none")]
748    pub state: Option<String>,
749}
750
751#[derive(Clone, Debug, Default, Deserialize, Serialize)]
752pub struct CustomerInvoiceSettingsCustomFields {
753    /// The name of the custom field.
754    ///
755    /// This may be up to 30 characters.
756    pub name: String,
757
758    /// The value of the custom field.
759    ///
760    /// This may be up to 30 characters.
761    pub value: String,
762}
763
764#[derive(Clone, Debug, Default, Deserialize, Serialize)]
765pub struct CustomerInvoiceSettingsRenderingOptions {
766    /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
767    ///
768    /// One of `exclude_tax` or `include_inclusive_tax`.
769    /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
770    /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
771    #[serde(skip_serializing_if = "Option::is_none")]
772    pub amount_tax_display: Option<CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay>,
773}
774
775#[derive(Clone, Debug, Default, Deserialize, Serialize)]
776pub struct UpdateCustomerCashBalanceSettings {
777    /// Controls how funds transferred by the customer are applied to payment intents and invoices.
778    ///
779    /// Valid options are `automatic`, `manual`, or `merchant_default`.
780    /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
781    #[serde(skip_serializing_if = "Option::is_none")]
782    pub reconciliation_mode: Option<UpdateCustomerCashBalanceSettingsReconciliationMode>,
783}
784
785#[derive(Clone, Debug, Default, Deserialize, Serialize)]
786pub struct UpdateCustomerShippingAddress {
787    /// City, district, suburb, town, or village.
788    #[serde(skip_serializing_if = "Option::is_none")]
789    pub city: Option<String>,
790
791    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
792    #[serde(skip_serializing_if = "Option::is_none")]
793    pub country: Option<String>,
794
795    /// Address line 1 (e.g., street, PO Box, or company name).
796    #[serde(skip_serializing_if = "Option::is_none")]
797    pub line1: Option<String>,
798
799    /// Address line 2 (e.g., apartment, suite, unit, or building).
800    #[serde(skip_serializing_if = "Option::is_none")]
801    pub line2: Option<String>,
802
803    /// ZIP or postal code.
804    #[serde(skip_serializing_if = "Option::is_none")]
805    pub postal_code: Option<String>,
806
807    /// State, county, province, or region.
808    #[serde(skip_serializing_if = "Option::is_none")]
809    pub state: Option<String>,
810}
811
812/// An enum representing the possible values of an `CreateCustomerCashBalanceSettings`'s `reconciliation_mode` field.
813#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
814#[serde(rename_all = "snake_case")]
815pub enum CreateCustomerCashBalanceSettingsReconciliationMode {
816    Automatic,
817    Manual,
818    MerchantDefault,
819}
820
821impl CreateCustomerCashBalanceSettingsReconciliationMode {
822    pub fn as_str(self) -> &'static str {
823        match self {
824            CreateCustomerCashBalanceSettingsReconciliationMode::Automatic => "automatic",
825            CreateCustomerCashBalanceSettingsReconciliationMode::Manual => "manual",
826            CreateCustomerCashBalanceSettingsReconciliationMode::MerchantDefault => {
827                "merchant_default"
828            }
829        }
830    }
831}
832
833impl AsRef<str> for CreateCustomerCashBalanceSettingsReconciliationMode {
834    fn as_ref(&self) -> &str {
835        self.as_str()
836    }
837}
838
839impl std::fmt::Display for CreateCustomerCashBalanceSettingsReconciliationMode {
840    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
841        self.as_str().fmt(f)
842    }
843}
844impl std::default::Default for CreateCustomerCashBalanceSettingsReconciliationMode {
845    fn default() -> Self {
846        Self::Automatic
847    }
848}
849
850/// An enum representing the possible values of an `CreateCustomerTax`'s `validate_location` field.
851#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
852#[serde(rename_all = "snake_case")]
853pub enum CreateCustomerTaxValidateLocation {
854    Deferred,
855    Immediately,
856}
857
858impl CreateCustomerTaxValidateLocation {
859    pub fn as_str(self) -> &'static str {
860        match self {
861            CreateCustomerTaxValidateLocation::Deferred => "deferred",
862            CreateCustomerTaxValidateLocation::Immediately => "immediately",
863        }
864    }
865}
866
867impl AsRef<str> for CreateCustomerTaxValidateLocation {
868    fn as_ref(&self) -> &str {
869        self.as_str()
870    }
871}
872
873impl std::fmt::Display for CreateCustomerTaxValidateLocation {
874    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
875        self.as_str().fmt(f)
876    }
877}
878impl std::default::Default for CreateCustomerTaxValidateLocation {
879    fn default() -> Self {
880        Self::Deferred
881    }
882}
883
884/// An enum representing the possible values of an `CustomerInvoiceSettingsRenderingOptions`'s `amount_tax_display` field.
885#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
886#[serde(rename_all = "snake_case")]
887pub enum CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
888    ExcludeTax,
889    IncludeInclusiveTax,
890}
891
892impl CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
893    pub fn as_str(self) -> &'static str {
894        match self {
895            CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::ExcludeTax => "exclude_tax",
896            CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::IncludeInclusiveTax => {
897                "include_inclusive_tax"
898            }
899        }
900    }
901}
902
903impl AsRef<str> for CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
904    fn as_ref(&self) -> &str {
905        self.as_str()
906    }
907}
908
909impl std::fmt::Display for CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
910    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
911        self.as_str().fmt(f)
912    }
913}
914impl std::default::Default for CustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
915    fn default() -> Self {
916        Self::ExcludeTax
917    }
918}
919
920/// An enum representing the possible values of an `CustomerTax`'s `automatic_tax` field.
921#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
922#[serde(rename_all = "snake_case")]
923pub enum CustomerTaxAutomaticTax {
924    Failed,
925    NotCollecting,
926    Supported,
927    UnrecognizedLocation,
928}
929
930impl CustomerTaxAutomaticTax {
931    pub fn as_str(self) -> &'static str {
932        match self {
933            CustomerTaxAutomaticTax::Failed => "failed",
934            CustomerTaxAutomaticTax::NotCollecting => "not_collecting",
935            CustomerTaxAutomaticTax::Supported => "supported",
936            CustomerTaxAutomaticTax::UnrecognizedLocation => "unrecognized_location",
937        }
938    }
939}
940
941impl AsRef<str> for CustomerTaxAutomaticTax {
942    fn as_ref(&self) -> &str {
943        self.as_str()
944    }
945}
946
947impl std::fmt::Display for CustomerTaxAutomaticTax {
948    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
949        self.as_str().fmt(f)
950    }
951}
952impl std::default::Default for CustomerTaxAutomaticTax {
953    fn default() -> Self {
954        Self::Failed
955    }
956}
957
958/// An enum representing the possible values of an `Customer`'s `tax_exempt` field.
959#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
960#[serde(rename_all = "snake_case")]
961pub enum CustomerTaxExempt {
962    Exempt,
963    None,
964    Reverse,
965}
966
967impl CustomerTaxExempt {
968    pub fn as_str(self) -> &'static str {
969        match self {
970            CustomerTaxExempt::Exempt => "exempt",
971            CustomerTaxExempt::None => "none",
972            CustomerTaxExempt::Reverse => "reverse",
973        }
974    }
975}
976
977impl AsRef<str> for CustomerTaxExempt {
978    fn as_ref(&self) -> &str {
979        self.as_str()
980    }
981}
982
983impl std::fmt::Display for CustomerTaxExempt {
984    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
985        self.as_str().fmt(f)
986    }
987}
988impl std::default::Default for CustomerTaxExempt {
989    fn default() -> Self {
990        Self::Exempt
991    }
992}
993
994/// An enum representing the possible values of an `CreateCustomer`'s `tax_exempt` field.
995#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
996#[serde(rename_all = "snake_case")]
997pub enum CustomerTaxExemptFilter {
998    Exempt,
999    None,
1000    Reverse,
1001}
1002
1003impl CustomerTaxExemptFilter {
1004    pub fn as_str(self) -> &'static str {
1005        match self {
1006            CustomerTaxExemptFilter::Exempt => "exempt",
1007            CustomerTaxExemptFilter::None => "none",
1008            CustomerTaxExemptFilter::Reverse => "reverse",
1009        }
1010    }
1011}
1012
1013impl AsRef<str> for CustomerTaxExemptFilter {
1014    fn as_ref(&self) -> &str {
1015        self.as_str()
1016    }
1017}
1018
1019impl std::fmt::Display for CustomerTaxExemptFilter {
1020    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1021        self.as_str().fmt(f)
1022    }
1023}
1024impl std::default::Default for CustomerTaxExemptFilter {
1025    fn default() -> Self {
1026        Self::Exempt
1027    }
1028}
1029
1030/// An enum representing the possible values of an `CustomerTaxLocation`'s `source` field.
1031#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1032#[serde(rename_all = "snake_case")]
1033pub enum CustomerTaxLocationSource {
1034    BillingAddress,
1035    IpAddress,
1036    PaymentMethod,
1037    ShippingDestination,
1038}
1039
1040impl CustomerTaxLocationSource {
1041    pub fn as_str(self) -> &'static str {
1042        match self {
1043            CustomerTaxLocationSource::BillingAddress => "billing_address",
1044            CustomerTaxLocationSource::IpAddress => "ip_address",
1045            CustomerTaxLocationSource::PaymentMethod => "payment_method",
1046            CustomerTaxLocationSource::ShippingDestination => "shipping_destination",
1047        }
1048    }
1049}
1050
1051impl AsRef<str> for CustomerTaxLocationSource {
1052    fn as_ref(&self) -> &str {
1053        self.as_str()
1054    }
1055}
1056
1057impl std::fmt::Display for CustomerTaxLocationSource {
1058    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1059        self.as_str().fmt(f)
1060    }
1061}
1062impl std::default::Default for CustomerTaxLocationSource {
1063    fn default() -> Self {
1064        Self::BillingAddress
1065    }
1066}
1067
1068/// An enum representing the possible values of an `TaxIdData`'s `type` field.
1069#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1070#[serde(rename_all = "snake_case")]
1071pub enum TaxIdType {
1072    AdNrt,
1073    AeTrn,
1074    ArCuit,
1075    AuAbn,
1076    AuArn,
1077    BgUic,
1078    BoTin,
1079    BrCnpj,
1080    BrCpf,
1081    CaBn,
1082    CaGstHst,
1083    CaPstBc,
1084    CaPstMb,
1085    CaPstSk,
1086    CaQst,
1087    ChVat,
1088    ClTin,
1089    CnTin,
1090    CoNit,
1091    CrTin,
1092    DoRcn,
1093    EcRuc,
1094    EgTin,
1095    EsCif,
1096    EuOssVat,
1097    EuVat,
1098    GbVat,
1099    GeVat,
1100    HkBr,
1101    HuTin,
1102    IdNpwp,
1103    IlVat,
1104    InGst,
1105    IsVat,
1106    JpCn,
1107    JpRn,
1108    JpTrn,
1109    KePin,
1110    KrBrn,
1111    LiUid,
1112    MxRfc,
1113    MyFrp,
1114    MyItn,
1115    MySst,
1116    NoVat,
1117    NzGst,
1118    PeRuc,
1119    PhTin,
1120    RoTin,
1121    RsPib,
1122    RuInn,
1123    RuKpp,
1124    SaVat,
1125    SgGst,
1126    SgUen,
1127    SiTin,
1128    SvNit,
1129    ThVat,
1130    TrTin,
1131    TwVat,
1132    UaVat,
1133    UsEin,
1134    UyRuc,
1135    VeRif,
1136    VnTin,
1137    ZaVat,
1138}
1139
1140impl TaxIdType {
1141    pub fn as_str(self) -> &'static str {
1142        match self {
1143            TaxIdType::AdNrt => "ad_nrt",
1144            TaxIdType::AeTrn => "ae_trn",
1145            TaxIdType::ArCuit => "ar_cuit",
1146            TaxIdType::AuAbn => "au_abn",
1147            TaxIdType::AuArn => "au_arn",
1148            TaxIdType::BgUic => "bg_uic",
1149            TaxIdType::BoTin => "bo_tin",
1150            TaxIdType::BrCnpj => "br_cnpj",
1151            TaxIdType::BrCpf => "br_cpf",
1152            TaxIdType::CaBn => "ca_bn",
1153            TaxIdType::CaGstHst => "ca_gst_hst",
1154            TaxIdType::CaPstBc => "ca_pst_bc",
1155            TaxIdType::CaPstMb => "ca_pst_mb",
1156            TaxIdType::CaPstSk => "ca_pst_sk",
1157            TaxIdType::CaQst => "ca_qst",
1158            TaxIdType::ChVat => "ch_vat",
1159            TaxIdType::ClTin => "cl_tin",
1160            TaxIdType::CnTin => "cn_tin",
1161            TaxIdType::CoNit => "co_nit",
1162            TaxIdType::CrTin => "cr_tin",
1163            TaxIdType::DoRcn => "do_rcn",
1164            TaxIdType::EcRuc => "ec_ruc",
1165            TaxIdType::EgTin => "eg_tin",
1166            TaxIdType::EsCif => "es_cif",
1167            TaxIdType::EuOssVat => "eu_oss_vat",
1168            TaxIdType::EuVat => "eu_vat",
1169            TaxIdType::GbVat => "gb_vat",
1170            TaxIdType::GeVat => "ge_vat",
1171            TaxIdType::HkBr => "hk_br",
1172            TaxIdType::HuTin => "hu_tin",
1173            TaxIdType::IdNpwp => "id_npwp",
1174            TaxIdType::IlVat => "il_vat",
1175            TaxIdType::InGst => "in_gst",
1176            TaxIdType::IsVat => "is_vat",
1177            TaxIdType::JpCn => "jp_cn",
1178            TaxIdType::JpRn => "jp_rn",
1179            TaxIdType::JpTrn => "jp_trn",
1180            TaxIdType::KePin => "ke_pin",
1181            TaxIdType::KrBrn => "kr_brn",
1182            TaxIdType::LiUid => "li_uid",
1183            TaxIdType::MxRfc => "mx_rfc",
1184            TaxIdType::MyFrp => "my_frp",
1185            TaxIdType::MyItn => "my_itn",
1186            TaxIdType::MySst => "my_sst",
1187            TaxIdType::NoVat => "no_vat",
1188            TaxIdType::NzGst => "nz_gst",
1189            TaxIdType::PeRuc => "pe_ruc",
1190            TaxIdType::PhTin => "ph_tin",
1191            TaxIdType::RoTin => "ro_tin",
1192            TaxIdType::RsPib => "rs_pib",
1193            TaxIdType::RuInn => "ru_inn",
1194            TaxIdType::RuKpp => "ru_kpp",
1195            TaxIdType::SaVat => "sa_vat",
1196            TaxIdType::SgGst => "sg_gst",
1197            TaxIdType::SgUen => "sg_uen",
1198            TaxIdType::SiTin => "si_tin",
1199            TaxIdType::SvNit => "sv_nit",
1200            TaxIdType::ThVat => "th_vat",
1201            TaxIdType::TrTin => "tr_tin",
1202            TaxIdType::TwVat => "tw_vat",
1203            TaxIdType::UaVat => "ua_vat",
1204            TaxIdType::UsEin => "us_ein",
1205            TaxIdType::UyRuc => "uy_ruc",
1206            TaxIdType::VeRif => "ve_rif",
1207            TaxIdType::VnTin => "vn_tin",
1208            TaxIdType::ZaVat => "za_vat",
1209        }
1210    }
1211}
1212
1213impl AsRef<str> for TaxIdType {
1214    fn as_ref(&self) -> &str {
1215        self.as_str()
1216    }
1217}
1218
1219impl std::fmt::Display for TaxIdType {
1220    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1221        self.as_str().fmt(f)
1222    }
1223}
1224impl std::default::Default for TaxIdType {
1225    fn default() -> Self {
1226        Self::AdNrt
1227    }
1228}
1229
1230/// An enum representing the possible values of an `UpdateCustomerCashBalanceSettings`'s `reconciliation_mode` field.
1231#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1232#[serde(rename_all = "snake_case")]
1233pub enum UpdateCustomerCashBalanceSettingsReconciliationMode {
1234    Automatic,
1235    Manual,
1236    MerchantDefault,
1237}
1238
1239impl UpdateCustomerCashBalanceSettingsReconciliationMode {
1240    pub fn as_str(self) -> &'static str {
1241        match self {
1242            UpdateCustomerCashBalanceSettingsReconciliationMode::Automatic => "automatic",
1243            UpdateCustomerCashBalanceSettingsReconciliationMode::Manual => "manual",
1244            UpdateCustomerCashBalanceSettingsReconciliationMode::MerchantDefault => {
1245                "merchant_default"
1246            }
1247        }
1248    }
1249}
1250
1251impl AsRef<str> for UpdateCustomerCashBalanceSettingsReconciliationMode {
1252    fn as_ref(&self) -> &str {
1253        self.as_str()
1254    }
1255}
1256
1257impl std::fmt::Display for UpdateCustomerCashBalanceSettingsReconciliationMode {
1258    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1259        self.as_str().fmt(f)
1260    }
1261}
1262impl std::default::Default for UpdateCustomerCashBalanceSettingsReconciliationMode {
1263    fn default() -> Self {
1264        Self::Automatic
1265    }
1266}
1267
1268/// An enum representing the possible values of an `UpdateCustomerTax`'s `validate_location` field.
1269#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1270#[serde(rename_all = "snake_case")]
1271pub enum UpdateCustomerTaxValidateLocation {
1272    Deferred,
1273    Immediately,
1274}
1275
1276impl UpdateCustomerTaxValidateLocation {
1277    pub fn as_str(self) -> &'static str {
1278        match self {
1279            UpdateCustomerTaxValidateLocation::Deferred => "deferred",
1280            UpdateCustomerTaxValidateLocation::Immediately => "immediately",
1281        }
1282    }
1283}
1284
1285impl AsRef<str> for UpdateCustomerTaxValidateLocation {
1286    fn as_ref(&self) -> &str {
1287        self.as_str()
1288    }
1289}
1290
1291impl std::fmt::Display for UpdateCustomerTaxValidateLocation {
1292    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1293        self.as_str().fmt(f)
1294    }
1295}
1296impl std::default::Default for UpdateCustomerTaxValidateLocation {
1297    fn default() -> Self {
1298        Self::Deferred
1299    }
1300}