stripe_core/customer/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5/// Permanently deletes a customer.
6/// It cannot be undone.
7/// Also immediately cancels any active subscriptions on the customer.
8#[derive(Clone, Debug, serde::Serialize)]
9pub struct DeleteCustomer {
10    customer: stripe_shared::CustomerId,
11}
12impl DeleteCustomer {
13    /// Construct a new `DeleteCustomer`.
14    pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
15        Self { customer: customer.into() }
16    }
17}
18impl DeleteCustomer {
19    /// Send the request and return the deserialized response.
20    pub async fn send<C: StripeClient>(
21        &self,
22        client: &C,
23    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
24        self.customize().send(client).await
25    }
26
27    /// Send the request and return the deserialized response, blocking until completion.
28    pub fn send_blocking<C: StripeBlockingClient>(
29        &self,
30        client: &C,
31    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
32        self.customize().send_blocking(client)
33    }
34}
35
36impl StripeRequest for DeleteCustomer {
37    type Output = stripe_shared::DeletedCustomer;
38
39    fn build(&self) -> RequestBuilder {
40        let customer = &self.customer;
41        RequestBuilder::new(StripeMethod::Delete, format!("/customers/{customer}"))
42    }
43}
44/// Removes the currently applied discount on a customer.
45#[derive(Clone, Debug, serde::Serialize)]
46pub struct DeleteDiscountCustomer {
47    customer: stripe_shared::CustomerId,
48}
49impl DeleteDiscountCustomer {
50    /// Construct a new `DeleteDiscountCustomer`.
51    pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
52        Self { customer: customer.into() }
53    }
54}
55impl DeleteDiscountCustomer {
56    /// Send the request and return the deserialized response.
57    pub async fn send<C: StripeClient>(
58        &self,
59        client: &C,
60    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
61        self.customize().send(client).await
62    }
63
64    /// Send the request and return the deserialized response, blocking until completion.
65    pub fn send_blocking<C: StripeBlockingClient>(
66        &self,
67        client: &C,
68    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
69        self.customize().send_blocking(client)
70    }
71}
72
73impl StripeRequest for DeleteDiscountCustomer {
74    type Output = stripe_shared::DeletedDiscount;
75
76    fn build(&self) -> RequestBuilder {
77        let customer = &self.customer;
78        RequestBuilder::new(StripeMethod::Delete, format!("/customers/{customer}/discount"))
79    }
80}
81#[derive(Clone, Debug, serde::Serialize)]
82struct ListCustomerBuilder {
83    #[serde(skip_serializing_if = "Option::is_none")]
84    created: Option<stripe_types::RangeQueryTs>,
85    #[serde(skip_serializing_if = "Option::is_none")]
86    email: Option<String>,
87    #[serde(skip_serializing_if = "Option::is_none")]
88    ending_before: Option<String>,
89    #[serde(skip_serializing_if = "Option::is_none")]
90    expand: Option<Vec<String>>,
91    #[serde(skip_serializing_if = "Option::is_none")]
92    limit: Option<i64>,
93    #[serde(skip_serializing_if = "Option::is_none")]
94    starting_after: Option<String>,
95    #[serde(skip_serializing_if = "Option::is_none")]
96    test_clock: Option<String>,
97}
98impl ListCustomerBuilder {
99    fn new() -> Self {
100        Self {
101            created: None,
102            email: None,
103            ending_before: None,
104            expand: None,
105            limit: None,
106            starting_after: None,
107            test_clock: None,
108        }
109    }
110}
111/// Returns a list of your customers.
112/// The customers are returned sorted by creation date, with the most recent customers appearing first.
113#[derive(Clone, Debug, serde::Serialize)]
114pub struct ListCustomer {
115    inner: ListCustomerBuilder,
116}
117impl ListCustomer {
118    /// Construct a new `ListCustomer`.
119    pub fn new() -> Self {
120        Self { inner: ListCustomerBuilder::new() }
121    }
122    /// Only return customers that were created during the given date interval.
123    pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
124        self.inner.created = Some(created.into());
125        self
126    }
127    /// A case-sensitive filter on the list based on the customer's `email` field.
128    /// The value must be a string.
129    pub fn email(mut self, email: impl Into<String>) -> Self {
130        self.inner.email = Some(email.into());
131        self
132    }
133    /// A cursor for use in pagination.
134    /// `ending_before` is an object ID that defines your place in the list.
135    /// 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.
136    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
137        self.inner.ending_before = Some(ending_before.into());
138        self
139    }
140    /// Specifies which fields in the response should be expanded.
141    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
142        self.inner.expand = Some(expand.into());
143        self
144    }
145    /// A limit on the number of objects to be returned.
146    /// Limit can range between 1 and 100, and the default is 10.
147    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
148        self.inner.limit = Some(limit.into());
149        self
150    }
151    /// A cursor for use in pagination.
152    /// `starting_after` is an object ID that defines your place in the list.
153    /// 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.
154    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
155        self.inner.starting_after = Some(starting_after.into());
156        self
157    }
158    /// Provides a list of customers that are associated with the specified test clock.
159    /// The response will not include customers with test clocks if this parameter is not set.
160    pub fn test_clock(mut self, test_clock: impl Into<String>) -> Self {
161        self.inner.test_clock = Some(test_clock.into());
162        self
163    }
164}
165impl Default for ListCustomer {
166    fn default() -> Self {
167        Self::new()
168    }
169}
170impl ListCustomer {
171    /// Send the request and return the deserialized response.
172    pub async fn send<C: StripeClient>(
173        &self,
174        client: &C,
175    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
176        self.customize().send(client).await
177    }
178
179    /// Send the request and return the deserialized response, blocking until completion.
180    pub fn send_blocking<C: StripeBlockingClient>(
181        &self,
182        client: &C,
183    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
184        self.customize().send_blocking(client)
185    }
186
187    pub fn paginate(
188        &self,
189    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::Customer>> {
190        stripe_client_core::ListPaginator::new_list("/customers", &self.inner)
191    }
192}
193
194impl StripeRequest for ListCustomer {
195    type Output = stripe_types::List<stripe_shared::Customer>;
196
197    fn build(&self) -> RequestBuilder {
198        RequestBuilder::new(StripeMethod::Get, "/customers").query(&self.inner)
199    }
200}
201#[derive(Clone, Debug, serde::Serialize)]
202struct RetrieveCustomerBuilder {
203    #[serde(skip_serializing_if = "Option::is_none")]
204    expand: Option<Vec<String>>,
205}
206impl RetrieveCustomerBuilder {
207    fn new() -> Self {
208        Self { expand: None }
209    }
210}
211/// Retrieves a Customer object.
212#[derive(Clone, Debug, serde::Serialize)]
213pub struct RetrieveCustomer {
214    inner: RetrieveCustomerBuilder,
215    customer: stripe_shared::CustomerId,
216}
217impl RetrieveCustomer {
218    /// Construct a new `RetrieveCustomer`.
219    pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
220        Self { customer: customer.into(), inner: RetrieveCustomerBuilder::new() }
221    }
222    /// Specifies which fields in the response should be expanded.
223    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
224        self.inner.expand = Some(expand.into());
225        self
226    }
227}
228impl RetrieveCustomer {
229    /// Send the request and return the deserialized response.
230    pub async fn send<C: StripeClient>(
231        &self,
232        client: &C,
233    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
234        self.customize().send(client).await
235    }
236
237    /// Send the request and return the deserialized response, blocking until completion.
238    pub fn send_blocking<C: StripeBlockingClient>(
239        &self,
240        client: &C,
241    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
242        self.customize().send_blocking(client)
243    }
244}
245
246impl StripeRequest for RetrieveCustomer {
247    type Output = RetrieveCustomerReturned;
248
249    fn build(&self) -> RequestBuilder {
250        let customer = &self.customer;
251        RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}")).query(&self.inner)
252    }
253}
254#[derive(Clone, Debug)]
255#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
256#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
257#[cfg_attr(any(feature = "deserialize", feature = "serialize"), serde(untagged))]
258pub enum RetrieveCustomerReturned {
259    Customer(stripe_shared::Customer),
260    DeletedCustomer(stripe_shared::DeletedCustomer),
261}
262
263#[derive(Default)]
264pub struct RetrieveCustomerReturnedBuilder {
265    inner: stripe_types::miniserde_helpers::MaybeDeletedBuilderInner,
266}
267
268const _: () = {
269    use miniserde::de::{Map, Visitor};
270    use miniserde::json::Value;
271    use miniserde::{Deserialize, Result, make_place};
272    use stripe_types::MapBuilder;
273    use stripe_types::miniserde_helpers::FromValueOpt;
274
275    use super::*;
276
277    make_place!(Place);
278
279    struct Builder<'a> {
280        out: &'a mut Option<RetrieveCustomerReturned>,
281        builder: RetrieveCustomerReturnedBuilder,
282    }
283
284    impl Deserialize for RetrieveCustomerReturned {
285        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
286            Place::new(out)
287        }
288    }
289
290    impl Visitor for Place<RetrieveCustomerReturned> {
291        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
292            Ok(Box::new(Builder { out: &mut self.out, builder: Default::default() }))
293        }
294    }
295
296    impl Map for Builder<'_> {
297        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
298            self.builder.key(k)
299        }
300
301        fn finish(&mut self) -> Result<()> {
302            *self.out = self.builder.take_out();
303            Ok(())
304        }
305    }
306
307    impl MapBuilder for RetrieveCustomerReturnedBuilder {
308        type Out = RetrieveCustomerReturned;
309        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
310            self.inner.key_inner(k)
311        }
312
313        fn deser_default() -> Self {
314            Self::default()
315        }
316
317        fn take_out(&mut self) -> Option<Self::Out> {
318            let (deleted, o) = self.inner.finish_inner()?;
319            Some(if deleted {
320                RetrieveCustomerReturned::DeletedCustomer(FromValueOpt::from_value(Value::Object(
321                    o,
322                ))?)
323            } else {
324                RetrieveCustomerReturned::Customer(FromValueOpt::from_value(Value::Object(o))?)
325            })
326        }
327    }
328
329    impl stripe_types::ObjectDeser for RetrieveCustomerReturned {
330        type Builder = RetrieveCustomerReturnedBuilder;
331    }
332};
333
334#[derive(Clone, Debug, serde::Serialize)]
335struct BalanceTransactionsCustomerBuilder {
336    #[serde(skip_serializing_if = "Option::is_none")]
337    ending_before: Option<String>,
338    #[serde(skip_serializing_if = "Option::is_none")]
339    expand: Option<Vec<String>>,
340    #[serde(skip_serializing_if = "Option::is_none")]
341    limit: Option<i64>,
342    #[serde(skip_serializing_if = "Option::is_none")]
343    starting_after: Option<String>,
344}
345impl BalanceTransactionsCustomerBuilder {
346    fn new() -> Self {
347        Self { ending_before: None, expand: None, limit: None, starting_after: None }
348    }
349}
350/// Returns a list of transactions that updated the customer’s [balances](https://stripe.com/docs/billing/customer/balance).
351#[derive(Clone, Debug, serde::Serialize)]
352pub struct BalanceTransactionsCustomer {
353    inner: BalanceTransactionsCustomerBuilder,
354    customer: stripe_shared::CustomerId,
355}
356impl BalanceTransactionsCustomer {
357    /// Construct a new `BalanceTransactionsCustomer`.
358    pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
359        Self { customer: customer.into(), inner: BalanceTransactionsCustomerBuilder::new() }
360    }
361    /// A cursor for use in pagination.
362    /// `ending_before` is an object ID that defines your place in the list.
363    /// 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.
364    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
365        self.inner.ending_before = Some(ending_before.into());
366        self
367    }
368    /// Specifies which fields in the response should be expanded.
369    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
370        self.inner.expand = Some(expand.into());
371        self
372    }
373    /// A limit on the number of objects to be returned.
374    /// Limit can range between 1 and 100, and the default is 10.
375    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
376        self.inner.limit = Some(limit.into());
377        self
378    }
379    /// A cursor for use in pagination.
380    /// `starting_after` is an object ID that defines your place in the list.
381    /// 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.
382    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
383        self.inner.starting_after = Some(starting_after.into());
384        self
385    }
386}
387impl BalanceTransactionsCustomer {
388    /// Send the request and return the deserialized response.
389    pub async fn send<C: StripeClient>(
390        &self,
391        client: &C,
392    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
393        self.customize().send(client).await
394    }
395
396    /// Send the request and return the deserialized response, blocking until completion.
397    pub fn send_blocking<C: StripeBlockingClient>(
398        &self,
399        client: &C,
400    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
401        self.customize().send_blocking(client)
402    }
403
404    pub fn paginate(
405        &self,
406    ) -> stripe_client_core::ListPaginator<
407        stripe_types::List<stripe_shared::CustomerBalanceTransaction>,
408    > {
409        let customer = &self.customer;
410
411        stripe_client_core::ListPaginator::new_list(
412            format!("/customers/{customer}/balance_transactions"),
413            &self.inner,
414        )
415    }
416}
417
418impl StripeRequest for BalanceTransactionsCustomer {
419    type Output = stripe_types::List<stripe_shared::CustomerBalanceTransaction>;
420
421    fn build(&self) -> RequestBuilder {
422        let customer = &self.customer;
423        RequestBuilder::new(
424            StripeMethod::Get,
425            format!("/customers/{customer}/balance_transactions"),
426        )
427        .query(&self.inner)
428    }
429}
430#[derive(Clone, Debug, serde::Serialize)]
431struct ListPaymentMethodsCustomerBuilder {
432    #[serde(skip_serializing_if = "Option::is_none")]
433    allow_redisplay: Option<ListPaymentMethodsCustomerAllowRedisplay>,
434    #[serde(skip_serializing_if = "Option::is_none")]
435    ending_before: Option<String>,
436    #[serde(skip_serializing_if = "Option::is_none")]
437    expand: Option<Vec<String>>,
438    #[serde(skip_serializing_if = "Option::is_none")]
439    limit: Option<i64>,
440    #[serde(skip_serializing_if = "Option::is_none")]
441    starting_after: Option<String>,
442    #[serde(rename = "type")]
443    #[serde(skip_serializing_if = "Option::is_none")]
444    type_: Option<ListPaymentMethodsCustomerType>,
445}
446impl ListPaymentMethodsCustomerBuilder {
447    fn new() -> Self {
448        Self {
449            allow_redisplay: None,
450            ending_before: None,
451            expand: None,
452            limit: None,
453            starting_after: None,
454            type_: None,
455        }
456    }
457}
458/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
459/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
460#[derive(Copy, Clone, Eq, PartialEq)]
461pub enum ListPaymentMethodsCustomerAllowRedisplay {
462    Always,
463    Limited,
464    Unspecified,
465}
466impl ListPaymentMethodsCustomerAllowRedisplay {
467    pub fn as_str(self) -> &'static str {
468        use ListPaymentMethodsCustomerAllowRedisplay::*;
469        match self {
470            Always => "always",
471            Limited => "limited",
472            Unspecified => "unspecified",
473        }
474    }
475}
476
477impl std::str::FromStr for ListPaymentMethodsCustomerAllowRedisplay {
478    type Err = stripe_types::StripeParseError;
479    fn from_str(s: &str) -> Result<Self, Self::Err> {
480        use ListPaymentMethodsCustomerAllowRedisplay::*;
481        match s {
482            "always" => Ok(Always),
483            "limited" => Ok(Limited),
484            "unspecified" => Ok(Unspecified),
485            _ => Err(stripe_types::StripeParseError),
486        }
487    }
488}
489impl std::fmt::Display for ListPaymentMethodsCustomerAllowRedisplay {
490    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
491        f.write_str(self.as_str())
492    }
493}
494
495impl std::fmt::Debug for ListPaymentMethodsCustomerAllowRedisplay {
496    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
497        f.write_str(self.as_str())
498    }
499}
500impl serde::Serialize for ListPaymentMethodsCustomerAllowRedisplay {
501    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
502    where
503        S: serde::Serializer,
504    {
505        serializer.serialize_str(self.as_str())
506    }
507}
508#[cfg(feature = "deserialize")]
509impl<'de> serde::Deserialize<'de> for ListPaymentMethodsCustomerAllowRedisplay {
510    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
511        use std::str::FromStr;
512        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
513        Self::from_str(&s).map_err(|_| {
514            serde::de::Error::custom("Unknown value for ListPaymentMethodsCustomerAllowRedisplay")
515        })
516    }
517}
518/// An optional filter on the list, based on the object `type` field.
519/// Without the filter, the list includes all current and future payment method types.
520/// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request.
521#[derive(Clone, Eq, PartialEq)]
522#[non_exhaustive]
523pub enum ListPaymentMethodsCustomerType {
524    AcssDebit,
525    Affirm,
526    AfterpayClearpay,
527    Alipay,
528    Alma,
529    AmazonPay,
530    AuBecsDebit,
531    BacsDebit,
532    Bancontact,
533    Billie,
534    Blik,
535    Boleto,
536    Card,
537    Cashapp,
538    Crypto,
539    CustomerBalance,
540    Eps,
541    Fpx,
542    Giropay,
543    Grabpay,
544    Ideal,
545    KakaoPay,
546    Klarna,
547    Konbini,
548    KrCard,
549    Link,
550    MbWay,
551    Mobilepay,
552    Multibanco,
553    NaverPay,
554    NzBankAccount,
555    Oxxo,
556    P24,
557    PayByBank,
558    Payco,
559    Paynow,
560    Paypal,
561    Pix,
562    Promptpay,
563    RevolutPay,
564    SamsungPay,
565    Satispay,
566    SepaDebit,
567    Sofort,
568    Swish,
569    Twint,
570    UsBankAccount,
571    WechatPay,
572    Zip,
573    /// An unrecognized value from Stripe. Should not be used as a request parameter.
574    Unknown(String),
575}
576impl ListPaymentMethodsCustomerType {
577    pub fn as_str(&self) -> &str {
578        use ListPaymentMethodsCustomerType::*;
579        match self {
580            AcssDebit => "acss_debit",
581            Affirm => "affirm",
582            AfterpayClearpay => "afterpay_clearpay",
583            Alipay => "alipay",
584            Alma => "alma",
585            AmazonPay => "amazon_pay",
586            AuBecsDebit => "au_becs_debit",
587            BacsDebit => "bacs_debit",
588            Bancontact => "bancontact",
589            Billie => "billie",
590            Blik => "blik",
591            Boleto => "boleto",
592            Card => "card",
593            Cashapp => "cashapp",
594            Crypto => "crypto",
595            CustomerBalance => "customer_balance",
596            Eps => "eps",
597            Fpx => "fpx",
598            Giropay => "giropay",
599            Grabpay => "grabpay",
600            Ideal => "ideal",
601            KakaoPay => "kakao_pay",
602            Klarna => "klarna",
603            Konbini => "konbini",
604            KrCard => "kr_card",
605            Link => "link",
606            MbWay => "mb_way",
607            Mobilepay => "mobilepay",
608            Multibanco => "multibanco",
609            NaverPay => "naver_pay",
610            NzBankAccount => "nz_bank_account",
611            Oxxo => "oxxo",
612            P24 => "p24",
613            PayByBank => "pay_by_bank",
614            Payco => "payco",
615            Paynow => "paynow",
616            Paypal => "paypal",
617            Pix => "pix",
618            Promptpay => "promptpay",
619            RevolutPay => "revolut_pay",
620            SamsungPay => "samsung_pay",
621            Satispay => "satispay",
622            SepaDebit => "sepa_debit",
623            Sofort => "sofort",
624            Swish => "swish",
625            Twint => "twint",
626            UsBankAccount => "us_bank_account",
627            WechatPay => "wechat_pay",
628            Zip => "zip",
629            Unknown(v) => v,
630        }
631    }
632}
633
634impl std::str::FromStr for ListPaymentMethodsCustomerType {
635    type Err = std::convert::Infallible;
636    fn from_str(s: &str) -> Result<Self, Self::Err> {
637        use ListPaymentMethodsCustomerType::*;
638        match s {
639            "acss_debit" => Ok(AcssDebit),
640            "affirm" => Ok(Affirm),
641            "afterpay_clearpay" => Ok(AfterpayClearpay),
642            "alipay" => Ok(Alipay),
643            "alma" => Ok(Alma),
644            "amazon_pay" => Ok(AmazonPay),
645            "au_becs_debit" => Ok(AuBecsDebit),
646            "bacs_debit" => Ok(BacsDebit),
647            "bancontact" => Ok(Bancontact),
648            "billie" => Ok(Billie),
649            "blik" => Ok(Blik),
650            "boleto" => Ok(Boleto),
651            "card" => Ok(Card),
652            "cashapp" => Ok(Cashapp),
653            "crypto" => Ok(Crypto),
654            "customer_balance" => Ok(CustomerBalance),
655            "eps" => Ok(Eps),
656            "fpx" => Ok(Fpx),
657            "giropay" => Ok(Giropay),
658            "grabpay" => Ok(Grabpay),
659            "ideal" => Ok(Ideal),
660            "kakao_pay" => Ok(KakaoPay),
661            "klarna" => Ok(Klarna),
662            "konbini" => Ok(Konbini),
663            "kr_card" => Ok(KrCard),
664            "link" => Ok(Link),
665            "mb_way" => Ok(MbWay),
666            "mobilepay" => Ok(Mobilepay),
667            "multibanco" => Ok(Multibanco),
668            "naver_pay" => Ok(NaverPay),
669            "nz_bank_account" => Ok(NzBankAccount),
670            "oxxo" => Ok(Oxxo),
671            "p24" => Ok(P24),
672            "pay_by_bank" => Ok(PayByBank),
673            "payco" => Ok(Payco),
674            "paynow" => Ok(Paynow),
675            "paypal" => Ok(Paypal),
676            "pix" => Ok(Pix),
677            "promptpay" => Ok(Promptpay),
678            "revolut_pay" => Ok(RevolutPay),
679            "samsung_pay" => Ok(SamsungPay),
680            "satispay" => Ok(Satispay),
681            "sepa_debit" => Ok(SepaDebit),
682            "sofort" => Ok(Sofort),
683            "swish" => Ok(Swish),
684            "twint" => Ok(Twint),
685            "us_bank_account" => Ok(UsBankAccount),
686            "wechat_pay" => Ok(WechatPay),
687            "zip" => Ok(Zip),
688            v => Ok(Unknown(v.to_owned())),
689        }
690    }
691}
692impl std::fmt::Display for ListPaymentMethodsCustomerType {
693    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
694        f.write_str(self.as_str())
695    }
696}
697
698impl std::fmt::Debug for ListPaymentMethodsCustomerType {
699    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
700        f.write_str(self.as_str())
701    }
702}
703impl serde::Serialize for ListPaymentMethodsCustomerType {
704    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
705    where
706        S: serde::Serializer,
707    {
708        serializer.serialize_str(self.as_str())
709    }
710}
711#[cfg(feature = "deserialize")]
712impl<'de> serde::Deserialize<'de> for ListPaymentMethodsCustomerType {
713    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
714        use std::str::FromStr;
715        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
716        Ok(Self::from_str(&s).unwrap())
717    }
718}
719/// Returns a list of PaymentMethods for a given Customer
720#[derive(Clone, Debug, serde::Serialize)]
721pub struct ListPaymentMethodsCustomer {
722    inner: ListPaymentMethodsCustomerBuilder,
723    customer: stripe_shared::CustomerId,
724}
725impl ListPaymentMethodsCustomer {
726    /// Construct a new `ListPaymentMethodsCustomer`.
727    pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
728        Self { customer: customer.into(), inner: ListPaymentMethodsCustomerBuilder::new() }
729    }
730    /// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
731    /// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
732    pub fn allow_redisplay(
733        mut self,
734        allow_redisplay: impl Into<ListPaymentMethodsCustomerAllowRedisplay>,
735    ) -> Self {
736        self.inner.allow_redisplay = Some(allow_redisplay.into());
737        self
738    }
739    /// A cursor for use in pagination.
740    /// `ending_before` is an object ID that defines your place in the list.
741    /// 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.
742    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
743        self.inner.ending_before = Some(ending_before.into());
744        self
745    }
746    /// Specifies which fields in the response should be expanded.
747    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
748        self.inner.expand = Some(expand.into());
749        self
750    }
751    /// A limit on the number of objects to be returned.
752    /// Limit can range between 1 and 100, and the default is 10.
753    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
754        self.inner.limit = Some(limit.into());
755        self
756    }
757    /// A cursor for use in pagination.
758    /// `starting_after` is an object ID that defines your place in the list.
759    /// 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.
760    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
761        self.inner.starting_after = Some(starting_after.into());
762        self
763    }
764    /// An optional filter on the list, based on the object `type` field.
765    /// Without the filter, the list includes all current and future payment method types.
766    /// If your integration expects only one type of payment method in the response, make sure to provide a type value in the request.
767    pub fn type_(mut self, type_: impl Into<ListPaymentMethodsCustomerType>) -> Self {
768        self.inner.type_ = Some(type_.into());
769        self
770    }
771}
772impl ListPaymentMethodsCustomer {
773    /// Send the request and return the deserialized response.
774    pub async fn send<C: StripeClient>(
775        &self,
776        client: &C,
777    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
778        self.customize().send(client).await
779    }
780
781    /// Send the request and return the deserialized response, blocking until completion.
782    pub fn send_blocking<C: StripeBlockingClient>(
783        &self,
784        client: &C,
785    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
786        self.customize().send_blocking(client)
787    }
788
789    pub fn paginate(
790        &self,
791    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::PaymentMethod>> {
792        let customer = &self.customer;
793
794        stripe_client_core::ListPaginator::new_list(
795            format!("/customers/{customer}/payment_methods"),
796            &self.inner,
797        )
798    }
799}
800
801impl StripeRequest for ListPaymentMethodsCustomer {
802    type Output = stripe_types::List<stripe_shared::PaymentMethod>;
803
804    fn build(&self) -> RequestBuilder {
805        let customer = &self.customer;
806        RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}/payment_methods"))
807            .query(&self.inner)
808    }
809}
810#[derive(Clone, Debug, serde::Serialize)]
811struct RetrievePaymentMethodCustomerBuilder {
812    #[serde(skip_serializing_if = "Option::is_none")]
813    expand: Option<Vec<String>>,
814}
815impl RetrievePaymentMethodCustomerBuilder {
816    fn new() -> Self {
817        Self { expand: None }
818    }
819}
820/// Retrieves a PaymentMethod object for a given Customer.
821#[derive(Clone, Debug, serde::Serialize)]
822pub struct RetrievePaymentMethodCustomer {
823    inner: RetrievePaymentMethodCustomerBuilder,
824    customer: stripe_shared::CustomerId,
825    payment_method: String,
826}
827impl RetrievePaymentMethodCustomer {
828    /// Construct a new `RetrievePaymentMethodCustomer`.
829    pub fn new(
830        customer: impl Into<stripe_shared::CustomerId>,
831        payment_method: impl Into<String>,
832    ) -> Self {
833        Self {
834            customer: customer.into(),
835            payment_method: payment_method.into(),
836            inner: RetrievePaymentMethodCustomerBuilder::new(),
837        }
838    }
839    /// Specifies which fields in the response should be expanded.
840    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
841        self.inner.expand = Some(expand.into());
842        self
843    }
844}
845impl RetrievePaymentMethodCustomer {
846    /// Send the request and return the deserialized response.
847    pub async fn send<C: StripeClient>(
848        &self,
849        client: &C,
850    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
851        self.customize().send(client).await
852    }
853
854    /// Send the request and return the deserialized response, blocking until completion.
855    pub fn send_blocking<C: StripeBlockingClient>(
856        &self,
857        client: &C,
858    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
859        self.customize().send_blocking(client)
860    }
861}
862
863impl StripeRequest for RetrievePaymentMethodCustomer {
864    type Output = stripe_shared::PaymentMethod;
865
866    fn build(&self) -> RequestBuilder {
867        let customer = &self.customer;
868        let payment_method = &self.payment_method;
869        RequestBuilder::new(
870            StripeMethod::Get,
871            format!("/customers/{customer}/payment_methods/{payment_method}"),
872        )
873        .query(&self.inner)
874    }
875}
876#[derive(Clone, Debug, serde::Serialize)]
877struct SearchCustomerBuilder {
878    #[serde(skip_serializing_if = "Option::is_none")]
879    expand: Option<Vec<String>>,
880    #[serde(skip_serializing_if = "Option::is_none")]
881    limit: Option<i64>,
882    #[serde(skip_serializing_if = "Option::is_none")]
883    page: Option<String>,
884    query: String,
885}
886impl SearchCustomerBuilder {
887    fn new(query: impl Into<String>) -> Self {
888        Self { expand: None, limit: None, page: None, query: query.into() }
889    }
890}
891/// Search for customers you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language).
892/// Don’t use search in read-after-write flows where strict consistency is necessary.
893/// Under normal operating.
894/// conditions, data is searchable in less than a minute.
895/// Occasionally, propagation of new or updated data can be up.
896/// to an hour behind during outages. Search functionality is not available to merchants in India.
897#[derive(Clone, Debug, serde::Serialize)]
898pub struct SearchCustomer {
899    inner: SearchCustomerBuilder,
900}
901impl SearchCustomer {
902    /// Construct a new `SearchCustomer`.
903    pub fn new(query: impl Into<String>) -> Self {
904        Self { inner: SearchCustomerBuilder::new(query.into()) }
905    }
906    /// Specifies which fields in the response should be expanded.
907    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
908        self.inner.expand = Some(expand.into());
909        self
910    }
911    /// A limit on the number of objects to be returned.
912    /// Limit can range between 1 and 100, and the default is 10.
913    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
914        self.inner.limit = Some(limit.into());
915        self
916    }
917    /// A cursor for pagination across multiple pages of results.
918    /// Don't include this parameter on the first call.
919    /// Use the next_page value returned in a previous response to request subsequent results.
920    pub fn page(mut self, page: impl Into<String>) -> Self {
921        self.inner.page = Some(page.into());
922        self
923    }
924}
925impl SearchCustomer {
926    /// Send the request and return the deserialized response.
927    pub async fn send<C: StripeClient>(
928        &self,
929        client: &C,
930    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
931        self.customize().send(client).await
932    }
933
934    /// Send the request and return the deserialized response, blocking until completion.
935    pub fn send_blocking<C: StripeBlockingClient>(
936        &self,
937        client: &C,
938    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
939        self.customize().send_blocking(client)
940    }
941
942    pub fn paginate(
943        &self,
944    ) -> stripe_client_core::ListPaginator<stripe_types::SearchList<stripe_shared::Customer>> {
945        stripe_client_core::ListPaginator::new_search_list("/customers/search", &self.inner)
946    }
947}
948
949impl StripeRequest for SearchCustomer {
950    type Output = stripe_types::SearchList<stripe_shared::Customer>;
951
952    fn build(&self) -> RequestBuilder {
953        RequestBuilder::new(StripeMethod::Get, "/customers/search").query(&self.inner)
954    }
955}
956#[derive(Clone, Debug, serde::Serialize)]
957struct CreateCustomerBuilder {
958    #[serde(skip_serializing_if = "Option::is_none")]
959    address: Option<OptionalFieldsCustomerAddress>,
960    #[serde(skip_serializing_if = "Option::is_none")]
961    balance: Option<i64>,
962    #[serde(skip_serializing_if = "Option::is_none")]
963    business_name: Option<String>,
964    #[serde(skip_serializing_if = "Option::is_none")]
965    cash_balance: Option<CreateCustomerCashBalance>,
966    #[serde(skip_serializing_if = "Option::is_none")]
967    description: Option<String>,
968    #[serde(skip_serializing_if = "Option::is_none")]
969    email: Option<String>,
970    #[serde(skip_serializing_if = "Option::is_none")]
971    expand: Option<Vec<String>>,
972    #[serde(skip_serializing_if = "Option::is_none")]
973    individual_name: Option<String>,
974    #[serde(skip_serializing_if = "Option::is_none")]
975    invoice_prefix: Option<String>,
976    #[serde(skip_serializing_if = "Option::is_none")]
977    invoice_settings: Option<CreateCustomerInvoiceSettings>,
978    #[serde(skip_serializing_if = "Option::is_none")]
979    metadata: Option<std::collections::HashMap<String, String>>,
980    #[serde(skip_serializing_if = "Option::is_none")]
981    name: Option<String>,
982    #[serde(skip_serializing_if = "Option::is_none")]
983    next_invoice_sequence: Option<i64>,
984    #[serde(skip_serializing_if = "Option::is_none")]
985    payment_method: Option<String>,
986    #[serde(skip_serializing_if = "Option::is_none")]
987    phone: Option<String>,
988    #[serde(skip_serializing_if = "Option::is_none")]
989    preferred_locales: Option<Vec<String>>,
990    #[serde(skip_serializing_if = "Option::is_none")]
991    shipping: Option<CustomerShipping>,
992    #[serde(skip_serializing_if = "Option::is_none")]
993    source: Option<String>,
994    #[serde(skip_serializing_if = "Option::is_none")]
995    tax: Option<CreateCustomerTax>,
996    #[serde(skip_serializing_if = "Option::is_none")]
997    tax_exempt: Option<stripe_shared::CustomerTaxExempt>,
998    #[serde(skip_serializing_if = "Option::is_none")]
999    tax_id_data: Option<Vec<CreateCustomerTaxIdData>>,
1000    #[serde(skip_serializing_if = "Option::is_none")]
1001    test_clock: Option<String>,
1002    #[serde(skip_serializing_if = "Option::is_none")]
1003    validate: Option<bool>,
1004}
1005impl CreateCustomerBuilder {
1006    fn new() -> Self {
1007        Self {
1008            address: None,
1009            balance: None,
1010            business_name: None,
1011            cash_balance: None,
1012            description: None,
1013            email: None,
1014            expand: None,
1015            individual_name: None,
1016            invoice_prefix: None,
1017            invoice_settings: None,
1018            metadata: None,
1019            name: None,
1020            next_invoice_sequence: None,
1021            payment_method: None,
1022            phone: None,
1023            preferred_locales: None,
1024            shipping: None,
1025            source: None,
1026            tax: None,
1027            tax_exempt: None,
1028            tax_id_data: None,
1029            test_clock: None,
1030            validate: None,
1031        }
1032    }
1033}
1034/// Balance information and default balance settings for this customer.
1035#[derive(Copy, Clone, Debug, serde::Serialize)]
1036pub struct CreateCustomerCashBalance {
1037    /// Settings controlling the behavior of the customer's cash balance,
1038    /// such as reconciliation of funds received.
1039    #[serde(skip_serializing_if = "Option::is_none")]
1040    pub settings: Option<CreateCustomerCashBalanceSettings>,
1041}
1042impl CreateCustomerCashBalance {
1043    pub fn new() -> Self {
1044        Self { settings: None }
1045    }
1046}
1047impl Default for CreateCustomerCashBalance {
1048    fn default() -> Self {
1049        Self::new()
1050    }
1051}
1052/// Settings controlling the behavior of the customer's cash balance,
1053/// such as reconciliation of funds received.
1054#[derive(Copy, Clone, Debug, serde::Serialize)]
1055pub struct CreateCustomerCashBalanceSettings {
1056    /// Controls how funds transferred by the customer are applied to payment intents and invoices.
1057    /// Valid options are `automatic`, `manual`, or `merchant_default`.
1058    /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
1059    #[serde(skip_serializing_if = "Option::is_none")]
1060    pub reconciliation_mode: Option<CreateCustomerCashBalanceSettingsReconciliationMode>,
1061}
1062impl CreateCustomerCashBalanceSettings {
1063    pub fn new() -> Self {
1064        Self { reconciliation_mode: None }
1065    }
1066}
1067impl Default for CreateCustomerCashBalanceSettings {
1068    fn default() -> Self {
1069        Self::new()
1070    }
1071}
1072/// Controls how funds transferred by the customer are applied to payment intents and invoices.
1073/// Valid options are `automatic`, `manual`, or `merchant_default`.
1074/// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
1075#[derive(Copy, Clone, Eq, PartialEq)]
1076pub enum CreateCustomerCashBalanceSettingsReconciliationMode {
1077    Automatic,
1078    Manual,
1079    MerchantDefault,
1080}
1081impl CreateCustomerCashBalanceSettingsReconciliationMode {
1082    pub fn as_str(self) -> &'static str {
1083        use CreateCustomerCashBalanceSettingsReconciliationMode::*;
1084        match self {
1085            Automatic => "automatic",
1086            Manual => "manual",
1087            MerchantDefault => "merchant_default",
1088        }
1089    }
1090}
1091
1092impl std::str::FromStr for CreateCustomerCashBalanceSettingsReconciliationMode {
1093    type Err = stripe_types::StripeParseError;
1094    fn from_str(s: &str) -> Result<Self, Self::Err> {
1095        use CreateCustomerCashBalanceSettingsReconciliationMode::*;
1096        match s {
1097            "automatic" => Ok(Automatic),
1098            "manual" => Ok(Manual),
1099            "merchant_default" => Ok(MerchantDefault),
1100            _ => Err(stripe_types::StripeParseError),
1101        }
1102    }
1103}
1104impl std::fmt::Display for CreateCustomerCashBalanceSettingsReconciliationMode {
1105    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1106        f.write_str(self.as_str())
1107    }
1108}
1109
1110impl std::fmt::Debug for CreateCustomerCashBalanceSettingsReconciliationMode {
1111    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1112        f.write_str(self.as_str())
1113    }
1114}
1115impl serde::Serialize for CreateCustomerCashBalanceSettingsReconciliationMode {
1116    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1117    where
1118        S: serde::Serializer,
1119    {
1120        serializer.serialize_str(self.as_str())
1121    }
1122}
1123#[cfg(feature = "deserialize")]
1124impl<'de> serde::Deserialize<'de> for CreateCustomerCashBalanceSettingsReconciliationMode {
1125    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1126        use std::str::FromStr;
1127        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1128        Self::from_str(&s).map_err(|_| {
1129            serde::de::Error::custom(
1130                "Unknown value for CreateCustomerCashBalanceSettingsReconciliationMode",
1131            )
1132        })
1133    }
1134}
1135/// Default invoice settings for this customer.
1136#[derive(Clone, Debug, serde::Serialize)]
1137pub struct CreateCustomerInvoiceSettings {
1138    /// The list of up to 4 default custom fields to be displayed on invoices for this customer.
1139    /// When updating, pass an empty string to remove previously-defined fields.
1140    #[serde(skip_serializing_if = "Option::is_none")]
1141    pub custom_fields: Option<Vec<CustomFieldParams>>,
1142    /// 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.
1143    #[serde(skip_serializing_if = "Option::is_none")]
1144    pub default_payment_method: Option<String>,
1145    /// Default footer to be displayed on invoices for this customer.
1146    #[serde(skip_serializing_if = "Option::is_none")]
1147    pub footer: Option<String>,
1148    /// Default options for invoice PDF rendering for this customer.
1149    #[serde(skip_serializing_if = "Option::is_none")]
1150    pub rendering_options: Option<CreateCustomerInvoiceSettingsRenderingOptions>,
1151}
1152impl CreateCustomerInvoiceSettings {
1153    pub fn new() -> Self {
1154        Self {
1155            custom_fields: None,
1156            default_payment_method: None,
1157            footer: None,
1158            rendering_options: None,
1159        }
1160    }
1161}
1162impl Default for CreateCustomerInvoiceSettings {
1163    fn default() -> Self {
1164        Self::new()
1165    }
1166}
1167/// Default options for invoice PDF rendering for this customer.
1168#[derive(Clone, Debug, serde::Serialize)]
1169pub struct CreateCustomerInvoiceSettingsRenderingOptions {
1170    /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
1171    /// One of `exclude_tax` or `include_inclusive_tax`.
1172    /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
1173    /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
1174    #[serde(skip_serializing_if = "Option::is_none")]
1175    pub amount_tax_display: Option<CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay>,
1176    /// ID of the invoice rendering template to use for future invoices.
1177    #[serde(skip_serializing_if = "Option::is_none")]
1178    pub template: Option<String>,
1179}
1180impl CreateCustomerInvoiceSettingsRenderingOptions {
1181    pub fn new() -> Self {
1182        Self { amount_tax_display: None, template: None }
1183    }
1184}
1185impl Default for CreateCustomerInvoiceSettingsRenderingOptions {
1186    fn default() -> Self {
1187        Self::new()
1188    }
1189}
1190/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
1191/// One of `exclude_tax` or `include_inclusive_tax`.
1192/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
1193/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
1194#[derive(Copy, Clone, Eq, PartialEq)]
1195pub enum CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1196    ExcludeTax,
1197    IncludeInclusiveTax,
1198}
1199impl CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1200    pub fn as_str(self) -> &'static str {
1201        use CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
1202        match self {
1203            ExcludeTax => "exclude_tax",
1204            IncludeInclusiveTax => "include_inclusive_tax",
1205        }
1206    }
1207}
1208
1209impl std::str::FromStr for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1210    type Err = stripe_types::StripeParseError;
1211    fn from_str(s: &str) -> Result<Self, Self::Err> {
1212        use CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
1213        match s {
1214            "exclude_tax" => Ok(ExcludeTax),
1215            "include_inclusive_tax" => Ok(IncludeInclusiveTax),
1216            _ => Err(stripe_types::StripeParseError),
1217        }
1218    }
1219}
1220impl std::fmt::Display for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1221    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1222        f.write_str(self.as_str())
1223    }
1224}
1225
1226impl std::fmt::Debug for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1227    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1228        f.write_str(self.as_str())
1229    }
1230}
1231impl serde::Serialize for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1232    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1233    where
1234        S: serde::Serializer,
1235    {
1236        serializer.serialize_str(self.as_str())
1237    }
1238}
1239#[cfg(feature = "deserialize")]
1240impl<'de> serde::Deserialize<'de>
1241    for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay
1242{
1243    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1244        use std::str::FromStr;
1245        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1246        Self::from_str(&s).map_err(|_| {
1247            serde::de::Error::custom(
1248                "Unknown value for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay",
1249            )
1250        })
1251    }
1252}
1253/// Tax details about the customer.
1254#[derive(Clone, Debug, serde::Serialize)]
1255pub struct CreateCustomerTax {
1256    /// A recent IP address of the customer used for tax reporting and tax location inference.
1257    /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated.
1258    /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
1259    #[serde(skip_serializing_if = "Option::is_none")]
1260    pub ip_address: Option<String>,
1261    /// A flag that indicates when Stripe should validate the customer tax location.
1262    /// Defaults to `deferred`.
1263    #[serde(skip_serializing_if = "Option::is_none")]
1264    pub validate_location: Option<CreateCustomerTaxValidateLocation>,
1265}
1266impl CreateCustomerTax {
1267    pub fn new() -> Self {
1268        Self { ip_address: None, validate_location: None }
1269    }
1270}
1271impl Default for CreateCustomerTax {
1272    fn default() -> Self {
1273        Self::new()
1274    }
1275}
1276/// A flag that indicates when Stripe should validate the customer tax location.
1277/// Defaults to `deferred`.
1278#[derive(Copy, Clone, Eq, PartialEq)]
1279pub enum CreateCustomerTaxValidateLocation {
1280    Deferred,
1281    Immediately,
1282}
1283impl CreateCustomerTaxValidateLocation {
1284    pub fn as_str(self) -> &'static str {
1285        use CreateCustomerTaxValidateLocation::*;
1286        match self {
1287            Deferred => "deferred",
1288            Immediately => "immediately",
1289        }
1290    }
1291}
1292
1293impl std::str::FromStr for CreateCustomerTaxValidateLocation {
1294    type Err = stripe_types::StripeParseError;
1295    fn from_str(s: &str) -> Result<Self, Self::Err> {
1296        use CreateCustomerTaxValidateLocation::*;
1297        match s {
1298            "deferred" => Ok(Deferred),
1299            "immediately" => Ok(Immediately),
1300            _ => Err(stripe_types::StripeParseError),
1301        }
1302    }
1303}
1304impl std::fmt::Display for CreateCustomerTaxValidateLocation {
1305    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1306        f.write_str(self.as_str())
1307    }
1308}
1309
1310impl std::fmt::Debug for CreateCustomerTaxValidateLocation {
1311    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1312        f.write_str(self.as_str())
1313    }
1314}
1315impl serde::Serialize for CreateCustomerTaxValidateLocation {
1316    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1317    where
1318        S: serde::Serializer,
1319    {
1320        serializer.serialize_str(self.as_str())
1321    }
1322}
1323#[cfg(feature = "deserialize")]
1324impl<'de> serde::Deserialize<'de> for CreateCustomerTaxValidateLocation {
1325    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1326        use std::str::FromStr;
1327        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1328        Self::from_str(&s).map_err(|_| {
1329            serde::de::Error::custom("Unknown value for CreateCustomerTaxValidateLocation")
1330        })
1331    }
1332}
1333/// The customer's tax IDs.
1334#[derive(Clone, Debug, serde::Serialize)]
1335pub struct CreateCustomerTaxIdData {
1336    /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `aw_tin`, `az_tin`, `ba_tin`, `bb_tin`, `bd_bin`, `bf_ifu`, `bg_uic`, `bh_vat`, `bj_ifu`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cm_niu`, `cn_tin`, `co_nit`, `cr_tin`, `cv_nif`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `et_tin`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kg_tin`, `kh_tin`, `kr_brn`, `kz_bin`, `la_tin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`.
1337    #[serde(rename = "type")]
1338    pub type_: CreateCustomerTaxIdDataType,
1339    /// Value of the tax ID.
1340    pub value: String,
1341}
1342impl CreateCustomerTaxIdData {
1343    pub fn new(type_: impl Into<CreateCustomerTaxIdDataType>, value: impl Into<String>) -> Self {
1344        Self { type_: type_.into(), value: value.into() }
1345    }
1346}
1347/// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `aw_tin`, `az_tin`, `ba_tin`, `bb_tin`, `bd_bin`, `bf_ifu`, `bg_uic`, `bh_vat`, `bj_ifu`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cm_niu`, `cn_tin`, `co_nit`, `cr_tin`, `cv_nif`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `et_tin`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kg_tin`, `kh_tin`, `kr_brn`, `kz_bin`, `la_tin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`.
1348#[derive(Clone, Eq, PartialEq)]
1349#[non_exhaustive]
1350pub enum CreateCustomerTaxIdDataType {
1351    AdNrt,
1352    AeTrn,
1353    AlTin,
1354    AmTin,
1355    AoTin,
1356    ArCuit,
1357    AuAbn,
1358    AuArn,
1359    AwTin,
1360    AzTin,
1361    BaTin,
1362    BbTin,
1363    BdBin,
1364    BfIfu,
1365    BgUic,
1366    BhVat,
1367    BjIfu,
1368    BoTin,
1369    BrCnpj,
1370    BrCpf,
1371    BsTin,
1372    ByTin,
1373    CaBn,
1374    CaGstHst,
1375    CaPstBc,
1376    CaPstMb,
1377    CaPstSk,
1378    CaQst,
1379    CdNif,
1380    ChUid,
1381    ChVat,
1382    ClTin,
1383    CmNiu,
1384    CnTin,
1385    CoNit,
1386    CrTin,
1387    CvNif,
1388    DeStn,
1389    DoRcn,
1390    EcRuc,
1391    EgTin,
1392    EsCif,
1393    EtTin,
1394    EuOssVat,
1395    EuVat,
1396    GbVat,
1397    GeVat,
1398    GnNif,
1399    HkBr,
1400    HrOib,
1401    HuTin,
1402    IdNpwp,
1403    IlVat,
1404    InGst,
1405    IsVat,
1406    JpCn,
1407    JpRn,
1408    JpTrn,
1409    KePin,
1410    KgTin,
1411    KhTin,
1412    KrBrn,
1413    KzBin,
1414    LaTin,
1415    LiUid,
1416    LiVat,
1417    MaVat,
1418    MdVat,
1419    MePib,
1420    MkVat,
1421    MrNif,
1422    MxRfc,
1423    MyFrp,
1424    MyItn,
1425    MySst,
1426    NgTin,
1427    NoVat,
1428    NoVoec,
1429    NpPan,
1430    NzGst,
1431    OmVat,
1432    PeRuc,
1433    PhTin,
1434    RoTin,
1435    RsPib,
1436    RuInn,
1437    RuKpp,
1438    SaVat,
1439    SgGst,
1440    SgUen,
1441    SiTin,
1442    SnNinea,
1443    SrFin,
1444    SvNit,
1445    ThVat,
1446    TjTin,
1447    TrTin,
1448    TwVat,
1449    TzVat,
1450    UaVat,
1451    UgTin,
1452    UsEin,
1453    UyRuc,
1454    UzTin,
1455    UzVat,
1456    VeRif,
1457    VnTin,
1458    ZaVat,
1459    ZmTin,
1460    ZwTin,
1461    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1462    Unknown(String),
1463}
1464impl CreateCustomerTaxIdDataType {
1465    pub fn as_str(&self) -> &str {
1466        use CreateCustomerTaxIdDataType::*;
1467        match self {
1468            AdNrt => "ad_nrt",
1469            AeTrn => "ae_trn",
1470            AlTin => "al_tin",
1471            AmTin => "am_tin",
1472            AoTin => "ao_tin",
1473            ArCuit => "ar_cuit",
1474            AuAbn => "au_abn",
1475            AuArn => "au_arn",
1476            AwTin => "aw_tin",
1477            AzTin => "az_tin",
1478            BaTin => "ba_tin",
1479            BbTin => "bb_tin",
1480            BdBin => "bd_bin",
1481            BfIfu => "bf_ifu",
1482            BgUic => "bg_uic",
1483            BhVat => "bh_vat",
1484            BjIfu => "bj_ifu",
1485            BoTin => "bo_tin",
1486            BrCnpj => "br_cnpj",
1487            BrCpf => "br_cpf",
1488            BsTin => "bs_tin",
1489            ByTin => "by_tin",
1490            CaBn => "ca_bn",
1491            CaGstHst => "ca_gst_hst",
1492            CaPstBc => "ca_pst_bc",
1493            CaPstMb => "ca_pst_mb",
1494            CaPstSk => "ca_pst_sk",
1495            CaQst => "ca_qst",
1496            CdNif => "cd_nif",
1497            ChUid => "ch_uid",
1498            ChVat => "ch_vat",
1499            ClTin => "cl_tin",
1500            CmNiu => "cm_niu",
1501            CnTin => "cn_tin",
1502            CoNit => "co_nit",
1503            CrTin => "cr_tin",
1504            CvNif => "cv_nif",
1505            DeStn => "de_stn",
1506            DoRcn => "do_rcn",
1507            EcRuc => "ec_ruc",
1508            EgTin => "eg_tin",
1509            EsCif => "es_cif",
1510            EtTin => "et_tin",
1511            EuOssVat => "eu_oss_vat",
1512            EuVat => "eu_vat",
1513            GbVat => "gb_vat",
1514            GeVat => "ge_vat",
1515            GnNif => "gn_nif",
1516            HkBr => "hk_br",
1517            HrOib => "hr_oib",
1518            HuTin => "hu_tin",
1519            IdNpwp => "id_npwp",
1520            IlVat => "il_vat",
1521            InGst => "in_gst",
1522            IsVat => "is_vat",
1523            JpCn => "jp_cn",
1524            JpRn => "jp_rn",
1525            JpTrn => "jp_trn",
1526            KePin => "ke_pin",
1527            KgTin => "kg_tin",
1528            KhTin => "kh_tin",
1529            KrBrn => "kr_brn",
1530            KzBin => "kz_bin",
1531            LaTin => "la_tin",
1532            LiUid => "li_uid",
1533            LiVat => "li_vat",
1534            MaVat => "ma_vat",
1535            MdVat => "md_vat",
1536            MePib => "me_pib",
1537            MkVat => "mk_vat",
1538            MrNif => "mr_nif",
1539            MxRfc => "mx_rfc",
1540            MyFrp => "my_frp",
1541            MyItn => "my_itn",
1542            MySst => "my_sst",
1543            NgTin => "ng_tin",
1544            NoVat => "no_vat",
1545            NoVoec => "no_voec",
1546            NpPan => "np_pan",
1547            NzGst => "nz_gst",
1548            OmVat => "om_vat",
1549            PeRuc => "pe_ruc",
1550            PhTin => "ph_tin",
1551            RoTin => "ro_tin",
1552            RsPib => "rs_pib",
1553            RuInn => "ru_inn",
1554            RuKpp => "ru_kpp",
1555            SaVat => "sa_vat",
1556            SgGst => "sg_gst",
1557            SgUen => "sg_uen",
1558            SiTin => "si_tin",
1559            SnNinea => "sn_ninea",
1560            SrFin => "sr_fin",
1561            SvNit => "sv_nit",
1562            ThVat => "th_vat",
1563            TjTin => "tj_tin",
1564            TrTin => "tr_tin",
1565            TwVat => "tw_vat",
1566            TzVat => "tz_vat",
1567            UaVat => "ua_vat",
1568            UgTin => "ug_tin",
1569            UsEin => "us_ein",
1570            UyRuc => "uy_ruc",
1571            UzTin => "uz_tin",
1572            UzVat => "uz_vat",
1573            VeRif => "ve_rif",
1574            VnTin => "vn_tin",
1575            ZaVat => "za_vat",
1576            ZmTin => "zm_tin",
1577            ZwTin => "zw_tin",
1578            Unknown(v) => v,
1579        }
1580    }
1581}
1582
1583impl std::str::FromStr for CreateCustomerTaxIdDataType {
1584    type Err = std::convert::Infallible;
1585    fn from_str(s: &str) -> Result<Self, Self::Err> {
1586        use CreateCustomerTaxIdDataType::*;
1587        match s {
1588            "ad_nrt" => Ok(AdNrt),
1589            "ae_trn" => Ok(AeTrn),
1590            "al_tin" => Ok(AlTin),
1591            "am_tin" => Ok(AmTin),
1592            "ao_tin" => Ok(AoTin),
1593            "ar_cuit" => Ok(ArCuit),
1594            "au_abn" => Ok(AuAbn),
1595            "au_arn" => Ok(AuArn),
1596            "aw_tin" => Ok(AwTin),
1597            "az_tin" => Ok(AzTin),
1598            "ba_tin" => Ok(BaTin),
1599            "bb_tin" => Ok(BbTin),
1600            "bd_bin" => Ok(BdBin),
1601            "bf_ifu" => Ok(BfIfu),
1602            "bg_uic" => Ok(BgUic),
1603            "bh_vat" => Ok(BhVat),
1604            "bj_ifu" => Ok(BjIfu),
1605            "bo_tin" => Ok(BoTin),
1606            "br_cnpj" => Ok(BrCnpj),
1607            "br_cpf" => Ok(BrCpf),
1608            "bs_tin" => Ok(BsTin),
1609            "by_tin" => Ok(ByTin),
1610            "ca_bn" => Ok(CaBn),
1611            "ca_gst_hst" => Ok(CaGstHst),
1612            "ca_pst_bc" => Ok(CaPstBc),
1613            "ca_pst_mb" => Ok(CaPstMb),
1614            "ca_pst_sk" => Ok(CaPstSk),
1615            "ca_qst" => Ok(CaQst),
1616            "cd_nif" => Ok(CdNif),
1617            "ch_uid" => Ok(ChUid),
1618            "ch_vat" => Ok(ChVat),
1619            "cl_tin" => Ok(ClTin),
1620            "cm_niu" => Ok(CmNiu),
1621            "cn_tin" => Ok(CnTin),
1622            "co_nit" => Ok(CoNit),
1623            "cr_tin" => Ok(CrTin),
1624            "cv_nif" => Ok(CvNif),
1625            "de_stn" => Ok(DeStn),
1626            "do_rcn" => Ok(DoRcn),
1627            "ec_ruc" => Ok(EcRuc),
1628            "eg_tin" => Ok(EgTin),
1629            "es_cif" => Ok(EsCif),
1630            "et_tin" => Ok(EtTin),
1631            "eu_oss_vat" => Ok(EuOssVat),
1632            "eu_vat" => Ok(EuVat),
1633            "gb_vat" => Ok(GbVat),
1634            "ge_vat" => Ok(GeVat),
1635            "gn_nif" => Ok(GnNif),
1636            "hk_br" => Ok(HkBr),
1637            "hr_oib" => Ok(HrOib),
1638            "hu_tin" => Ok(HuTin),
1639            "id_npwp" => Ok(IdNpwp),
1640            "il_vat" => Ok(IlVat),
1641            "in_gst" => Ok(InGst),
1642            "is_vat" => Ok(IsVat),
1643            "jp_cn" => Ok(JpCn),
1644            "jp_rn" => Ok(JpRn),
1645            "jp_trn" => Ok(JpTrn),
1646            "ke_pin" => Ok(KePin),
1647            "kg_tin" => Ok(KgTin),
1648            "kh_tin" => Ok(KhTin),
1649            "kr_brn" => Ok(KrBrn),
1650            "kz_bin" => Ok(KzBin),
1651            "la_tin" => Ok(LaTin),
1652            "li_uid" => Ok(LiUid),
1653            "li_vat" => Ok(LiVat),
1654            "ma_vat" => Ok(MaVat),
1655            "md_vat" => Ok(MdVat),
1656            "me_pib" => Ok(MePib),
1657            "mk_vat" => Ok(MkVat),
1658            "mr_nif" => Ok(MrNif),
1659            "mx_rfc" => Ok(MxRfc),
1660            "my_frp" => Ok(MyFrp),
1661            "my_itn" => Ok(MyItn),
1662            "my_sst" => Ok(MySst),
1663            "ng_tin" => Ok(NgTin),
1664            "no_vat" => Ok(NoVat),
1665            "no_voec" => Ok(NoVoec),
1666            "np_pan" => Ok(NpPan),
1667            "nz_gst" => Ok(NzGst),
1668            "om_vat" => Ok(OmVat),
1669            "pe_ruc" => Ok(PeRuc),
1670            "ph_tin" => Ok(PhTin),
1671            "ro_tin" => Ok(RoTin),
1672            "rs_pib" => Ok(RsPib),
1673            "ru_inn" => Ok(RuInn),
1674            "ru_kpp" => Ok(RuKpp),
1675            "sa_vat" => Ok(SaVat),
1676            "sg_gst" => Ok(SgGst),
1677            "sg_uen" => Ok(SgUen),
1678            "si_tin" => Ok(SiTin),
1679            "sn_ninea" => Ok(SnNinea),
1680            "sr_fin" => Ok(SrFin),
1681            "sv_nit" => Ok(SvNit),
1682            "th_vat" => Ok(ThVat),
1683            "tj_tin" => Ok(TjTin),
1684            "tr_tin" => Ok(TrTin),
1685            "tw_vat" => Ok(TwVat),
1686            "tz_vat" => Ok(TzVat),
1687            "ua_vat" => Ok(UaVat),
1688            "ug_tin" => Ok(UgTin),
1689            "us_ein" => Ok(UsEin),
1690            "uy_ruc" => Ok(UyRuc),
1691            "uz_tin" => Ok(UzTin),
1692            "uz_vat" => Ok(UzVat),
1693            "ve_rif" => Ok(VeRif),
1694            "vn_tin" => Ok(VnTin),
1695            "za_vat" => Ok(ZaVat),
1696            "zm_tin" => Ok(ZmTin),
1697            "zw_tin" => Ok(ZwTin),
1698            v => Ok(Unknown(v.to_owned())),
1699        }
1700    }
1701}
1702impl std::fmt::Display for CreateCustomerTaxIdDataType {
1703    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1704        f.write_str(self.as_str())
1705    }
1706}
1707
1708impl std::fmt::Debug for CreateCustomerTaxIdDataType {
1709    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1710        f.write_str(self.as_str())
1711    }
1712}
1713impl serde::Serialize for CreateCustomerTaxIdDataType {
1714    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1715    where
1716        S: serde::Serializer,
1717    {
1718        serializer.serialize_str(self.as_str())
1719    }
1720}
1721#[cfg(feature = "deserialize")]
1722impl<'de> serde::Deserialize<'de> for CreateCustomerTaxIdDataType {
1723    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1724        use std::str::FromStr;
1725        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1726        Ok(Self::from_str(&s).unwrap())
1727    }
1728}
1729/// Creates a new customer object.
1730#[derive(Clone, Debug, serde::Serialize)]
1731pub struct CreateCustomer {
1732    inner: CreateCustomerBuilder,
1733}
1734impl CreateCustomer {
1735    /// Construct a new `CreateCustomer`.
1736    pub fn new() -> Self {
1737        Self { inner: CreateCustomerBuilder::new() }
1738    }
1739    /// The customer's address.
1740    pub fn address(mut self, address: impl Into<OptionalFieldsCustomerAddress>) -> Self {
1741        self.inner.address = Some(address.into());
1742        self
1743    }
1744    /// An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices.
1745    /// A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
1746    pub fn balance(mut self, balance: impl Into<i64>) -> Self {
1747        self.inner.balance = Some(balance.into());
1748        self
1749    }
1750    /// The customer's business name. This may be up to *150 characters*.
1751    pub fn business_name(mut self, business_name: impl Into<String>) -> Self {
1752        self.inner.business_name = Some(business_name.into());
1753        self
1754    }
1755    /// Balance information and default balance settings for this customer.
1756    pub fn cash_balance(mut self, cash_balance: impl Into<CreateCustomerCashBalance>) -> Self {
1757        self.inner.cash_balance = Some(cash_balance.into());
1758        self
1759    }
1760    /// An arbitrary string that you can attach to a customer object.
1761    /// It is displayed alongside the customer in the dashboard.
1762    pub fn description(mut self, description: impl Into<String>) -> Self {
1763        self.inner.description = Some(description.into());
1764        self
1765    }
1766    /// Customer's email address.
1767    /// It's displayed alongside the customer in your dashboard and can be useful for searching and tracking.
1768    /// This may be up to *512 characters*.
1769    pub fn email(mut self, email: impl Into<String>) -> Self {
1770        self.inner.email = Some(email.into());
1771        self
1772    }
1773    /// Specifies which fields in the response should be expanded.
1774    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1775        self.inner.expand = Some(expand.into());
1776        self
1777    }
1778    /// The customer's full name. This may be up to *150 characters*.
1779    pub fn individual_name(mut self, individual_name: impl Into<String>) -> Self {
1780        self.inner.individual_name = Some(individual_name.into());
1781        self
1782    }
1783    /// The prefix for the customer used to generate unique invoice numbers.
1784    /// Must be 3–12 uppercase letters or numbers.
1785    pub fn invoice_prefix(mut self, invoice_prefix: impl Into<String>) -> Self {
1786        self.inner.invoice_prefix = Some(invoice_prefix.into());
1787        self
1788    }
1789    /// Default invoice settings for this customer.
1790    pub fn invoice_settings(
1791        mut self,
1792        invoice_settings: impl Into<CreateCustomerInvoiceSettings>,
1793    ) -> Self {
1794        self.inner.invoice_settings = Some(invoice_settings.into());
1795        self
1796    }
1797    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
1798    /// This can be useful for storing additional information about the object in a structured format.
1799    /// Individual keys can be unset by posting an empty value to them.
1800    /// All keys can be unset by posting an empty value to `metadata`.
1801    pub fn metadata(
1802        mut self,
1803        metadata: impl Into<std::collections::HashMap<String, String>>,
1804    ) -> Self {
1805        self.inner.metadata = Some(metadata.into());
1806        self
1807    }
1808    /// The customer's full name or business name.
1809    pub fn name(mut self, name: impl Into<String>) -> Self {
1810        self.inner.name = Some(name.into());
1811        self
1812    }
1813    /// The sequence to be used on the customer's next invoice. Defaults to 1.
1814    pub fn next_invoice_sequence(mut self, next_invoice_sequence: impl Into<i64>) -> Self {
1815        self.inner.next_invoice_sequence = Some(next_invoice_sequence.into());
1816        self
1817    }
1818    pub fn payment_method(mut self, payment_method: impl Into<String>) -> Self {
1819        self.inner.payment_method = Some(payment_method.into());
1820        self
1821    }
1822    /// The customer's phone number.
1823    pub fn phone(mut self, phone: impl Into<String>) -> Self {
1824        self.inner.phone = Some(phone.into());
1825        self
1826    }
1827    /// Customer's preferred languages, ordered by preference.
1828    pub fn preferred_locales(mut self, preferred_locales: impl Into<Vec<String>>) -> Self {
1829        self.inner.preferred_locales = Some(preferred_locales.into());
1830        self
1831    }
1832    /// The customer's shipping information. Appears on invoices emailed to this customer.
1833    pub fn shipping(mut self, shipping: impl Into<CustomerShipping>) -> Self {
1834        self.inner.shipping = Some(shipping.into());
1835        self
1836    }
1837    pub fn source(mut self, source: impl Into<String>) -> Self {
1838        self.inner.source = Some(source.into());
1839        self
1840    }
1841    /// Tax details about the customer.
1842    pub fn tax(mut self, tax: impl Into<CreateCustomerTax>) -> Self {
1843        self.inner.tax = Some(tax.into());
1844        self
1845    }
1846    /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`.
1847    pub fn tax_exempt(mut self, tax_exempt: impl Into<stripe_shared::CustomerTaxExempt>) -> Self {
1848        self.inner.tax_exempt = Some(tax_exempt.into());
1849        self
1850    }
1851    /// The customer's tax IDs.
1852    pub fn tax_id_data(mut self, tax_id_data: impl Into<Vec<CreateCustomerTaxIdData>>) -> Self {
1853        self.inner.tax_id_data = Some(tax_id_data.into());
1854        self
1855    }
1856    /// ID of the test clock to attach to the customer.
1857    pub fn test_clock(mut self, test_clock: impl Into<String>) -> Self {
1858        self.inner.test_clock = Some(test_clock.into());
1859        self
1860    }
1861    pub fn validate(mut self, validate: impl Into<bool>) -> Self {
1862        self.inner.validate = Some(validate.into());
1863        self
1864    }
1865}
1866impl Default for CreateCustomer {
1867    fn default() -> Self {
1868        Self::new()
1869    }
1870}
1871impl CreateCustomer {
1872    /// Send the request and return the deserialized response.
1873    pub async fn send<C: StripeClient>(
1874        &self,
1875        client: &C,
1876    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1877        self.customize().send(client).await
1878    }
1879
1880    /// Send the request and return the deserialized response, blocking until completion.
1881    pub fn send_blocking<C: StripeBlockingClient>(
1882        &self,
1883        client: &C,
1884    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1885        self.customize().send_blocking(client)
1886    }
1887}
1888
1889impl StripeRequest for CreateCustomer {
1890    type Output = stripe_shared::Customer;
1891
1892    fn build(&self) -> RequestBuilder {
1893        RequestBuilder::new(StripeMethod::Post, "/customers").form(&self.inner)
1894    }
1895}
1896#[derive(Clone, Debug, serde::Serialize)]
1897struct UpdateCustomerBuilder {
1898    #[serde(skip_serializing_if = "Option::is_none")]
1899    address: Option<OptionalFieldsCustomerAddress>,
1900    #[serde(skip_serializing_if = "Option::is_none")]
1901    balance: Option<i64>,
1902    #[serde(skip_serializing_if = "Option::is_none")]
1903    business_name: Option<String>,
1904    #[serde(skip_serializing_if = "Option::is_none")]
1905    cash_balance: Option<UpdateCustomerCashBalance>,
1906    #[serde(skip_serializing_if = "Option::is_none")]
1907    default_source: Option<String>,
1908    #[serde(skip_serializing_if = "Option::is_none")]
1909    description: Option<String>,
1910    #[serde(skip_serializing_if = "Option::is_none")]
1911    email: Option<String>,
1912    #[serde(skip_serializing_if = "Option::is_none")]
1913    expand: Option<Vec<String>>,
1914    #[serde(skip_serializing_if = "Option::is_none")]
1915    individual_name: Option<String>,
1916    #[serde(skip_serializing_if = "Option::is_none")]
1917    invoice_prefix: Option<String>,
1918    #[serde(skip_serializing_if = "Option::is_none")]
1919    invoice_settings: Option<UpdateCustomerInvoiceSettings>,
1920    #[serde(skip_serializing_if = "Option::is_none")]
1921    metadata: Option<std::collections::HashMap<String, String>>,
1922    #[serde(skip_serializing_if = "Option::is_none")]
1923    name: Option<String>,
1924    #[serde(skip_serializing_if = "Option::is_none")]
1925    next_invoice_sequence: Option<i64>,
1926    #[serde(skip_serializing_if = "Option::is_none")]
1927    phone: Option<String>,
1928    #[serde(skip_serializing_if = "Option::is_none")]
1929    preferred_locales: Option<Vec<String>>,
1930    #[serde(skip_serializing_if = "Option::is_none")]
1931    shipping: Option<CustomerShipping>,
1932    #[serde(skip_serializing_if = "Option::is_none")]
1933    source: Option<String>,
1934    #[serde(skip_serializing_if = "Option::is_none")]
1935    tax: Option<UpdateCustomerTax>,
1936    #[serde(skip_serializing_if = "Option::is_none")]
1937    tax_exempt: Option<stripe_shared::CustomerTaxExempt>,
1938    #[serde(skip_serializing_if = "Option::is_none")]
1939    validate: Option<bool>,
1940}
1941impl UpdateCustomerBuilder {
1942    fn new() -> Self {
1943        Self {
1944            address: None,
1945            balance: None,
1946            business_name: None,
1947            cash_balance: None,
1948            default_source: None,
1949            description: None,
1950            email: None,
1951            expand: None,
1952            individual_name: None,
1953            invoice_prefix: None,
1954            invoice_settings: None,
1955            metadata: None,
1956            name: None,
1957            next_invoice_sequence: None,
1958            phone: None,
1959            preferred_locales: None,
1960            shipping: None,
1961            source: None,
1962            tax: None,
1963            tax_exempt: None,
1964            validate: None,
1965        }
1966    }
1967}
1968/// Balance information and default balance settings for this customer.
1969#[derive(Copy, Clone, Debug, serde::Serialize)]
1970pub struct UpdateCustomerCashBalance {
1971    /// Settings controlling the behavior of the customer's cash balance,
1972    /// such as reconciliation of funds received.
1973    #[serde(skip_serializing_if = "Option::is_none")]
1974    pub settings: Option<UpdateCustomerCashBalanceSettings>,
1975}
1976impl UpdateCustomerCashBalance {
1977    pub fn new() -> Self {
1978        Self { settings: None }
1979    }
1980}
1981impl Default for UpdateCustomerCashBalance {
1982    fn default() -> Self {
1983        Self::new()
1984    }
1985}
1986/// Settings controlling the behavior of the customer's cash balance,
1987/// such as reconciliation of funds received.
1988#[derive(Copy, Clone, Debug, serde::Serialize)]
1989pub struct UpdateCustomerCashBalanceSettings {
1990    /// Controls how funds transferred by the customer are applied to payment intents and invoices.
1991    /// Valid options are `automatic`, `manual`, or `merchant_default`.
1992    /// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
1993    #[serde(skip_serializing_if = "Option::is_none")]
1994    pub reconciliation_mode: Option<UpdateCustomerCashBalanceSettingsReconciliationMode>,
1995}
1996impl UpdateCustomerCashBalanceSettings {
1997    pub fn new() -> Self {
1998        Self { reconciliation_mode: None }
1999    }
2000}
2001impl Default for UpdateCustomerCashBalanceSettings {
2002    fn default() -> Self {
2003        Self::new()
2004    }
2005}
2006/// Controls how funds transferred by the customer are applied to payment intents and invoices.
2007/// Valid options are `automatic`, `manual`, or `merchant_default`.
2008/// For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
2009#[derive(Copy, Clone, Eq, PartialEq)]
2010pub enum UpdateCustomerCashBalanceSettingsReconciliationMode {
2011    Automatic,
2012    Manual,
2013    MerchantDefault,
2014}
2015impl UpdateCustomerCashBalanceSettingsReconciliationMode {
2016    pub fn as_str(self) -> &'static str {
2017        use UpdateCustomerCashBalanceSettingsReconciliationMode::*;
2018        match self {
2019            Automatic => "automatic",
2020            Manual => "manual",
2021            MerchantDefault => "merchant_default",
2022        }
2023    }
2024}
2025
2026impl std::str::FromStr for UpdateCustomerCashBalanceSettingsReconciliationMode {
2027    type Err = stripe_types::StripeParseError;
2028    fn from_str(s: &str) -> Result<Self, Self::Err> {
2029        use UpdateCustomerCashBalanceSettingsReconciliationMode::*;
2030        match s {
2031            "automatic" => Ok(Automatic),
2032            "manual" => Ok(Manual),
2033            "merchant_default" => Ok(MerchantDefault),
2034            _ => Err(stripe_types::StripeParseError),
2035        }
2036    }
2037}
2038impl std::fmt::Display for UpdateCustomerCashBalanceSettingsReconciliationMode {
2039    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2040        f.write_str(self.as_str())
2041    }
2042}
2043
2044impl std::fmt::Debug for UpdateCustomerCashBalanceSettingsReconciliationMode {
2045    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2046        f.write_str(self.as_str())
2047    }
2048}
2049impl serde::Serialize for UpdateCustomerCashBalanceSettingsReconciliationMode {
2050    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2051    where
2052        S: serde::Serializer,
2053    {
2054        serializer.serialize_str(self.as_str())
2055    }
2056}
2057#[cfg(feature = "deserialize")]
2058impl<'de> serde::Deserialize<'de> for UpdateCustomerCashBalanceSettingsReconciliationMode {
2059    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2060        use std::str::FromStr;
2061        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2062        Self::from_str(&s).map_err(|_| {
2063            serde::de::Error::custom(
2064                "Unknown value for UpdateCustomerCashBalanceSettingsReconciliationMode",
2065            )
2066        })
2067    }
2068}
2069/// Default invoice settings for this customer.
2070#[derive(Clone, Debug, serde::Serialize)]
2071pub struct UpdateCustomerInvoiceSettings {
2072    /// The list of up to 4 default custom fields to be displayed on invoices for this customer.
2073    /// When updating, pass an empty string to remove previously-defined fields.
2074    #[serde(skip_serializing_if = "Option::is_none")]
2075    pub custom_fields: Option<Vec<CustomFieldParams>>,
2076    /// 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.
2077    #[serde(skip_serializing_if = "Option::is_none")]
2078    pub default_payment_method: Option<String>,
2079    /// Default footer to be displayed on invoices for this customer.
2080    #[serde(skip_serializing_if = "Option::is_none")]
2081    pub footer: Option<String>,
2082    /// Default options for invoice PDF rendering for this customer.
2083    #[serde(skip_serializing_if = "Option::is_none")]
2084    pub rendering_options: Option<UpdateCustomerInvoiceSettingsRenderingOptions>,
2085}
2086impl UpdateCustomerInvoiceSettings {
2087    pub fn new() -> Self {
2088        Self {
2089            custom_fields: None,
2090            default_payment_method: None,
2091            footer: None,
2092            rendering_options: None,
2093        }
2094    }
2095}
2096impl Default for UpdateCustomerInvoiceSettings {
2097    fn default() -> Self {
2098        Self::new()
2099    }
2100}
2101/// Default options for invoice PDF rendering for this customer.
2102#[derive(Clone, Debug, serde::Serialize)]
2103pub struct UpdateCustomerInvoiceSettingsRenderingOptions {
2104    /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
2105    /// One of `exclude_tax` or `include_inclusive_tax`.
2106    /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
2107    /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
2108    #[serde(skip_serializing_if = "Option::is_none")]
2109    pub amount_tax_display: Option<UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay>,
2110    /// ID of the invoice rendering template to use for future invoices.
2111    #[serde(skip_serializing_if = "Option::is_none")]
2112    pub template: Option<String>,
2113}
2114impl UpdateCustomerInvoiceSettingsRenderingOptions {
2115    pub fn new() -> Self {
2116        Self { amount_tax_display: None, template: None }
2117    }
2118}
2119impl Default for UpdateCustomerInvoiceSettingsRenderingOptions {
2120    fn default() -> Self {
2121        Self::new()
2122    }
2123}
2124/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
2125/// One of `exclude_tax` or `include_inclusive_tax`.
2126/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
2127/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
2128#[derive(Copy, Clone, Eq, PartialEq)]
2129pub enum UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2130    ExcludeTax,
2131    IncludeInclusiveTax,
2132}
2133impl UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2134    pub fn as_str(self) -> &'static str {
2135        use UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
2136        match self {
2137            ExcludeTax => "exclude_tax",
2138            IncludeInclusiveTax => "include_inclusive_tax",
2139        }
2140    }
2141}
2142
2143impl std::str::FromStr for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2144    type Err = stripe_types::StripeParseError;
2145    fn from_str(s: &str) -> Result<Self, Self::Err> {
2146        use UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
2147        match s {
2148            "exclude_tax" => Ok(ExcludeTax),
2149            "include_inclusive_tax" => Ok(IncludeInclusiveTax),
2150            _ => Err(stripe_types::StripeParseError),
2151        }
2152    }
2153}
2154impl std::fmt::Display for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2155    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2156        f.write_str(self.as_str())
2157    }
2158}
2159
2160impl std::fmt::Debug for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2161    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2162        f.write_str(self.as_str())
2163    }
2164}
2165impl serde::Serialize for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2166    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2167    where
2168        S: serde::Serializer,
2169    {
2170        serializer.serialize_str(self.as_str())
2171    }
2172}
2173#[cfg(feature = "deserialize")]
2174impl<'de> serde::Deserialize<'de>
2175    for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay
2176{
2177    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2178        use std::str::FromStr;
2179        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2180        Self::from_str(&s).map_err(|_| {
2181            serde::de::Error::custom(
2182                "Unknown value for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay",
2183            )
2184        })
2185    }
2186}
2187/// Tax details about the customer.
2188#[derive(Clone, Debug, serde::Serialize)]
2189pub struct UpdateCustomerTax {
2190    /// A recent IP address of the customer used for tax reporting and tax location inference.
2191    /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated.
2192    /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
2193    #[serde(skip_serializing_if = "Option::is_none")]
2194    pub ip_address: Option<String>,
2195    /// A flag that indicates when Stripe should validate the customer tax location. Defaults to `auto`.
2196    #[serde(skip_serializing_if = "Option::is_none")]
2197    pub validate_location: Option<UpdateCustomerTaxValidateLocation>,
2198}
2199impl UpdateCustomerTax {
2200    pub fn new() -> Self {
2201        Self { ip_address: None, validate_location: None }
2202    }
2203}
2204impl Default for UpdateCustomerTax {
2205    fn default() -> Self {
2206        Self::new()
2207    }
2208}
2209/// A flag that indicates when Stripe should validate the customer tax location. Defaults to `auto`.
2210#[derive(Copy, Clone, Eq, PartialEq)]
2211pub enum UpdateCustomerTaxValidateLocation {
2212    Auto,
2213    Deferred,
2214    Immediately,
2215}
2216impl UpdateCustomerTaxValidateLocation {
2217    pub fn as_str(self) -> &'static str {
2218        use UpdateCustomerTaxValidateLocation::*;
2219        match self {
2220            Auto => "auto",
2221            Deferred => "deferred",
2222            Immediately => "immediately",
2223        }
2224    }
2225}
2226
2227impl std::str::FromStr for UpdateCustomerTaxValidateLocation {
2228    type Err = stripe_types::StripeParseError;
2229    fn from_str(s: &str) -> Result<Self, Self::Err> {
2230        use UpdateCustomerTaxValidateLocation::*;
2231        match s {
2232            "auto" => Ok(Auto),
2233            "deferred" => Ok(Deferred),
2234            "immediately" => Ok(Immediately),
2235            _ => Err(stripe_types::StripeParseError),
2236        }
2237    }
2238}
2239impl std::fmt::Display for UpdateCustomerTaxValidateLocation {
2240    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2241        f.write_str(self.as_str())
2242    }
2243}
2244
2245impl std::fmt::Debug for UpdateCustomerTaxValidateLocation {
2246    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2247        f.write_str(self.as_str())
2248    }
2249}
2250impl serde::Serialize for UpdateCustomerTaxValidateLocation {
2251    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2252    where
2253        S: serde::Serializer,
2254    {
2255        serializer.serialize_str(self.as_str())
2256    }
2257}
2258#[cfg(feature = "deserialize")]
2259impl<'de> serde::Deserialize<'de> for UpdateCustomerTaxValidateLocation {
2260    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2261        use std::str::FromStr;
2262        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2263        Self::from_str(&s).map_err(|_| {
2264            serde::de::Error::custom("Unknown value for UpdateCustomerTaxValidateLocation")
2265        })
2266    }
2267}
2268/// Updates the specified customer by setting the values of the parameters passed.
2269/// Any parameters not provided will be left unchanged.
2270/// 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.
2271/// 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.
2272/// This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice.
2273/// Changing the **default_source** for a customer will not trigger this behavior.
2274///
2275/// This request accepts mostly the same arguments as the customer creation call.
2276#[derive(Clone, Debug, serde::Serialize)]
2277pub struct UpdateCustomer {
2278    inner: UpdateCustomerBuilder,
2279    customer: stripe_shared::CustomerId,
2280}
2281impl UpdateCustomer {
2282    /// Construct a new `UpdateCustomer`.
2283    pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
2284        Self { customer: customer.into(), inner: UpdateCustomerBuilder::new() }
2285    }
2286    /// The customer's address.
2287    pub fn address(mut self, address: impl Into<OptionalFieldsCustomerAddress>) -> Self {
2288        self.inner.address = Some(address.into());
2289        self
2290    }
2291    /// An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices.
2292    /// A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
2293    pub fn balance(mut self, balance: impl Into<i64>) -> Self {
2294        self.inner.balance = Some(balance.into());
2295        self
2296    }
2297    /// The customer's business name. This may be up to *150 characters*.
2298    pub fn business_name(mut self, business_name: impl Into<String>) -> Self {
2299        self.inner.business_name = Some(business_name.into());
2300        self
2301    }
2302    /// Balance information and default balance settings for this customer.
2303    pub fn cash_balance(mut self, cash_balance: impl Into<UpdateCustomerCashBalance>) -> Self {
2304        self.inner.cash_balance = Some(cash_balance.into());
2305        self
2306    }
2307    /// 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.
2308    ///
2309    /// Provide the ID of a payment source already attached to this customer to make it this customer's default payment source.
2310    ///
2311    /// 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.
2312    pub fn default_source(mut self, default_source: impl Into<String>) -> Self {
2313        self.inner.default_source = Some(default_source.into());
2314        self
2315    }
2316    /// An arbitrary string that you can attach to a customer object.
2317    /// It is displayed alongside the customer in the dashboard.
2318    pub fn description(mut self, description: impl Into<String>) -> Self {
2319        self.inner.description = Some(description.into());
2320        self
2321    }
2322    /// Customer's email address.
2323    /// It's displayed alongside the customer in your dashboard and can be useful for searching and tracking.
2324    /// This may be up to *512 characters*.
2325    pub fn email(mut self, email: impl Into<String>) -> Self {
2326        self.inner.email = Some(email.into());
2327        self
2328    }
2329    /// Specifies which fields in the response should be expanded.
2330    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2331        self.inner.expand = Some(expand.into());
2332        self
2333    }
2334    /// The customer's full name. This may be up to *150 characters*.
2335    pub fn individual_name(mut self, individual_name: impl Into<String>) -> Self {
2336        self.inner.individual_name = Some(individual_name.into());
2337        self
2338    }
2339    /// The prefix for the customer used to generate unique invoice numbers.
2340    /// Must be 3–12 uppercase letters or numbers.
2341    pub fn invoice_prefix(mut self, invoice_prefix: impl Into<String>) -> Self {
2342        self.inner.invoice_prefix = Some(invoice_prefix.into());
2343        self
2344    }
2345    /// Default invoice settings for this customer.
2346    pub fn invoice_settings(
2347        mut self,
2348        invoice_settings: impl Into<UpdateCustomerInvoiceSettings>,
2349    ) -> Self {
2350        self.inner.invoice_settings = Some(invoice_settings.into());
2351        self
2352    }
2353    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
2354    /// This can be useful for storing additional information about the object in a structured format.
2355    /// Individual keys can be unset by posting an empty value to them.
2356    /// All keys can be unset by posting an empty value to `metadata`.
2357    pub fn metadata(
2358        mut self,
2359        metadata: impl Into<std::collections::HashMap<String, String>>,
2360    ) -> Self {
2361        self.inner.metadata = Some(metadata.into());
2362        self
2363    }
2364    /// The customer's full name or business name.
2365    pub fn name(mut self, name: impl Into<String>) -> Self {
2366        self.inner.name = Some(name.into());
2367        self
2368    }
2369    /// The sequence to be used on the customer's next invoice. Defaults to 1.
2370    pub fn next_invoice_sequence(mut self, next_invoice_sequence: impl Into<i64>) -> Self {
2371        self.inner.next_invoice_sequence = Some(next_invoice_sequence.into());
2372        self
2373    }
2374    /// The customer's phone number.
2375    pub fn phone(mut self, phone: impl Into<String>) -> Self {
2376        self.inner.phone = Some(phone.into());
2377        self
2378    }
2379    /// Customer's preferred languages, ordered by preference.
2380    pub fn preferred_locales(mut self, preferred_locales: impl Into<Vec<String>>) -> Self {
2381        self.inner.preferred_locales = Some(preferred_locales.into());
2382        self
2383    }
2384    /// The customer's shipping information. Appears on invoices emailed to this customer.
2385    pub fn shipping(mut self, shipping: impl Into<CustomerShipping>) -> Self {
2386        self.inner.shipping = Some(shipping.into());
2387        self
2388    }
2389    pub fn source(mut self, source: impl Into<String>) -> Self {
2390        self.inner.source = Some(source.into());
2391        self
2392    }
2393    /// Tax details about the customer.
2394    pub fn tax(mut self, tax: impl Into<UpdateCustomerTax>) -> Self {
2395        self.inner.tax = Some(tax.into());
2396        self
2397    }
2398    /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`.
2399    pub fn tax_exempt(mut self, tax_exempt: impl Into<stripe_shared::CustomerTaxExempt>) -> Self {
2400        self.inner.tax_exempt = Some(tax_exempt.into());
2401        self
2402    }
2403    pub fn validate(mut self, validate: impl Into<bool>) -> Self {
2404        self.inner.validate = Some(validate.into());
2405        self
2406    }
2407}
2408impl UpdateCustomer {
2409    /// Send the request and return the deserialized response.
2410    pub async fn send<C: StripeClient>(
2411        &self,
2412        client: &C,
2413    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2414        self.customize().send(client).await
2415    }
2416
2417    /// Send the request and return the deserialized response, blocking until completion.
2418    pub fn send_blocking<C: StripeBlockingClient>(
2419        &self,
2420        client: &C,
2421    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2422        self.customize().send_blocking(client)
2423    }
2424}
2425
2426impl StripeRequest for UpdateCustomer {
2427    type Output = stripe_shared::Customer;
2428
2429    fn build(&self) -> RequestBuilder {
2430        let customer = &self.customer;
2431        RequestBuilder::new(StripeMethod::Post, format!("/customers/{customer}")).form(&self.inner)
2432    }
2433}
2434#[derive(Clone, Debug, serde::Serialize)]
2435struct CreateFundingInstructionsCustomerBuilder {
2436    bank_transfer: CreateFundingInstructionsCustomerBankTransfer,
2437    currency: stripe_types::Currency,
2438    #[serde(skip_serializing_if = "Option::is_none")]
2439    expand: Option<Vec<String>>,
2440    funding_type: CreateFundingInstructionsCustomerFundingType,
2441}
2442impl CreateFundingInstructionsCustomerBuilder {
2443    fn new(
2444        bank_transfer: impl Into<CreateFundingInstructionsCustomerBankTransfer>,
2445        currency: impl Into<stripe_types::Currency>,
2446        funding_type: impl Into<CreateFundingInstructionsCustomerFundingType>,
2447    ) -> Self {
2448        Self {
2449            bank_transfer: bank_transfer.into(),
2450            currency: currency.into(),
2451            expand: None,
2452            funding_type: funding_type.into(),
2453        }
2454    }
2455}
2456/// Additional parameters for `bank_transfer` funding types
2457#[derive(Clone, Debug, serde::Serialize)]
2458pub struct CreateFundingInstructionsCustomerBankTransfer {
2459    /// Configuration for eu_bank_transfer funding type.
2460    #[serde(skip_serializing_if = "Option::is_none")]
2461    pub eu_bank_transfer: Option<CreateFundingInstructionsCustomerBankTransferEuBankTransfer>,
2462    /// List of address types that should be returned in the financial_addresses response.
2463    /// If not specified, all valid types will be returned.
2464    ///
2465    /// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`.
2466    #[serde(skip_serializing_if = "Option::is_none")]
2467    pub requested_address_types:
2468        Option<Vec<CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes>>,
2469    /// The type of the `bank_transfer`
2470    #[serde(rename = "type")]
2471    pub type_: CreateFundingInstructionsCustomerBankTransferType,
2472}
2473impl CreateFundingInstructionsCustomerBankTransfer {
2474    pub fn new(type_: impl Into<CreateFundingInstructionsCustomerBankTransferType>) -> Self {
2475        Self { eu_bank_transfer: None, requested_address_types: None, type_: type_.into() }
2476    }
2477}
2478/// Configuration for eu_bank_transfer funding type.
2479#[derive(Clone, Debug, serde::Serialize)]
2480pub struct CreateFundingInstructionsCustomerBankTransferEuBankTransfer {
2481    /// The desired country code of the bank account information.
2482    /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
2483    pub country: String,
2484}
2485impl CreateFundingInstructionsCustomerBankTransferEuBankTransfer {
2486    pub fn new(country: impl Into<String>) -> Self {
2487        Self { country: country.into() }
2488    }
2489}
2490/// List of address types that should be returned in the financial_addresses response.
2491/// If not specified, all valid types will be returned.
2492///
2493/// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`.
2494#[derive(Copy, Clone, Eq, PartialEq)]
2495pub enum CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2496    Iban,
2497    SortCode,
2498    Spei,
2499    Zengin,
2500}
2501impl CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2502    pub fn as_str(self) -> &'static str {
2503        use CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes::*;
2504        match self {
2505            Iban => "iban",
2506            SortCode => "sort_code",
2507            Spei => "spei",
2508            Zengin => "zengin",
2509        }
2510    }
2511}
2512
2513impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2514    type Err = stripe_types::StripeParseError;
2515    fn from_str(s: &str) -> Result<Self, Self::Err> {
2516        use CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes::*;
2517        match s {
2518            "iban" => Ok(Iban),
2519            "sort_code" => Ok(SortCode),
2520            "spei" => Ok(Spei),
2521            "zengin" => Ok(Zengin),
2522            _ => Err(stripe_types::StripeParseError),
2523        }
2524    }
2525}
2526impl std::fmt::Display for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2527    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2528        f.write_str(self.as_str())
2529    }
2530}
2531
2532impl std::fmt::Debug for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2533    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2534        f.write_str(self.as_str())
2535    }
2536}
2537impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2538    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2539    where
2540        S: serde::Serializer,
2541    {
2542        serializer.serialize_str(self.as_str())
2543    }
2544}
2545#[cfg(feature = "deserialize")]
2546impl<'de> serde::Deserialize<'de>
2547    for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes
2548{
2549    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2550        use std::str::FromStr;
2551        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2552        Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes"))
2553    }
2554}
2555/// The type of the `bank_transfer`
2556#[derive(Copy, Clone, Eq, PartialEq)]
2557pub enum CreateFundingInstructionsCustomerBankTransferType {
2558    EuBankTransfer,
2559    GbBankTransfer,
2560    JpBankTransfer,
2561    MxBankTransfer,
2562    UsBankTransfer,
2563}
2564impl CreateFundingInstructionsCustomerBankTransferType {
2565    pub fn as_str(self) -> &'static str {
2566        use CreateFundingInstructionsCustomerBankTransferType::*;
2567        match self {
2568            EuBankTransfer => "eu_bank_transfer",
2569            GbBankTransfer => "gb_bank_transfer",
2570            JpBankTransfer => "jp_bank_transfer",
2571            MxBankTransfer => "mx_bank_transfer",
2572            UsBankTransfer => "us_bank_transfer",
2573        }
2574    }
2575}
2576
2577impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferType {
2578    type Err = stripe_types::StripeParseError;
2579    fn from_str(s: &str) -> Result<Self, Self::Err> {
2580        use CreateFundingInstructionsCustomerBankTransferType::*;
2581        match s {
2582            "eu_bank_transfer" => Ok(EuBankTransfer),
2583            "gb_bank_transfer" => Ok(GbBankTransfer),
2584            "jp_bank_transfer" => Ok(JpBankTransfer),
2585            "mx_bank_transfer" => Ok(MxBankTransfer),
2586            "us_bank_transfer" => Ok(UsBankTransfer),
2587            _ => Err(stripe_types::StripeParseError),
2588        }
2589    }
2590}
2591impl std::fmt::Display for CreateFundingInstructionsCustomerBankTransferType {
2592    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2593        f.write_str(self.as_str())
2594    }
2595}
2596
2597impl std::fmt::Debug for CreateFundingInstructionsCustomerBankTransferType {
2598    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2599        f.write_str(self.as_str())
2600    }
2601}
2602impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferType {
2603    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2604    where
2605        S: serde::Serializer,
2606    {
2607        serializer.serialize_str(self.as_str())
2608    }
2609}
2610#[cfg(feature = "deserialize")]
2611impl<'de> serde::Deserialize<'de> for CreateFundingInstructionsCustomerBankTransferType {
2612    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2613        use std::str::FromStr;
2614        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2615        Self::from_str(&s).map_err(|_| {
2616            serde::de::Error::custom(
2617                "Unknown value for CreateFundingInstructionsCustomerBankTransferType",
2618            )
2619        })
2620    }
2621}
2622/// The `funding_type` to get the instructions for.
2623#[derive(Copy, Clone, Eq, PartialEq)]
2624pub enum CreateFundingInstructionsCustomerFundingType {
2625    BankTransfer,
2626}
2627impl CreateFundingInstructionsCustomerFundingType {
2628    pub fn as_str(self) -> &'static str {
2629        use CreateFundingInstructionsCustomerFundingType::*;
2630        match self {
2631            BankTransfer => "bank_transfer",
2632        }
2633    }
2634}
2635
2636impl std::str::FromStr for CreateFundingInstructionsCustomerFundingType {
2637    type Err = stripe_types::StripeParseError;
2638    fn from_str(s: &str) -> Result<Self, Self::Err> {
2639        use CreateFundingInstructionsCustomerFundingType::*;
2640        match s {
2641            "bank_transfer" => Ok(BankTransfer),
2642            _ => Err(stripe_types::StripeParseError),
2643        }
2644    }
2645}
2646impl std::fmt::Display for CreateFundingInstructionsCustomerFundingType {
2647    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2648        f.write_str(self.as_str())
2649    }
2650}
2651
2652impl std::fmt::Debug for CreateFundingInstructionsCustomerFundingType {
2653    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2654        f.write_str(self.as_str())
2655    }
2656}
2657impl serde::Serialize for CreateFundingInstructionsCustomerFundingType {
2658    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2659    where
2660        S: serde::Serializer,
2661    {
2662        serializer.serialize_str(self.as_str())
2663    }
2664}
2665#[cfg(feature = "deserialize")]
2666impl<'de> serde::Deserialize<'de> for CreateFundingInstructionsCustomerFundingType {
2667    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2668        use std::str::FromStr;
2669        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2670        Self::from_str(&s).map_err(|_| {
2671            serde::de::Error::custom(
2672                "Unknown value for CreateFundingInstructionsCustomerFundingType",
2673            )
2674        })
2675    }
2676}
2677/// Retrieve funding instructions for a customer cash balance.
2678/// If funding instructions do not yet exist for the customer, new.
2679/// funding instructions will be created.
2680/// If funding instructions have already been created for a given customer, the same.
2681/// funding instructions will be retrieved.
2682/// In other words, we will return the same funding instructions each time.
2683#[derive(Clone, Debug, serde::Serialize)]
2684pub struct CreateFundingInstructionsCustomer {
2685    inner: CreateFundingInstructionsCustomerBuilder,
2686    customer: stripe_shared::CustomerId,
2687}
2688impl CreateFundingInstructionsCustomer {
2689    /// Construct a new `CreateFundingInstructionsCustomer`.
2690    pub fn new(
2691        customer: impl Into<stripe_shared::CustomerId>,
2692        bank_transfer: impl Into<CreateFundingInstructionsCustomerBankTransfer>,
2693        currency: impl Into<stripe_types::Currency>,
2694        funding_type: impl Into<CreateFundingInstructionsCustomerFundingType>,
2695    ) -> Self {
2696        Self {
2697            customer: customer.into(),
2698            inner: CreateFundingInstructionsCustomerBuilder::new(
2699                bank_transfer.into(),
2700                currency.into(),
2701                funding_type.into(),
2702            ),
2703        }
2704    }
2705    /// Specifies which fields in the response should be expanded.
2706    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2707        self.inner.expand = Some(expand.into());
2708        self
2709    }
2710}
2711impl CreateFundingInstructionsCustomer {
2712    /// Send the request and return the deserialized response.
2713    pub async fn send<C: StripeClient>(
2714        &self,
2715        client: &C,
2716    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2717        self.customize().send(client).await
2718    }
2719
2720    /// Send the request and return the deserialized response, blocking until completion.
2721    pub fn send_blocking<C: StripeBlockingClient>(
2722        &self,
2723        client: &C,
2724    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2725        self.customize().send_blocking(client)
2726    }
2727}
2728
2729impl StripeRequest for CreateFundingInstructionsCustomer {
2730    type Output = stripe_shared::FundingInstructions;
2731
2732    fn build(&self) -> RequestBuilder {
2733        let customer = &self.customer;
2734        RequestBuilder::new(
2735            StripeMethod::Post,
2736            format!("/customers/{customer}/funding_instructions"),
2737        )
2738        .form(&self.inner)
2739    }
2740}
2741#[derive(Clone, Debug, serde::Serialize)]
2742struct FundCashBalanceCustomerBuilder {
2743    amount: i64,
2744    currency: stripe_types::Currency,
2745    #[serde(skip_serializing_if = "Option::is_none")]
2746    expand: Option<Vec<String>>,
2747    #[serde(skip_serializing_if = "Option::is_none")]
2748    reference: Option<String>,
2749}
2750impl FundCashBalanceCustomerBuilder {
2751    fn new(amount: impl Into<i64>, currency: impl Into<stripe_types::Currency>) -> Self {
2752        Self { amount: amount.into(), currency: currency.into(), expand: None, reference: None }
2753    }
2754}
2755/// Create an incoming testmode bank transfer
2756#[derive(Clone, Debug, serde::Serialize)]
2757pub struct FundCashBalanceCustomer {
2758    inner: FundCashBalanceCustomerBuilder,
2759    customer: String,
2760}
2761impl FundCashBalanceCustomer {
2762    /// Construct a new `FundCashBalanceCustomer`.
2763    pub fn new(
2764        customer: impl Into<String>,
2765        amount: impl Into<i64>,
2766        currency: impl Into<stripe_types::Currency>,
2767    ) -> Self {
2768        Self {
2769            customer: customer.into(),
2770            inner: FundCashBalanceCustomerBuilder::new(amount.into(), currency.into()),
2771        }
2772    }
2773    /// Specifies which fields in the response should be expanded.
2774    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2775        self.inner.expand = Some(expand.into());
2776        self
2777    }
2778    /// A description of the test funding.
2779    /// This simulates free-text references supplied by customers when making bank transfers to their cash balance.
2780    /// You can use this to test how Stripe's [reconciliation algorithm](https://stripe.com/docs/payments/customer-balance/reconciliation) applies to different user inputs.
2781    pub fn reference(mut self, reference: impl Into<String>) -> Self {
2782        self.inner.reference = Some(reference.into());
2783        self
2784    }
2785}
2786impl FundCashBalanceCustomer {
2787    /// Send the request and return the deserialized response.
2788    pub async fn send<C: StripeClient>(
2789        &self,
2790        client: &C,
2791    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2792        self.customize().send(client).await
2793    }
2794
2795    /// Send the request and return the deserialized response, blocking until completion.
2796    pub fn send_blocking<C: StripeBlockingClient>(
2797        &self,
2798        client: &C,
2799    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2800        self.customize().send_blocking(client)
2801    }
2802}
2803
2804impl StripeRequest for FundCashBalanceCustomer {
2805    type Output = stripe_shared::CustomerCashBalanceTransaction;
2806
2807    fn build(&self) -> RequestBuilder {
2808        let customer = &self.customer;
2809        RequestBuilder::new(
2810            StripeMethod::Post,
2811            format!("/test_helpers/customers/{customer}/fund_cash_balance"),
2812        )
2813        .form(&self.inner)
2814    }
2815}
2816
2817#[derive(Clone, Debug, serde::Serialize)]
2818pub struct OptionalFieldsCustomerAddress {
2819    /// City, district, suburb, town, or village.
2820    #[serde(skip_serializing_if = "Option::is_none")]
2821    pub city: Option<String>,
2822    /// A freeform text field for the country.
2823    /// However, in order to activate some tax features, the format should be a two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
2824    #[serde(skip_serializing_if = "Option::is_none")]
2825    pub country: Option<String>,
2826    /// Address line 1, such as the street, PO Box, or company name.
2827    #[serde(skip_serializing_if = "Option::is_none")]
2828    pub line1: Option<String>,
2829    /// Address line 2, such as the apartment, suite, unit, or building.
2830    #[serde(skip_serializing_if = "Option::is_none")]
2831    pub line2: Option<String>,
2832    /// ZIP or postal code.
2833    #[serde(skip_serializing_if = "Option::is_none")]
2834    pub postal_code: Option<String>,
2835    /// State, county, province, or region.
2836    #[serde(skip_serializing_if = "Option::is_none")]
2837    pub state: Option<String>,
2838}
2839impl OptionalFieldsCustomerAddress {
2840    pub fn new() -> Self {
2841        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
2842    }
2843}
2844impl Default for OptionalFieldsCustomerAddress {
2845    fn default() -> Self {
2846        Self::new()
2847    }
2848}
2849#[derive(Clone, Debug, serde::Serialize)]
2850pub struct CustomFieldParams {
2851    /// The name of the custom field. This may be up to 40 characters.
2852    pub name: String,
2853    /// The value of the custom field. This may be up to 140 characters.
2854    pub value: String,
2855}
2856impl CustomFieldParams {
2857    pub fn new(name: impl Into<String>, value: impl Into<String>) -> Self {
2858        Self { name: name.into(), value: value.into() }
2859    }
2860}
2861#[derive(Clone, Debug, serde::Serialize)]
2862pub struct CustomerShipping {
2863    /// Customer shipping address.
2864    pub address: OptionalFieldsCustomerAddress,
2865    /// Customer name.
2866    pub name: String,
2867    /// Customer phone (including extension).
2868    #[serde(skip_serializing_if = "Option::is_none")]
2869    pub phone: Option<String>,
2870}
2871impl CustomerShipping {
2872    pub fn new(address: impl Into<OptionalFieldsCustomerAddress>, name: impl Into<String>) -> Self {
2873        Self { address: address.into(), name: name.into(), phone: None }
2874    }
2875}