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 created: Option<stripe_types::RangeQueryTs>,
338 #[serde(skip_serializing_if = "Option::is_none")]
339 ending_before: Option<String>,
340 #[serde(skip_serializing_if = "Option::is_none")]
341 expand: Option<Vec<String>>,
342 #[serde(skip_serializing_if = "Option::is_none")]
343 invoice: Option<String>,
344 #[serde(skip_serializing_if = "Option::is_none")]
345 limit: Option<i64>,
346 #[serde(skip_serializing_if = "Option::is_none")]
347 starting_after: Option<String>,
348}
349impl BalanceTransactionsCustomerBuilder {
350 fn new() -> Self {
351 Self {
352 created: None,
353 ending_before: None,
354 expand: None,
355 invoice: None,
356 limit: None,
357 starting_after: None,
358 }
359 }
360}
361#[derive(Clone, Debug, serde::Serialize)]
363pub struct BalanceTransactionsCustomer {
364 inner: BalanceTransactionsCustomerBuilder,
365 customer: stripe_shared::CustomerId,
366}
367impl BalanceTransactionsCustomer {
368 pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
370 Self { customer: customer.into(), inner: BalanceTransactionsCustomerBuilder::new() }
371 }
372 pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
374 self.inner.created = Some(created.into());
375 self
376 }
377 pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
381 self.inner.ending_before = Some(ending_before.into());
382 self
383 }
384 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
386 self.inner.expand = Some(expand.into());
387 self
388 }
389 pub fn invoice(mut self, invoice: impl Into<String>) -> Self {
391 self.inner.invoice = Some(invoice.into());
392 self
393 }
394 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
397 self.inner.limit = Some(limit.into());
398 self
399 }
400 pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
404 self.inner.starting_after = Some(starting_after.into());
405 self
406 }
407}
408impl BalanceTransactionsCustomer {
409 pub async fn send<C: StripeClient>(
411 &self,
412 client: &C,
413 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
414 self.customize().send(client).await
415 }
416
417 pub fn send_blocking<C: StripeBlockingClient>(
419 &self,
420 client: &C,
421 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
422 self.customize().send_blocking(client)
423 }
424
425 pub fn paginate(
426 &self,
427 ) -> stripe_client_core::ListPaginator<
428 stripe_types::List<stripe_shared::CustomerBalanceTransaction>,
429 > {
430 let customer = &self.customer;
431
432 stripe_client_core::ListPaginator::new_list(
433 format!("/customers/{customer}/balance_transactions"),
434 &self.inner,
435 )
436 }
437}
438
439impl StripeRequest for BalanceTransactionsCustomer {
440 type Output = stripe_types::List<stripe_shared::CustomerBalanceTransaction>;
441
442 fn build(&self) -> RequestBuilder {
443 let customer = &self.customer;
444 RequestBuilder::new(
445 StripeMethod::Get,
446 format!("/customers/{customer}/balance_transactions"),
447 )
448 .query(&self.inner)
449 }
450}
451#[derive(Clone, Debug, serde::Serialize)]
452struct ListPaymentMethodsCustomerBuilder {
453 #[serde(skip_serializing_if = "Option::is_none")]
454 allow_redisplay: Option<ListPaymentMethodsCustomerAllowRedisplay>,
455 #[serde(skip_serializing_if = "Option::is_none")]
456 ending_before: Option<String>,
457 #[serde(skip_serializing_if = "Option::is_none")]
458 expand: Option<Vec<String>>,
459 #[serde(skip_serializing_if = "Option::is_none")]
460 limit: Option<i64>,
461 #[serde(skip_serializing_if = "Option::is_none")]
462 starting_after: Option<String>,
463 #[serde(rename = "type")]
464 #[serde(skip_serializing_if = "Option::is_none")]
465 type_: Option<ListPaymentMethodsCustomerType>,
466}
467impl ListPaymentMethodsCustomerBuilder {
468 fn new() -> Self {
469 Self {
470 allow_redisplay: None,
471 ending_before: None,
472 expand: None,
473 limit: None,
474 starting_after: None,
475 type_: None,
476 }
477 }
478}
479#[derive(Clone, Eq, PartialEq)]
482#[non_exhaustive]
483pub enum ListPaymentMethodsCustomerAllowRedisplay {
484 Always,
485 Limited,
486 Unspecified,
487 Unknown(String),
489}
490impl ListPaymentMethodsCustomerAllowRedisplay {
491 pub fn as_str(&self) -> &str {
492 use ListPaymentMethodsCustomerAllowRedisplay::*;
493 match self {
494 Always => "always",
495 Limited => "limited",
496 Unspecified => "unspecified",
497 Unknown(v) => v,
498 }
499 }
500}
501
502impl std::str::FromStr for ListPaymentMethodsCustomerAllowRedisplay {
503 type Err = std::convert::Infallible;
504 fn from_str(s: &str) -> Result<Self, Self::Err> {
505 use ListPaymentMethodsCustomerAllowRedisplay::*;
506 match s {
507 "always" => Ok(Always),
508 "limited" => Ok(Limited),
509 "unspecified" => Ok(Unspecified),
510 v => {
511 tracing::warn!(
512 "Unknown value '{}' for enum '{}'",
513 v,
514 "ListPaymentMethodsCustomerAllowRedisplay"
515 );
516 Ok(Unknown(v.to_owned()))
517 }
518 }
519 }
520}
521impl std::fmt::Display for ListPaymentMethodsCustomerAllowRedisplay {
522 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
523 f.write_str(self.as_str())
524 }
525}
526
527impl std::fmt::Debug for ListPaymentMethodsCustomerAllowRedisplay {
528 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
529 f.write_str(self.as_str())
530 }
531}
532impl serde::Serialize for ListPaymentMethodsCustomerAllowRedisplay {
533 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
534 where
535 S: serde::Serializer,
536 {
537 serializer.serialize_str(self.as_str())
538 }
539}
540#[cfg(feature = "deserialize")]
541impl<'de> serde::Deserialize<'de> for ListPaymentMethodsCustomerAllowRedisplay {
542 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
543 use std::str::FromStr;
544 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
545 Ok(Self::from_str(&s).expect("infallible"))
546 }
547}
548#[derive(Clone, Eq, PartialEq)]
552#[non_exhaustive]
553pub enum ListPaymentMethodsCustomerType {
554 AcssDebit,
555 Affirm,
556 AfterpayClearpay,
557 Alipay,
558 Alma,
559 AmazonPay,
560 AuBecsDebit,
561 BacsDebit,
562 Bancontact,
563 Billie,
564 Blik,
565 Boleto,
566 Card,
567 Cashapp,
568 Crypto,
569 Custom,
570 CustomerBalance,
571 Eps,
572 Fpx,
573 Giropay,
574 Grabpay,
575 Ideal,
576 KakaoPay,
577 Klarna,
578 Konbini,
579 KrCard,
580 Link,
581 MbWay,
582 Mobilepay,
583 Multibanco,
584 NaverPay,
585 NzBankAccount,
586 Oxxo,
587 P24,
588 PayByBank,
589 Payco,
590 Paynow,
591 Paypal,
592 Payto,
593 Pix,
594 Promptpay,
595 RevolutPay,
596 SamsungPay,
597 Satispay,
598 SepaDebit,
599 Sofort,
600 Swish,
601 Twint,
602 UsBankAccount,
603 WechatPay,
604 Zip,
605 Unknown(String),
607}
608impl ListPaymentMethodsCustomerType {
609 pub fn as_str(&self) -> &str {
610 use ListPaymentMethodsCustomerType::*;
611 match self {
612 AcssDebit => "acss_debit",
613 Affirm => "affirm",
614 AfterpayClearpay => "afterpay_clearpay",
615 Alipay => "alipay",
616 Alma => "alma",
617 AmazonPay => "amazon_pay",
618 AuBecsDebit => "au_becs_debit",
619 BacsDebit => "bacs_debit",
620 Bancontact => "bancontact",
621 Billie => "billie",
622 Blik => "blik",
623 Boleto => "boleto",
624 Card => "card",
625 Cashapp => "cashapp",
626 Crypto => "crypto",
627 Custom => "custom",
628 CustomerBalance => "customer_balance",
629 Eps => "eps",
630 Fpx => "fpx",
631 Giropay => "giropay",
632 Grabpay => "grabpay",
633 Ideal => "ideal",
634 KakaoPay => "kakao_pay",
635 Klarna => "klarna",
636 Konbini => "konbini",
637 KrCard => "kr_card",
638 Link => "link",
639 MbWay => "mb_way",
640 Mobilepay => "mobilepay",
641 Multibanco => "multibanco",
642 NaverPay => "naver_pay",
643 NzBankAccount => "nz_bank_account",
644 Oxxo => "oxxo",
645 P24 => "p24",
646 PayByBank => "pay_by_bank",
647 Payco => "payco",
648 Paynow => "paynow",
649 Paypal => "paypal",
650 Payto => "payto",
651 Pix => "pix",
652 Promptpay => "promptpay",
653 RevolutPay => "revolut_pay",
654 SamsungPay => "samsung_pay",
655 Satispay => "satispay",
656 SepaDebit => "sepa_debit",
657 Sofort => "sofort",
658 Swish => "swish",
659 Twint => "twint",
660 UsBankAccount => "us_bank_account",
661 WechatPay => "wechat_pay",
662 Zip => "zip",
663 Unknown(v) => v,
664 }
665 }
666}
667
668impl std::str::FromStr for ListPaymentMethodsCustomerType {
669 type Err = std::convert::Infallible;
670 fn from_str(s: &str) -> Result<Self, Self::Err> {
671 use ListPaymentMethodsCustomerType::*;
672 match s {
673 "acss_debit" => Ok(AcssDebit),
674 "affirm" => Ok(Affirm),
675 "afterpay_clearpay" => Ok(AfterpayClearpay),
676 "alipay" => Ok(Alipay),
677 "alma" => Ok(Alma),
678 "amazon_pay" => Ok(AmazonPay),
679 "au_becs_debit" => Ok(AuBecsDebit),
680 "bacs_debit" => Ok(BacsDebit),
681 "bancontact" => Ok(Bancontact),
682 "billie" => Ok(Billie),
683 "blik" => Ok(Blik),
684 "boleto" => Ok(Boleto),
685 "card" => Ok(Card),
686 "cashapp" => Ok(Cashapp),
687 "crypto" => Ok(Crypto),
688 "custom" => Ok(Custom),
689 "customer_balance" => Ok(CustomerBalance),
690 "eps" => Ok(Eps),
691 "fpx" => Ok(Fpx),
692 "giropay" => Ok(Giropay),
693 "grabpay" => Ok(Grabpay),
694 "ideal" => Ok(Ideal),
695 "kakao_pay" => Ok(KakaoPay),
696 "klarna" => Ok(Klarna),
697 "konbini" => Ok(Konbini),
698 "kr_card" => Ok(KrCard),
699 "link" => Ok(Link),
700 "mb_way" => Ok(MbWay),
701 "mobilepay" => Ok(Mobilepay),
702 "multibanco" => Ok(Multibanco),
703 "naver_pay" => Ok(NaverPay),
704 "nz_bank_account" => Ok(NzBankAccount),
705 "oxxo" => Ok(Oxxo),
706 "p24" => Ok(P24),
707 "pay_by_bank" => Ok(PayByBank),
708 "payco" => Ok(Payco),
709 "paynow" => Ok(Paynow),
710 "paypal" => Ok(Paypal),
711 "payto" => Ok(Payto),
712 "pix" => Ok(Pix),
713 "promptpay" => Ok(Promptpay),
714 "revolut_pay" => Ok(RevolutPay),
715 "samsung_pay" => Ok(SamsungPay),
716 "satispay" => Ok(Satispay),
717 "sepa_debit" => Ok(SepaDebit),
718 "sofort" => Ok(Sofort),
719 "swish" => Ok(Swish),
720 "twint" => Ok(Twint),
721 "us_bank_account" => Ok(UsBankAccount),
722 "wechat_pay" => Ok(WechatPay),
723 "zip" => Ok(Zip),
724 v => {
725 tracing::warn!(
726 "Unknown value '{}' for enum '{}'",
727 v,
728 "ListPaymentMethodsCustomerType"
729 );
730 Ok(Unknown(v.to_owned()))
731 }
732 }
733 }
734}
735impl std::fmt::Display for ListPaymentMethodsCustomerType {
736 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
737 f.write_str(self.as_str())
738 }
739}
740
741impl std::fmt::Debug for ListPaymentMethodsCustomerType {
742 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
743 f.write_str(self.as_str())
744 }
745}
746impl serde::Serialize for ListPaymentMethodsCustomerType {
747 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
748 where
749 S: serde::Serializer,
750 {
751 serializer.serialize_str(self.as_str())
752 }
753}
754#[cfg(feature = "deserialize")]
755impl<'de> serde::Deserialize<'de> for ListPaymentMethodsCustomerType {
756 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
757 use std::str::FromStr;
758 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
759 Ok(Self::from_str(&s).expect("infallible"))
760 }
761}
762#[derive(Clone, Debug, serde::Serialize)]
764pub struct ListPaymentMethodsCustomer {
765 inner: ListPaymentMethodsCustomerBuilder,
766 customer: stripe_shared::CustomerId,
767}
768impl ListPaymentMethodsCustomer {
769 pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
771 Self { customer: customer.into(), inner: ListPaymentMethodsCustomerBuilder::new() }
772 }
773 pub fn allow_redisplay(
776 mut self,
777 allow_redisplay: impl Into<ListPaymentMethodsCustomerAllowRedisplay>,
778 ) -> Self {
779 self.inner.allow_redisplay = Some(allow_redisplay.into());
780 self
781 }
782 pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
786 self.inner.ending_before = Some(ending_before.into());
787 self
788 }
789 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
791 self.inner.expand = Some(expand.into());
792 self
793 }
794 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
797 self.inner.limit = Some(limit.into());
798 self
799 }
800 pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
804 self.inner.starting_after = Some(starting_after.into());
805 self
806 }
807 pub fn type_(mut self, type_: impl Into<ListPaymentMethodsCustomerType>) -> Self {
811 self.inner.type_ = Some(type_.into());
812 self
813 }
814}
815impl ListPaymentMethodsCustomer {
816 pub async fn send<C: StripeClient>(
818 &self,
819 client: &C,
820 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
821 self.customize().send(client).await
822 }
823
824 pub fn send_blocking<C: StripeBlockingClient>(
826 &self,
827 client: &C,
828 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
829 self.customize().send_blocking(client)
830 }
831
832 pub fn paginate(
833 &self,
834 ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::PaymentMethod>> {
835 let customer = &self.customer;
836
837 stripe_client_core::ListPaginator::new_list(
838 format!("/customers/{customer}/payment_methods"),
839 &self.inner,
840 )
841 }
842}
843
844impl StripeRequest for ListPaymentMethodsCustomer {
845 type Output = stripe_types::List<stripe_shared::PaymentMethod>;
846
847 fn build(&self) -> RequestBuilder {
848 let customer = &self.customer;
849 RequestBuilder::new(StripeMethod::Get, format!("/customers/{customer}/payment_methods"))
850 .query(&self.inner)
851 }
852}
853#[derive(Clone, Debug, serde::Serialize)]
854struct RetrievePaymentMethodCustomerBuilder {
855 #[serde(skip_serializing_if = "Option::is_none")]
856 expand: Option<Vec<String>>,
857}
858impl RetrievePaymentMethodCustomerBuilder {
859 fn new() -> Self {
860 Self { expand: None }
861 }
862}
863#[derive(Clone, Debug, serde::Serialize)]
865pub struct RetrievePaymentMethodCustomer {
866 inner: RetrievePaymentMethodCustomerBuilder,
867 customer: stripe_shared::CustomerId,
868 payment_method: String,
869}
870impl RetrievePaymentMethodCustomer {
871 pub fn new(
873 customer: impl Into<stripe_shared::CustomerId>,
874 payment_method: impl Into<String>,
875 ) -> Self {
876 Self {
877 customer: customer.into(),
878 payment_method: payment_method.into(),
879 inner: RetrievePaymentMethodCustomerBuilder::new(),
880 }
881 }
882 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
884 self.inner.expand = Some(expand.into());
885 self
886 }
887}
888impl RetrievePaymentMethodCustomer {
889 pub async fn send<C: StripeClient>(
891 &self,
892 client: &C,
893 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
894 self.customize().send(client).await
895 }
896
897 pub fn send_blocking<C: StripeBlockingClient>(
899 &self,
900 client: &C,
901 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
902 self.customize().send_blocking(client)
903 }
904}
905
906impl StripeRequest for RetrievePaymentMethodCustomer {
907 type Output = stripe_shared::PaymentMethod;
908
909 fn build(&self) -> RequestBuilder {
910 let customer = &self.customer;
911 let payment_method = &self.payment_method;
912 RequestBuilder::new(
913 StripeMethod::Get,
914 format!("/customers/{customer}/payment_methods/{payment_method}"),
915 )
916 .query(&self.inner)
917 }
918}
919#[derive(Clone, Debug, serde::Serialize)]
920struct SearchCustomerBuilder {
921 #[serde(skip_serializing_if = "Option::is_none")]
922 expand: Option<Vec<String>>,
923 #[serde(skip_serializing_if = "Option::is_none")]
924 limit: Option<i64>,
925 #[serde(skip_serializing_if = "Option::is_none")]
926 page: Option<String>,
927 query: String,
928}
929impl SearchCustomerBuilder {
930 fn new(query: impl Into<String>) -> Self {
931 Self { expand: None, limit: None, page: None, query: query.into() }
932 }
933}
934#[derive(Clone, Debug, serde::Serialize)]
941pub struct SearchCustomer {
942 inner: SearchCustomerBuilder,
943}
944impl SearchCustomer {
945 pub fn new(query: impl Into<String>) -> Self {
947 Self { inner: SearchCustomerBuilder::new(query.into()) }
948 }
949 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
951 self.inner.expand = Some(expand.into());
952 self
953 }
954 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
957 self.inner.limit = Some(limit.into());
958 self
959 }
960 pub fn page(mut self, page: impl Into<String>) -> Self {
964 self.inner.page = Some(page.into());
965 self
966 }
967}
968impl SearchCustomer {
969 pub async fn send<C: StripeClient>(
971 &self,
972 client: &C,
973 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
974 self.customize().send(client).await
975 }
976
977 pub fn send_blocking<C: StripeBlockingClient>(
979 &self,
980 client: &C,
981 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
982 self.customize().send_blocking(client)
983 }
984
985 pub fn paginate(
986 &self,
987 ) -> stripe_client_core::ListPaginator<stripe_types::SearchList<stripe_shared::Customer>> {
988 stripe_client_core::ListPaginator::new_search_list("/customers/search", &self.inner)
989 }
990}
991
992impl StripeRequest for SearchCustomer {
993 type Output = stripe_types::SearchList<stripe_shared::Customer>;
994
995 fn build(&self) -> RequestBuilder {
996 RequestBuilder::new(StripeMethod::Get, "/customers/search").query(&self.inner)
997 }
998}
999#[derive(Clone, Debug, serde::Serialize)]
1000struct CreateCustomerBuilder {
1001 #[serde(skip_serializing_if = "Option::is_none")]
1002 address: Option<OptionalFieldsCustomerAddress>,
1003 #[serde(skip_serializing_if = "Option::is_none")]
1004 balance: Option<i64>,
1005 #[serde(skip_serializing_if = "Option::is_none")]
1006 business_name: Option<String>,
1007 #[serde(skip_serializing_if = "Option::is_none")]
1008 cash_balance: Option<CreateCustomerCashBalance>,
1009 #[serde(skip_serializing_if = "Option::is_none")]
1010 description: Option<String>,
1011 #[serde(skip_serializing_if = "Option::is_none")]
1012 email: Option<String>,
1013 #[serde(skip_serializing_if = "Option::is_none")]
1014 expand: Option<Vec<String>>,
1015 #[serde(skip_serializing_if = "Option::is_none")]
1016 individual_name: Option<String>,
1017 #[serde(skip_serializing_if = "Option::is_none")]
1018 invoice_prefix: Option<String>,
1019 #[serde(skip_serializing_if = "Option::is_none")]
1020 invoice_settings: Option<CreateCustomerInvoiceSettings>,
1021 #[serde(skip_serializing_if = "Option::is_none")]
1022 metadata: Option<std::collections::HashMap<String, String>>,
1023 #[serde(skip_serializing_if = "Option::is_none")]
1024 name: Option<String>,
1025 #[serde(skip_serializing_if = "Option::is_none")]
1026 next_invoice_sequence: Option<i64>,
1027 #[serde(skip_serializing_if = "Option::is_none")]
1028 payment_method: Option<String>,
1029 #[serde(skip_serializing_if = "Option::is_none")]
1030 phone: Option<String>,
1031 #[serde(skip_serializing_if = "Option::is_none")]
1032 preferred_locales: Option<Vec<String>>,
1033 #[serde(skip_serializing_if = "Option::is_none")]
1034 shipping: Option<CustomerShipping>,
1035 #[serde(skip_serializing_if = "Option::is_none")]
1036 source: Option<String>,
1037 #[serde(skip_serializing_if = "Option::is_none")]
1038 tax: Option<CreateCustomerTax>,
1039 #[serde(skip_serializing_if = "Option::is_none")]
1040 tax_exempt: Option<stripe_shared::CustomerTaxExempt>,
1041 #[serde(skip_serializing_if = "Option::is_none")]
1042 tax_id_data: Option<Vec<CreateCustomerTaxIdData>>,
1043 #[serde(skip_serializing_if = "Option::is_none")]
1044 test_clock: Option<String>,
1045 #[serde(skip_serializing_if = "Option::is_none")]
1046 validate: Option<bool>,
1047}
1048impl CreateCustomerBuilder {
1049 fn new() -> Self {
1050 Self {
1051 address: None,
1052 balance: None,
1053 business_name: None,
1054 cash_balance: None,
1055 description: None,
1056 email: None,
1057 expand: None,
1058 individual_name: None,
1059 invoice_prefix: None,
1060 invoice_settings: None,
1061 metadata: None,
1062 name: None,
1063 next_invoice_sequence: None,
1064 payment_method: None,
1065 phone: None,
1066 preferred_locales: None,
1067 shipping: None,
1068 source: None,
1069 tax: None,
1070 tax_exempt: None,
1071 tax_id_data: None,
1072 test_clock: None,
1073 validate: None,
1074 }
1075 }
1076}
1077#[derive(Clone, Debug, serde::Serialize)]
1079pub struct CreateCustomerCashBalance {
1080 #[serde(skip_serializing_if = "Option::is_none")]
1083 pub settings: Option<CreateCustomerCashBalanceSettings>,
1084}
1085impl CreateCustomerCashBalance {
1086 pub fn new() -> Self {
1087 Self { settings: None }
1088 }
1089}
1090impl Default for CreateCustomerCashBalance {
1091 fn default() -> Self {
1092 Self::new()
1093 }
1094}
1095#[derive(Clone, Debug, serde::Serialize)]
1098pub struct CreateCustomerCashBalanceSettings {
1099 #[serde(skip_serializing_if = "Option::is_none")]
1103 pub reconciliation_mode: Option<CreateCustomerCashBalanceSettingsReconciliationMode>,
1104}
1105impl CreateCustomerCashBalanceSettings {
1106 pub fn new() -> Self {
1107 Self { reconciliation_mode: None }
1108 }
1109}
1110impl Default for CreateCustomerCashBalanceSettings {
1111 fn default() -> Self {
1112 Self::new()
1113 }
1114}
1115#[derive(Clone, Eq, PartialEq)]
1119#[non_exhaustive]
1120pub enum CreateCustomerCashBalanceSettingsReconciliationMode {
1121 Automatic,
1122 Manual,
1123 MerchantDefault,
1124 Unknown(String),
1126}
1127impl CreateCustomerCashBalanceSettingsReconciliationMode {
1128 pub fn as_str(&self) -> &str {
1129 use CreateCustomerCashBalanceSettingsReconciliationMode::*;
1130 match self {
1131 Automatic => "automatic",
1132 Manual => "manual",
1133 MerchantDefault => "merchant_default",
1134 Unknown(v) => v,
1135 }
1136 }
1137}
1138
1139impl std::str::FromStr for CreateCustomerCashBalanceSettingsReconciliationMode {
1140 type Err = std::convert::Infallible;
1141 fn from_str(s: &str) -> Result<Self, Self::Err> {
1142 use CreateCustomerCashBalanceSettingsReconciliationMode::*;
1143 match s {
1144 "automatic" => Ok(Automatic),
1145 "manual" => Ok(Manual),
1146 "merchant_default" => Ok(MerchantDefault),
1147 v => {
1148 tracing::warn!(
1149 "Unknown value '{}' for enum '{}'",
1150 v,
1151 "CreateCustomerCashBalanceSettingsReconciliationMode"
1152 );
1153 Ok(Unknown(v.to_owned()))
1154 }
1155 }
1156 }
1157}
1158impl std::fmt::Display for CreateCustomerCashBalanceSettingsReconciliationMode {
1159 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1160 f.write_str(self.as_str())
1161 }
1162}
1163
1164impl std::fmt::Debug for CreateCustomerCashBalanceSettingsReconciliationMode {
1165 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1166 f.write_str(self.as_str())
1167 }
1168}
1169impl serde::Serialize for CreateCustomerCashBalanceSettingsReconciliationMode {
1170 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1171 where
1172 S: serde::Serializer,
1173 {
1174 serializer.serialize_str(self.as_str())
1175 }
1176}
1177#[cfg(feature = "deserialize")]
1178impl<'de> serde::Deserialize<'de> for CreateCustomerCashBalanceSettingsReconciliationMode {
1179 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1180 use std::str::FromStr;
1181 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1182 Ok(Self::from_str(&s).expect("infallible"))
1183 }
1184}
1185#[derive(Clone, Debug, serde::Serialize)]
1187pub struct CreateCustomerInvoiceSettings {
1188 #[serde(skip_serializing_if = "Option::is_none")]
1191 pub custom_fields: Option<Vec<CustomFieldParams>>,
1192 #[serde(skip_serializing_if = "Option::is_none")]
1194 pub default_payment_method: Option<String>,
1195 #[serde(skip_serializing_if = "Option::is_none")]
1197 pub footer: Option<String>,
1198 #[serde(skip_serializing_if = "Option::is_none")]
1200 pub rendering_options: Option<CreateCustomerInvoiceSettingsRenderingOptions>,
1201}
1202impl CreateCustomerInvoiceSettings {
1203 pub fn new() -> Self {
1204 Self {
1205 custom_fields: None,
1206 default_payment_method: None,
1207 footer: None,
1208 rendering_options: None,
1209 }
1210 }
1211}
1212impl Default for CreateCustomerInvoiceSettings {
1213 fn default() -> Self {
1214 Self::new()
1215 }
1216}
1217#[derive(Clone, Debug, serde::Serialize)]
1219pub struct CreateCustomerInvoiceSettingsRenderingOptions {
1220 #[serde(skip_serializing_if = "Option::is_none")]
1225 pub amount_tax_display: Option<CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay>,
1226 #[serde(skip_serializing_if = "Option::is_none")]
1228 pub template: Option<String>,
1229}
1230impl CreateCustomerInvoiceSettingsRenderingOptions {
1231 pub fn new() -> Self {
1232 Self { amount_tax_display: None, template: None }
1233 }
1234}
1235impl Default for CreateCustomerInvoiceSettingsRenderingOptions {
1236 fn default() -> Self {
1237 Self::new()
1238 }
1239}
1240#[derive(Clone, Eq, PartialEq)]
1245#[non_exhaustive]
1246pub enum CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1247 ExcludeTax,
1248 IncludeInclusiveTax,
1249 Unknown(String),
1251}
1252impl CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1253 pub fn as_str(&self) -> &str {
1254 use CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
1255 match self {
1256 ExcludeTax => "exclude_tax",
1257 IncludeInclusiveTax => "include_inclusive_tax",
1258 Unknown(v) => v,
1259 }
1260 }
1261}
1262
1263impl std::str::FromStr for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1264 type Err = std::convert::Infallible;
1265 fn from_str(s: &str) -> Result<Self, Self::Err> {
1266 use CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
1267 match s {
1268 "exclude_tax" => Ok(ExcludeTax),
1269 "include_inclusive_tax" => Ok(IncludeInclusiveTax),
1270 v => {
1271 tracing::warn!(
1272 "Unknown value '{}' for enum '{}'",
1273 v,
1274 "CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay"
1275 );
1276 Ok(Unknown(v.to_owned()))
1277 }
1278 }
1279 }
1280}
1281impl std::fmt::Display for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1282 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1283 f.write_str(self.as_str())
1284 }
1285}
1286
1287impl std::fmt::Debug for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1288 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1289 f.write_str(self.as_str())
1290 }
1291}
1292impl serde::Serialize for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
1293 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1294 where
1295 S: serde::Serializer,
1296 {
1297 serializer.serialize_str(self.as_str())
1298 }
1299}
1300#[cfg(feature = "deserialize")]
1301impl<'de> serde::Deserialize<'de>
1302 for CreateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay
1303{
1304 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1305 use std::str::FromStr;
1306 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1307 Ok(Self::from_str(&s).expect("infallible"))
1308 }
1309}
1310#[derive(Clone, Debug, serde::Serialize)]
1312pub struct CreateCustomerTax {
1313 #[serde(skip_serializing_if = "Option::is_none")]
1317 pub ip_address: Option<String>,
1318 #[serde(skip_serializing_if = "Option::is_none")]
1321 pub validate_location: Option<CreateCustomerTaxValidateLocation>,
1322}
1323impl CreateCustomerTax {
1324 pub fn new() -> Self {
1325 Self { ip_address: None, validate_location: None }
1326 }
1327}
1328impl Default for CreateCustomerTax {
1329 fn default() -> Self {
1330 Self::new()
1331 }
1332}
1333#[derive(Clone, Eq, PartialEq)]
1336#[non_exhaustive]
1337pub enum CreateCustomerTaxValidateLocation {
1338 Deferred,
1339 Immediately,
1340 Unknown(String),
1342}
1343impl CreateCustomerTaxValidateLocation {
1344 pub fn as_str(&self) -> &str {
1345 use CreateCustomerTaxValidateLocation::*;
1346 match self {
1347 Deferred => "deferred",
1348 Immediately => "immediately",
1349 Unknown(v) => v,
1350 }
1351 }
1352}
1353
1354impl std::str::FromStr for CreateCustomerTaxValidateLocation {
1355 type Err = std::convert::Infallible;
1356 fn from_str(s: &str) -> Result<Self, Self::Err> {
1357 use CreateCustomerTaxValidateLocation::*;
1358 match s {
1359 "deferred" => Ok(Deferred),
1360 "immediately" => Ok(Immediately),
1361 v => {
1362 tracing::warn!(
1363 "Unknown value '{}' for enum '{}'",
1364 v,
1365 "CreateCustomerTaxValidateLocation"
1366 );
1367 Ok(Unknown(v.to_owned()))
1368 }
1369 }
1370 }
1371}
1372impl std::fmt::Display for CreateCustomerTaxValidateLocation {
1373 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1374 f.write_str(self.as_str())
1375 }
1376}
1377
1378impl std::fmt::Debug for CreateCustomerTaxValidateLocation {
1379 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1380 f.write_str(self.as_str())
1381 }
1382}
1383impl serde::Serialize for CreateCustomerTaxValidateLocation {
1384 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1385 where
1386 S: serde::Serializer,
1387 {
1388 serializer.serialize_str(self.as_str())
1389 }
1390}
1391#[cfg(feature = "deserialize")]
1392impl<'de> serde::Deserialize<'de> for CreateCustomerTaxValidateLocation {
1393 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1394 use std::str::FromStr;
1395 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1396 Ok(Self::from_str(&s).expect("infallible"))
1397 }
1398}
1399#[derive(Clone, Debug, serde::Serialize)]
1401pub struct CreateCustomerTaxIdData {
1402 #[serde(rename = "type")]
1404 pub type_: CreateCustomerTaxIdDataType,
1405 pub value: String,
1407}
1408impl CreateCustomerTaxIdData {
1409 pub fn new(type_: impl Into<CreateCustomerTaxIdDataType>, value: impl Into<String>) -> Self {
1410 Self { type_: type_.into(), value: value.into() }
1411 }
1412}
1413#[derive(Clone, Eq, PartialEq)]
1415#[non_exhaustive]
1416pub enum CreateCustomerTaxIdDataType {
1417 AdNrt,
1418 AeTrn,
1419 AlTin,
1420 AmTin,
1421 AoTin,
1422 ArCuit,
1423 AuAbn,
1424 AuArn,
1425 AwTin,
1426 AzTin,
1427 BaTin,
1428 BbTin,
1429 BdBin,
1430 BfIfu,
1431 BgUic,
1432 BhVat,
1433 BjIfu,
1434 BoTin,
1435 BrCnpj,
1436 BrCpf,
1437 BsTin,
1438 ByTin,
1439 CaBn,
1440 CaGstHst,
1441 CaPstBc,
1442 CaPstMb,
1443 CaPstSk,
1444 CaQst,
1445 CdNif,
1446 ChUid,
1447 ChVat,
1448 ClTin,
1449 CmNiu,
1450 CnTin,
1451 CoNit,
1452 CrTin,
1453 CvNif,
1454 DeStn,
1455 DoRcn,
1456 EcRuc,
1457 EgTin,
1458 EsCif,
1459 EtTin,
1460 EuOssVat,
1461 EuVat,
1462 GbVat,
1463 GeVat,
1464 GnNif,
1465 HkBr,
1466 HrOib,
1467 HuTin,
1468 IdNpwp,
1469 IlVat,
1470 InGst,
1471 IsVat,
1472 JpCn,
1473 JpRn,
1474 JpTrn,
1475 KePin,
1476 KgTin,
1477 KhTin,
1478 KrBrn,
1479 KzBin,
1480 LaTin,
1481 LiUid,
1482 LiVat,
1483 MaVat,
1484 MdVat,
1485 MePib,
1486 MkVat,
1487 MrNif,
1488 MxRfc,
1489 MyFrp,
1490 MyItn,
1491 MySst,
1492 NgTin,
1493 NoVat,
1494 NoVoec,
1495 NpPan,
1496 NzGst,
1497 OmVat,
1498 PeRuc,
1499 PhTin,
1500 RoTin,
1501 RsPib,
1502 RuInn,
1503 RuKpp,
1504 SaVat,
1505 SgGst,
1506 SgUen,
1507 SiTin,
1508 SnNinea,
1509 SrFin,
1510 SvNit,
1511 ThVat,
1512 TjTin,
1513 TrTin,
1514 TwVat,
1515 TzVat,
1516 UaVat,
1517 UgTin,
1518 UsEin,
1519 UyRuc,
1520 UzTin,
1521 UzVat,
1522 VeRif,
1523 VnTin,
1524 ZaVat,
1525 ZmTin,
1526 ZwTin,
1527 Unknown(String),
1529}
1530impl CreateCustomerTaxIdDataType {
1531 pub fn as_str(&self) -> &str {
1532 use CreateCustomerTaxIdDataType::*;
1533 match self {
1534 AdNrt => "ad_nrt",
1535 AeTrn => "ae_trn",
1536 AlTin => "al_tin",
1537 AmTin => "am_tin",
1538 AoTin => "ao_tin",
1539 ArCuit => "ar_cuit",
1540 AuAbn => "au_abn",
1541 AuArn => "au_arn",
1542 AwTin => "aw_tin",
1543 AzTin => "az_tin",
1544 BaTin => "ba_tin",
1545 BbTin => "bb_tin",
1546 BdBin => "bd_bin",
1547 BfIfu => "bf_ifu",
1548 BgUic => "bg_uic",
1549 BhVat => "bh_vat",
1550 BjIfu => "bj_ifu",
1551 BoTin => "bo_tin",
1552 BrCnpj => "br_cnpj",
1553 BrCpf => "br_cpf",
1554 BsTin => "bs_tin",
1555 ByTin => "by_tin",
1556 CaBn => "ca_bn",
1557 CaGstHst => "ca_gst_hst",
1558 CaPstBc => "ca_pst_bc",
1559 CaPstMb => "ca_pst_mb",
1560 CaPstSk => "ca_pst_sk",
1561 CaQst => "ca_qst",
1562 CdNif => "cd_nif",
1563 ChUid => "ch_uid",
1564 ChVat => "ch_vat",
1565 ClTin => "cl_tin",
1566 CmNiu => "cm_niu",
1567 CnTin => "cn_tin",
1568 CoNit => "co_nit",
1569 CrTin => "cr_tin",
1570 CvNif => "cv_nif",
1571 DeStn => "de_stn",
1572 DoRcn => "do_rcn",
1573 EcRuc => "ec_ruc",
1574 EgTin => "eg_tin",
1575 EsCif => "es_cif",
1576 EtTin => "et_tin",
1577 EuOssVat => "eu_oss_vat",
1578 EuVat => "eu_vat",
1579 GbVat => "gb_vat",
1580 GeVat => "ge_vat",
1581 GnNif => "gn_nif",
1582 HkBr => "hk_br",
1583 HrOib => "hr_oib",
1584 HuTin => "hu_tin",
1585 IdNpwp => "id_npwp",
1586 IlVat => "il_vat",
1587 InGst => "in_gst",
1588 IsVat => "is_vat",
1589 JpCn => "jp_cn",
1590 JpRn => "jp_rn",
1591 JpTrn => "jp_trn",
1592 KePin => "ke_pin",
1593 KgTin => "kg_tin",
1594 KhTin => "kh_tin",
1595 KrBrn => "kr_brn",
1596 KzBin => "kz_bin",
1597 LaTin => "la_tin",
1598 LiUid => "li_uid",
1599 LiVat => "li_vat",
1600 MaVat => "ma_vat",
1601 MdVat => "md_vat",
1602 MePib => "me_pib",
1603 MkVat => "mk_vat",
1604 MrNif => "mr_nif",
1605 MxRfc => "mx_rfc",
1606 MyFrp => "my_frp",
1607 MyItn => "my_itn",
1608 MySst => "my_sst",
1609 NgTin => "ng_tin",
1610 NoVat => "no_vat",
1611 NoVoec => "no_voec",
1612 NpPan => "np_pan",
1613 NzGst => "nz_gst",
1614 OmVat => "om_vat",
1615 PeRuc => "pe_ruc",
1616 PhTin => "ph_tin",
1617 RoTin => "ro_tin",
1618 RsPib => "rs_pib",
1619 RuInn => "ru_inn",
1620 RuKpp => "ru_kpp",
1621 SaVat => "sa_vat",
1622 SgGst => "sg_gst",
1623 SgUen => "sg_uen",
1624 SiTin => "si_tin",
1625 SnNinea => "sn_ninea",
1626 SrFin => "sr_fin",
1627 SvNit => "sv_nit",
1628 ThVat => "th_vat",
1629 TjTin => "tj_tin",
1630 TrTin => "tr_tin",
1631 TwVat => "tw_vat",
1632 TzVat => "tz_vat",
1633 UaVat => "ua_vat",
1634 UgTin => "ug_tin",
1635 UsEin => "us_ein",
1636 UyRuc => "uy_ruc",
1637 UzTin => "uz_tin",
1638 UzVat => "uz_vat",
1639 VeRif => "ve_rif",
1640 VnTin => "vn_tin",
1641 ZaVat => "za_vat",
1642 ZmTin => "zm_tin",
1643 ZwTin => "zw_tin",
1644 Unknown(v) => v,
1645 }
1646 }
1647}
1648
1649impl std::str::FromStr for CreateCustomerTaxIdDataType {
1650 type Err = std::convert::Infallible;
1651 fn from_str(s: &str) -> Result<Self, Self::Err> {
1652 use CreateCustomerTaxIdDataType::*;
1653 match s {
1654 "ad_nrt" => Ok(AdNrt),
1655 "ae_trn" => Ok(AeTrn),
1656 "al_tin" => Ok(AlTin),
1657 "am_tin" => Ok(AmTin),
1658 "ao_tin" => Ok(AoTin),
1659 "ar_cuit" => Ok(ArCuit),
1660 "au_abn" => Ok(AuAbn),
1661 "au_arn" => Ok(AuArn),
1662 "aw_tin" => Ok(AwTin),
1663 "az_tin" => Ok(AzTin),
1664 "ba_tin" => Ok(BaTin),
1665 "bb_tin" => Ok(BbTin),
1666 "bd_bin" => Ok(BdBin),
1667 "bf_ifu" => Ok(BfIfu),
1668 "bg_uic" => Ok(BgUic),
1669 "bh_vat" => Ok(BhVat),
1670 "bj_ifu" => Ok(BjIfu),
1671 "bo_tin" => Ok(BoTin),
1672 "br_cnpj" => Ok(BrCnpj),
1673 "br_cpf" => Ok(BrCpf),
1674 "bs_tin" => Ok(BsTin),
1675 "by_tin" => Ok(ByTin),
1676 "ca_bn" => Ok(CaBn),
1677 "ca_gst_hst" => Ok(CaGstHst),
1678 "ca_pst_bc" => Ok(CaPstBc),
1679 "ca_pst_mb" => Ok(CaPstMb),
1680 "ca_pst_sk" => Ok(CaPstSk),
1681 "ca_qst" => Ok(CaQst),
1682 "cd_nif" => Ok(CdNif),
1683 "ch_uid" => Ok(ChUid),
1684 "ch_vat" => Ok(ChVat),
1685 "cl_tin" => Ok(ClTin),
1686 "cm_niu" => Ok(CmNiu),
1687 "cn_tin" => Ok(CnTin),
1688 "co_nit" => Ok(CoNit),
1689 "cr_tin" => Ok(CrTin),
1690 "cv_nif" => Ok(CvNif),
1691 "de_stn" => Ok(DeStn),
1692 "do_rcn" => Ok(DoRcn),
1693 "ec_ruc" => Ok(EcRuc),
1694 "eg_tin" => Ok(EgTin),
1695 "es_cif" => Ok(EsCif),
1696 "et_tin" => Ok(EtTin),
1697 "eu_oss_vat" => Ok(EuOssVat),
1698 "eu_vat" => Ok(EuVat),
1699 "gb_vat" => Ok(GbVat),
1700 "ge_vat" => Ok(GeVat),
1701 "gn_nif" => Ok(GnNif),
1702 "hk_br" => Ok(HkBr),
1703 "hr_oib" => Ok(HrOib),
1704 "hu_tin" => Ok(HuTin),
1705 "id_npwp" => Ok(IdNpwp),
1706 "il_vat" => Ok(IlVat),
1707 "in_gst" => Ok(InGst),
1708 "is_vat" => Ok(IsVat),
1709 "jp_cn" => Ok(JpCn),
1710 "jp_rn" => Ok(JpRn),
1711 "jp_trn" => Ok(JpTrn),
1712 "ke_pin" => Ok(KePin),
1713 "kg_tin" => Ok(KgTin),
1714 "kh_tin" => Ok(KhTin),
1715 "kr_brn" => Ok(KrBrn),
1716 "kz_bin" => Ok(KzBin),
1717 "la_tin" => Ok(LaTin),
1718 "li_uid" => Ok(LiUid),
1719 "li_vat" => Ok(LiVat),
1720 "ma_vat" => Ok(MaVat),
1721 "md_vat" => Ok(MdVat),
1722 "me_pib" => Ok(MePib),
1723 "mk_vat" => Ok(MkVat),
1724 "mr_nif" => Ok(MrNif),
1725 "mx_rfc" => Ok(MxRfc),
1726 "my_frp" => Ok(MyFrp),
1727 "my_itn" => Ok(MyItn),
1728 "my_sst" => Ok(MySst),
1729 "ng_tin" => Ok(NgTin),
1730 "no_vat" => Ok(NoVat),
1731 "no_voec" => Ok(NoVoec),
1732 "np_pan" => Ok(NpPan),
1733 "nz_gst" => Ok(NzGst),
1734 "om_vat" => Ok(OmVat),
1735 "pe_ruc" => Ok(PeRuc),
1736 "ph_tin" => Ok(PhTin),
1737 "ro_tin" => Ok(RoTin),
1738 "rs_pib" => Ok(RsPib),
1739 "ru_inn" => Ok(RuInn),
1740 "ru_kpp" => Ok(RuKpp),
1741 "sa_vat" => Ok(SaVat),
1742 "sg_gst" => Ok(SgGst),
1743 "sg_uen" => Ok(SgUen),
1744 "si_tin" => Ok(SiTin),
1745 "sn_ninea" => Ok(SnNinea),
1746 "sr_fin" => Ok(SrFin),
1747 "sv_nit" => Ok(SvNit),
1748 "th_vat" => Ok(ThVat),
1749 "tj_tin" => Ok(TjTin),
1750 "tr_tin" => Ok(TrTin),
1751 "tw_vat" => Ok(TwVat),
1752 "tz_vat" => Ok(TzVat),
1753 "ua_vat" => Ok(UaVat),
1754 "ug_tin" => Ok(UgTin),
1755 "us_ein" => Ok(UsEin),
1756 "uy_ruc" => Ok(UyRuc),
1757 "uz_tin" => Ok(UzTin),
1758 "uz_vat" => Ok(UzVat),
1759 "ve_rif" => Ok(VeRif),
1760 "vn_tin" => Ok(VnTin),
1761 "za_vat" => Ok(ZaVat),
1762 "zm_tin" => Ok(ZmTin),
1763 "zw_tin" => Ok(ZwTin),
1764 v => {
1765 tracing::warn!(
1766 "Unknown value '{}' for enum '{}'",
1767 v,
1768 "CreateCustomerTaxIdDataType"
1769 );
1770 Ok(Unknown(v.to_owned()))
1771 }
1772 }
1773 }
1774}
1775impl std::fmt::Display for CreateCustomerTaxIdDataType {
1776 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1777 f.write_str(self.as_str())
1778 }
1779}
1780
1781impl std::fmt::Debug for CreateCustomerTaxIdDataType {
1782 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1783 f.write_str(self.as_str())
1784 }
1785}
1786impl serde::Serialize for CreateCustomerTaxIdDataType {
1787 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1788 where
1789 S: serde::Serializer,
1790 {
1791 serializer.serialize_str(self.as_str())
1792 }
1793}
1794#[cfg(feature = "deserialize")]
1795impl<'de> serde::Deserialize<'de> for CreateCustomerTaxIdDataType {
1796 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1797 use std::str::FromStr;
1798 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1799 Ok(Self::from_str(&s).expect("infallible"))
1800 }
1801}
1802#[derive(Clone, Debug, serde::Serialize)]
1804pub struct CreateCustomer {
1805 inner: CreateCustomerBuilder,
1806}
1807impl CreateCustomer {
1808 pub fn new() -> Self {
1810 Self { inner: CreateCustomerBuilder::new() }
1811 }
1812 pub fn address(mut self, address: impl Into<OptionalFieldsCustomerAddress>) -> Self {
1815 self.inner.address = Some(address.into());
1816 self
1817 }
1818 pub fn balance(mut self, balance: impl Into<i64>) -> Self {
1821 self.inner.balance = Some(balance.into());
1822 self
1823 }
1824 pub fn business_name(mut self, business_name: impl Into<String>) -> Self {
1826 self.inner.business_name = Some(business_name.into());
1827 self
1828 }
1829 pub fn cash_balance(mut self, cash_balance: impl Into<CreateCustomerCashBalance>) -> Self {
1831 self.inner.cash_balance = Some(cash_balance.into());
1832 self
1833 }
1834 pub fn description(mut self, description: impl Into<String>) -> Self {
1837 self.inner.description = Some(description.into());
1838 self
1839 }
1840 pub fn email(mut self, email: impl Into<String>) -> Self {
1844 self.inner.email = Some(email.into());
1845 self
1846 }
1847 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1849 self.inner.expand = Some(expand.into());
1850 self
1851 }
1852 pub fn individual_name(mut self, individual_name: impl Into<String>) -> Self {
1854 self.inner.individual_name = Some(individual_name.into());
1855 self
1856 }
1857 pub fn invoice_prefix(mut self, invoice_prefix: impl Into<String>) -> Self {
1860 self.inner.invoice_prefix = Some(invoice_prefix.into());
1861 self
1862 }
1863 pub fn invoice_settings(
1865 mut self,
1866 invoice_settings: impl Into<CreateCustomerInvoiceSettings>,
1867 ) -> Self {
1868 self.inner.invoice_settings = Some(invoice_settings.into());
1869 self
1870 }
1871 pub fn metadata(
1876 mut self,
1877 metadata: impl Into<std::collections::HashMap<String, String>>,
1878 ) -> Self {
1879 self.inner.metadata = Some(metadata.into());
1880 self
1881 }
1882 pub fn name(mut self, name: impl Into<String>) -> Self {
1884 self.inner.name = Some(name.into());
1885 self
1886 }
1887 pub fn next_invoice_sequence(mut self, next_invoice_sequence: impl Into<i64>) -> Self {
1889 self.inner.next_invoice_sequence = Some(next_invoice_sequence.into());
1890 self
1891 }
1892 pub fn payment_method(mut self, payment_method: impl Into<String>) -> Self {
1893 self.inner.payment_method = Some(payment_method.into());
1894 self
1895 }
1896 pub fn phone(mut self, phone: impl Into<String>) -> Self {
1898 self.inner.phone = Some(phone.into());
1899 self
1900 }
1901 pub fn preferred_locales(mut self, preferred_locales: impl Into<Vec<String>>) -> Self {
1903 self.inner.preferred_locales = Some(preferred_locales.into());
1904 self
1905 }
1906 pub fn shipping(mut self, shipping: impl Into<CustomerShipping>) -> Self {
1908 self.inner.shipping = Some(shipping.into());
1909 self
1910 }
1911 pub fn source(mut self, source: impl Into<String>) -> Self {
1912 self.inner.source = Some(source.into());
1913 self
1914 }
1915 pub fn tax(mut self, tax: impl Into<CreateCustomerTax>) -> Self {
1917 self.inner.tax = Some(tax.into());
1918 self
1919 }
1920 pub fn tax_exempt(mut self, tax_exempt: impl Into<stripe_shared::CustomerTaxExempt>) -> Self {
1922 self.inner.tax_exempt = Some(tax_exempt.into());
1923 self
1924 }
1925 pub fn tax_id_data(mut self, tax_id_data: impl Into<Vec<CreateCustomerTaxIdData>>) -> Self {
1927 self.inner.tax_id_data = Some(tax_id_data.into());
1928 self
1929 }
1930 pub fn test_clock(mut self, test_clock: impl Into<String>) -> Self {
1932 self.inner.test_clock = Some(test_clock.into());
1933 self
1934 }
1935 pub fn validate(mut self, validate: impl Into<bool>) -> Self {
1936 self.inner.validate = Some(validate.into());
1937 self
1938 }
1939}
1940impl Default for CreateCustomer {
1941 fn default() -> Self {
1942 Self::new()
1943 }
1944}
1945impl CreateCustomer {
1946 pub async fn send<C: StripeClient>(
1948 &self,
1949 client: &C,
1950 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1951 self.customize().send(client).await
1952 }
1953
1954 pub fn send_blocking<C: StripeBlockingClient>(
1956 &self,
1957 client: &C,
1958 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1959 self.customize().send_blocking(client)
1960 }
1961}
1962
1963impl StripeRequest for CreateCustomer {
1964 type Output = stripe_shared::Customer;
1965
1966 fn build(&self) -> RequestBuilder {
1967 RequestBuilder::new(StripeMethod::Post, "/customers").form(&self.inner)
1968 }
1969}
1970#[derive(Clone, Debug, serde::Serialize)]
1971struct UpdateCustomerBuilder {
1972 #[serde(skip_serializing_if = "Option::is_none")]
1973 address: Option<OptionalFieldsCustomerAddress>,
1974 #[serde(skip_serializing_if = "Option::is_none")]
1975 balance: Option<i64>,
1976 #[serde(skip_serializing_if = "Option::is_none")]
1977 business_name: Option<String>,
1978 #[serde(skip_serializing_if = "Option::is_none")]
1979 cash_balance: Option<UpdateCustomerCashBalance>,
1980 #[serde(skip_serializing_if = "Option::is_none")]
1981 default_source: Option<String>,
1982 #[serde(skip_serializing_if = "Option::is_none")]
1983 description: Option<String>,
1984 #[serde(skip_serializing_if = "Option::is_none")]
1985 email: Option<String>,
1986 #[serde(skip_serializing_if = "Option::is_none")]
1987 expand: Option<Vec<String>>,
1988 #[serde(skip_serializing_if = "Option::is_none")]
1989 individual_name: Option<String>,
1990 #[serde(skip_serializing_if = "Option::is_none")]
1991 invoice_prefix: Option<String>,
1992 #[serde(skip_serializing_if = "Option::is_none")]
1993 invoice_settings: Option<UpdateCustomerInvoiceSettings>,
1994 #[serde(skip_serializing_if = "Option::is_none")]
1995 metadata: Option<std::collections::HashMap<String, String>>,
1996 #[serde(skip_serializing_if = "Option::is_none")]
1997 name: Option<String>,
1998 #[serde(skip_serializing_if = "Option::is_none")]
1999 next_invoice_sequence: Option<i64>,
2000 #[serde(skip_serializing_if = "Option::is_none")]
2001 phone: Option<String>,
2002 #[serde(skip_serializing_if = "Option::is_none")]
2003 preferred_locales: Option<Vec<String>>,
2004 #[serde(skip_serializing_if = "Option::is_none")]
2005 shipping: Option<CustomerShipping>,
2006 #[serde(skip_serializing_if = "Option::is_none")]
2007 source: Option<String>,
2008 #[serde(skip_serializing_if = "Option::is_none")]
2009 tax: Option<UpdateCustomerTax>,
2010 #[serde(skip_serializing_if = "Option::is_none")]
2011 tax_exempt: Option<stripe_shared::CustomerTaxExempt>,
2012 #[serde(skip_serializing_if = "Option::is_none")]
2013 validate: Option<bool>,
2014}
2015impl UpdateCustomerBuilder {
2016 fn new() -> Self {
2017 Self {
2018 address: None,
2019 balance: None,
2020 business_name: None,
2021 cash_balance: None,
2022 default_source: None,
2023 description: None,
2024 email: None,
2025 expand: None,
2026 individual_name: None,
2027 invoice_prefix: None,
2028 invoice_settings: None,
2029 metadata: None,
2030 name: None,
2031 next_invoice_sequence: None,
2032 phone: None,
2033 preferred_locales: None,
2034 shipping: None,
2035 source: None,
2036 tax: None,
2037 tax_exempt: None,
2038 validate: None,
2039 }
2040 }
2041}
2042#[derive(Clone, Debug, serde::Serialize)]
2044pub struct UpdateCustomerCashBalance {
2045 #[serde(skip_serializing_if = "Option::is_none")]
2048 pub settings: Option<UpdateCustomerCashBalanceSettings>,
2049}
2050impl UpdateCustomerCashBalance {
2051 pub fn new() -> Self {
2052 Self { settings: None }
2053 }
2054}
2055impl Default for UpdateCustomerCashBalance {
2056 fn default() -> Self {
2057 Self::new()
2058 }
2059}
2060#[derive(Clone, Debug, serde::Serialize)]
2063pub struct UpdateCustomerCashBalanceSettings {
2064 #[serde(skip_serializing_if = "Option::is_none")]
2068 pub reconciliation_mode: Option<UpdateCustomerCashBalanceSettingsReconciliationMode>,
2069}
2070impl UpdateCustomerCashBalanceSettings {
2071 pub fn new() -> Self {
2072 Self { reconciliation_mode: None }
2073 }
2074}
2075impl Default for UpdateCustomerCashBalanceSettings {
2076 fn default() -> Self {
2077 Self::new()
2078 }
2079}
2080#[derive(Clone, Eq, PartialEq)]
2084#[non_exhaustive]
2085pub enum UpdateCustomerCashBalanceSettingsReconciliationMode {
2086 Automatic,
2087 Manual,
2088 MerchantDefault,
2089 Unknown(String),
2091}
2092impl UpdateCustomerCashBalanceSettingsReconciliationMode {
2093 pub fn as_str(&self) -> &str {
2094 use UpdateCustomerCashBalanceSettingsReconciliationMode::*;
2095 match self {
2096 Automatic => "automatic",
2097 Manual => "manual",
2098 MerchantDefault => "merchant_default",
2099 Unknown(v) => v,
2100 }
2101 }
2102}
2103
2104impl std::str::FromStr for UpdateCustomerCashBalanceSettingsReconciliationMode {
2105 type Err = std::convert::Infallible;
2106 fn from_str(s: &str) -> Result<Self, Self::Err> {
2107 use UpdateCustomerCashBalanceSettingsReconciliationMode::*;
2108 match s {
2109 "automatic" => Ok(Automatic),
2110 "manual" => Ok(Manual),
2111 "merchant_default" => Ok(MerchantDefault),
2112 v => {
2113 tracing::warn!(
2114 "Unknown value '{}' for enum '{}'",
2115 v,
2116 "UpdateCustomerCashBalanceSettingsReconciliationMode"
2117 );
2118 Ok(Unknown(v.to_owned()))
2119 }
2120 }
2121 }
2122}
2123impl std::fmt::Display for UpdateCustomerCashBalanceSettingsReconciliationMode {
2124 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2125 f.write_str(self.as_str())
2126 }
2127}
2128
2129impl std::fmt::Debug for UpdateCustomerCashBalanceSettingsReconciliationMode {
2130 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2131 f.write_str(self.as_str())
2132 }
2133}
2134impl serde::Serialize for UpdateCustomerCashBalanceSettingsReconciliationMode {
2135 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2136 where
2137 S: serde::Serializer,
2138 {
2139 serializer.serialize_str(self.as_str())
2140 }
2141}
2142#[cfg(feature = "deserialize")]
2143impl<'de> serde::Deserialize<'de> for UpdateCustomerCashBalanceSettingsReconciliationMode {
2144 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2145 use std::str::FromStr;
2146 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2147 Ok(Self::from_str(&s).expect("infallible"))
2148 }
2149}
2150#[derive(Clone, Debug, serde::Serialize)]
2152pub struct UpdateCustomerInvoiceSettings {
2153 #[serde(skip_serializing_if = "Option::is_none")]
2156 pub custom_fields: Option<Vec<CustomFieldParams>>,
2157 #[serde(skip_serializing_if = "Option::is_none")]
2159 pub default_payment_method: Option<String>,
2160 #[serde(skip_serializing_if = "Option::is_none")]
2162 pub footer: Option<String>,
2163 #[serde(skip_serializing_if = "Option::is_none")]
2165 pub rendering_options: Option<UpdateCustomerInvoiceSettingsRenderingOptions>,
2166}
2167impl UpdateCustomerInvoiceSettings {
2168 pub fn new() -> Self {
2169 Self {
2170 custom_fields: None,
2171 default_payment_method: None,
2172 footer: None,
2173 rendering_options: None,
2174 }
2175 }
2176}
2177impl Default for UpdateCustomerInvoiceSettings {
2178 fn default() -> Self {
2179 Self::new()
2180 }
2181}
2182#[derive(Clone, Debug, serde::Serialize)]
2184pub struct UpdateCustomerInvoiceSettingsRenderingOptions {
2185 #[serde(skip_serializing_if = "Option::is_none")]
2190 pub amount_tax_display: Option<UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay>,
2191 #[serde(skip_serializing_if = "Option::is_none")]
2193 pub template: Option<String>,
2194}
2195impl UpdateCustomerInvoiceSettingsRenderingOptions {
2196 pub fn new() -> Self {
2197 Self { amount_tax_display: None, template: None }
2198 }
2199}
2200impl Default for UpdateCustomerInvoiceSettingsRenderingOptions {
2201 fn default() -> Self {
2202 Self::new()
2203 }
2204}
2205#[derive(Clone, Eq, PartialEq)]
2210#[non_exhaustive]
2211pub enum UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2212 ExcludeTax,
2213 IncludeInclusiveTax,
2214 Unknown(String),
2216}
2217impl UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2218 pub fn as_str(&self) -> &str {
2219 use UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
2220 match self {
2221 ExcludeTax => "exclude_tax",
2222 IncludeInclusiveTax => "include_inclusive_tax",
2223 Unknown(v) => v,
2224 }
2225 }
2226}
2227
2228impl std::str::FromStr for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2229 type Err = std::convert::Infallible;
2230 fn from_str(s: &str) -> Result<Self, Self::Err> {
2231 use UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay::*;
2232 match s {
2233 "exclude_tax" => Ok(ExcludeTax),
2234 "include_inclusive_tax" => Ok(IncludeInclusiveTax),
2235 v => {
2236 tracing::warn!(
2237 "Unknown value '{}' for enum '{}'",
2238 v,
2239 "UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay"
2240 );
2241 Ok(Unknown(v.to_owned()))
2242 }
2243 }
2244 }
2245}
2246impl std::fmt::Display for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2247 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2248 f.write_str(self.as_str())
2249 }
2250}
2251
2252impl std::fmt::Debug for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2253 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2254 f.write_str(self.as_str())
2255 }
2256}
2257impl serde::Serialize for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay {
2258 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2259 where
2260 S: serde::Serializer,
2261 {
2262 serializer.serialize_str(self.as_str())
2263 }
2264}
2265#[cfg(feature = "deserialize")]
2266impl<'de> serde::Deserialize<'de>
2267 for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTaxDisplay
2268{
2269 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2270 use std::str::FromStr;
2271 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2272 Ok(Self::from_str(&s).expect("infallible"))
2273 }
2274}
2275#[derive(Clone, Debug, serde::Serialize)]
2277pub struct UpdateCustomerTax {
2278 #[serde(skip_serializing_if = "Option::is_none")]
2282 pub ip_address: Option<String>,
2283 #[serde(skip_serializing_if = "Option::is_none")]
2285 pub validate_location: Option<UpdateCustomerTaxValidateLocation>,
2286}
2287impl UpdateCustomerTax {
2288 pub fn new() -> Self {
2289 Self { ip_address: None, validate_location: None }
2290 }
2291}
2292impl Default for UpdateCustomerTax {
2293 fn default() -> Self {
2294 Self::new()
2295 }
2296}
2297#[derive(Clone, Eq, PartialEq)]
2299#[non_exhaustive]
2300pub enum UpdateCustomerTaxValidateLocation {
2301 Auto,
2302 Deferred,
2303 Immediately,
2304 Unknown(String),
2306}
2307impl UpdateCustomerTaxValidateLocation {
2308 pub fn as_str(&self) -> &str {
2309 use UpdateCustomerTaxValidateLocation::*;
2310 match self {
2311 Auto => "auto",
2312 Deferred => "deferred",
2313 Immediately => "immediately",
2314 Unknown(v) => v,
2315 }
2316 }
2317}
2318
2319impl std::str::FromStr for UpdateCustomerTaxValidateLocation {
2320 type Err = std::convert::Infallible;
2321 fn from_str(s: &str) -> Result<Self, Self::Err> {
2322 use UpdateCustomerTaxValidateLocation::*;
2323 match s {
2324 "auto" => Ok(Auto),
2325 "deferred" => Ok(Deferred),
2326 "immediately" => Ok(Immediately),
2327 v => {
2328 tracing::warn!(
2329 "Unknown value '{}' for enum '{}'",
2330 v,
2331 "UpdateCustomerTaxValidateLocation"
2332 );
2333 Ok(Unknown(v.to_owned()))
2334 }
2335 }
2336 }
2337}
2338impl std::fmt::Display for UpdateCustomerTaxValidateLocation {
2339 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2340 f.write_str(self.as_str())
2341 }
2342}
2343
2344impl std::fmt::Debug for UpdateCustomerTaxValidateLocation {
2345 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2346 f.write_str(self.as_str())
2347 }
2348}
2349impl serde::Serialize for UpdateCustomerTaxValidateLocation {
2350 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2351 where
2352 S: serde::Serializer,
2353 {
2354 serializer.serialize_str(self.as_str())
2355 }
2356}
2357#[cfg(feature = "deserialize")]
2358impl<'de> serde::Deserialize<'de> for UpdateCustomerTaxValidateLocation {
2359 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2360 use std::str::FromStr;
2361 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2362 Ok(Self::from_str(&s).expect("infallible"))
2363 }
2364}
2365#[derive(Clone, Debug, serde::Serialize)]
2374pub struct UpdateCustomer {
2375 inner: UpdateCustomerBuilder,
2376 customer: stripe_shared::CustomerId,
2377}
2378impl UpdateCustomer {
2379 pub fn new(customer: impl Into<stripe_shared::CustomerId>) -> Self {
2381 Self { customer: customer.into(), inner: UpdateCustomerBuilder::new() }
2382 }
2383 pub fn address(mut self, address: impl Into<OptionalFieldsCustomerAddress>) -> Self {
2386 self.inner.address = Some(address.into());
2387 self
2388 }
2389 pub fn balance(mut self, balance: impl Into<i64>) -> Self {
2392 self.inner.balance = Some(balance.into());
2393 self
2394 }
2395 pub fn business_name(mut self, business_name: impl Into<String>) -> Self {
2397 self.inner.business_name = Some(business_name.into());
2398 self
2399 }
2400 pub fn cash_balance(mut self, cash_balance: impl Into<UpdateCustomerCashBalance>) -> Self {
2402 self.inner.cash_balance = Some(cash_balance.into());
2403 self
2404 }
2405 pub fn default_source(mut self, default_source: impl Into<String>) -> Self {
2411 self.inner.default_source = Some(default_source.into());
2412 self
2413 }
2414 pub fn description(mut self, description: impl Into<String>) -> Self {
2417 self.inner.description = Some(description.into());
2418 self
2419 }
2420 pub fn email(mut self, email: impl Into<String>) -> Self {
2424 self.inner.email = Some(email.into());
2425 self
2426 }
2427 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2429 self.inner.expand = Some(expand.into());
2430 self
2431 }
2432 pub fn individual_name(mut self, individual_name: impl Into<String>) -> Self {
2434 self.inner.individual_name = Some(individual_name.into());
2435 self
2436 }
2437 pub fn invoice_prefix(mut self, invoice_prefix: impl Into<String>) -> Self {
2440 self.inner.invoice_prefix = Some(invoice_prefix.into());
2441 self
2442 }
2443 pub fn invoice_settings(
2445 mut self,
2446 invoice_settings: impl Into<UpdateCustomerInvoiceSettings>,
2447 ) -> Self {
2448 self.inner.invoice_settings = Some(invoice_settings.into());
2449 self
2450 }
2451 pub fn metadata(
2456 mut self,
2457 metadata: impl Into<std::collections::HashMap<String, String>>,
2458 ) -> Self {
2459 self.inner.metadata = Some(metadata.into());
2460 self
2461 }
2462 pub fn name(mut self, name: impl Into<String>) -> Self {
2464 self.inner.name = Some(name.into());
2465 self
2466 }
2467 pub fn next_invoice_sequence(mut self, next_invoice_sequence: impl Into<i64>) -> Self {
2469 self.inner.next_invoice_sequence = Some(next_invoice_sequence.into());
2470 self
2471 }
2472 pub fn phone(mut self, phone: impl Into<String>) -> Self {
2474 self.inner.phone = Some(phone.into());
2475 self
2476 }
2477 pub fn preferred_locales(mut self, preferred_locales: impl Into<Vec<String>>) -> Self {
2479 self.inner.preferred_locales = Some(preferred_locales.into());
2480 self
2481 }
2482 pub fn shipping(mut self, shipping: impl Into<CustomerShipping>) -> Self {
2484 self.inner.shipping = Some(shipping.into());
2485 self
2486 }
2487 pub fn source(mut self, source: impl Into<String>) -> Self {
2488 self.inner.source = Some(source.into());
2489 self
2490 }
2491 pub fn tax(mut self, tax: impl Into<UpdateCustomerTax>) -> Self {
2493 self.inner.tax = Some(tax.into());
2494 self
2495 }
2496 pub fn tax_exempt(mut self, tax_exempt: impl Into<stripe_shared::CustomerTaxExempt>) -> Self {
2498 self.inner.tax_exempt = Some(tax_exempt.into());
2499 self
2500 }
2501 pub fn validate(mut self, validate: impl Into<bool>) -> Self {
2502 self.inner.validate = Some(validate.into());
2503 self
2504 }
2505}
2506impl UpdateCustomer {
2507 pub async fn send<C: StripeClient>(
2509 &self,
2510 client: &C,
2511 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2512 self.customize().send(client).await
2513 }
2514
2515 pub fn send_blocking<C: StripeBlockingClient>(
2517 &self,
2518 client: &C,
2519 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2520 self.customize().send_blocking(client)
2521 }
2522}
2523
2524impl StripeRequest for UpdateCustomer {
2525 type Output = stripe_shared::Customer;
2526
2527 fn build(&self) -> RequestBuilder {
2528 let customer = &self.customer;
2529 RequestBuilder::new(StripeMethod::Post, format!("/customers/{customer}")).form(&self.inner)
2530 }
2531}
2532#[derive(Clone, Debug, serde::Serialize)]
2533struct CreateFundingInstructionsCustomerBuilder {
2534 bank_transfer: CreateFundingInstructionsCustomerBankTransfer,
2535 currency: stripe_types::Currency,
2536 #[serde(skip_serializing_if = "Option::is_none")]
2537 expand: Option<Vec<String>>,
2538 funding_type: CreateFundingInstructionsCustomerFundingType,
2539}
2540impl CreateFundingInstructionsCustomerBuilder {
2541 fn new(
2542 bank_transfer: impl Into<CreateFundingInstructionsCustomerBankTransfer>,
2543 currency: impl Into<stripe_types::Currency>,
2544 funding_type: impl Into<CreateFundingInstructionsCustomerFundingType>,
2545 ) -> Self {
2546 Self {
2547 bank_transfer: bank_transfer.into(),
2548 currency: currency.into(),
2549 expand: None,
2550 funding_type: funding_type.into(),
2551 }
2552 }
2553}
2554#[derive(Clone, Debug, serde::Serialize)]
2556pub struct CreateFundingInstructionsCustomerBankTransfer {
2557 #[serde(skip_serializing_if = "Option::is_none")]
2559 pub eu_bank_transfer: Option<CreateFundingInstructionsCustomerBankTransferEuBankTransfer>,
2560 #[serde(skip_serializing_if = "Option::is_none")]
2565 pub requested_address_types:
2566 Option<Vec<CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes>>,
2567 #[serde(rename = "type")]
2569 pub type_: CreateFundingInstructionsCustomerBankTransferType,
2570}
2571impl CreateFundingInstructionsCustomerBankTransfer {
2572 pub fn new(type_: impl Into<CreateFundingInstructionsCustomerBankTransferType>) -> Self {
2573 Self { eu_bank_transfer: None, requested_address_types: None, type_: type_.into() }
2574 }
2575}
2576#[derive(Clone, Debug, serde::Serialize)]
2578pub struct CreateFundingInstructionsCustomerBankTransferEuBankTransfer {
2579 pub country: String,
2582}
2583impl CreateFundingInstructionsCustomerBankTransferEuBankTransfer {
2584 pub fn new(country: impl Into<String>) -> Self {
2585 Self { country: country.into() }
2586 }
2587}
2588#[derive(Clone, Eq, PartialEq)]
2593#[non_exhaustive]
2594pub enum CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2595 Iban,
2596 SortCode,
2597 Spei,
2598 Zengin,
2599 Unknown(String),
2601}
2602impl CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2603 pub fn as_str(&self) -> &str {
2604 use CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes::*;
2605 match self {
2606 Iban => "iban",
2607 SortCode => "sort_code",
2608 Spei => "spei",
2609 Zengin => "zengin",
2610 Unknown(v) => v,
2611 }
2612 }
2613}
2614
2615impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2616 type Err = std::convert::Infallible;
2617 fn from_str(s: &str) -> Result<Self, Self::Err> {
2618 use CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes::*;
2619 match s {
2620 "iban" => Ok(Iban),
2621 "sort_code" => Ok(SortCode),
2622 "spei" => Ok(Spei),
2623 "zengin" => Ok(Zengin),
2624 v => {
2625 tracing::warn!(
2626 "Unknown value '{}' for enum '{}'",
2627 v,
2628 "CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes"
2629 );
2630 Ok(Unknown(v.to_owned()))
2631 }
2632 }
2633 }
2634}
2635impl std::fmt::Display for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2636 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2637 f.write_str(self.as_str())
2638 }
2639}
2640
2641impl std::fmt::Debug for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2642 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2643 f.write_str(self.as_str())
2644 }
2645}
2646impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes {
2647 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2648 where
2649 S: serde::Serializer,
2650 {
2651 serializer.serialize_str(self.as_str())
2652 }
2653}
2654#[cfg(feature = "deserialize")]
2655impl<'de> serde::Deserialize<'de>
2656 for CreateFundingInstructionsCustomerBankTransferRequestedAddressTypes
2657{
2658 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2659 use std::str::FromStr;
2660 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2661 Ok(Self::from_str(&s).expect("infallible"))
2662 }
2663}
2664#[derive(Clone, Eq, PartialEq)]
2666#[non_exhaustive]
2667pub enum CreateFundingInstructionsCustomerBankTransferType {
2668 EuBankTransfer,
2669 GbBankTransfer,
2670 JpBankTransfer,
2671 MxBankTransfer,
2672 UsBankTransfer,
2673 Unknown(String),
2675}
2676impl CreateFundingInstructionsCustomerBankTransferType {
2677 pub fn as_str(&self) -> &str {
2678 use CreateFundingInstructionsCustomerBankTransferType::*;
2679 match self {
2680 EuBankTransfer => "eu_bank_transfer",
2681 GbBankTransfer => "gb_bank_transfer",
2682 JpBankTransfer => "jp_bank_transfer",
2683 MxBankTransfer => "mx_bank_transfer",
2684 UsBankTransfer => "us_bank_transfer",
2685 Unknown(v) => v,
2686 }
2687 }
2688}
2689
2690impl std::str::FromStr for CreateFundingInstructionsCustomerBankTransferType {
2691 type Err = std::convert::Infallible;
2692 fn from_str(s: &str) -> Result<Self, Self::Err> {
2693 use CreateFundingInstructionsCustomerBankTransferType::*;
2694 match s {
2695 "eu_bank_transfer" => Ok(EuBankTransfer),
2696 "gb_bank_transfer" => Ok(GbBankTransfer),
2697 "jp_bank_transfer" => Ok(JpBankTransfer),
2698 "mx_bank_transfer" => Ok(MxBankTransfer),
2699 "us_bank_transfer" => Ok(UsBankTransfer),
2700 v => {
2701 tracing::warn!(
2702 "Unknown value '{}' for enum '{}'",
2703 v,
2704 "CreateFundingInstructionsCustomerBankTransferType"
2705 );
2706 Ok(Unknown(v.to_owned()))
2707 }
2708 }
2709 }
2710}
2711impl std::fmt::Display for CreateFundingInstructionsCustomerBankTransferType {
2712 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2713 f.write_str(self.as_str())
2714 }
2715}
2716
2717impl std::fmt::Debug for CreateFundingInstructionsCustomerBankTransferType {
2718 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2719 f.write_str(self.as_str())
2720 }
2721}
2722impl serde::Serialize for CreateFundingInstructionsCustomerBankTransferType {
2723 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2724 where
2725 S: serde::Serializer,
2726 {
2727 serializer.serialize_str(self.as_str())
2728 }
2729}
2730#[cfg(feature = "deserialize")]
2731impl<'de> serde::Deserialize<'de> for CreateFundingInstructionsCustomerBankTransferType {
2732 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2733 use std::str::FromStr;
2734 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2735 Ok(Self::from_str(&s).expect("infallible"))
2736 }
2737}
2738#[derive(Clone, Eq, PartialEq)]
2740#[non_exhaustive]
2741pub enum CreateFundingInstructionsCustomerFundingType {
2742 BankTransfer,
2743 Unknown(String),
2745}
2746impl CreateFundingInstructionsCustomerFundingType {
2747 pub fn as_str(&self) -> &str {
2748 use CreateFundingInstructionsCustomerFundingType::*;
2749 match self {
2750 BankTransfer => "bank_transfer",
2751 Unknown(v) => v,
2752 }
2753 }
2754}
2755
2756impl std::str::FromStr for CreateFundingInstructionsCustomerFundingType {
2757 type Err = std::convert::Infallible;
2758 fn from_str(s: &str) -> Result<Self, Self::Err> {
2759 use CreateFundingInstructionsCustomerFundingType::*;
2760 match s {
2761 "bank_transfer" => Ok(BankTransfer),
2762 v => {
2763 tracing::warn!(
2764 "Unknown value '{}' for enum '{}'",
2765 v,
2766 "CreateFundingInstructionsCustomerFundingType"
2767 );
2768 Ok(Unknown(v.to_owned()))
2769 }
2770 }
2771 }
2772}
2773impl std::fmt::Display for CreateFundingInstructionsCustomerFundingType {
2774 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2775 f.write_str(self.as_str())
2776 }
2777}
2778
2779impl std::fmt::Debug for CreateFundingInstructionsCustomerFundingType {
2780 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2781 f.write_str(self.as_str())
2782 }
2783}
2784impl serde::Serialize for CreateFundingInstructionsCustomerFundingType {
2785 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2786 where
2787 S: serde::Serializer,
2788 {
2789 serializer.serialize_str(self.as_str())
2790 }
2791}
2792#[cfg(feature = "deserialize")]
2793impl<'de> serde::Deserialize<'de> for CreateFundingInstructionsCustomerFundingType {
2794 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2795 use std::str::FromStr;
2796 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2797 Ok(Self::from_str(&s).expect("infallible"))
2798 }
2799}
2800#[derive(Clone, Debug, serde::Serialize)]
2807pub struct CreateFundingInstructionsCustomer {
2808 inner: CreateFundingInstructionsCustomerBuilder,
2809 customer: stripe_shared::CustomerId,
2810}
2811impl CreateFundingInstructionsCustomer {
2812 pub fn new(
2814 customer: impl Into<stripe_shared::CustomerId>,
2815 bank_transfer: impl Into<CreateFundingInstructionsCustomerBankTransfer>,
2816 currency: impl Into<stripe_types::Currency>,
2817 funding_type: impl Into<CreateFundingInstructionsCustomerFundingType>,
2818 ) -> Self {
2819 Self {
2820 customer: customer.into(),
2821 inner: CreateFundingInstructionsCustomerBuilder::new(
2822 bank_transfer.into(),
2823 currency.into(),
2824 funding_type.into(),
2825 ),
2826 }
2827 }
2828 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2830 self.inner.expand = Some(expand.into());
2831 self
2832 }
2833}
2834impl CreateFundingInstructionsCustomer {
2835 pub async fn send<C: StripeClient>(
2837 &self,
2838 client: &C,
2839 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2840 self.customize().send(client).await
2841 }
2842
2843 pub fn send_blocking<C: StripeBlockingClient>(
2845 &self,
2846 client: &C,
2847 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2848 self.customize().send_blocking(client)
2849 }
2850}
2851
2852impl StripeRequest for CreateFundingInstructionsCustomer {
2853 type Output = stripe_shared::FundingInstructions;
2854
2855 fn build(&self) -> RequestBuilder {
2856 let customer = &self.customer;
2857 RequestBuilder::new(
2858 StripeMethod::Post,
2859 format!("/customers/{customer}/funding_instructions"),
2860 )
2861 .form(&self.inner)
2862 }
2863}
2864#[derive(Clone, Debug, serde::Serialize)]
2865struct FundCashBalanceCustomerBuilder {
2866 amount: i64,
2867 currency: stripe_types::Currency,
2868 #[serde(skip_serializing_if = "Option::is_none")]
2869 expand: Option<Vec<String>>,
2870 #[serde(skip_serializing_if = "Option::is_none")]
2871 reference: Option<String>,
2872}
2873impl FundCashBalanceCustomerBuilder {
2874 fn new(amount: impl Into<i64>, currency: impl Into<stripe_types::Currency>) -> Self {
2875 Self { amount: amount.into(), currency: currency.into(), expand: None, reference: None }
2876 }
2877}
2878#[derive(Clone, Debug, serde::Serialize)]
2880pub struct FundCashBalanceCustomer {
2881 inner: FundCashBalanceCustomerBuilder,
2882 customer: String,
2883}
2884impl FundCashBalanceCustomer {
2885 pub fn new(
2887 customer: impl Into<String>,
2888 amount: impl Into<i64>,
2889 currency: impl Into<stripe_types::Currency>,
2890 ) -> Self {
2891 Self {
2892 customer: customer.into(),
2893 inner: FundCashBalanceCustomerBuilder::new(amount.into(), currency.into()),
2894 }
2895 }
2896 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2898 self.inner.expand = Some(expand.into());
2899 self
2900 }
2901 pub fn reference(mut self, reference: impl Into<String>) -> Self {
2905 self.inner.reference = Some(reference.into());
2906 self
2907 }
2908}
2909impl FundCashBalanceCustomer {
2910 pub async fn send<C: StripeClient>(
2912 &self,
2913 client: &C,
2914 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2915 self.customize().send(client).await
2916 }
2917
2918 pub fn send_blocking<C: StripeBlockingClient>(
2920 &self,
2921 client: &C,
2922 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2923 self.customize().send_blocking(client)
2924 }
2925}
2926
2927impl StripeRequest for FundCashBalanceCustomer {
2928 type Output = stripe_shared::CustomerCashBalanceTransaction;
2929
2930 fn build(&self) -> RequestBuilder {
2931 let customer = &self.customer;
2932 RequestBuilder::new(
2933 StripeMethod::Post,
2934 format!("/test_helpers/customers/{customer}/fund_cash_balance"),
2935 )
2936 .form(&self.inner)
2937 }
2938}
2939
2940#[derive(Clone, Debug, serde::Serialize)]
2941pub struct OptionalFieldsCustomerAddress {
2942 #[serde(skip_serializing_if = "Option::is_none")]
2944 pub city: Option<String>,
2945 #[serde(skip_serializing_if = "Option::is_none")]
2948 pub country: Option<String>,
2949 #[serde(skip_serializing_if = "Option::is_none")]
2951 pub line1: Option<String>,
2952 #[serde(skip_serializing_if = "Option::is_none")]
2954 pub line2: Option<String>,
2955 #[serde(skip_serializing_if = "Option::is_none")]
2957 pub postal_code: Option<String>,
2958 #[serde(skip_serializing_if = "Option::is_none")]
2960 pub state: Option<String>,
2961}
2962impl OptionalFieldsCustomerAddress {
2963 pub fn new() -> Self {
2964 Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
2965 }
2966}
2967impl Default for OptionalFieldsCustomerAddress {
2968 fn default() -> Self {
2969 Self::new()
2970 }
2971}
2972#[derive(Clone, Debug, serde::Serialize)]
2973pub struct CustomFieldParams {
2974 pub name: String,
2976 pub value: String,
2978}
2979impl CustomFieldParams {
2980 pub fn new(name: impl Into<String>, value: impl Into<String>) -> Self {
2981 Self { name: name.into(), value: value.into() }
2982 }
2983}
2984#[derive(Clone, Debug, serde::Serialize)]
2985pub struct CustomerShipping {
2986 pub address: OptionalFieldsCustomerAddress,
2988 pub name: String,
2990 #[serde(skip_serializing_if = "Option::is_none")]
2992 pub phone: Option<String>,
2993}
2994impl CustomerShipping {
2995 pub fn new(address: impl Into<OptionalFieldsCustomerAddress>, name: impl Into<String>) -> Self {
2996 Self { address: address.into(), name: name.into(), phone: None }
2997 }
2998}