1use stripe_client_core::{
2 RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
9pub struct DeleteCustomer {
10 customer: stripe_shared::CustomerId,
11}
12impl DeleteCustomer {
13 pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
15 Self { customer: customer.into() }
16 }
17}
18impl DeleteCustomer {
19 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 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#[derive(Clone, Debug, serde::Serialize)]
46pub struct DeleteDiscountCustomer {
47 customer: stripe_shared::CustomerId,
48}
49impl DeleteDiscountCustomer {
50 pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
52 Self { customer: customer.into() }
53 }
54}
55impl DeleteDiscountCustomer {
56 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 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#[derive(Clone, Debug, serde::Serialize)]
114pub struct ListCustomer {
115 inner: ListCustomerBuilder,
116}
117impl ListCustomer {
118 pub fn new() -> Self {
120 Self { inner: ListCustomerBuilder::new() }
121 }
122 pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
124 self.inner.created = Some(created.into());
125 self
126 }
127 pub fn email(mut self, email: impl Into<String>) -> Self {
130 self.inner.email = Some(email.into());
131 self
132 }
133 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 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
142 self.inner.expand = Some(expand.into());
143 self
144 }
145 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
148 self.inner.limit = Some(limit.into());
149 self
150 }
151 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 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 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 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#[derive(Clone, Debug, serde::Serialize)]
213pub struct RetrieveCustomer {
214 inner: RetrieveCustomerBuilder,
215 customer: stripe_shared::CustomerId,
216}
217impl RetrieveCustomer {
218 pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
220 Self { customer: customer.into(), inner: RetrieveCustomerBuilder::new() }
221 }
222 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 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 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#[derive(Clone, Debug, serde::Serialize)]
352pub struct BalanceTransactionsCustomer {
353 inner: BalanceTransactionsCustomerBuilder,
354 customer: stripe_shared::CustomerId,
355}
356impl BalanceTransactionsCustomer {
357 pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
359 Self { customer: customer.into(), inner: BalanceTransactionsCustomerBuilder::new() }
360 }
361 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 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
370 self.inner.expand = Some(expand.into());
371 self
372 }
373 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
376 self.inner.limit = Some(limit.into());
377 self
378 }
379 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 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 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#[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#[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 Custom,
540 CustomerBalance,
541 Eps,
542 Fpx,
543 Giropay,
544 Grabpay,
545 Ideal,
546 KakaoPay,
547 Klarna,
548 Konbini,
549 KrCard,
550 Link,
551 MbWay,
552 Mobilepay,
553 Multibanco,
554 NaverPay,
555 NzBankAccount,
556 Oxxo,
557 P24,
558 PayByBank,
559 Payco,
560 Paynow,
561 Paypal,
562 Pix,
563 Promptpay,
564 RevolutPay,
565 SamsungPay,
566 Satispay,
567 SepaDebit,
568 Sofort,
569 Swish,
570 Twint,
571 UsBankAccount,
572 WechatPay,
573 Zip,
574 Unknown(String),
576}
577impl ListPaymentMethodsCustomerType {
578 pub fn as_str(&self) -> &str {
579 use ListPaymentMethodsCustomerType::*;
580 match self {
581 AcssDebit => "acss_debit",
582 Affirm => "affirm",
583 AfterpayClearpay => "afterpay_clearpay",
584 Alipay => "alipay",
585 Alma => "alma",
586 AmazonPay => "amazon_pay",
587 AuBecsDebit => "au_becs_debit",
588 BacsDebit => "bacs_debit",
589 Bancontact => "bancontact",
590 Billie => "billie",
591 Blik => "blik",
592 Boleto => "boleto",
593 Card => "card",
594 Cashapp => "cashapp",
595 Crypto => "crypto",
596 Custom => "custom",
597 CustomerBalance => "customer_balance",
598 Eps => "eps",
599 Fpx => "fpx",
600 Giropay => "giropay",
601 Grabpay => "grabpay",
602 Ideal => "ideal",
603 KakaoPay => "kakao_pay",
604 Klarna => "klarna",
605 Konbini => "konbini",
606 KrCard => "kr_card",
607 Link => "link",
608 MbWay => "mb_way",
609 Mobilepay => "mobilepay",
610 Multibanco => "multibanco",
611 NaverPay => "naver_pay",
612 NzBankAccount => "nz_bank_account",
613 Oxxo => "oxxo",
614 P24 => "p24",
615 PayByBank => "pay_by_bank",
616 Payco => "payco",
617 Paynow => "paynow",
618 Paypal => "paypal",
619 Pix => "pix",
620 Promptpay => "promptpay",
621 RevolutPay => "revolut_pay",
622 SamsungPay => "samsung_pay",
623 Satispay => "satispay",
624 SepaDebit => "sepa_debit",
625 Sofort => "sofort",
626 Swish => "swish",
627 Twint => "twint",
628 UsBankAccount => "us_bank_account",
629 WechatPay => "wechat_pay",
630 Zip => "zip",
631 Unknown(v) => v,
632 }
633 }
634}
635
636impl std::str::FromStr for ListPaymentMethodsCustomerType {
637 type Err = std::convert::Infallible;
638 fn from_str(s: &str) -> Result<Self, Self::Err> {
639 use ListPaymentMethodsCustomerType::*;
640 match s {
641 "acss_debit" => Ok(AcssDebit),
642 "affirm" => Ok(Affirm),
643 "afterpay_clearpay" => Ok(AfterpayClearpay),
644 "alipay" => Ok(Alipay),
645 "alma" => Ok(Alma),
646 "amazon_pay" => Ok(AmazonPay),
647 "au_becs_debit" => Ok(AuBecsDebit),
648 "bacs_debit" => Ok(BacsDebit),
649 "bancontact" => Ok(Bancontact),
650 "billie" => Ok(Billie),
651 "blik" => Ok(Blik),
652 "boleto" => Ok(Boleto),
653 "card" => Ok(Card),
654 "cashapp" => Ok(Cashapp),
655 "crypto" => Ok(Crypto),
656 "custom" => Ok(Custom),
657 "customer_balance" => Ok(CustomerBalance),
658 "eps" => Ok(Eps),
659 "fpx" => Ok(Fpx),
660 "giropay" => Ok(Giropay),
661 "grabpay" => Ok(Grabpay),
662 "ideal" => Ok(Ideal),
663 "kakao_pay" => Ok(KakaoPay),
664 "klarna" => Ok(Klarna),
665 "konbini" => Ok(Konbini),
666 "kr_card" => Ok(KrCard),
667 "link" => Ok(Link),
668 "mb_way" => Ok(MbWay),
669 "mobilepay" => Ok(Mobilepay),
670 "multibanco" => Ok(Multibanco),
671 "naver_pay" => Ok(NaverPay),
672 "nz_bank_account" => Ok(NzBankAccount),
673 "oxxo" => Ok(Oxxo),
674 "p24" => Ok(P24),
675 "pay_by_bank" => Ok(PayByBank),
676 "payco" => Ok(Payco),
677 "paynow" => Ok(Paynow),
678 "paypal" => Ok(Paypal),
679 "pix" => Ok(Pix),
680 "promptpay" => Ok(Promptpay),
681 "revolut_pay" => Ok(RevolutPay),
682 "samsung_pay" => Ok(SamsungPay),
683 "satispay" => Ok(Satispay),
684 "sepa_debit" => Ok(SepaDebit),
685 "sofort" => Ok(Sofort),
686 "swish" => Ok(Swish),
687 "twint" => Ok(Twint),
688 "us_bank_account" => Ok(UsBankAccount),
689 "wechat_pay" => Ok(WechatPay),
690 "zip" => Ok(Zip),
691 v => Ok(Unknown(v.to_owned())),
692 }
693 }
694}
695impl std::fmt::Display for ListPaymentMethodsCustomerType {
696 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
697 f.write_str(self.as_str())
698 }
699}
700
701impl std::fmt::Debug for ListPaymentMethodsCustomerType {
702 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
703 f.write_str(self.as_str())
704 }
705}
706impl serde::Serialize for ListPaymentMethodsCustomerType {
707 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
708 where
709 S: serde::Serializer,
710 {
711 serializer.serialize_str(self.as_str())
712 }
713}
714#[cfg(feature = "deserialize")]
715impl<'de> serde::Deserialize<'de> for ListPaymentMethodsCustomerType {
716 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
717 use std::str::FromStr;
718 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
719 Ok(Self::from_str(&s).unwrap())
720 }
721}
722#[derive(Clone, Debug, serde::Serialize)]
724pub struct ListPaymentMethodsCustomer {
725 inner: ListPaymentMethodsCustomerBuilder,
726 customer: stripe_shared::CustomerId,
727}
728impl ListPaymentMethodsCustomer {
729 pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
731 Self { customer: customer.into(), inner: ListPaymentMethodsCustomerBuilder::new() }
732 }
733 pub fn allow_redisplay(
736 mut self,
737 allow_redisplay: impl Into<ListPaymentMethodsCustomerAllowRedisplay>,
738 ) -> Self {
739 self.inner.allow_redisplay = Some(allow_redisplay.into());
740 self
741 }
742 pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
746 self.inner.ending_before = Some(ending_before.into());
747 self
748 }
749 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
751 self.inner.expand = Some(expand.into());
752 self
753 }
754 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
757 self.inner.limit = Some(limit.into());
758 self
759 }
760 pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
764 self.inner.starting_after = Some(starting_after.into());
765 self
766 }
767 pub fn type_(mut self, type_: impl Into<ListPaymentMethodsCustomerType>) -> Self {
771 self.inner.type_ = Some(type_.into());
772 self
773 }
774}
775impl ListPaymentMethodsCustomer {
776 pub async fn send<C: StripeClient>(
778 &self,
779 client: &C,
780 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
781 self.customize().send(client).await
782 }
783
784 pub fn send_blocking<C: StripeBlockingClient>(
786 &self,
787 client: &C,
788 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
789 self.customize().send_blocking(client)
790 }
791
792 pub fn paginate(
793 &self,
794 ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::PaymentMethod>> {
795 let customer = &self.customer;
796
797 stripe_client_core::ListPaginator::new_list(
798 format!("/customers/{customer}/payment_methods"),
799 &self.inner,
800 )
801 }
802}
803
804impl StripeRequest for ListPaymentMethodsCustomer {
805 type Output = stripe_types::List<stripe_shared::PaymentMethod>;
806
807 fn build(&self) -> RequestBuilder {
808 let customer = &self.customer;
809 RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}/payment_methods"))
810 .query(&self.inner)
811 }
812}
813#[derive(Clone, Debug, serde::Serialize)]
814struct RetrievePaymentMethodCustomerBuilder {
815 #[serde(skip_serializing_if = "Option::is_none")]
816 expand: Option<Vec<String>>,
817}
818impl RetrievePaymentMethodCustomerBuilder {
819 fn new() -> Self {
820 Self { expand: None }
821 }
822}
823#[derive(Clone, Debug, serde::Serialize)]
825pub struct RetrievePaymentMethodCustomer {
826 inner: RetrievePaymentMethodCustomerBuilder,
827 customer: stripe_shared::CustomerId,
828 payment_method: String,
829}
830impl RetrievePaymentMethodCustomer {
831 pub fn new(
833 customer: impl Into<stripe_shared::CustomerId>,
834 payment_method: impl Into<String>,
835 ) -> Self {
836 Self {
837 customer: customer.into(),
838 payment_method: payment_method.into(),
839 inner: RetrievePaymentMethodCustomerBuilder::new(),
840 }
841 }
842 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
844 self.inner.expand = Some(expand.into());
845 self
846 }
847}
848impl RetrievePaymentMethodCustomer {
849 pub async fn send<C: StripeClient>(
851 &self,
852 client: &C,
853 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
854 self.customize().send(client).await
855 }
856
857 pub fn send_blocking<C: StripeBlockingClient>(
859 &self,
860 client: &C,
861 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
862 self.customize().send_blocking(client)
863 }
864}
865
866impl StripeRequest for RetrievePaymentMethodCustomer {
867 type Output = stripe_shared::PaymentMethod;
868
869 fn build(&self) -> RequestBuilder {
870 let customer = &self.customer;
871 let payment_method = &self.payment_method;
872 RequestBuilder::new(
873 StripeMethod::Get,
874 format!("/customers/{customer}/payment_methods/{payment_method}"),
875 )
876 .query(&self.inner)
877 }
878}
879#[derive(Clone, Debug, serde::Serialize)]
880struct SearchCustomerBuilder {
881 #[serde(skip_serializing_if = "Option::is_none")]
882 expand: Option<Vec<String>>,
883 #[serde(skip_serializing_if = "Option::is_none")]
884 limit: Option<i64>,
885 #[serde(skip_serializing_if = "Option::is_none")]
886 page: Option<String>,
887 query: String,
888}
889impl SearchCustomerBuilder {
890 fn new(query: impl Into<String>) -> Self {
891 Self { expand: None, limit: None, page: None, query: query.into() }
892 }
893}
894#[derive(Clone, Debug, serde::Serialize)]
901pub struct SearchCustomer {
902 inner: SearchCustomerBuilder,
903}
904impl SearchCustomer {
905 pub fn new(query: impl Into<String>) -> Self {
907 Self { inner: SearchCustomerBuilder::new(query.into()) }
908 }
909 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
911 self.inner.expand = Some(expand.into());
912 self
913 }
914 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
917 self.inner.limit = Some(limit.into());
918 self
919 }
920 pub fn page(mut self, page: impl Into<String>) -> Self {
924 self.inner.page = Some(page.into());
925 self
926 }
927}
928impl SearchCustomer {
929 pub async fn send<C: StripeClient>(
931 &self,
932 client: &C,
933 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
934 self.customize().send(client).await
935 }
936
937 pub fn send_blocking<C: StripeBlockingClient>(
939 &self,
940 client: &C,
941 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
942 self.customize().send_blocking(client)
943 }
944
945 pub fn paginate(
946 &self,
947 ) -> stripe_client_core::ListPaginator<stripe_types::SearchList<stripe_shared::Customer>> {
948 stripe_client_core::ListPaginator::new_search_list("/customers/search", &self.inner)
949 }
950}
951
952impl StripeRequest for SearchCustomer {
953 type Output = stripe_types::SearchList<stripe_shared::Customer>;
954
955 fn build(&self) -> RequestBuilder {
956 RequestBuilder::new(StripeMethod::Get, "/customers/search").query(&self.inner)
957 }
958}
959#[derive(Clone, Debug, serde::Serialize)]
960struct CreateCustomerBuilder {
961 #[serde(skip_serializing_if = "Option::is_none")]
962 address: Option<OptionalFieldsCustomerAddress>,
963 #[serde(skip_serializing_if = "Option::is_none")]
964 balance: Option<i64>,
965 #[serde(skip_serializing_if = "Option::is_none")]
966 business_name: Option<String>,
967 #[serde(skip_serializing_if = "Option::is_none")]
968 cash_balance: Option<CreateCustomerCashBalance>,
969 #[serde(skip_serializing_if = "Option::is_none")]
970 description: Option<String>,
971 #[serde(skip_serializing_if = "Option::is_none")]
972 email: Option<String>,
973 #[serde(skip_serializing_if = "Option::is_none")]
974 expand: Option<Vec<String>>,
975 #[serde(skip_serializing_if = "Option::is_none")]
976 individual_name: Option<String>,
977 #[serde(skip_serializing_if = "Option::is_none")]
978 invoice_prefix: Option<String>,
979 #[serde(skip_serializing_if = "Option::is_none")]
980 invoice_settings: Option<CreateCustomerInvoiceSettings>,
981 #[serde(skip_serializing_if = "Option::is_none")]
982 metadata: Option<std::collections::HashMap<String, String>>,
983 #[serde(skip_serializing_if = "Option::is_none")]
984 name: Option<String>,
985 #[serde(skip_serializing_if = "Option::is_none")]
986 next_invoice_sequence: Option<i64>,
987 #[serde(skip_serializing_if = "Option::is_none")]
988 payment_method: Option<String>,
989 #[serde(skip_serializing_if = "Option::is_none")]
990 phone: Option<String>,
991 #[serde(skip_serializing_if = "Option::is_none")]
992 preferred_locales: Option<Vec<String>>,
993 #[serde(skip_serializing_if = "Option::is_none")]
994 shipping: Option<CustomerShipping>,
995 #[serde(skip_serializing_if = "Option::is_none")]
996 source: Option<String>,
997 #[serde(skip_serializing_if = "Option::is_none")]
998 tax: Option<CreateCustomerTax>,
999 #[serde(skip_serializing_if = "Option::is_none")]
1000 tax_exempt: Option<stripe_shared::CustomerTaxExempt>,
1001 #[serde(skip_serializing_if = "Option::is_none")]
1002 tax_id_data: Option<Vec<CreateCustomerTaxIdData>>,
1003 #[serde(skip_serializing_if = "Option::is_none")]
1004 test_clock: Option<String>,
1005 #[serde(skip_serializing_if = "Option::is_none")]
1006 validate: Option<bool>,
1007}
1008impl CreateCustomerBuilder {
1009 fn new() -> Self {
1010 Self {
1011 address: None,
1012 balance: None,
1013 business_name: None,
1014 cash_balance: None,
1015 description: None,
1016 email: None,
1017 expand: None,
1018 individual_name: None,
1019 invoice_prefix: None,
1020 invoice_settings: None,
1021 metadata: None,
1022 name: None,
1023 next_invoice_sequence: None,
1024 payment_method: None,
1025 phone: None,
1026 preferred_locales: None,
1027 shipping: None,
1028 source: None,
1029 tax: None,
1030 tax_exempt: None,
1031 tax_id_data: None,
1032 test_clock: None,
1033 validate: None,
1034 }
1035 }
1036}
1037#[derive(Copy, Clone, Debug, serde::Serialize)]
1039pub struct CreateCustomerCashBalance {
1040 #[serde(skip_serializing_if = "Option::is_none")]
1043 pub settings: Option<CreateCustomerCashBalanceSettings>,
1044}
1045impl CreateCustomerCashBalance {
1046 pub fn new() -> Self {
1047 Self { settings: None }
1048 }
1049}
1050impl Default for CreateCustomerCashBalance {
1051 fn default() -> Self {
1052 Self::new()
1053 }
1054}
1055#[derive(Copy, Clone, Debug, serde::Serialize)]
1058pub struct CreateCustomerCashBalanceSettings {
1059 #[serde(skip_serializing_if = "Option::is_none")]
1063 pub reconciliation_mode: Option<CreateCustomerCashBalanceSettingsReconciliationMode>,
1064}
1065impl CreateCustomerCashBalanceSettings {
1066 pub fn new() -> Self {
1067 Self { reconciliation_mode: None }
1068 }
1069}
1070impl Default for CreateCustomerCashBalanceSettings {
1071 fn default() -> Self {
1072 Self::new()
1073 }
1074}
1075#[derive(Copy, Clone, Eq, PartialEq)]
1079pub enum CreateCustomerCashBalanceSettingsReconciliationMode {
1080 Automatic,
1081 Manual,
1082 MerchantDefault,
1083}
1084impl CreateCustomerCashBalanceSettingsReconciliationMode {
1085 pub fn as_str(self) -> &'static str {
1086 use CreateCustomerCashBalanceSettingsReconciliationMode::*;
1087 match self {
1088 Automatic => "automatic",
1089 Manual => "manual",
1090 MerchantDefault => "merchant_default",
1091 }
1092 }
1093}
1094
1095impl std::str::FromStr for CreateCustomerCashBalanceSettingsReconciliationMode {
1096 type Err = stripe_types::StripeParseError;
1097 fn from_str(s: &str) -> Result<Self, Self::Err> {
1098 use CreateCustomerCashBalanceSettingsReconciliationMode::*;
1099 match s {
1100 "automatic" => Ok(Automatic),
1101 "manual" => Ok(Manual),
1102 "merchant_default" => Ok(MerchantDefault),
1103 _ => Err(stripe_types::StripeParseError),
1104 }
1105 }
1106}
1107impl std::fmt::Display for CreateCustomerCashBalanceSettingsReconciliationMode {
1108 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1109 f.write_str(self.as_str())
1110 }
1111}
1112
1113impl std::fmt::Debug for CreateCustomerCashBalanceSettingsReconciliationMode {
1114 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1115 f.write_str(self.as_str())
1116 }
1117}
1118impl serde::Serialize for CreateCustomerCashBalanceSettingsReconciliationMode {
1119 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1120 where
1121 S: serde::Serializer,
1122 {
1123 serializer.serialize_str(self.as_str())
1124 }
1125}
1126#[cfg(feature = "deserialize")]
1127impl<'de> serde::Deserialize<'de> for CreateCustomerCashBalanceSettingsReconciliationMode {
1128 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1129 use std::str::FromStr;
1130 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1131 Self::from_str(&s).map_err(|_| {
1132 serde::de::Error::custom(
1133 "Unknown value for CreateCustomerCashBalanceSettingsReconciliationMode",
1134 )
1135 })
1136 }
1137}
1138#[derive(Clone, Debug, serde::Serialize)]
1140pub struct CreateCustomerInvoiceSettings {
1141 #[serde(skip_serializing_if = "Option::is_none")]
1144 pub custom_fields: Option<Vec<CustomFieldParams>>,
1145 #[serde(skip_serializing_if = "Option::is_none")]
1147 pub default_payment_method: Option<String>,
1148 #[serde(skip_serializing_if = "Option::is_none")]
1150 pub footer: Option<String>,
1151 #[serde(skip_serializing_if = "Option::is_none")]
1153 pub rendering_options: Option<CreateCustomerInvoiceSettingsRenderingOptions>,
1154}
1155impl CreateCustomerInvoiceSettings {
1156 pub fn new() -> Self {
1157 Self {
1158 custom_fields: None,
1159 default_payment_method: None,
1160 footer: None,
1161 rendering_options: None,
1162 }
1163 }
1164}
1165impl Default for CreateCustomerInvoiceSettings {
1166 fn default() -> Self {
1167 Self::new()
1168 }
1169}
1170#[derive(Clone, Debug, serde::Serialize)]
1172pub struct CreateCustomerInvoiceSettingsRenderingOptions {
1173 #[serde(skip_serializing_if = "Option::is_none")]
1178 pub amount_tax_display: Option<CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay>,
1179 #[serde(skip_serializing_if = "Option::is_none")]
1181 pub template: Option<String>,
1182}
1183impl CreateCustomerInvoiceSettingsRenderingOptions {
1184 pub fn new() -> Self {
1185 Self { amount_tax_display: None, template: None }
1186 }
1187}
1188impl Default for CreateCustomerInvoiceSettingsRenderingOptions {
1189 fn default() -> Self {
1190 Self::new()
1191 }
1192}
1193#[derive(Copy, Clone, Eq, PartialEq)]
1198pub enum CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1199 ExcludeTax,
1200 IncludeInclusiveTax,
1201}
1202impl CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1203 pub fn as_str(self) -> &'static str {
1204 use CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
1205 match self {
1206 ExcludeTax => "exclude_tax",
1207 IncludeInclusiveTax => "include_inclusive_tax",
1208 }
1209 }
1210}
1211
1212impl std::str::FromStr for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1213 type Err = stripe_types::StripeParseError;
1214 fn from_str(s: &str) -> Result<Self, Self::Err> {
1215 use CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
1216 match s {
1217 "exclude_tax" => Ok(ExcludeTax),
1218 "include_inclusive_tax" => Ok(IncludeInclusiveTax),
1219 _ => Err(stripe_types::StripeParseError),
1220 }
1221 }
1222}
1223impl std::fmt::Display for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1224 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1225 f.write_str(self.as_str())
1226 }
1227}
1228
1229impl std::fmt::Debug for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1230 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1231 f.write_str(self.as_str())
1232 }
1233}
1234impl serde::Serialize for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1235 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1236 where
1237 S: serde::Serializer,
1238 {
1239 serializer.serialize_str(self.as_str())
1240 }
1241}
1242#[cfg(feature = "deserialize")]
1243impl<'de> serde::Deserialize<'de>
1244 for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay
1245{
1246 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1247 use std::str::FromStr;
1248 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1249 Self::from_str(&s).map_err(|_| {
1250 serde::de::Error::custom(
1251 "Unknown value for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay",
1252 )
1253 })
1254 }
1255}
1256#[derive(Clone, Debug, serde::Serialize)]
1258pub struct CreateCustomerTax {
1259 #[serde(skip_serializing_if = "Option::is_none")]
1263 pub ip_address: Option<String>,
1264 #[serde(skip_serializing_if = "Option::is_none")]
1267 pub validate_location: Option<CreateCustomerTaxValidateLocation>,
1268}
1269impl CreateCustomerTax {
1270 pub fn new() -> Self {
1271 Self { ip_address: None, validate_location: None }
1272 }
1273}
1274impl Default for CreateCustomerTax {
1275 fn default() -> Self {
1276 Self::new()
1277 }
1278}
1279#[derive(Copy, Clone, Eq, PartialEq)]
1282pub enum CreateCustomerTaxValidateLocation {
1283 Deferred,
1284 Immediately,
1285}
1286impl CreateCustomerTaxValidateLocation {
1287 pub fn as_str(self) -> &'static str {
1288 use CreateCustomerTaxValidateLocation::*;
1289 match self {
1290 Deferred => "deferred",
1291 Immediately => "immediately",
1292 }
1293 }
1294}
1295
1296impl std::str::FromStr for CreateCustomerTaxValidateLocation {
1297 type Err = stripe_types::StripeParseError;
1298 fn from_str(s: &str) -> Result<Self, Self::Err> {
1299 use CreateCustomerTaxValidateLocation::*;
1300 match s {
1301 "deferred" => Ok(Deferred),
1302 "immediately" => Ok(Immediately),
1303 _ => Err(stripe_types::StripeParseError),
1304 }
1305 }
1306}
1307impl std::fmt::Display for CreateCustomerTaxValidateLocation {
1308 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1309 f.write_str(self.as_str())
1310 }
1311}
1312
1313impl std::fmt::Debug for CreateCustomerTaxValidateLocation {
1314 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1315 f.write_str(self.as_str())
1316 }
1317}
1318impl serde::Serialize for CreateCustomerTaxValidateLocation {
1319 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1320 where
1321 S: serde::Serializer,
1322 {
1323 serializer.serialize_str(self.as_str())
1324 }
1325}
1326#[cfg(feature = "deserialize")]
1327impl<'de> serde::Deserialize<'de> for CreateCustomerTaxValidateLocation {
1328 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1329 use std::str::FromStr;
1330 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1331 Self::from_str(&s).map_err(|_| {
1332 serde::de::Error::custom("Unknown value for CreateCustomerTaxValidateLocation")
1333 })
1334 }
1335}
1336#[derive(Clone, Debug, serde::Serialize)]
1338pub struct CreateCustomerTaxIdData {
1339 #[serde(rename = "type")]
1341 pub type_: CreateCustomerTaxIdDataType,
1342 pub value: String,
1344}
1345impl CreateCustomerTaxIdData {
1346 pub fn new(type_: impl Into<CreateCustomerTaxIdDataType>, value: impl Into<String>) -> Self {
1347 Self { type_: type_.into(), value: value.into() }
1348 }
1349}
1350#[derive(Clone, Eq, PartialEq)]
1352#[non_exhaustive]
1353pub enum CreateCustomerTaxIdDataType {
1354 AdNrt,
1355 AeTrn,
1356 AlTin,
1357 AmTin,
1358 AoTin,
1359 ArCuit,
1360 AuAbn,
1361 AuArn,
1362 AwTin,
1363 AzTin,
1364 BaTin,
1365 BbTin,
1366 BdBin,
1367 BfIfu,
1368 BgUic,
1369 BhVat,
1370 BjIfu,
1371 BoTin,
1372 BrCnpj,
1373 BrCpf,
1374 BsTin,
1375 ByTin,
1376 CaBn,
1377 CaGstHst,
1378 CaPstBc,
1379 CaPstMb,
1380 CaPstSk,
1381 CaQst,
1382 CdNif,
1383 ChUid,
1384 ChVat,
1385 ClTin,
1386 CmNiu,
1387 CnTin,
1388 CoNit,
1389 CrTin,
1390 CvNif,
1391 DeStn,
1392 DoRcn,
1393 EcRuc,
1394 EgTin,
1395 EsCif,
1396 EtTin,
1397 EuOssVat,
1398 EuVat,
1399 GbVat,
1400 GeVat,
1401 GnNif,
1402 HkBr,
1403 HrOib,
1404 HuTin,
1405 IdNpwp,
1406 IlVat,
1407 InGst,
1408 IsVat,
1409 JpCn,
1410 JpRn,
1411 JpTrn,
1412 KePin,
1413 KgTin,
1414 KhTin,
1415 KrBrn,
1416 KzBin,
1417 LaTin,
1418 LiUid,
1419 LiVat,
1420 MaVat,
1421 MdVat,
1422 MePib,
1423 MkVat,
1424 MrNif,
1425 MxRfc,
1426 MyFrp,
1427 MyItn,
1428 MySst,
1429 NgTin,
1430 NoVat,
1431 NoVoec,
1432 NpPan,
1433 NzGst,
1434 OmVat,
1435 PeRuc,
1436 PhTin,
1437 RoTin,
1438 RsPib,
1439 RuInn,
1440 RuKpp,
1441 SaVat,
1442 SgGst,
1443 SgUen,
1444 SiTin,
1445 SnNinea,
1446 SrFin,
1447 SvNit,
1448 ThVat,
1449 TjTin,
1450 TrTin,
1451 TwVat,
1452 TzVat,
1453 UaVat,
1454 UgTin,
1455 UsEin,
1456 UyRuc,
1457 UzTin,
1458 UzVat,
1459 VeRif,
1460 VnTin,
1461 ZaVat,
1462 ZmTin,
1463 ZwTin,
1464 Unknown(String),
1466}
1467impl CreateCustomerTaxIdDataType {
1468 pub fn as_str(&self) -> &str {
1469 use CreateCustomerTaxIdDataType::*;
1470 match self {
1471 AdNrt => "ad_nrt",
1472 AeTrn => "ae_trn",
1473 AlTin => "al_tin",
1474 AmTin => "am_tin",
1475 AoTin => "ao_tin",
1476 ArCuit => "ar_cuit",
1477 AuAbn => "au_abn",
1478 AuArn => "au_arn",
1479 AwTin => "aw_tin",
1480 AzTin => "az_tin",
1481 BaTin => "ba_tin",
1482 BbTin => "bb_tin",
1483 BdBin => "bd_bin",
1484 BfIfu => "bf_ifu",
1485 BgUic => "bg_uic",
1486 BhVat => "bh_vat",
1487 BjIfu => "bj_ifu",
1488 BoTin => "bo_tin",
1489 BrCnpj => "br_cnpj",
1490 BrCpf => "br_cpf",
1491 BsTin => "bs_tin",
1492 ByTin => "by_tin",
1493 CaBn => "ca_bn",
1494 CaGstHst => "ca_gst_hst",
1495 CaPstBc => "ca_pst_bc",
1496 CaPstMb => "ca_pst_mb",
1497 CaPstSk => "ca_pst_sk",
1498 CaQst => "ca_qst",
1499 CdNif => "cd_nif",
1500 ChUid => "ch_uid",
1501 ChVat => "ch_vat",
1502 ClTin => "cl_tin",
1503 CmNiu => "cm_niu",
1504 CnTin => "cn_tin",
1505 CoNit => "co_nit",
1506 CrTin => "cr_tin",
1507 CvNif => "cv_nif",
1508 DeStn => "de_stn",
1509 DoRcn => "do_rcn",
1510 EcRuc => "ec_ruc",
1511 EgTin => "eg_tin",
1512 EsCif => "es_cif",
1513 EtTin => "et_tin",
1514 EuOssVat => "eu_oss_vat",
1515 EuVat => "eu_vat",
1516 GbVat => "gb_vat",
1517 GeVat => "ge_vat",
1518 GnNif => "gn_nif",
1519 HkBr => "hk_br",
1520 HrOib => "hr_oib",
1521 HuTin => "hu_tin",
1522 IdNpwp => "id_npwp",
1523 IlVat => "il_vat",
1524 InGst => "in_gst",
1525 IsVat => "is_vat",
1526 JpCn => "jp_cn",
1527 JpRn => "jp_rn",
1528 JpTrn => "jp_trn",
1529 KePin => "ke_pin",
1530 KgTin => "kg_tin",
1531 KhTin => "kh_tin",
1532 KrBrn => "kr_brn",
1533 KzBin => "kz_bin",
1534 LaTin => "la_tin",
1535 LiUid => "li_uid",
1536 LiVat => "li_vat",
1537 MaVat => "ma_vat",
1538 MdVat => "md_vat",
1539 MePib => "me_pib",
1540 MkVat => "mk_vat",
1541 MrNif => "mr_nif",
1542 MxRfc => "mx_rfc",
1543 MyFrp => "my_frp",
1544 MyItn => "my_itn",
1545 MySst => "my_sst",
1546 NgTin => "ng_tin",
1547 NoVat => "no_vat",
1548 NoVoec => "no_voec",
1549 NpPan => "np_pan",
1550 NzGst => "nz_gst",
1551 OmVat => "om_vat",
1552 PeRuc => "pe_ruc",
1553 PhTin => "ph_tin",
1554 RoTin => "ro_tin",
1555 RsPib => "rs_pib",
1556 RuInn => "ru_inn",
1557 RuKpp => "ru_kpp",
1558 SaVat => "sa_vat",
1559 SgGst => "sg_gst",
1560 SgUen => "sg_uen",
1561 SiTin => "si_tin",
1562 SnNinea => "sn_ninea",
1563 SrFin => "sr_fin",
1564 SvNit => "sv_nit",
1565 ThVat => "th_vat",
1566 TjTin => "tj_tin",
1567 TrTin => "tr_tin",
1568 TwVat => "tw_vat",
1569 TzVat => "tz_vat",
1570 UaVat => "ua_vat",
1571 UgTin => "ug_tin",
1572 UsEin => "us_ein",
1573 UyRuc => "uy_ruc",
1574 UzTin => "uz_tin",
1575 UzVat => "uz_vat",
1576 VeRif => "ve_rif",
1577 VnTin => "vn_tin",
1578 ZaVat => "za_vat",
1579 ZmTin => "zm_tin",
1580 ZwTin => "zw_tin",
1581 Unknown(v) => v,
1582 }
1583 }
1584}
1585
1586impl std::str::FromStr for CreateCustomerTaxIdDataType {
1587 type Err = std::convert::Infallible;
1588 fn from_str(s: &str) -> Result<Self, Self::Err> {
1589 use CreateCustomerTaxIdDataType::*;
1590 match s {
1591 "ad_nrt" => Ok(AdNrt),
1592 "ae_trn" => Ok(AeTrn),
1593 "al_tin" => Ok(AlTin),
1594 "am_tin" => Ok(AmTin),
1595 "ao_tin" => Ok(AoTin),
1596 "ar_cuit" => Ok(ArCuit),
1597 "au_abn" => Ok(AuAbn),
1598 "au_arn" => Ok(AuArn),
1599 "aw_tin" => Ok(AwTin),
1600 "az_tin" => Ok(AzTin),
1601 "ba_tin" => Ok(BaTin),
1602 "bb_tin" => Ok(BbTin),
1603 "bd_bin" => Ok(BdBin),
1604 "bf_ifu" => Ok(BfIfu),
1605 "bg_uic" => Ok(BgUic),
1606 "bh_vat" => Ok(BhVat),
1607 "bj_ifu" => Ok(BjIfu),
1608 "bo_tin" => Ok(BoTin),
1609 "br_cnpj" => Ok(BrCnpj),
1610 "br_cpf" => Ok(BrCpf),
1611 "bs_tin" => Ok(BsTin),
1612 "by_tin" => Ok(ByTin),
1613 "ca_bn" => Ok(CaBn),
1614 "ca_gst_hst" => Ok(CaGstHst),
1615 "ca_pst_bc" => Ok(CaPstBc),
1616 "ca_pst_mb" => Ok(CaPstMb),
1617 "ca_pst_sk" => Ok(CaPstSk),
1618 "ca_qst" => Ok(CaQst),
1619 "cd_nif" => Ok(CdNif),
1620 "ch_uid" => Ok(ChUid),
1621 "ch_vat" => Ok(ChVat),
1622 "cl_tin" => Ok(ClTin),
1623 "cm_niu" => Ok(CmNiu),
1624 "cn_tin" => Ok(CnTin),
1625 "co_nit" => Ok(CoNit),
1626 "cr_tin" => Ok(CrTin),
1627 "cv_nif" => Ok(CvNif),
1628 "de_stn" => Ok(DeStn),
1629 "do_rcn" => Ok(DoRcn),
1630 "ec_ruc" => Ok(EcRuc),
1631 "eg_tin" => Ok(EgTin),
1632 "es_cif" => Ok(EsCif),
1633 "et_tin" => Ok(EtTin),
1634 "eu_oss_vat" => Ok(EuOssVat),
1635 "eu_vat" => Ok(EuVat),
1636 "gb_vat" => Ok(GbVat),
1637 "ge_vat" => Ok(GeVat),
1638 "gn_nif" => Ok(GnNif),
1639 "hk_br" => Ok(HkBr),
1640 "hr_oib" => Ok(HrOib),
1641 "hu_tin" => Ok(HuTin),
1642 "id_npwp" => Ok(IdNpwp),
1643 "il_vat" => Ok(IlVat),
1644 "in_gst" => Ok(InGst),
1645 "is_vat" => Ok(IsVat),
1646 "jp_cn" => Ok(JpCn),
1647 "jp_rn" => Ok(JpRn),
1648 "jp_trn" => Ok(JpTrn),
1649 "ke_pin" => Ok(KePin),
1650 "kg_tin" => Ok(KgTin),
1651 "kh_tin" => Ok(KhTin),
1652 "kr_brn" => Ok(KrBrn),
1653 "kz_bin" => Ok(KzBin),
1654 "la_tin" => Ok(LaTin),
1655 "li_uid" => Ok(LiUid),
1656 "li_vat" => Ok(LiVat),
1657 "ma_vat" => Ok(MaVat),
1658 "md_vat" => Ok(MdVat),
1659 "me_pib" => Ok(MePib),
1660 "mk_vat" => Ok(MkVat),
1661 "mr_nif" => Ok(MrNif),
1662 "mx_rfc" => Ok(MxRfc),
1663 "my_frp" => Ok(MyFrp),
1664 "my_itn" => Ok(MyItn),
1665 "my_sst" => Ok(MySst),
1666 "ng_tin" => Ok(NgTin),
1667 "no_vat" => Ok(NoVat),
1668 "no_voec" => Ok(NoVoec),
1669 "np_pan" => Ok(NpPan),
1670 "nz_gst" => Ok(NzGst),
1671 "om_vat" => Ok(OmVat),
1672 "pe_ruc" => Ok(PeRuc),
1673 "ph_tin" => Ok(PhTin),
1674 "ro_tin" => Ok(RoTin),
1675 "rs_pib" => Ok(RsPib),
1676 "ru_inn" => Ok(RuInn),
1677 "ru_kpp" => Ok(RuKpp),
1678 "sa_vat" => Ok(SaVat),
1679 "sg_gst" => Ok(SgGst),
1680 "sg_uen" => Ok(SgUen),
1681 "si_tin" => Ok(SiTin),
1682 "sn_ninea" => Ok(SnNinea),
1683 "sr_fin" => Ok(SrFin),
1684 "sv_nit" => Ok(SvNit),
1685 "th_vat" => Ok(ThVat),
1686 "tj_tin" => Ok(TjTin),
1687 "tr_tin" => Ok(TrTin),
1688 "tw_vat" => Ok(TwVat),
1689 "tz_vat" => Ok(TzVat),
1690 "ua_vat" => Ok(UaVat),
1691 "ug_tin" => Ok(UgTin),
1692 "us_ein" => Ok(UsEin),
1693 "uy_ruc" => Ok(UyRuc),
1694 "uz_tin" => Ok(UzTin),
1695 "uz_vat" => Ok(UzVat),
1696 "ve_rif" => Ok(VeRif),
1697 "vn_tin" => Ok(VnTin),
1698 "za_vat" => Ok(ZaVat),
1699 "zm_tin" => Ok(ZmTin),
1700 "zw_tin" => Ok(ZwTin),
1701 v => Ok(Unknown(v.to_owned())),
1702 }
1703 }
1704}
1705impl std::fmt::Display for CreateCustomerTaxIdDataType {
1706 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1707 f.write_str(self.as_str())
1708 }
1709}
1710
1711impl std::fmt::Debug for CreateCustomerTaxIdDataType {
1712 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1713 f.write_str(self.as_str())
1714 }
1715}
1716impl serde::Serialize for CreateCustomerTaxIdDataType {
1717 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1718 where
1719 S: serde::Serializer,
1720 {
1721 serializer.serialize_str(self.as_str())
1722 }
1723}
1724#[cfg(feature = "deserialize")]
1725impl<'de> serde::Deserialize<'de> for CreateCustomerTaxIdDataType {
1726 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1727 use std::str::FromStr;
1728 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1729 Ok(Self::from_str(&s).unwrap())
1730 }
1731}
1732#[derive(Clone, Debug, serde::Serialize)]
1734pub struct CreateCustomer {
1735 inner: CreateCustomerBuilder,
1736}
1737impl CreateCustomer {
1738 pub fn new() -> Self {
1740 Self { inner: CreateCustomerBuilder::new() }
1741 }
1742 pub fn address(mut self, address: impl Into<OptionalFieldsCustomerAddress>) -> Self {
1744 self.inner.address = Some(address.into());
1745 self
1746 }
1747 pub fn balance(mut self, balance: impl Into<i64>) -> Self {
1750 self.inner.balance = Some(balance.into());
1751 self
1752 }
1753 pub fn business_name(mut self, business_name: impl Into<String>) -> Self {
1755 self.inner.business_name = Some(business_name.into());
1756 self
1757 }
1758 pub fn cash_balance(mut self, cash_balance: impl Into<CreateCustomerCashBalance>) -> Self {
1760 self.inner.cash_balance = Some(cash_balance.into());
1761 self
1762 }
1763 pub fn description(mut self, description: impl Into<String>) -> Self {
1766 self.inner.description = Some(description.into());
1767 self
1768 }
1769 pub fn email(mut self, email: impl Into<String>) -> Self {
1773 self.inner.email = Some(email.into());
1774 self
1775 }
1776 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1778 self.inner.expand = Some(expand.into());
1779 self
1780 }
1781 pub fn individual_name(mut self, individual_name: impl Into<String>) -> Self {
1783 self.inner.individual_name = Some(individual_name.into());
1784 self
1785 }
1786 pub fn invoice_prefix(mut self, invoice_prefix: impl Into<String>) -> Self {
1789 self.inner.invoice_prefix = Some(invoice_prefix.into());
1790 self
1791 }
1792 pub fn invoice_settings(
1794 mut self,
1795 invoice_settings: impl Into<CreateCustomerInvoiceSettings>,
1796 ) -> Self {
1797 self.inner.invoice_settings = Some(invoice_settings.into());
1798 self
1799 }
1800 pub fn metadata(
1805 mut self,
1806 metadata: impl Into<std::collections::HashMap<String, String>>,
1807 ) -> Self {
1808 self.inner.metadata = Some(metadata.into());
1809 self
1810 }
1811 pub fn name(mut self, name: impl Into<String>) -> Self {
1813 self.inner.name = Some(name.into());
1814 self
1815 }
1816 pub fn next_invoice_sequence(mut self, next_invoice_sequence: impl Into<i64>) -> Self {
1818 self.inner.next_invoice_sequence = Some(next_invoice_sequence.into());
1819 self
1820 }
1821 pub fn payment_method(mut self, payment_method: impl Into<String>) -> Self {
1822 self.inner.payment_method = Some(payment_method.into());
1823 self
1824 }
1825 pub fn phone(mut self, phone: impl Into<String>) -> Self {
1827 self.inner.phone = Some(phone.into());
1828 self
1829 }
1830 pub fn preferred_locales(mut self, preferred_locales: impl Into<Vec<String>>) -> Self {
1832 self.inner.preferred_locales = Some(preferred_locales.into());
1833 self
1834 }
1835 pub fn shipping(mut self, shipping: impl Into<CustomerShipping>) -> Self {
1837 self.inner.shipping = Some(shipping.into());
1838 self
1839 }
1840 pub fn source(mut self, source: impl Into<String>) -> Self {
1841 self.inner.source = Some(source.into());
1842 self
1843 }
1844 pub fn tax(mut self, tax: impl Into<CreateCustomerTax>) -> Self {
1846 self.inner.tax = Some(tax.into());
1847 self
1848 }
1849 pub fn tax_exempt(mut self, tax_exempt: impl Into<stripe_shared::CustomerTaxExempt>) -> Self {
1851 self.inner.tax_exempt = Some(tax_exempt.into());
1852 self
1853 }
1854 pub fn tax_id_data(mut self, tax_id_data: impl Into<Vec<CreateCustomerTaxIdData>>) -> Self {
1856 self.inner.tax_id_data = Some(tax_id_data.into());
1857 self
1858 }
1859 pub fn test_clock(mut self, test_clock: impl Into<String>) -> Self {
1861 self.inner.test_clock = Some(test_clock.into());
1862 self
1863 }
1864 pub fn validate(mut self, validate: impl Into<bool>) -> Self {
1865 self.inner.validate = Some(validate.into());
1866 self
1867 }
1868}
1869impl Default for CreateCustomer {
1870 fn default() -> Self {
1871 Self::new()
1872 }
1873}
1874impl CreateCustomer {
1875 pub async fn send<C: StripeClient>(
1877 &self,
1878 client: &C,
1879 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1880 self.customize().send(client).await
1881 }
1882
1883 pub fn send_blocking<C: StripeBlockingClient>(
1885 &self,
1886 client: &C,
1887 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1888 self.customize().send_blocking(client)
1889 }
1890}
1891
1892impl StripeRequest for CreateCustomer {
1893 type Output = stripe_shared::Customer;
1894
1895 fn build(&self) -> RequestBuilder {
1896 RequestBuilder::new(StripeMethod::Post, "/customers").form(&self.inner)
1897 }
1898}
1899#[derive(Clone, Debug, serde::Serialize)]
1900struct UpdateCustomerBuilder {
1901 #[serde(skip_serializing_if = "Option::is_none")]
1902 address: Option<OptionalFieldsCustomerAddress>,
1903 #[serde(skip_serializing_if = "Option::is_none")]
1904 balance: Option<i64>,
1905 #[serde(skip_serializing_if = "Option::is_none")]
1906 business_name: Option<String>,
1907 #[serde(skip_serializing_if = "Option::is_none")]
1908 cash_balance: Option<UpdateCustomerCashBalance>,
1909 #[serde(skip_serializing_if = "Option::is_none")]
1910 default_source: Option<String>,
1911 #[serde(skip_serializing_if = "Option::is_none")]
1912 description: Option<String>,
1913 #[serde(skip_serializing_if = "Option::is_none")]
1914 email: Option<String>,
1915 #[serde(skip_serializing_if = "Option::is_none")]
1916 expand: Option<Vec<String>>,
1917 #[serde(skip_serializing_if = "Option::is_none")]
1918 individual_name: Option<String>,
1919 #[serde(skip_serializing_if = "Option::is_none")]
1920 invoice_prefix: Option<String>,
1921 #[serde(skip_serializing_if = "Option::is_none")]
1922 invoice_settings: Option<UpdateCustomerInvoiceSettings>,
1923 #[serde(skip_serializing_if = "Option::is_none")]
1924 metadata: Option<std::collections::HashMap<String, String>>,
1925 #[serde(skip_serializing_if = "Option::is_none")]
1926 name: Option<String>,
1927 #[serde(skip_serializing_if = "Option::is_none")]
1928 next_invoice_sequence: Option<i64>,
1929 #[serde(skip_serializing_if = "Option::is_none")]
1930 phone: Option<String>,
1931 #[serde(skip_serializing_if = "Option::is_none")]
1932 preferred_locales: Option<Vec<String>>,
1933 #[serde(skip_serializing_if = "Option::is_none")]
1934 shipping: Option<CustomerShipping>,
1935 #[serde(skip_serializing_if = "Option::is_none")]
1936 source: Option<String>,
1937 #[serde(skip_serializing_if = "Option::is_none")]
1938 tax: Option<UpdateCustomerTax>,
1939 #[serde(skip_serializing_if = "Option::is_none")]
1940 tax_exempt: Option<stripe_shared::CustomerTaxExempt>,
1941 #[serde(skip_serializing_if = "Option::is_none")]
1942 validate: Option<bool>,
1943}
1944impl UpdateCustomerBuilder {
1945 fn new() -> Self {
1946 Self {
1947 address: None,
1948 balance: None,
1949 business_name: None,
1950 cash_balance: None,
1951 default_source: None,
1952 description: None,
1953 email: None,
1954 expand: None,
1955 individual_name: None,
1956 invoice_prefix: None,
1957 invoice_settings: None,
1958 metadata: None,
1959 name: None,
1960 next_invoice_sequence: None,
1961 phone: None,
1962 preferred_locales: None,
1963 shipping: None,
1964 source: None,
1965 tax: None,
1966 tax_exempt: None,
1967 validate: None,
1968 }
1969 }
1970}
1971#[derive(Copy, Clone, Debug, serde::Serialize)]
1973pub struct UpdateCustomerCashBalance {
1974 #[serde(skip_serializing_if = "Option::is_none")]
1977 pub settings: Option<UpdateCustomerCashBalanceSettings>,
1978}
1979impl UpdateCustomerCashBalance {
1980 pub fn new() -> Self {
1981 Self { settings: None }
1982 }
1983}
1984impl Default for UpdateCustomerCashBalance {
1985 fn default() -> Self {
1986 Self::new()
1987 }
1988}
1989#[derive(Copy, Clone, Debug, serde::Serialize)]
1992pub struct UpdateCustomerCashBalanceSettings {
1993 #[serde(skip_serializing_if = "Option::is_none")]
1997 pub reconciliation_mode: Option<UpdateCustomerCashBalanceSettingsReconciliationMode>,
1998}
1999impl UpdateCustomerCashBalanceSettings {
2000 pub fn new() -> Self {
2001 Self { reconciliation_mode: None }
2002 }
2003}
2004impl Default for UpdateCustomerCashBalanceSettings {
2005 fn default() -> Self {
2006 Self::new()
2007 }
2008}
2009#[derive(Copy, Clone, Eq, PartialEq)]
2013pub enum UpdateCustomerCashBalanceSettingsReconciliationMode {
2014 Automatic,
2015 Manual,
2016 MerchantDefault,
2017}
2018impl UpdateCustomerCashBalanceSettingsReconciliationMode {
2019 pub fn as_str(self) -> &'static str {
2020 use UpdateCustomerCashBalanceSettingsReconciliationMode::*;
2021 match self {
2022 Automatic => "automatic",
2023 Manual => "manual",
2024 MerchantDefault => "merchant_default",
2025 }
2026 }
2027}
2028
2029impl std::str::FromStr for UpdateCustomerCashBalanceSettingsReconciliationMode {
2030 type Err = stripe_types::StripeParseError;
2031 fn from_str(s: &str) -> Result<Self, Self::Err> {
2032 use UpdateCustomerCashBalanceSettingsReconciliationMode::*;
2033 match s {
2034 "automatic" => Ok(Automatic),
2035 "manual" => Ok(Manual),
2036 "merchant_default" => Ok(MerchantDefault),
2037 _ => Err(stripe_types::StripeParseError),
2038 }
2039 }
2040}
2041impl std::fmt::Display for UpdateCustomerCashBalanceSettingsReconciliationMode {
2042 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2043 f.write_str(self.as_str())
2044 }
2045}
2046
2047impl std::fmt::Debug for UpdateCustomerCashBalanceSettingsReconciliationMode {
2048 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2049 f.write_str(self.as_str())
2050 }
2051}
2052impl serde::Serialize for UpdateCustomerCashBalanceSettingsReconciliationMode {
2053 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2054 where
2055 S: serde::Serializer,
2056 {
2057 serializer.serialize_str(self.as_str())
2058 }
2059}
2060#[cfg(feature = "deserialize")]
2061impl<'de> serde::Deserialize<'de> for UpdateCustomerCashBalanceSettingsReconciliationMode {
2062 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2063 use std::str::FromStr;
2064 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2065 Self::from_str(&s).map_err(|_| {
2066 serde::de::Error::custom(
2067 "Unknown value for UpdateCustomerCashBalanceSettingsReconciliationMode",
2068 )
2069 })
2070 }
2071}
2072#[derive(Clone, Debug, serde::Serialize)]
2074pub struct UpdateCustomerInvoiceSettings {
2075 #[serde(skip_serializing_if = "Option::is_none")]
2078 pub custom_fields: Option<Vec<CustomFieldParams>>,
2079 #[serde(skip_serializing_if = "Option::is_none")]
2081 pub default_payment_method: Option<String>,
2082 #[serde(skip_serializing_if = "Option::is_none")]
2084 pub footer: Option<String>,
2085 #[serde(skip_serializing_if = "Option::is_none")]
2087 pub rendering_options: Option<UpdateCustomerInvoiceSettingsRenderingOptions>,
2088}
2089impl UpdateCustomerInvoiceSettings {
2090 pub fn new() -> Self {
2091 Self {
2092 custom_fields: None,
2093 default_payment_method: None,
2094 footer: None,
2095 rendering_options: None,
2096 }
2097 }
2098}
2099impl Default for UpdateCustomerInvoiceSettings {
2100 fn default() -> Self {
2101 Self::new()
2102 }
2103}
2104#[derive(Clone, Debug, serde::Serialize)]
2106pub struct UpdateCustomerInvoiceSettingsRenderingOptions {
2107 #[serde(skip_serializing_if = "Option::is_none")]
2112 pub amount_tax_display: Option<UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay>,
2113 #[serde(skip_serializing_if = "Option::is_none")]
2115 pub template: Option<String>,
2116}
2117impl UpdateCustomerInvoiceSettingsRenderingOptions {
2118 pub fn new() -> Self {
2119 Self { amount_tax_display: None, template: None }
2120 }
2121}
2122impl Default for UpdateCustomerInvoiceSettingsRenderingOptions {
2123 fn default() -> Self {
2124 Self::new()
2125 }
2126}
2127#[derive(Copy, Clone, Eq, PartialEq)]
2132pub enum UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2133 ExcludeTax,
2134 IncludeInclusiveTax,
2135}
2136impl UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2137 pub fn as_str(self) -> &'static str {
2138 use UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
2139 match self {
2140 ExcludeTax => "exclude_tax",
2141 IncludeInclusiveTax => "include_inclusive_tax",
2142 }
2143 }
2144}
2145
2146impl std::str::FromStr for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2147 type Err = stripe_types::StripeParseError;
2148 fn from_str(s: &str) -> Result<Self, Self::Err> {
2149 use UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
2150 match s {
2151 "exclude_tax" => Ok(ExcludeTax),
2152 "include_inclusive_tax" => Ok(IncludeInclusiveTax),
2153 _ => Err(stripe_types::StripeParseError),
2154 }
2155 }
2156}
2157impl std::fmt::Display for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2158 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2159 f.write_str(self.as_str())
2160 }
2161}
2162
2163impl std::fmt::Debug for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2164 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2165 f.write_str(self.as_str())
2166 }
2167}
2168impl serde::Serialize for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2169 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2170 where
2171 S: serde::Serializer,
2172 {
2173 serializer.serialize_str(self.as_str())
2174 }
2175}
2176#[cfg(feature = "deserialize")]
2177impl<'de> serde::Deserialize<'de>
2178 for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay
2179{
2180 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2181 use std::str::FromStr;
2182 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2183 Self::from_str(&s).map_err(|_| {
2184 serde::de::Error::custom(
2185 "Unknown value for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay",
2186 )
2187 })
2188 }
2189}
2190#[derive(Clone, Debug, serde::Serialize)]
2192pub struct UpdateCustomerTax {
2193 #[serde(skip_serializing_if = "Option::is_none")]
2197 pub ip_address: Option<String>,
2198 #[serde(skip_serializing_if = "Option::is_none")]
2200 pub validate_location: Option<UpdateCustomerTaxValidateLocation>,
2201}
2202impl UpdateCustomerTax {
2203 pub fn new() -> Self {
2204 Self { ip_address: None, validate_location: None }
2205 }
2206}
2207impl Default for UpdateCustomerTax {
2208 fn default() -> Self {
2209 Self::new()
2210 }
2211}
2212#[derive(Copy, Clone, Eq, PartialEq)]
2214pub enum UpdateCustomerTaxValidateLocation {
2215 Auto,
2216 Deferred,
2217 Immediately,
2218}
2219impl UpdateCustomerTaxValidateLocation {
2220 pub fn as_str(self) -> &'static str {
2221 use UpdateCustomerTaxValidateLocation::*;
2222 match self {
2223 Auto => "auto",
2224 Deferred => "deferred",
2225 Immediately => "immediately",
2226 }
2227 }
2228}
2229
2230impl std::str::FromStr for UpdateCustomerTaxValidateLocation {
2231 type Err = stripe_types::StripeParseError;
2232 fn from_str(s: &str) -> Result<Self, Self::Err> {
2233 use UpdateCustomerTaxValidateLocation::*;
2234 match s {
2235 "auto" => Ok(Auto),
2236 "deferred" => Ok(Deferred),
2237 "immediately" => Ok(Immediately),
2238 _ => Err(stripe_types::StripeParseError),
2239 }
2240 }
2241}
2242impl std::fmt::Display for UpdateCustomerTaxValidateLocation {
2243 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2244 f.write_str(self.as_str())
2245 }
2246}
2247
2248impl std::fmt::Debug for UpdateCustomerTaxValidateLocation {
2249 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2250 f.write_str(self.as_str())
2251 }
2252}
2253impl serde::Serialize for UpdateCustomerTaxValidateLocation {
2254 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2255 where
2256 S: serde::Serializer,
2257 {
2258 serializer.serialize_str(self.as_str())
2259 }
2260}
2261#[cfg(feature = "deserialize")]
2262impl<'de> serde::Deserialize<'de> for UpdateCustomerTaxValidateLocation {
2263 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2264 use std::str::FromStr;
2265 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2266 Self::from_str(&s).map_err(|_| {
2267 serde::de::Error::custom("Unknown value for UpdateCustomerTaxValidateLocation")
2268 })
2269 }
2270}
2271#[derive(Clone, Debug, serde::Serialize)]
2280pub struct UpdateCustomer {
2281 inner: UpdateCustomerBuilder,
2282 customer: stripe_shared::CustomerId,
2283}
2284impl UpdateCustomer {
2285 pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
2287 Self { customer: customer.into(), inner: UpdateCustomerBuilder::new() }
2288 }
2289 pub fn address(mut self, address: impl Into<OptionalFieldsCustomerAddress>) -> Self {
2291 self.inner.address = Some(address.into());
2292 self
2293 }
2294 pub fn balance(mut self, balance: impl Into<i64>) -> Self {
2297 self.inner.balance = Some(balance.into());
2298 self
2299 }
2300 pub fn business_name(mut self, business_name: impl Into<String>) -> Self {
2302 self.inner.business_name = Some(business_name.into());
2303 self
2304 }
2305 pub fn cash_balance(mut self, cash_balance: impl Into<UpdateCustomerCashBalance>) -> Self {
2307 self.inner.cash_balance = Some(cash_balance.into());
2308 self
2309 }
2310 pub fn default_source(mut self, default_source: impl Into<String>) -> Self {
2316 self.inner.default_source = Some(default_source.into());
2317 self
2318 }
2319 pub fn description(mut self, description: impl Into<String>) -> Self {
2322 self.inner.description = Some(description.into());
2323 self
2324 }
2325 pub fn email(mut self, email: impl Into<String>) -> Self {
2329 self.inner.email = Some(email.into());
2330 self
2331 }
2332 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2334 self.inner.expand = Some(expand.into());
2335 self
2336 }
2337 pub fn individual_name(mut self, individual_name: impl Into<String>) -> Self {
2339 self.inner.individual_name = Some(individual_name.into());
2340 self
2341 }
2342 pub fn invoice_prefix(mut self, invoice_prefix: impl Into<String>) -> Self {
2345 self.inner.invoice_prefix = Some(invoice_prefix.into());
2346 self
2347 }
2348 pub fn invoice_settings(
2350 mut self,
2351 invoice_settings: impl Into<UpdateCustomerInvoiceSettings>,
2352 ) -> Self {
2353 self.inner.invoice_settings = Some(invoice_settings.into());
2354 self
2355 }
2356 pub fn metadata(
2361 mut self,
2362 metadata: impl Into<std::collections::HashMap<String, String>>,
2363 ) -> Self {
2364 self.inner.metadata = Some(metadata.into());
2365 self
2366 }
2367 pub fn name(mut self, name: impl Into<String>) -> Self {
2369 self.inner.name = Some(name.into());
2370 self
2371 }
2372 pub fn next_invoice_sequence(mut self, next_invoice_sequence: impl Into<i64>) -> Self {
2374 self.inner.next_invoice_sequence = Some(next_invoice_sequence.into());
2375 self
2376 }
2377 pub fn phone(mut self, phone: impl Into<String>) -> Self {
2379 self.inner.phone = Some(phone.into());
2380 self
2381 }
2382 pub fn preferred_locales(mut self, preferred_locales: impl Into<Vec<String>>) -> Self {
2384 self.inner.preferred_locales = Some(preferred_locales.into());
2385 self
2386 }
2387 pub fn shipping(mut self, shipping: impl Into<CustomerShipping>) -> Self {
2389 self.inner.shipping = Some(shipping.into());
2390 self
2391 }
2392 pub fn source(mut self, source: impl Into<String>) -> Self {
2393 self.inner.source = Some(source.into());
2394 self
2395 }
2396 pub fn tax(mut self, tax: impl Into<UpdateCustomerTax>) -> Self {
2398 self.inner.tax = Some(tax.into());
2399 self
2400 }
2401 pub fn tax_exempt(mut self, tax_exempt: impl Into<stripe_shared::CustomerTaxExempt>) -> Self {
2403 self.inner.tax_exempt = Some(tax_exempt.into());
2404 self
2405 }
2406 pub fn validate(mut self, validate: impl Into<bool>) -> Self {
2407 self.inner.validate = Some(validate.into());
2408 self
2409 }
2410}
2411impl UpdateCustomer {
2412 pub async fn send<C: StripeClient>(
2414 &self,
2415 client: &C,
2416 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2417 self.customize().send(client).await
2418 }
2419
2420 pub fn send_blocking<C: StripeBlockingClient>(
2422 &self,
2423 client: &C,
2424 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2425 self.customize().send_blocking(client)
2426 }
2427}
2428
2429impl StripeRequest for UpdateCustomer {
2430 type Output = stripe_shared::Customer;
2431
2432 fn build(&self) -> RequestBuilder {
2433 let customer = &self.customer;
2434 RequestBuilder::new(StripeMethod::Post, format!("/customers/{customer}")).form(&self.inner)
2435 }
2436}
2437#[derive(Clone, Debug, serde::Serialize)]
2438struct CreateFundingInstructionsCustomerBuilder {
2439 bank_transfer: CreateFundingInstructionsCustomerBankTransfer,
2440 currency: stripe_types::Currency,
2441 #[serde(skip_serializing_if = "Option::is_none")]
2442 expand: Option<Vec<String>>,
2443 funding_type: CreateFundingInstructionsCustomerFundingType,
2444}
2445impl CreateFundingInstructionsCustomerBuilder {
2446 fn new(
2447 bank_transfer: impl Into<CreateFundingInstructionsCustomerBankTransfer>,
2448 currency: impl Into<stripe_types::Currency>,
2449 funding_type: impl Into<CreateFundingInstructionsCustomerFundingType>,
2450 ) -> Self {
2451 Self {
2452 bank_transfer: bank_transfer.into(),
2453 currency: currency.into(),
2454 expand: None,
2455 funding_type: funding_type.into(),
2456 }
2457 }
2458}
2459#[derive(Clone, Debug, serde::Serialize)]
2461pub struct CreateFundingInstructionsCustomerBankTransfer {
2462 #[serde(skip_serializing_if = "Option::is_none")]
2464 pub eu_bank_transfer: Option<CreateFundingInstructionsCustomerBankTransferEuBankTransfer>,
2465 #[serde(skip_serializing_if = "Option::is_none")]
2470 pub requested_address_types:
2471 Option<Vec<CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes>>,
2472 #[serde(rename = "type")]
2474 pub type_: CreateFundingInstructionsCustomerBankTransferType,
2475}
2476impl CreateFundingInstructionsCustomerBankTransfer {
2477 pub fn new(type_: impl Into<CreateFundingInstructionsCustomerBankTransferType>) -> Self {
2478 Self { eu_bank_transfer: None, requested_address_types: None, type_: type_.into() }
2479 }
2480}
2481#[derive(Clone, Debug, serde::Serialize)]
2483pub struct CreateFundingInstructionsCustomerBankTransferEuBankTransfer {
2484 pub country: String,
2487}
2488impl CreateFundingInstructionsCustomerBankTransferEuBankTransfer {
2489 pub fn new(country: impl Into<String>) -> Self {
2490 Self { country: country.into() }
2491 }
2492}
2493#[derive(Copy, Clone, Eq, PartialEq)]
2498pub enum CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2499 Iban,
2500 SortCode,
2501 Spei,
2502 Zengin,
2503}
2504impl CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2505 pub fn as_str(self) -> &'static str {
2506 use CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes::*;
2507 match self {
2508 Iban => "iban",
2509 SortCode => "sort_code",
2510 Spei => "spei",
2511 Zengin => "zengin",
2512 }
2513 }
2514}
2515
2516impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2517 type Err = stripe_types::StripeParseError;
2518 fn from_str(s: &str) -> Result<Self, Self::Err> {
2519 use CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes::*;
2520 match s {
2521 "iban" => Ok(Iban),
2522 "sort_code" => Ok(SortCode),
2523 "spei" => Ok(Spei),
2524 "zengin" => Ok(Zengin),
2525 _ => Err(stripe_types::StripeParseError),
2526 }
2527 }
2528}
2529impl std::fmt::Display for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2530 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2531 f.write_str(self.as_str())
2532 }
2533}
2534
2535impl std::fmt::Debug for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2536 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2537 f.write_str(self.as_str())
2538 }
2539}
2540impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2541 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2542 where
2543 S: serde::Serializer,
2544 {
2545 serializer.serialize_str(self.as_str())
2546 }
2547}
2548#[cfg(feature = "deserialize")]
2549impl<'de> serde::Deserialize<'de>
2550 for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes
2551{
2552 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2553 use std::str::FromStr;
2554 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2555 Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes"))
2556 }
2557}
2558#[derive(Copy, Clone, Eq, PartialEq)]
2560pub enum CreateFundingInstructionsCustomerBankTransferType {
2561 EuBankTransfer,
2562 GbBankTransfer,
2563 JpBankTransfer,
2564 MxBankTransfer,
2565 UsBankTransfer,
2566}
2567impl CreateFundingInstructionsCustomerBankTransferType {
2568 pub fn as_str(self) -> &'static str {
2569 use CreateFundingInstructionsCustomerBankTransferType::*;
2570 match self {
2571 EuBankTransfer => "eu_bank_transfer",
2572 GbBankTransfer => "gb_bank_transfer",
2573 JpBankTransfer => "jp_bank_transfer",
2574 MxBankTransfer => "mx_bank_transfer",
2575 UsBankTransfer => "us_bank_transfer",
2576 }
2577 }
2578}
2579
2580impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferType {
2581 type Err = stripe_types::StripeParseError;
2582 fn from_str(s: &str) -> Result<Self, Self::Err> {
2583 use CreateFundingInstructionsCustomerBankTransferType::*;
2584 match s {
2585 "eu_bank_transfer" => Ok(EuBankTransfer),
2586 "gb_bank_transfer" => Ok(GbBankTransfer),
2587 "jp_bank_transfer" => Ok(JpBankTransfer),
2588 "mx_bank_transfer" => Ok(MxBankTransfer),
2589 "us_bank_transfer" => Ok(UsBankTransfer),
2590 _ => Err(stripe_types::StripeParseError),
2591 }
2592 }
2593}
2594impl std::fmt::Display for CreateFundingInstructionsCustomerBankTransferType {
2595 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2596 f.write_str(self.as_str())
2597 }
2598}
2599
2600impl std::fmt::Debug for CreateFundingInstructionsCustomerBankTransferType {
2601 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2602 f.write_str(self.as_str())
2603 }
2604}
2605impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferType {
2606 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2607 where
2608 S: serde::Serializer,
2609 {
2610 serializer.serialize_str(self.as_str())
2611 }
2612}
2613#[cfg(feature = "deserialize")]
2614impl<'de> serde::Deserialize<'de> for CreateFundingInstructionsCustomerBankTransferType {
2615 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2616 use std::str::FromStr;
2617 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2618 Self::from_str(&s).map_err(|_| {
2619 serde::de::Error::custom(
2620 "Unknown value for CreateFundingInstructionsCustomerBankTransferType",
2621 )
2622 })
2623 }
2624}
2625#[derive(Copy, Clone, Eq, PartialEq)]
2627pub enum CreateFundingInstructionsCustomerFundingType {
2628 BankTransfer,
2629}
2630impl CreateFundingInstructionsCustomerFundingType {
2631 pub fn as_str(self) -> &'static str {
2632 use CreateFundingInstructionsCustomerFundingType::*;
2633 match self {
2634 BankTransfer => "bank_transfer",
2635 }
2636 }
2637}
2638
2639impl std::str::FromStr for CreateFundingInstructionsCustomerFundingType {
2640 type Err = stripe_types::StripeParseError;
2641 fn from_str(s: &str) -> Result<Self, Self::Err> {
2642 use CreateFundingInstructionsCustomerFundingType::*;
2643 match s {
2644 "bank_transfer" => Ok(BankTransfer),
2645 _ => Err(stripe_types::StripeParseError),
2646 }
2647 }
2648}
2649impl std::fmt::Display for CreateFundingInstructionsCustomerFundingType {
2650 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2651 f.write_str(self.as_str())
2652 }
2653}
2654
2655impl std::fmt::Debug for CreateFundingInstructionsCustomerFundingType {
2656 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2657 f.write_str(self.as_str())
2658 }
2659}
2660impl serde::Serialize for CreateFundingInstructionsCustomerFundingType {
2661 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2662 where
2663 S: serde::Serializer,
2664 {
2665 serializer.serialize_str(self.as_str())
2666 }
2667}
2668#[cfg(feature = "deserialize")]
2669impl<'de> serde::Deserialize<'de> for CreateFundingInstructionsCustomerFundingType {
2670 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2671 use std::str::FromStr;
2672 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2673 Self::from_str(&s).map_err(|_| {
2674 serde::de::Error::custom(
2675 "Unknown value for CreateFundingInstructionsCustomerFundingType",
2676 )
2677 })
2678 }
2679}
2680#[derive(Clone, Debug, serde::Serialize)]
2687pub struct CreateFundingInstructionsCustomer {
2688 inner: CreateFundingInstructionsCustomerBuilder,
2689 customer: stripe_shared::CustomerId,
2690}
2691impl CreateFundingInstructionsCustomer {
2692 pub fn new(
2694 customer: impl Into<stripe_shared::CustomerId>,
2695 bank_transfer: impl Into<CreateFundingInstructionsCustomerBankTransfer>,
2696 currency: impl Into<stripe_types::Currency>,
2697 funding_type: impl Into<CreateFundingInstructionsCustomerFundingType>,
2698 ) -> Self {
2699 Self {
2700 customer: customer.into(),
2701 inner: CreateFundingInstructionsCustomerBuilder::new(
2702 bank_transfer.into(),
2703 currency.into(),
2704 funding_type.into(),
2705 ),
2706 }
2707 }
2708 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2710 self.inner.expand = Some(expand.into());
2711 self
2712 }
2713}
2714impl CreateFundingInstructionsCustomer {
2715 pub async fn send<C: StripeClient>(
2717 &self,
2718 client: &C,
2719 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2720 self.customize().send(client).await
2721 }
2722
2723 pub fn send_blocking<C: StripeBlockingClient>(
2725 &self,
2726 client: &C,
2727 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2728 self.customize().send_blocking(client)
2729 }
2730}
2731
2732impl StripeRequest for CreateFundingInstructionsCustomer {
2733 type Output = stripe_shared::FundingInstructions;
2734
2735 fn build(&self) -> RequestBuilder {
2736 let customer = &self.customer;
2737 RequestBuilder::new(
2738 StripeMethod::Post,
2739 format!("/customers/{customer}/funding_instructions"),
2740 )
2741 .form(&self.inner)
2742 }
2743}
2744#[derive(Clone, Debug, serde::Serialize)]
2745struct FundCashBalanceCustomerBuilder {
2746 amount: i64,
2747 currency: stripe_types::Currency,
2748 #[serde(skip_serializing_if = "Option::is_none")]
2749 expand: Option<Vec<String>>,
2750 #[serde(skip_serializing_if = "Option::is_none")]
2751 reference: Option<String>,
2752}
2753impl FundCashBalanceCustomerBuilder {
2754 fn new(amount: impl Into<i64>, currency: impl Into<stripe_types::Currency>) -> Self {
2755 Self { amount: amount.into(), currency: currency.into(), expand: None, reference: None }
2756 }
2757}
2758#[derive(Clone, Debug, serde::Serialize)]
2760pub struct FundCashBalanceCustomer {
2761 inner: FundCashBalanceCustomerBuilder,
2762 customer: String,
2763}
2764impl FundCashBalanceCustomer {
2765 pub fn new(
2767 customer: impl Into<String>,
2768 amount: impl Into<i64>,
2769 currency: impl Into<stripe_types::Currency>,
2770 ) -> Self {
2771 Self {
2772 customer: customer.into(),
2773 inner: FundCashBalanceCustomerBuilder::new(amount.into(), currency.into()),
2774 }
2775 }
2776 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2778 self.inner.expand = Some(expand.into());
2779 self
2780 }
2781 pub fn reference(mut self, reference: impl Into<String>) -> Self {
2785 self.inner.reference = Some(reference.into());
2786 self
2787 }
2788}
2789impl FundCashBalanceCustomer {
2790 pub async fn send<C: StripeClient>(
2792 &self,
2793 client: &C,
2794 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2795 self.customize().send(client).await
2796 }
2797
2798 pub fn send_blocking<C: StripeBlockingClient>(
2800 &self,
2801 client: &C,
2802 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2803 self.customize().send_blocking(client)
2804 }
2805}
2806
2807impl StripeRequest for FundCashBalanceCustomer {
2808 type Output = stripe_shared::CustomerCashBalanceTransaction;
2809
2810 fn build(&self) -> RequestBuilder {
2811 let customer = &self.customer;
2812 RequestBuilder::new(
2813 StripeMethod::Post,
2814 format!("/test_helpers/customers/{customer}/fund_cash_balance"),
2815 )
2816 .form(&self.inner)
2817 }
2818}
2819
2820#[derive(Clone, Debug, serde::Serialize)]
2821pub struct OptionalFieldsCustomerAddress {
2822 #[serde(skip_serializing_if = "Option::is_none")]
2824 pub city: Option<String>,
2825 #[serde(skip_serializing_if = "Option::is_none")]
2828 pub country: Option<String>,
2829 #[serde(skip_serializing_if = "Option::is_none")]
2831 pub line1: Option<String>,
2832 #[serde(skip_serializing_if = "Option::is_none")]
2834 pub line2: Option<String>,
2835 #[serde(skip_serializing_if = "Option::is_none")]
2837 pub postal_code: Option<String>,
2838 #[serde(skip_serializing_if = "Option::is_none")]
2840 pub state: Option<String>,
2841}
2842impl OptionalFieldsCustomerAddress {
2843 pub fn new() -> Self {
2844 Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
2845 }
2846}
2847impl Default for OptionalFieldsCustomerAddress {
2848 fn default() -> Self {
2849 Self::new()
2850 }
2851}
2852#[derive(Clone, Debug, serde::Serialize)]
2853pub struct CustomFieldParams {
2854 pub name: String,
2856 pub value: String,
2858}
2859impl CustomFieldParams {
2860 pub fn new(name: impl Into<String>, value: impl Into<String>) -> Self {
2861 Self { name: name.into(), value: value.into() }
2862 }
2863}
2864#[derive(Clone, Debug, serde::Serialize)]
2865pub struct CustomerShipping {
2866 pub address: OptionalFieldsCustomerAddress,
2868 pub name: String,
2870 #[serde(skip_serializing_if = "Option::is_none")]
2872 pub phone: Option<String>,
2873}
2874impl CustomerShipping {
2875 pub fn new(address: impl Into<OptionalFieldsCustomerAddress>, name: impl Into<String>) -> Self {
2876 Self { address: address.into(), name: name.into(), phone: None }
2877 }
2878}