Skip to main content

stripe/resources/generated/
customer.rs

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