1use stripe_client_core::{
2 RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Eq, PartialEq)]
6#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
7#[derive(serde::Serialize)]
8struct DetachSourceBuilder {
9 #[serde(skip_serializing_if = "Option::is_none")]
10 expand: Option<Vec<String>>,
11}
12#[cfg(feature = "redact-generated-debug")]
13impl std::fmt::Debug for DetachSourceBuilder {
14 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
15 f.debug_struct("DetachSourceBuilder").finish_non_exhaustive()
16 }
17}
18impl DetachSourceBuilder {
19 fn new() -> Self {
20 Self { expand: None }
21 }
22}
23#[derive(Clone)]
25#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
26#[derive(serde::Serialize)]
27pub struct DetachSource {
28 inner: DetachSourceBuilder,
29 customer: stripe_shared::CustomerId,
30 id: String,
31}
32#[cfg(feature = "redact-generated-debug")]
33impl std::fmt::Debug for DetachSource {
34 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
35 f.debug_struct("DetachSource").finish_non_exhaustive()
36 }
37}
38impl DetachSource {
39 pub fn new(customer: impl Into<stripe_shared::CustomerId>, id: impl Into<String>) -> Self {
41 Self { customer: customer.into(), id: id.into(), inner: DetachSourceBuilder::new() }
42 }
43 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
45 self.inner.expand = Some(expand.into());
46 self
47 }
48}
49impl DetachSource {
50 pub async fn send<C: StripeClient>(
52 &self,
53 client: &C,
54 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
55 self.customize().send(client).await
56 }
57
58 pub fn send_blocking<C: StripeBlockingClient>(
60 &self,
61 client: &C,
62 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
63 self.customize().send_blocking(client)
64 }
65}
66
67impl StripeRequest for DetachSource {
68 type Output = DetachSourceReturned;
69
70 fn build(&self) -> RequestBuilder {
71 let customer = &self.customer;
72 let id = &self.id;
73 RequestBuilder::new(StripeMethod::Delete, format!("/customers/{customer}/sources/{id}"))
74 .form(&self.inner)
75 }
76}
77#[derive(Clone)]
78#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
79#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
80#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
81#[cfg_attr(any(feature = "deserialize", feature = "serialize"), serde(untagged))]
82pub enum DetachSourceReturned {
83 PaymentSource(stripe_shared::PaymentSource),
84 DeletedPaymentSource(stripe_shared::DeletedPaymentSource),
85}
86
87#[derive(Default)]
88pub struct DetachSourceReturnedBuilder {
89 inner: stripe_types::miniserde_helpers::MaybeDeletedBuilderInner,
90}
91
92const _: () = {
93 use miniserde::de::{Map, Visitor};
94 use miniserde::json::Value;
95 use miniserde::{Deserialize, Result, make_place};
96 use stripe_types::MapBuilder;
97 use stripe_types::miniserde_helpers::FromValueOpt;
98
99 use super::*;
100
101 make_place!(Place);
102
103 struct Builder<'a> {
104 out: &'a mut Option<DetachSourceReturned>,
105 builder: DetachSourceReturnedBuilder,
106 }
107
108 impl Deserialize for DetachSourceReturned {
109 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
110 Place::new(out)
111 }
112 }
113
114 impl Visitor for Place<DetachSourceReturned> {
115 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
116 Ok(Box::new(Builder { out: &mut self.out, builder: Default::default() }))
117 }
118 }
119
120 impl Map for Builder<'_> {
121 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
122 self.builder.key(k)
123 }
124
125 fn finish(&mut self) -> Result<()> {
126 *self.out = self.builder.take_out();
127 Ok(())
128 }
129 }
130
131 impl MapBuilder for DetachSourceReturnedBuilder {
132 type Out = DetachSourceReturned;
133 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
134 self.inner.key_inner(k)
135 }
136
137 fn deser_default() -> Self {
138 Self::default()
139 }
140
141 fn take_out(&mut self) -> Option<Self::Out> {
142 let (deleted, o) = self.inner.finish_inner()?;
143 Some(if deleted {
144 DetachSourceReturned::DeletedPaymentSource(FromValueOpt::from_value(
145 Value::Object(o),
146 )?)
147 } else {
148 DetachSourceReturned::PaymentSource(FromValueOpt::from_value(Value::Object(o))?)
149 })
150 }
151 }
152
153 impl stripe_types::ObjectDeser for DetachSourceReturned {
154 type Builder = DetachSourceReturnedBuilder;
155 }
156};
157
158#[cfg(feature = "redact-generated-debug")]
159impl std::fmt::Debug for DetachSourceReturned {
160 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
161 f.debug_struct("DetachSourceReturned").finish_non_exhaustive()
162 }
163}
164#[derive(Clone, Eq, PartialEq)]
165#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
166#[derive(serde::Serialize)]
167struct RetrieveSourceBuilder {
168 #[serde(skip_serializing_if = "Option::is_none")]
169 client_secret: Option<String>,
170 #[serde(skip_serializing_if = "Option::is_none")]
171 expand: Option<Vec<String>>,
172}
173#[cfg(feature = "redact-generated-debug")]
174impl std::fmt::Debug for RetrieveSourceBuilder {
175 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
176 f.debug_struct("RetrieveSourceBuilder").finish_non_exhaustive()
177 }
178}
179impl RetrieveSourceBuilder {
180 fn new() -> Self {
181 Self { client_secret: None, expand: None }
182 }
183}
184#[derive(Clone)]
187#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
188#[derive(serde::Serialize)]
189pub struct RetrieveSource {
190 inner: RetrieveSourceBuilder,
191 source: stripe_shared::SourceId,
192}
193#[cfg(feature = "redact-generated-debug")]
194impl std::fmt::Debug for RetrieveSource {
195 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
196 f.debug_struct("RetrieveSource").finish_non_exhaustive()
197 }
198}
199impl RetrieveSource {
200 pub fn new(source: impl Into<stripe_shared::SourceId>) -> Self {
202 Self { source: source.into(), inner: RetrieveSourceBuilder::new() }
203 }
204 pub fn client_secret(mut self, client_secret: impl Into<String>) -> Self {
206 self.inner.client_secret = Some(client_secret.into());
207 self
208 }
209 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
211 self.inner.expand = Some(expand.into());
212 self
213 }
214}
215impl RetrieveSource {
216 pub async fn send<C: StripeClient>(
218 &self,
219 client: &C,
220 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
221 self.customize().send(client).await
222 }
223
224 pub fn send_blocking<C: StripeBlockingClient>(
226 &self,
227 client: &C,
228 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
229 self.customize().send_blocking(client)
230 }
231}
232
233impl StripeRequest for RetrieveSource {
234 type Output = stripe_shared::Source;
235
236 fn build(&self) -> RequestBuilder {
237 let source = &self.source;
238 RequestBuilder::new(StripeMethod::Get, format!("/sources/{source}")).query(&self.inner)
239 }
240}
241#[derive(Clone, Eq, PartialEq)]
242#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
243#[derive(serde::Serialize)]
244struct SourceTransactionsSourceBuilder {
245 #[serde(skip_serializing_if = "Option::is_none")]
246 ending_before: Option<String>,
247 #[serde(skip_serializing_if = "Option::is_none")]
248 expand: Option<Vec<String>>,
249 #[serde(skip_serializing_if = "Option::is_none")]
250 limit: Option<i64>,
251 #[serde(skip_serializing_if = "Option::is_none")]
252 starting_after: Option<String>,
253}
254#[cfg(feature = "redact-generated-debug")]
255impl std::fmt::Debug for SourceTransactionsSourceBuilder {
256 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
257 f.debug_struct("SourceTransactionsSourceBuilder").finish_non_exhaustive()
258 }
259}
260impl SourceTransactionsSourceBuilder {
261 fn new() -> Self {
262 Self { ending_before: None, expand: None, limit: None, starting_after: None }
263 }
264}
265#[derive(Clone)]
267#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
268#[derive(serde::Serialize)]
269pub struct SourceTransactionsSource {
270 inner: SourceTransactionsSourceBuilder,
271 source: stripe_shared::SourceId,
272}
273#[cfg(feature = "redact-generated-debug")]
274impl std::fmt::Debug for SourceTransactionsSource {
275 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
276 f.debug_struct("SourceTransactionsSource").finish_non_exhaustive()
277 }
278}
279impl SourceTransactionsSource {
280 pub fn new(source: impl Into<stripe_shared::SourceId>) -> Self {
282 Self { source: source.into(), inner: SourceTransactionsSourceBuilder::new() }
283 }
284 pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
288 self.inner.ending_before = Some(ending_before.into());
289 self
290 }
291 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
293 self.inner.expand = Some(expand.into());
294 self
295 }
296 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
299 self.inner.limit = Some(limit.into());
300 self
301 }
302 pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
306 self.inner.starting_after = Some(starting_after.into());
307 self
308 }
309}
310impl SourceTransactionsSource {
311 pub async fn send<C: StripeClient>(
313 &self,
314 client: &C,
315 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
316 self.customize().send(client).await
317 }
318
319 pub fn send_blocking<C: StripeBlockingClient>(
321 &self,
322 client: &C,
323 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
324 self.customize().send_blocking(client)
325 }
326
327 pub fn paginate(
328 &self,
329 ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::SourceTransaction>>
330 {
331 let source = &self.source;
332
333 stripe_client_core::ListPaginator::new_list(
334 format!("/sources/{source}/source_transactions"),
335 &self.inner,
336 )
337 }
338}
339
340impl StripeRequest for SourceTransactionsSource {
341 type Output = stripe_types::List<stripe_shared::SourceTransaction>;
342
343 fn build(&self) -> RequestBuilder {
344 let source = &self.source;
345 RequestBuilder::new(StripeMethod::Get, format!("/sources/{source}/source_transactions"))
346 .query(&self.inner)
347 }
348}
349#[derive(Clone)]
350#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
351#[derive(serde::Serialize)]
352struct CreateSourceBuilder {
353 #[serde(skip_serializing_if = "Option::is_none")]
354 amount: Option<i64>,
355 #[serde(skip_serializing_if = "Option::is_none")]
356 currency: Option<stripe_types::Currency>,
357 #[serde(skip_serializing_if = "Option::is_none")]
358 customer: Option<String>,
359 #[serde(skip_serializing_if = "Option::is_none")]
360 expand: Option<Vec<String>>,
361 #[serde(skip_serializing_if = "Option::is_none")]
362 flow: Option<CreateSourceFlow>,
363 #[serde(skip_serializing_if = "Option::is_none")]
364 mandate: Option<CreateSourceMandate>,
365 #[serde(skip_serializing_if = "Option::is_none")]
366 metadata: Option<std::collections::HashMap<String, String>>,
367 #[serde(skip_serializing_if = "Option::is_none")]
368 original_source: Option<String>,
369 #[serde(skip_serializing_if = "Option::is_none")]
370 owner: Option<Owner>,
371 #[serde(skip_serializing_if = "Option::is_none")]
372 receiver: Option<CreateSourceReceiver>,
373 #[serde(skip_serializing_if = "Option::is_none")]
374 redirect: Option<CreateSourceRedirect>,
375 #[serde(skip_serializing_if = "Option::is_none")]
376 source_order: Option<CreateSourceSourceOrder>,
377 #[serde(skip_serializing_if = "Option::is_none")]
378 statement_descriptor: Option<String>,
379 #[serde(skip_serializing_if = "Option::is_none")]
380 token: Option<String>,
381 #[serde(rename = "type")]
382 #[serde(skip_serializing_if = "Option::is_none")]
383 type_: Option<String>,
384 #[serde(skip_serializing_if = "Option::is_none")]
385 usage: Option<CreateSourceUsage>,
386}
387#[cfg(feature = "redact-generated-debug")]
388impl std::fmt::Debug for CreateSourceBuilder {
389 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
390 f.debug_struct("CreateSourceBuilder").finish_non_exhaustive()
391 }
392}
393impl CreateSourceBuilder {
394 fn new() -> Self {
395 Self {
396 amount: None,
397 currency: None,
398 customer: None,
399 expand: None,
400 flow: None,
401 mandate: None,
402 metadata: None,
403 original_source: None,
404 owner: None,
405 receiver: None,
406 redirect: None,
407 source_order: None,
408 statement_descriptor: None,
409 token: None,
410 type_: None,
411 usage: None,
412 }
413 }
414}
415#[derive(Clone, Eq, PartialEq)]
419#[non_exhaustive]
420pub enum CreateSourceFlow {
421 CodeVerification,
422 None,
423 Receiver,
424 Redirect,
425 Unknown(String),
427}
428impl CreateSourceFlow {
429 pub fn as_str(&self) -> &str {
430 use CreateSourceFlow::*;
431 match self {
432 CodeVerification => "code_verification",
433 None => "none",
434 Receiver => "receiver",
435 Redirect => "redirect",
436 Unknown(v) => v,
437 }
438 }
439}
440
441impl std::str::FromStr for CreateSourceFlow {
442 type Err = std::convert::Infallible;
443 fn from_str(s: &str) -> Result<Self, Self::Err> {
444 use CreateSourceFlow::*;
445 match s {
446 "code_verification" => Ok(CodeVerification),
447 "none" => Ok(None),
448 "receiver" => Ok(Receiver),
449 "redirect" => Ok(Redirect),
450 v => {
451 tracing::warn!("Unknown value '{}' for enum '{}'", v, "CreateSourceFlow");
452 Ok(Unknown(v.to_owned()))
453 }
454 }
455 }
456}
457impl std::fmt::Display for CreateSourceFlow {
458 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
459 f.write_str(self.as_str())
460 }
461}
462
463#[cfg(not(feature = "redact-generated-debug"))]
464impl std::fmt::Debug for CreateSourceFlow {
465 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
466 f.write_str(self.as_str())
467 }
468}
469#[cfg(feature = "redact-generated-debug")]
470impl std::fmt::Debug for CreateSourceFlow {
471 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
472 f.debug_struct(stringify!(CreateSourceFlow)).finish_non_exhaustive()
473 }
474}
475impl serde::Serialize for CreateSourceFlow {
476 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
477 where
478 S: serde::Serializer,
479 {
480 serializer.serialize_str(self.as_str())
481 }
482}
483#[cfg(feature = "deserialize")]
484impl<'de> serde::Deserialize<'de> for CreateSourceFlow {
485 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
486 use std::str::FromStr;
487 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
488 Ok(Self::from_str(&s).expect("infallible"))
489 }
490}
491#[derive(Clone, Eq, PartialEq)]
493#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
494#[derive(serde::Serialize)]
495pub struct CreateSourceMandate {
496 #[serde(skip_serializing_if = "Option::is_none")]
498 pub acceptance: Option<CreateSourceMandateAcceptance>,
499 #[serde(skip_serializing_if = "Option::is_none")]
501 pub amount: Option<i64>,
502 #[serde(skip_serializing_if = "Option::is_none")]
504 pub currency: Option<stripe_types::Currency>,
505 #[serde(skip_serializing_if = "Option::is_none")]
508 pub interval: Option<CreateSourceMandateInterval>,
509 #[serde(skip_serializing_if = "Option::is_none")]
512 pub notification_method: Option<CreateSourceMandateNotificationMethod>,
513}
514#[cfg(feature = "redact-generated-debug")]
515impl std::fmt::Debug for CreateSourceMandate {
516 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
517 f.debug_struct("CreateSourceMandate").finish_non_exhaustive()
518 }
519}
520impl CreateSourceMandate {
521 pub fn new() -> Self {
522 Self {
523 acceptance: None,
524 amount: None,
525 currency: None,
526 interval: None,
527 notification_method: None,
528 }
529 }
530}
531impl Default for CreateSourceMandate {
532 fn default() -> Self {
533 Self::new()
534 }
535}
536#[derive(Clone, Eq, PartialEq)]
538#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
539#[derive(serde::Serialize)]
540pub struct CreateSourceMandateAcceptance {
541 #[serde(skip_serializing_if = "Option::is_none")]
543 pub date: Option<stripe_types::Timestamp>,
544 #[serde(skip_serializing_if = "Option::is_none")]
546 pub ip: Option<String>,
547 #[serde(skip_serializing_if = "Option::is_none")]
550 pub offline: Option<MandateOfflineAcceptanceParams>,
551 #[serde(skip_serializing_if = "Option::is_none")]
554 pub online: Option<MandateOnlineAcceptanceParams>,
555 pub status: CreateSourceMandateAcceptanceStatus,
558 #[serde(rename = "type")]
560 #[serde(skip_serializing_if = "Option::is_none")]
561 pub type_: Option<CreateSourceMandateAcceptanceType>,
562 #[serde(skip_serializing_if = "Option::is_none")]
564 pub user_agent: Option<String>,
565}
566#[cfg(feature = "redact-generated-debug")]
567impl std::fmt::Debug for CreateSourceMandateAcceptance {
568 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
569 f.debug_struct("CreateSourceMandateAcceptance").finish_non_exhaustive()
570 }
571}
572impl CreateSourceMandateAcceptance {
573 pub fn new(status: impl Into<CreateSourceMandateAcceptanceStatus>) -> Self {
574 Self {
575 date: None,
576 ip: None,
577 offline: None,
578 online: None,
579 status: status.into(),
580 type_: None,
581 user_agent: None,
582 }
583 }
584}
585#[derive(Clone, Eq, PartialEq)]
588#[non_exhaustive]
589pub enum CreateSourceMandateAcceptanceStatus {
590 Accepted,
591 Pending,
592 Refused,
593 Revoked,
594 Unknown(String),
596}
597impl CreateSourceMandateAcceptanceStatus {
598 pub fn as_str(&self) -> &str {
599 use CreateSourceMandateAcceptanceStatus::*;
600 match self {
601 Accepted => "accepted",
602 Pending => "pending",
603 Refused => "refused",
604 Revoked => "revoked",
605 Unknown(v) => v,
606 }
607 }
608}
609
610impl std::str::FromStr for CreateSourceMandateAcceptanceStatus {
611 type Err = std::convert::Infallible;
612 fn from_str(s: &str) -> Result<Self, Self::Err> {
613 use CreateSourceMandateAcceptanceStatus::*;
614 match s {
615 "accepted" => Ok(Accepted),
616 "pending" => Ok(Pending),
617 "refused" => Ok(Refused),
618 "revoked" => Ok(Revoked),
619 v => {
620 tracing::warn!(
621 "Unknown value '{}' for enum '{}'",
622 v,
623 "CreateSourceMandateAcceptanceStatus"
624 );
625 Ok(Unknown(v.to_owned()))
626 }
627 }
628 }
629}
630impl std::fmt::Display for CreateSourceMandateAcceptanceStatus {
631 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
632 f.write_str(self.as_str())
633 }
634}
635
636#[cfg(not(feature = "redact-generated-debug"))]
637impl std::fmt::Debug for CreateSourceMandateAcceptanceStatus {
638 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
639 f.write_str(self.as_str())
640 }
641}
642#[cfg(feature = "redact-generated-debug")]
643impl std::fmt::Debug for CreateSourceMandateAcceptanceStatus {
644 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
645 f.debug_struct(stringify!(CreateSourceMandateAcceptanceStatus)).finish_non_exhaustive()
646 }
647}
648impl serde::Serialize for CreateSourceMandateAcceptanceStatus {
649 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
650 where
651 S: serde::Serializer,
652 {
653 serializer.serialize_str(self.as_str())
654 }
655}
656#[cfg(feature = "deserialize")]
657impl<'de> serde::Deserialize<'de> for CreateSourceMandateAcceptanceStatus {
658 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
659 use std::str::FromStr;
660 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
661 Ok(Self::from_str(&s).expect("infallible"))
662 }
663}
664#[derive(Clone, Eq, PartialEq)]
666#[non_exhaustive]
667pub enum CreateSourceMandateAcceptanceType {
668 Offline,
669 Online,
670 Unknown(String),
672}
673impl CreateSourceMandateAcceptanceType {
674 pub fn as_str(&self) -> &str {
675 use CreateSourceMandateAcceptanceType::*;
676 match self {
677 Offline => "offline",
678 Online => "online",
679 Unknown(v) => v,
680 }
681 }
682}
683
684impl std::str::FromStr for CreateSourceMandateAcceptanceType {
685 type Err = std::convert::Infallible;
686 fn from_str(s: &str) -> Result<Self, Self::Err> {
687 use CreateSourceMandateAcceptanceType::*;
688 match s {
689 "offline" => Ok(Offline),
690 "online" => Ok(Online),
691 v => {
692 tracing::warn!(
693 "Unknown value '{}' for enum '{}'",
694 v,
695 "CreateSourceMandateAcceptanceType"
696 );
697 Ok(Unknown(v.to_owned()))
698 }
699 }
700 }
701}
702impl std::fmt::Display for CreateSourceMandateAcceptanceType {
703 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
704 f.write_str(self.as_str())
705 }
706}
707
708#[cfg(not(feature = "redact-generated-debug"))]
709impl std::fmt::Debug for CreateSourceMandateAcceptanceType {
710 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
711 f.write_str(self.as_str())
712 }
713}
714#[cfg(feature = "redact-generated-debug")]
715impl std::fmt::Debug for CreateSourceMandateAcceptanceType {
716 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
717 f.debug_struct(stringify!(CreateSourceMandateAcceptanceType)).finish_non_exhaustive()
718 }
719}
720impl serde::Serialize for CreateSourceMandateAcceptanceType {
721 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
722 where
723 S: serde::Serializer,
724 {
725 serializer.serialize_str(self.as_str())
726 }
727}
728#[cfg(feature = "deserialize")]
729impl<'de> serde::Deserialize<'de> for CreateSourceMandateAcceptanceType {
730 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
731 use std::str::FromStr;
732 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
733 Ok(Self::from_str(&s).expect("infallible"))
734 }
735}
736#[derive(Clone, Eq, PartialEq)]
739#[non_exhaustive]
740pub enum CreateSourceMandateInterval {
741 OneTime,
742 Scheduled,
743 Variable,
744 Unknown(String),
746}
747impl CreateSourceMandateInterval {
748 pub fn as_str(&self) -> &str {
749 use CreateSourceMandateInterval::*;
750 match self {
751 OneTime => "one_time",
752 Scheduled => "scheduled",
753 Variable => "variable",
754 Unknown(v) => v,
755 }
756 }
757}
758
759impl std::str::FromStr for CreateSourceMandateInterval {
760 type Err = std::convert::Infallible;
761 fn from_str(s: &str) -> Result<Self, Self::Err> {
762 use CreateSourceMandateInterval::*;
763 match s {
764 "one_time" => Ok(OneTime),
765 "scheduled" => Ok(Scheduled),
766 "variable" => Ok(Variable),
767 v => {
768 tracing::warn!(
769 "Unknown value '{}' for enum '{}'",
770 v,
771 "CreateSourceMandateInterval"
772 );
773 Ok(Unknown(v.to_owned()))
774 }
775 }
776 }
777}
778impl std::fmt::Display for CreateSourceMandateInterval {
779 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
780 f.write_str(self.as_str())
781 }
782}
783
784#[cfg(not(feature = "redact-generated-debug"))]
785impl std::fmt::Debug for CreateSourceMandateInterval {
786 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
787 f.write_str(self.as_str())
788 }
789}
790#[cfg(feature = "redact-generated-debug")]
791impl std::fmt::Debug for CreateSourceMandateInterval {
792 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
793 f.debug_struct(stringify!(CreateSourceMandateInterval)).finish_non_exhaustive()
794 }
795}
796impl serde::Serialize for CreateSourceMandateInterval {
797 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
798 where
799 S: serde::Serializer,
800 {
801 serializer.serialize_str(self.as_str())
802 }
803}
804#[cfg(feature = "deserialize")]
805impl<'de> serde::Deserialize<'de> for CreateSourceMandateInterval {
806 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
807 use std::str::FromStr;
808 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
809 Ok(Self::from_str(&s).expect("infallible"))
810 }
811}
812#[derive(Clone, Eq, PartialEq)]
815#[non_exhaustive]
816pub enum CreateSourceMandateNotificationMethod {
817 DeprecatedNone,
818 Email,
819 Manual,
820 None,
821 StripeEmail,
822 Unknown(String),
824}
825impl CreateSourceMandateNotificationMethod {
826 pub fn as_str(&self) -> &str {
827 use CreateSourceMandateNotificationMethod::*;
828 match self {
829 DeprecatedNone => "deprecated_none",
830 Email => "email",
831 Manual => "manual",
832 None => "none",
833 StripeEmail => "stripe_email",
834 Unknown(v) => v,
835 }
836 }
837}
838
839impl std::str::FromStr for CreateSourceMandateNotificationMethod {
840 type Err = std::convert::Infallible;
841 fn from_str(s: &str) -> Result<Self, Self::Err> {
842 use CreateSourceMandateNotificationMethod::*;
843 match s {
844 "deprecated_none" => Ok(DeprecatedNone),
845 "email" => Ok(Email),
846 "manual" => Ok(Manual),
847 "none" => Ok(None),
848 "stripe_email" => Ok(StripeEmail),
849 v => {
850 tracing::warn!(
851 "Unknown value '{}' for enum '{}'",
852 v,
853 "CreateSourceMandateNotificationMethod"
854 );
855 Ok(Unknown(v.to_owned()))
856 }
857 }
858 }
859}
860impl std::fmt::Display for CreateSourceMandateNotificationMethod {
861 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
862 f.write_str(self.as_str())
863 }
864}
865
866#[cfg(not(feature = "redact-generated-debug"))]
867impl std::fmt::Debug for CreateSourceMandateNotificationMethod {
868 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
869 f.write_str(self.as_str())
870 }
871}
872#[cfg(feature = "redact-generated-debug")]
873impl std::fmt::Debug for CreateSourceMandateNotificationMethod {
874 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
875 f.debug_struct(stringify!(CreateSourceMandateNotificationMethod)).finish_non_exhaustive()
876 }
877}
878impl serde::Serialize for CreateSourceMandateNotificationMethod {
879 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
880 where
881 S: serde::Serializer,
882 {
883 serializer.serialize_str(self.as_str())
884 }
885}
886#[cfg(feature = "deserialize")]
887impl<'de> serde::Deserialize<'de> for CreateSourceMandateNotificationMethod {
888 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
889 use std::str::FromStr;
890 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
891 Ok(Self::from_str(&s).expect("infallible"))
892 }
893}
894#[derive(Clone, Eq, PartialEq)]
897#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
898#[derive(serde::Serialize)]
899pub struct CreateSourceReceiver {
900 #[serde(skip_serializing_if = "Option::is_none")]
904 pub refund_attributes_method: Option<CreateSourceReceiverRefundAttributesMethod>,
905}
906#[cfg(feature = "redact-generated-debug")]
907impl std::fmt::Debug for CreateSourceReceiver {
908 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
909 f.debug_struct("CreateSourceReceiver").finish_non_exhaustive()
910 }
911}
912impl CreateSourceReceiver {
913 pub fn new() -> Self {
914 Self { refund_attributes_method: None }
915 }
916}
917impl Default for CreateSourceReceiver {
918 fn default() -> Self {
919 Self::new()
920 }
921}
922#[derive(Clone, Eq, PartialEq)]
926#[non_exhaustive]
927pub enum CreateSourceReceiverRefundAttributesMethod {
928 Email,
929 Manual,
930 None,
931 Unknown(String),
933}
934impl CreateSourceReceiverRefundAttributesMethod {
935 pub fn as_str(&self) -> &str {
936 use CreateSourceReceiverRefundAttributesMethod::*;
937 match self {
938 Email => "email",
939 Manual => "manual",
940 None => "none",
941 Unknown(v) => v,
942 }
943 }
944}
945
946impl std::str::FromStr for CreateSourceReceiverRefundAttributesMethod {
947 type Err = std::convert::Infallible;
948 fn from_str(s: &str) -> Result<Self, Self::Err> {
949 use CreateSourceReceiverRefundAttributesMethod::*;
950 match s {
951 "email" => Ok(Email),
952 "manual" => Ok(Manual),
953 "none" => Ok(None),
954 v => {
955 tracing::warn!(
956 "Unknown value '{}' for enum '{}'",
957 v,
958 "CreateSourceReceiverRefundAttributesMethod"
959 );
960 Ok(Unknown(v.to_owned()))
961 }
962 }
963 }
964}
965impl std::fmt::Display for CreateSourceReceiverRefundAttributesMethod {
966 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
967 f.write_str(self.as_str())
968 }
969}
970
971#[cfg(not(feature = "redact-generated-debug"))]
972impl std::fmt::Debug for CreateSourceReceiverRefundAttributesMethod {
973 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
974 f.write_str(self.as_str())
975 }
976}
977#[cfg(feature = "redact-generated-debug")]
978impl std::fmt::Debug for CreateSourceReceiverRefundAttributesMethod {
979 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
980 f.debug_struct(stringify!(CreateSourceReceiverRefundAttributesMethod))
981 .finish_non_exhaustive()
982 }
983}
984impl serde::Serialize for CreateSourceReceiverRefundAttributesMethod {
985 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
986 where
987 S: serde::Serializer,
988 {
989 serializer.serialize_str(self.as_str())
990 }
991}
992#[cfg(feature = "deserialize")]
993impl<'de> serde::Deserialize<'de> for CreateSourceReceiverRefundAttributesMethod {
994 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
995 use std::str::FromStr;
996 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
997 Ok(Self::from_str(&s).expect("infallible"))
998 }
999}
1000#[derive(Clone, Eq, PartialEq)]
1003#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1004#[derive(serde::Serialize)]
1005pub struct CreateSourceRedirect {
1006 pub return_url: String,
1009}
1010#[cfg(feature = "redact-generated-debug")]
1011impl std::fmt::Debug for CreateSourceRedirect {
1012 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1013 f.debug_struct("CreateSourceRedirect").finish_non_exhaustive()
1014 }
1015}
1016impl CreateSourceRedirect {
1017 pub fn new(return_url: impl Into<String>) -> Self {
1018 Self { return_url: return_url.into() }
1019 }
1020}
1021#[derive(Clone, Eq, PartialEq)]
1024#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1025#[derive(serde::Serialize)]
1026pub struct CreateSourceSourceOrder {
1027 #[serde(skip_serializing_if = "Option::is_none")]
1029 pub items: Option<Vec<CreateSourceSourceOrderItems>>,
1030 #[serde(skip_serializing_if = "Option::is_none")]
1033 pub shipping: Option<OrderShipping>,
1034}
1035#[cfg(feature = "redact-generated-debug")]
1036impl std::fmt::Debug for CreateSourceSourceOrder {
1037 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1038 f.debug_struct("CreateSourceSourceOrder").finish_non_exhaustive()
1039 }
1040}
1041impl CreateSourceSourceOrder {
1042 pub fn new() -> Self {
1043 Self { items: None, shipping: None }
1044 }
1045}
1046impl Default for CreateSourceSourceOrder {
1047 fn default() -> Self {
1048 Self::new()
1049 }
1050}
1051#[derive(Clone, Eq, PartialEq)]
1053#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1054#[derive(serde::Serialize)]
1055pub struct CreateSourceSourceOrderItems {
1056 #[serde(skip_serializing_if = "Option::is_none")]
1057 pub amount: Option<i64>,
1058 #[serde(skip_serializing_if = "Option::is_none")]
1059 pub currency: Option<stripe_types::Currency>,
1060 #[serde(skip_serializing_if = "Option::is_none")]
1061 pub description: Option<String>,
1062 #[serde(skip_serializing_if = "Option::is_none")]
1064 pub parent: Option<String>,
1065 #[serde(skip_serializing_if = "Option::is_none")]
1068 pub quantity: Option<u64>,
1069 #[serde(rename = "type")]
1070 #[serde(skip_serializing_if = "Option::is_none")]
1071 pub type_: Option<CreateSourceSourceOrderItemsType>,
1072}
1073#[cfg(feature = "redact-generated-debug")]
1074impl std::fmt::Debug for CreateSourceSourceOrderItems {
1075 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1076 f.debug_struct("CreateSourceSourceOrderItems").finish_non_exhaustive()
1077 }
1078}
1079impl CreateSourceSourceOrderItems {
1080 pub fn new() -> Self {
1081 Self {
1082 amount: None,
1083 currency: None,
1084 description: None,
1085 parent: None,
1086 quantity: None,
1087 type_: None,
1088 }
1089 }
1090}
1091impl Default for CreateSourceSourceOrderItems {
1092 fn default() -> Self {
1093 Self::new()
1094 }
1095}
1096#[derive(Clone, Eq, PartialEq)]
1097#[non_exhaustive]
1098pub enum CreateSourceSourceOrderItemsType {
1099 Discount,
1100 Shipping,
1101 Sku,
1102 Tax,
1103 Unknown(String),
1105}
1106impl CreateSourceSourceOrderItemsType {
1107 pub fn as_str(&self) -> &str {
1108 use CreateSourceSourceOrderItemsType::*;
1109 match self {
1110 Discount => "discount",
1111 Shipping => "shipping",
1112 Sku => "sku",
1113 Tax => "tax",
1114 Unknown(v) => v,
1115 }
1116 }
1117}
1118
1119impl std::str::FromStr for CreateSourceSourceOrderItemsType {
1120 type Err = std::convert::Infallible;
1121 fn from_str(s: &str) -> Result<Self, Self::Err> {
1122 use CreateSourceSourceOrderItemsType::*;
1123 match s {
1124 "discount" => Ok(Discount),
1125 "shipping" => Ok(Shipping),
1126 "sku" => Ok(Sku),
1127 "tax" => Ok(Tax),
1128 v => {
1129 tracing::warn!(
1130 "Unknown value '{}' for enum '{}'",
1131 v,
1132 "CreateSourceSourceOrderItemsType"
1133 );
1134 Ok(Unknown(v.to_owned()))
1135 }
1136 }
1137 }
1138}
1139impl std::fmt::Display for CreateSourceSourceOrderItemsType {
1140 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1141 f.write_str(self.as_str())
1142 }
1143}
1144
1145#[cfg(not(feature = "redact-generated-debug"))]
1146impl std::fmt::Debug for CreateSourceSourceOrderItemsType {
1147 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1148 f.write_str(self.as_str())
1149 }
1150}
1151#[cfg(feature = "redact-generated-debug")]
1152impl std::fmt::Debug for CreateSourceSourceOrderItemsType {
1153 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1154 f.debug_struct(stringify!(CreateSourceSourceOrderItemsType)).finish_non_exhaustive()
1155 }
1156}
1157impl serde::Serialize for CreateSourceSourceOrderItemsType {
1158 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1159 where
1160 S: serde::Serializer,
1161 {
1162 serializer.serialize_str(self.as_str())
1163 }
1164}
1165#[cfg(feature = "deserialize")]
1166impl<'de> serde::Deserialize<'de> for CreateSourceSourceOrderItemsType {
1167 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1168 use std::str::FromStr;
1169 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1170 Ok(Self::from_str(&s).expect("infallible"))
1171 }
1172}
1173#[derive(Clone, Eq, PartialEq)]
1174#[non_exhaustive]
1175pub enum CreateSourceUsage {
1176 Reusable,
1177 SingleUse,
1178 Unknown(String),
1180}
1181impl CreateSourceUsage {
1182 pub fn as_str(&self) -> &str {
1183 use CreateSourceUsage::*;
1184 match self {
1185 Reusable => "reusable",
1186 SingleUse => "single_use",
1187 Unknown(v) => v,
1188 }
1189 }
1190}
1191
1192impl std::str::FromStr for CreateSourceUsage {
1193 type Err = std::convert::Infallible;
1194 fn from_str(s: &str) -> Result<Self, Self::Err> {
1195 use CreateSourceUsage::*;
1196 match s {
1197 "reusable" => Ok(Reusable),
1198 "single_use" => Ok(SingleUse),
1199 v => {
1200 tracing::warn!("Unknown value '{}' for enum '{}'", v, "CreateSourceUsage");
1201 Ok(Unknown(v.to_owned()))
1202 }
1203 }
1204 }
1205}
1206impl std::fmt::Display for CreateSourceUsage {
1207 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1208 f.write_str(self.as_str())
1209 }
1210}
1211
1212#[cfg(not(feature = "redact-generated-debug"))]
1213impl std::fmt::Debug for CreateSourceUsage {
1214 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1215 f.write_str(self.as_str())
1216 }
1217}
1218#[cfg(feature = "redact-generated-debug")]
1219impl std::fmt::Debug for CreateSourceUsage {
1220 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1221 f.debug_struct(stringify!(CreateSourceUsage)).finish_non_exhaustive()
1222 }
1223}
1224impl serde::Serialize for CreateSourceUsage {
1225 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1226 where
1227 S: serde::Serializer,
1228 {
1229 serializer.serialize_str(self.as_str())
1230 }
1231}
1232#[cfg(feature = "deserialize")]
1233impl<'de> serde::Deserialize<'de> for CreateSourceUsage {
1234 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1235 use std::str::FromStr;
1236 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1237 Ok(Self::from_str(&s).expect("infallible"))
1238 }
1239}
1240#[derive(Clone)]
1242#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1243#[derive(serde::Serialize)]
1244pub struct CreateSource {
1245 inner: CreateSourceBuilder,
1246}
1247#[cfg(feature = "redact-generated-debug")]
1248impl std::fmt::Debug for CreateSource {
1249 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1250 f.debug_struct("CreateSource").finish_non_exhaustive()
1251 }
1252}
1253impl CreateSource {
1254 pub fn new() -> Self {
1256 Self { inner: CreateSourceBuilder::new() }
1257 }
1258 pub fn amount(mut self, amount: impl Into<i64>) -> Self {
1263 self.inner.amount = Some(amount.into());
1264 self
1265 }
1266 pub fn currency(mut self, currency: impl Into<stripe_types::Currency>) -> Self {
1269 self.inner.currency = Some(currency.into());
1270 self
1271 }
1272 pub fn customer(mut self, customer: impl Into<String>) -> Self {
1275 self.inner.customer = Some(customer.into());
1276 self
1277 }
1278 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1280 self.inner.expand = Some(expand.into());
1281 self
1282 }
1283 pub fn flow(mut self, flow: impl Into<CreateSourceFlow>) -> Self {
1287 self.inner.flow = Some(flow.into());
1288 self
1289 }
1290 pub fn mandate(mut self, mandate: impl Into<CreateSourceMandate>) -> Self {
1292 self.inner.mandate = Some(mandate.into());
1293 self
1294 }
1295 pub fn metadata(
1296 mut self,
1297 metadata: impl Into<std::collections::HashMap<String, String>>,
1298 ) -> Self {
1299 self.inner.metadata = Some(metadata.into());
1300 self
1301 }
1302 pub fn original_source(mut self, original_source: impl Into<String>) -> Self {
1304 self.inner.original_source = Some(original_source.into());
1305 self
1306 }
1307 pub fn owner(mut self, owner: impl Into<Owner>) -> Self {
1309 self.inner.owner = Some(owner.into());
1310 self
1311 }
1312 pub fn receiver(mut self, receiver: impl Into<CreateSourceReceiver>) -> Self {
1315 self.inner.receiver = Some(receiver.into());
1316 self
1317 }
1318 pub fn redirect(mut self, redirect: impl Into<CreateSourceRedirect>) -> Self {
1321 self.inner.redirect = Some(redirect.into());
1322 self
1323 }
1324 pub fn source_order(mut self, source_order: impl Into<CreateSourceSourceOrder>) -> Self {
1327 self.inner.source_order = Some(source_order.into());
1328 self
1329 }
1330 pub fn statement_descriptor(mut self, statement_descriptor: impl Into<String>) -> Self {
1333 self.inner.statement_descriptor = Some(statement_descriptor.into());
1334 self
1335 }
1336 pub fn token(mut self, token: impl Into<String>) -> Self {
1339 self.inner.token = Some(token.into());
1340 self
1341 }
1342 pub fn type_(mut self, type_: impl Into<String>) -> Self {
1345 self.inner.type_ = Some(type_.into());
1346 self
1347 }
1348 pub fn usage(mut self, usage: impl Into<CreateSourceUsage>) -> Self {
1349 self.inner.usage = Some(usage.into());
1350 self
1351 }
1352}
1353impl Default for CreateSource {
1354 fn default() -> Self {
1355 Self::new()
1356 }
1357}
1358impl CreateSource {
1359 pub async fn send<C: StripeClient>(
1361 &self,
1362 client: &C,
1363 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1364 self.customize().send(client).await
1365 }
1366
1367 pub fn send_blocking<C: StripeBlockingClient>(
1369 &self,
1370 client: &C,
1371 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1372 self.customize().send_blocking(client)
1373 }
1374}
1375
1376impl StripeRequest for CreateSource {
1377 type Output = stripe_shared::Source;
1378
1379 fn build(&self) -> RequestBuilder {
1380 RequestBuilder::new(StripeMethod::Post, "/sources").form(&self.inner)
1381 }
1382}
1383#[derive(Clone)]
1384#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1385#[derive(serde::Serialize)]
1386struct UpdateSourceBuilder {
1387 #[serde(skip_serializing_if = "Option::is_none")]
1388 amount: Option<i64>,
1389 #[serde(skip_serializing_if = "Option::is_none")]
1390 expand: Option<Vec<String>>,
1391 #[serde(skip_serializing_if = "Option::is_none")]
1392 mandate: Option<UpdateSourceMandate>,
1393 #[serde(skip_serializing_if = "Option::is_none")]
1394 metadata: Option<std::collections::HashMap<String, String>>,
1395 #[serde(skip_serializing_if = "Option::is_none")]
1396 owner: Option<Owner>,
1397 #[serde(skip_serializing_if = "Option::is_none")]
1398 source_order: Option<UpdateSourceSourceOrder>,
1399}
1400#[cfg(feature = "redact-generated-debug")]
1401impl std::fmt::Debug for UpdateSourceBuilder {
1402 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1403 f.debug_struct("UpdateSourceBuilder").finish_non_exhaustive()
1404 }
1405}
1406impl UpdateSourceBuilder {
1407 fn new() -> Self {
1408 Self {
1409 amount: None,
1410 expand: None,
1411 mandate: None,
1412 metadata: None,
1413 owner: None,
1414 source_order: None,
1415 }
1416 }
1417}
1418#[derive(Clone, Eq, PartialEq)]
1420#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1421#[derive(serde::Serialize)]
1422pub struct UpdateSourceMandate {
1423 #[serde(skip_serializing_if = "Option::is_none")]
1425 pub acceptance: Option<UpdateSourceMandateAcceptance>,
1426 #[serde(skip_serializing_if = "Option::is_none")]
1428 pub amount: Option<i64>,
1429 #[serde(skip_serializing_if = "Option::is_none")]
1431 pub currency: Option<stripe_types::Currency>,
1432 #[serde(skip_serializing_if = "Option::is_none")]
1435 pub interval: Option<UpdateSourceMandateInterval>,
1436 #[serde(skip_serializing_if = "Option::is_none")]
1439 pub notification_method: Option<UpdateSourceMandateNotificationMethod>,
1440}
1441#[cfg(feature = "redact-generated-debug")]
1442impl std::fmt::Debug for UpdateSourceMandate {
1443 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1444 f.debug_struct("UpdateSourceMandate").finish_non_exhaustive()
1445 }
1446}
1447impl UpdateSourceMandate {
1448 pub fn new() -> Self {
1449 Self {
1450 acceptance: None,
1451 amount: None,
1452 currency: None,
1453 interval: None,
1454 notification_method: None,
1455 }
1456 }
1457}
1458impl Default for UpdateSourceMandate {
1459 fn default() -> Self {
1460 Self::new()
1461 }
1462}
1463#[derive(Clone, Eq, PartialEq)]
1465#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1466#[derive(serde::Serialize)]
1467pub struct UpdateSourceMandateAcceptance {
1468 #[serde(skip_serializing_if = "Option::is_none")]
1470 pub date: Option<stripe_types::Timestamp>,
1471 #[serde(skip_serializing_if = "Option::is_none")]
1473 pub ip: Option<String>,
1474 #[serde(skip_serializing_if = "Option::is_none")]
1477 pub offline: Option<MandateOfflineAcceptanceParams>,
1478 #[serde(skip_serializing_if = "Option::is_none")]
1481 pub online: Option<MandateOnlineAcceptanceParams>,
1482 pub status: UpdateSourceMandateAcceptanceStatus,
1485 #[serde(rename = "type")]
1487 #[serde(skip_serializing_if = "Option::is_none")]
1488 pub type_: Option<UpdateSourceMandateAcceptanceType>,
1489 #[serde(skip_serializing_if = "Option::is_none")]
1491 pub user_agent: Option<String>,
1492}
1493#[cfg(feature = "redact-generated-debug")]
1494impl std::fmt::Debug for UpdateSourceMandateAcceptance {
1495 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1496 f.debug_struct("UpdateSourceMandateAcceptance").finish_non_exhaustive()
1497 }
1498}
1499impl UpdateSourceMandateAcceptance {
1500 pub fn new(status: impl Into<UpdateSourceMandateAcceptanceStatus>) -> Self {
1501 Self {
1502 date: None,
1503 ip: None,
1504 offline: None,
1505 online: None,
1506 status: status.into(),
1507 type_: None,
1508 user_agent: None,
1509 }
1510 }
1511}
1512#[derive(Clone, Eq, PartialEq)]
1515#[non_exhaustive]
1516pub enum UpdateSourceMandateAcceptanceStatus {
1517 Accepted,
1518 Pending,
1519 Refused,
1520 Revoked,
1521 Unknown(String),
1523}
1524impl UpdateSourceMandateAcceptanceStatus {
1525 pub fn as_str(&self) -> &str {
1526 use UpdateSourceMandateAcceptanceStatus::*;
1527 match self {
1528 Accepted => "accepted",
1529 Pending => "pending",
1530 Refused => "refused",
1531 Revoked => "revoked",
1532 Unknown(v) => v,
1533 }
1534 }
1535}
1536
1537impl std::str::FromStr for UpdateSourceMandateAcceptanceStatus {
1538 type Err = std::convert::Infallible;
1539 fn from_str(s: &str) -> Result<Self, Self::Err> {
1540 use UpdateSourceMandateAcceptanceStatus::*;
1541 match s {
1542 "accepted" => Ok(Accepted),
1543 "pending" => Ok(Pending),
1544 "refused" => Ok(Refused),
1545 "revoked" => Ok(Revoked),
1546 v => {
1547 tracing::warn!(
1548 "Unknown value '{}' for enum '{}'",
1549 v,
1550 "UpdateSourceMandateAcceptanceStatus"
1551 );
1552 Ok(Unknown(v.to_owned()))
1553 }
1554 }
1555 }
1556}
1557impl std::fmt::Display for UpdateSourceMandateAcceptanceStatus {
1558 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1559 f.write_str(self.as_str())
1560 }
1561}
1562
1563#[cfg(not(feature = "redact-generated-debug"))]
1564impl std::fmt::Debug for UpdateSourceMandateAcceptanceStatus {
1565 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1566 f.write_str(self.as_str())
1567 }
1568}
1569#[cfg(feature = "redact-generated-debug")]
1570impl std::fmt::Debug for UpdateSourceMandateAcceptanceStatus {
1571 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1572 f.debug_struct(stringify!(UpdateSourceMandateAcceptanceStatus)).finish_non_exhaustive()
1573 }
1574}
1575impl serde::Serialize for UpdateSourceMandateAcceptanceStatus {
1576 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1577 where
1578 S: serde::Serializer,
1579 {
1580 serializer.serialize_str(self.as_str())
1581 }
1582}
1583#[cfg(feature = "deserialize")]
1584impl<'de> serde::Deserialize<'de> for UpdateSourceMandateAcceptanceStatus {
1585 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1586 use std::str::FromStr;
1587 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1588 Ok(Self::from_str(&s).expect("infallible"))
1589 }
1590}
1591#[derive(Clone, Eq, PartialEq)]
1593#[non_exhaustive]
1594pub enum UpdateSourceMandateAcceptanceType {
1595 Offline,
1596 Online,
1597 Unknown(String),
1599}
1600impl UpdateSourceMandateAcceptanceType {
1601 pub fn as_str(&self) -> &str {
1602 use UpdateSourceMandateAcceptanceType::*;
1603 match self {
1604 Offline => "offline",
1605 Online => "online",
1606 Unknown(v) => v,
1607 }
1608 }
1609}
1610
1611impl std::str::FromStr for UpdateSourceMandateAcceptanceType {
1612 type Err = std::convert::Infallible;
1613 fn from_str(s: &str) -> Result<Self, Self::Err> {
1614 use UpdateSourceMandateAcceptanceType::*;
1615 match s {
1616 "offline" => Ok(Offline),
1617 "online" => Ok(Online),
1618 v => {
1619 tracing::warn!(
1620 "Unknown value '{}' for enum '{}'",
1621 v,
1622 "UpdateSourceMandateAcceptanceType"
1623 );
1624 Ok(Unknown(v.to_owned()))
1625 }
1626 }
1627 }
1628}
1629impl std::fmt::Display for UpdateSourceMandateAcceptanceType {
1630 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1631 f.write_str(self.as_str())
1632 }
1633}
1634
1635#[cfg(not(feature = "redact-generated-debug"))]
1636impl std::fmt::Debug for UpdateSourceMandateAcceptanceType {
1637 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1638 f.write_str(self.as_str())
1639 }
1640}
1641#[cfg(feature = "redact-generated-debug")]
1642impl std::fmt::Debug for UpdateSourceMandateAcceptanceType {
1643 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1644 f.debug_struct(stringify!(UpdateSourceMandateAcceptanceType)).finish_non_exhaustive()
1645 }
1646}
1647impl serde::Serialize for UpdateSourceMandateAcceptanceType {
1648 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1649 where
1650 S: serde::Serializer,
1651 {
1652 serializer.serialize_str(self.as_str())
1653 }
1654}
1655#[cfg(feature = "deserialize")]
1656impl<'de> serde::Deserialize<'de> for UpdateSourceMandateAcceptanceType {
1657 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1658 use std::str::FromStr;
1659 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1660 Ok(Self::from_str(&s).expect("infallible"))
1661 }
1662}
1663#[derive(Clone, Eq, PartialEq)]
1666#[non_exhaustive]
1667pub enum UpdateSourceMandateInterval {
1668 OneTime,
1669 Scheduled,
1670 Variable,
1671 Unknown(String),
1673}
1674impl UpdateSourceMandateInterval {
1675 pub fn as_str(&self) -> &str {
1676 use UpdateSourceMandateInterval::*;
1677 match self {
1678 OneTime => "one_time",
1679 Scheduled => "scheduled",
1680 Variable => "variable",
1681 Unknown(v) => v,
1682 }
1683 }
1684}
1685
1686impl std::str::FromStr for UpdateSourceMandateInterval {
1687 type Err = std::convert::Infallible;
1688 fn from_str(s: &str) -> Result<Self, Self::Err> {
1689 use UpdateSourceMandateInterval::*;
1690 match s {
1691 "one_time" => Ok(OneTime),
1692 "scheduled" => Ok(Scheduled),
1693 "variable" => Ok(Variable),
1694 v => {
1695 tracing::warn!(
1696 "Unknown value '{}' for enum '{}'",
1697 v,
1698 "UpdateSourceMandateInterval"
1699 );
1700 Ok(Unknown(v.to_owned()))
1701 }
1702 }
1703 }
1704}
1705impl std::fmt::Display for UpdateSourceMandateInterval {
1706 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1707 f.write_str(self.as_str())
1708 }
1709}
1710
1711#[cfg(not(feature = "redact-generated-debug"))]
1712impl std::fmt::Debug for UpdateSourceMandateInterval {
1713 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1714 f.write_str(self.as_str())
1715 }
1716}
1717#[cfg(feature = "redact-generated-debug")]
1718impl std::fmt::Debug for UpdateSourceMandateInterval {
1719 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1720 f.debug_struct(stringify!(UpdateSourceMandateInterval)).finish_non_exhaustive()
1721 }
1722}
1723impl serde::Serialize for UpdateSourceMandateInterval {
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 UpdateSourceMandateInterval {
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).expect("infallible"))
1737 }
1738}
1739#[derive(Clone, Eq, PartialEq)]
1742#[non_exhaustive]
1743pub enum UpdateSourceMandateNotificationMethod {
1744 DeprecatedNone,
1745 Email,
1746 Manual,
1747 None,
1748 StripeEmail,
1749 Unknown(String),
1751}
1752impl UpdateSourceMandateNotificationMethod {
1753 pub fn as_str(&self) -> &str {
1754 use UpdateSourceMandateNotificationMethod::*;
1755 match self {
1756 DeprecatedNone => "deprecated_none",
1757 Email => "email",
1758 Manual => "manual",
1759 None => "none",
1760 StripeEmail => "stripe_email",
1761 Unknown(v) => v,
1762 }
1763 }
1764}
1765
1766impl std::str::FromStr for UpdateSourceMandateNotificationMethod {
1767 type Err = std::convert::Infallible;
1768 fn from_str(s: &str) -> Result<Self, Self::Err> {
1769 use UpdateSourceMandateNotificationMethod::*;
1770 match s {
1771 "deprecated_none" => Ok(DeprecatedNone),
1772 "email" => Ok(Email),
1773 "manual" => Ok(Manual),
1774 "none" => Ok(None),
1775 "stripe_email" => Ok(StripeEmail),
1776 v => {
1777 tracing::warn!(
1778 "Unknown value '{}' for enum '{}'",
1779 v,
1780 "UpdateSourceMandateNotificationMethod"
1781 );
1782 Ok(Unknown(v.to_owned()))
1783 }
1784 }
1785 }
1786}
1787impl std::fmt::Display for UpdateSourceMandateNotificationMethod {
1788 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1789 f.write_str(self.as_str())
1790 }
1791}
1792
1793#[cfg(not(feature = "redact-generated-debug"))]
1794impl std::fmt::Debug for UpdateSourceMandateNotificationMethod {
1795 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1796 f.write_str(self.as_str())
1797 }
1798}
1799#[cfg(feature = "redact-generated-debug")]
1800impl std::fmt::Debug for UpdateSourceMandateNotificationMethod {
1801 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1802 f.debug_struct(stringify!(UpdateSourceMandateNotificationMethod)).finish_non_exhaustive()
1803 }
1804}
1805impl serde::Serialize for UpdateSourceMandateNotificationMethod {
1806 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1807 where
1808 S: serde::Serializer,
1809 {
1810 serializer.serialize_str(self.as_str())
1811 }
1812}
1813#[cfg(feature = "deserialize")]
1814impl<'de> serde::Deserialize<'de> for UpdateSourceMandateNotificationMethod {
1815 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1816 use std::str::FromStr;
1817 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1818 Ok(Self::from_str(&s).expect("infallible"))
1819 }
1820}
1821#[derive(Clone, Eq, PartialEq)]
1824#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1825#[derive(serde::Serialize)]
1826pub struct UpdateSourceSourceOrder {
1827 #[serde(skip_serializing_if = "Option::is_none")]
1829 pub items: Option<Vec<UpdateSourceSourceOrderItems>>,
1830 #[serde(skip_serializing_if = "Option::is_none")]
1833 pub shipping: Option<OrderShipping>,
1834}
1835#[cfg(feature = "redact-generated-debug")]
1836impl std::fmt::Debug for UpdateSourceSourceOrder {
1837 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1838 f.debug_struct("UpdateSourceSourceOrder").finish_non_exhaustive()
1839 }
1840}
1841impl UpdateSourceSourceOrder {
1842 pub fn new() -> Self {
1843 Self { items: None, shipping: None }
1844 }
1845}
1846impl Default for UpdateSourceSourceOrder {
1847 fn default() -> Self {
1848 Self::new()
1849 }
1850}
1851#[derive(Clone, Eq, PartialEq)]
1853#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1854#[derive(serde::Serialize)]
1855pub struct UpdateSourceSourceOrderItems {
1856 #[serde(skip_serializing_if = "Option::is_none")]
1857 pub amount: Option<i64>,
1858 #[serde(skip_serializing_if = "Option::is_none")]
1859 pub currency: Option<stripe_types::Currency>,
1860 #[serde(skip_serializing_if = "Option::is_none")]
1861 pub description: Option<String>,
1862 #[serde(skip_serializing_if = "Option::is_none")]
1864 pub parent: Option<String>,
1865 #[serde(skip_serializing_if = "Option::is_none")]
1868 pub quantity: Option<u64>,
1869 #[serde(rename = "type")]
1870 #[serde(skip_serializing_if = "Option::is_none")]
1871 pub type_: Option<UpdateSourceSourceOrderItemsType>,
1872}
1873#[cfg(feature = "redact-generated-debug")]
1874impl std::fmt::Debug for UpdateSourceSourceOrderItems {
1875 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1876 f.debug_struct("UpdateSourceSourceOrderItems").finish_non_exhaustive()
1877 }
1878}
1879impl UpdateSourceSourceOrderItems {
1880 pub fn new() -> Self {
1881 Self {
1882 amount: None,
1883 currency: None,
1884 description: None,
1885 parent: None,
1886 quantity: None,
1887 type_: None,
1888 }
1889 }
1890}
1891impl Default for UpdateSourceSourceOrderItems {
1892 fn default() -> Self {
1893 Self::new()
1894 }
1895}
1896#[derive(Clone, Eq, PartialEq)]
1897#[non_exhaustive]
1898pub enum UpdateSourceSourceOrderItemsType {
1899 Discount,
1900 Shipping,
1901 Sku,
1902 Tax,
1903 Unknown(String),
1905}
1906impl UpdateSourceSourceOrderItemsType {
1907 pub fn as_str(&self) -> &str {
1908 use UpdateSourceSourceOrderItemsType::*;
1909 match self {
1910 Discount => "discount",
1911 Shipping => "shipping",
1912 Sku => "sku",
1913 Tax => "tax",
1914 Unknown(v) => v,
1915 }
1916 }
1917}
1918
1919impl std::str::FromStr for UpdateSourceSourceOrderItemsType {
1920 type Err = std::convert::Infallible;
1921 fn from_str(s: &str) -> Result<Self, Self::Err> {
1922 use UpdateSourceSourceOrderItemsType::*;
1923 match s {
1924 "discount" => Ok(Discount),
1925 "shipping" => Ok(Shipping),
1926 "sku" => Ok(Sku),
1927 "tax" => Ok(Tax),
1928 v => {
1929 tracing::warn!(
1930 "Unknown value '{}' for enum '{}'",
1931 v,
1932 "UpdateSourceSourceOrderItemsType"
1933 );
1934 Ok(Unknown(v.to_owned()))
1935 }
1936 }
1937 }
1938}
1939impl std::fmt::Display for UpdateSourceSourceOrderItemsType {
1940 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1941 f.write_str(self.as_str())
1942 }
1943}
1944
1945#[cfg(not(feature = "redact-generated-debug"))]
1946impl std::fmt::Debug for UpdateSourceSourceOrderItemsType {
1947 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1948 f.write_str(self.as_str())
1949 }
1950}
1951#[cfg(feature = "redact-generated-debug")]
1952impl std::fmt::Debug for UpdateSourceSourceOrderItemsType {
1953 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1954 f.debug_struct(stringify!(UpdateSourceSourceOrderItemsType)).finish_non_exhaustive()
1955 }
1956}
1957impl serde::Serialize for UpdateSourceSourceOrderItemsType {
1958 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1959 where
1960 S: serde::Serializer,
1961 {
1962 serializer.serialize_str(self.as_str())
1963 }
1964}
1965#[cfg(feature = "deserialize")]
1966impl<'de> serde::Deserialize<'de> for UpdateSourceSourceOrderItemsType {
1967 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1968 use std::str::FromStr;
1969 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1970 Ok(Self::from_str(&s).expect("infallible"))
1971 }
1972}
1973#[derive(Clone)]
1980#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1981#[derive(serde::Serialize)]
1982pub struct UpdateSource {
1983 inner: UpdateSourceBuilder,
1984 source: stripe_shared::SourceId,
1985}
1986#[cfg(feature = "redact-generated-debug")]
1987impl std::fmt::Debug for UpdateSource {
1988 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1989 f.debug_struct("UpdateSource").finish_non_exhaustive()
1990 }
1991}
1992impl UpdateSource {
1993 pub fn new(source: impl Into<stripe_shared::SourceId>) -> Self {
1995 Self { source: source.into(), inner: UpdateSourceBuilder::new() }
1996 }
1997 pub fn amount(mut self, amount: impl Into<i64>) -> Self {
1999 self.inner.amount = Some(amount.into());
2000 self
2001 }
2002 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2004 self.inner.expand = Some(expand.into());
2005 self
2006 }
2007 pub fn mandate(mut self, mandate: impl Into<UpdateSourceMandate>) -> Self {
2009 self.inner.mandate = Some(mandate.into());
2010 self
2011 }
2012 pub fn metadata(
2017 mut self,
2018 metadata: impl Into<std::collections::HashMap<String, String>>,
2019 ) -> Self {
2020 self.inner.metadata = Some(metadata.into());
2021 self
2022 }
2023 pub fn owner(mut self, owner: impl Into<Owner>) -> Self {
2025 self.inner.owner = Some(owner.into());
2026 self
2027 }
2028 pub fn source_order(mut self, source_order: impl Into<UpdateSourceSourceOrder>) -> Self {
2031 self.inner.source_order = Some(source_order.into());
2032 self
2033 }
2034}
2035impl UpdateSource {
2036 pub async fn send<C: StripeClient>(
2038 &self,
2039 client: &C,
2040 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2041 self.customize().send(client).await
2042 }
2043
2044 pub fn send_blocking<C: StripeBlockingClient>(
2046 &self,
2047 client: &C,
2048 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2049 self.customize().send_blocking(client)
2050 }
2051}
2052
2053impl StripeRequest for UpdateSource {
2054 type Output = stripe_shared::Source;
2055
2056 fn build(&self) -> RequestBuilder {
2057 let source = &self.source;
2058 RequestBuilder::new(StripeMethod::Post, format!("/sources/{source}")).form(&self.inner)
2059 }
2060}
2061#[derive(Clone, Eq, PartialEq)]
2062#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2063#[derive(serde::Serialize)]
2064struct VerifySourceBuilder {
2065 #[serde(skip_serializing_if = "Option::is_none")]
2066 expand: Option<Vec<String>>,
2067 values: Vec<String>,
2068}
2069#[cfg(feature = "redact-generated-debug")]
2070impl std::fmt::Debug for VerifySourceBuilder {
2071 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2072 f.debug_struct("VerifySourceBuilder").finish_non_exhaustive()
2073 }
2074}
2075impl VerifySourceBuilder {
2076 fn new(values: impl Into<Vec<String>>) -> Self {
2077 Self { expand: None, values: values.into() }
2078 }
2079}
2080#[derive(Clone)]
2082#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2083#[derive(serde::Serialize)]
2084pub struct VerifySource {
2085 inner: VerifySourceBuilder,
2086 source: stripe_shared::SourceId,
2087}
2088#[cfg(feature = "redact-generated-debug")]
2089impl std::fmt::Debug for VerifySource {
2090 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2091 f.debug_struct("VerifySource").finish_non_exhaustive()
2092 }
2093}
2094impl VerifySource {
2095 pub fn new(source: impl Into<stripe_shared::SourceId>, values: impl Into<Vec<String>>) -> Self {
2097 Self { source: source.into(), inner: VerifySourceBuilder::new(values.into()) }
2098 }
2099 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2101 self.inner.expand = Some(expand.into());
2102 self
2103 }
2104}
2105impl VerifySource {
2106 pub async fn send<C: StripeClient>(
2108 &self,
2109 client: &C,
2110 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2111 self.customize().send(client).await
2112 }
2113
2114 pub fn send_blocking<C: StripeBlockingClient>(
2116 &self,
2117 client: &C,
2118 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2119 self.customize().send_blocking(client)
2120 }
2121}
2122
2123impl StripeRequest for VerifySource {
2124 type Output = stripe_shared::Source;
2125
2126 fn build(&self) -> RequestBuilder {
2127 let source = &self.source;
2128 RequestBuilder::new(StripeMethod::Post, format!("/sources/{source}/verify"))
2129 .form(&self.inner)
2130 }
2131}
2132
2133#[derive(Clone, Eq, PartialEq)]
2134#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2135#[derive(serde::Serialize)]
2136pub struct MandateOfflineAcceptanceParams {
2137 pub contact_email: String,
2139}
2140#[cfg(feature = "redact-generated-debug")]
2141impl std::fmt::Debug for MandateOfflineAcceptanceParams {
2142 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2143 f.debug_struct("MandateOfflineAcceptanceParams").finish_non_exhaustive()
2144 }
2145}
2146impl MandateOfflineAcceptanceParams {
2147 pub fn new(contact_email: impl Into<String>) -> Self {
2148 Self { contact_email: contact_email.into() }
2149 }
2150}
2151#[derive(Clone, Eq, PartialEq)]
2152#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2153#[derive(serde::Serialize)]
2154pub struct MandateOnlineAcceptanceParams {
2155 #[serde(skip_serializing_if = "Option::is_none")]
2157 pub date: Option<stripe_types::Timestamp>,
2158 #[serde(skip_serializing_if = "Option::is_none")]
2160 pub ip: Option<String>,
2161 #[serde(skip_serializing_if = "Option::is_none")]
2163 pub user_agent: Option<String>,
2164}
2165#[cfg(feature = "redact-generated-debug")]
2166impl std::fmt::Debug for MandateOnlineAcceptanceParams {
2167 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2168 f.debug_struct("MandateOnlineAcceptanceParams").finish_non_exhaustive()
2169 }
2170}
2171impl MandateOnlineAcceptanceParams {
2172 pub fn new() -> Self {
2173 Self { date: None, ip: None, user_agent: None }
2174 }
2175}
2176impl Default for MandateOnlineAcceptanceParams {
2177 fn default() -> Self {
2178 Self::new()
2179 }
2180}
2181#[derive(Clone, Eq, PartialEq)]
2182#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2183#[derive(serde::Serialize)]
2184pub struct SourceAddress {
2185 #[serde(skip_serializing_if = "Option::is_none")]
2187 pub city: Option<String>,
2188 #[serde(skip_serializing_if = "Option::is_none")]
2190 pub country: Option<String>,
2191 #[serde(skip_serializing_if = "Option::is_none")]
2193 pub line1: Option<String>,
2194 #[serde(skip_serializing_if = "Option::is_none")]
2196 pub line2: Option<String>,
2197 #[serde(skip_serializing_if = "Option::is_none")]
2199 pub postal_code: Option<String>,
2200 #[serde(skip_serializing_if = "Option::is_none")]
2202 pub state: Option<String>,
2203}
2204#[cfg(feature = "redact-generated-debug")]
2205impl std::fmt::Debug for SourceAddress {
2206 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2207 f.debug_struct("SourceAddress").finish_non_exhaustive()
2208 }
2209}
2210impl SourceAddress {
2211 pub fn new() -> Self {
2212 Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
2213 }
2214}
2215impl Default for SourceAddress {
2216 fn default() -> Self {
2217 Self::new()
2218 }
2219}
2220#[derive(Clone, Eq, PartialEq)]
2221#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2222#[derive(serde::Serialize)]
2223pub struct Address {
2224 #[serde(skip_serializing_if = "Option::is_none")]
2226 pub city: Option<String>,
2227 #[serde(skip_serializing_if = "Option::is_none")]
2229 pub country: Option<String>,
2230 pub line1: String,
2232 #[serde(skip_serializing_if = "Option::is_none")]
2234 pub line2: Option<String>,
2235 #[serde(skip_serializing_if = "Option::is_none")]
2237 pub postal_code: Option<String>,
2238 #[serde(skip_serializing_if = "Option::is_none")]
2240 pub state: Option<String>,
2241}
2242#[cfg(feature = "redact-generated-debug")]
2243impl std::fmt::Debug for Address {
2244 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2245 f.debug_struct("Address").finish_non_exhaustive()
2246 }
2247}
2248impl Address {
2249 pub fn new(line1: impl Into<String>) -> Self {
2250 Self {
2251 city: None,
2252 country: None,
2253 line1: line1.into(),
2254 line2: None,
2255 postal_code: None,
2256 state: None,
2257 }
2258 }
2259}
2260#[derive(Clone, Eq, PartialEq)]
2261#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2262#[derive(serde::Serialize)]
2263pub struct Owner {
2264 #[serde(skip_serializing_if = "Option::is_none")]
2266 pub address: Option<SourceAddress>,
2267 #[serde(skip_serializing_if = "Option::is_none")]
2269 pub email: Option<String>,
2270 #[serde(skip_serializing_if = "Option::is_none")]
2272 pub name: Option<String>,
2273 #[serde(skip_serializing_if = "Option::is_none")]
2275 pub phone: Option<String>,
2276}
2277#[cfg(feature = "redact-generated-debug")]
2278impl std::fmt::Debug for Owner {
2279 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2280 f.debug_struct("Owner").finish_non_exhaustive()
2281 }
2282}
2283impl Owner {
2284 pub fn new() -> Self {
2285 Self { address: None, email: None, name: None, phone: None }
2286 }
2287}
2288impl Default for Owner {
2289 fn default() -> Self {
2290 Self::new()
2291 }
2292}
2293#[derive(Clone, Eq, PartialEq)]
2294#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2295#[derive(serde::Serialize)]
2296pub struct OrderShipping {
2297 pub address: Address,
2299 #[serde(skip_serializing_if = "Option::is_none")]
2301 pub carrier: Option<String>,
2302 #[serde(skip_serializing_if = "Option::is_none")]
2304 pub name: Option<String>,
2305 #[serde(skip_serializing_if = "Option::is_none")]
2307 pub phone: Option<String>,
2308 #[serde(skip_serializing_if = "Option::is_none")]
2311 pub tracking_number: Option<String>,
2312}
2313#[cfg(feature = "redact-generated-debug")]
2314impl std::fmt::Debug for OrderShipping {
2315 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2316 f.debug_struct("OrderShipping").finish_non_exhaustive()
2317 }
2318}
2319impl OrderShipping {
2320 pub fn new(address: impl Into<Address>) -> Self {
2321 Self {
2322 address: address.into(),
2323 carrier: None,
2324 name: None,
2325 phone: None,
2326 tracking_number: None,
2327 }
2328 }
2329}