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