1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct PaymentIntentPaymentMethodOptionsUsBankAccount {
5 pub financial_connections: Option<stripe_shared::LinkedAccountOptionsCommon>,
6 pub mandate_options: Option<stripe_shared::PaymentMethodOptionsUsBankAccountMandateOptions>,
7 pub preferred_settlement_speed:
9 Option<PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed>,
10 pub setup_future_usage: Option<PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>,
19 pub target_date: Option<String>,
23 pub verification_method:
25 Option<PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>,
26}
27#[doc(hidden)]
28pub struct PaymentIntentPaymentMethodOptionsUsBankAccountBuilder {
29 financial_connections: Option<Option<stripe_shared::LinkedAccountOptionsCommon>>,
30 mandate_options: Option<Option<stripe_shared::PaymentMethodOptionsUsBankAccountMandateOptions>>,
31 preferred_settlement_speed:
32 Option<Option<PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed>>,
33 setup_future_usage:
34 Option<Option<PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>>,
35 target_date: Option<Option<String>>,
36 verification_method:
37 Option<Option<PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>>,
38}
39
40#[allow(
41 unused_variables,
42 irrefutable_let_patterns,
43 clippy::let_unit_value,
44 clippy::match_single_binding,
45 clippy::single_match
46)]
47const _: () = {
48 use miniserde::de::{Map, Visitor};
49 use miniserde::json::Value;
50 use miniserde::{Deserialize, Result, make_place};
51 use stripe_types::miniserde_helpers::FromValueOpt;
52 use stripe_types::{MapBuilder, ObjectDeser};
53
54 make_place!(Place);
55
56 impl Deserialize for PaymentIntentPaymentMethodOptionsUsBankAccount {
57 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
58 Place::new(out)
59 }
60 }
61
62 struct Builder<'a> {
63 out: &'a mut Option<PaymentIntentPaymentMethodOptionsUsBankAccount>,
64 builder: PaymentIntentPaymentMethodOptionsUsBankAccountBuilder,
65 }
66
67 impl Visitor for Place<PaymentIntentPaymentMethodOptionsUsBankAccount> {
68 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
69 Ok(Box::new(Builder {
70 out: &mut self.out,
71 builder: PaymentIntentPaymentMethodOptionsUsBankAccountBuilder::deser_default(),
72 }))
73 }
74 }
75
76 impl MapBuilder for PaymentIntentPaymentMethodOptionsUsBankAccountBuilder {
77 type Out = PaymentIntentPaymentMethodOptionsUsBankAccount;
78 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
79 Ok(match k {
80 "financial_connections" => Deserialize::begin(&mut self.financial_connections),
81 "mandate_options" => Deserialize::begin(&mut self.mandate_options),
82 "preferred_settlement_speed" => {
83 Deserialize::begin(&mut self.preferred_settlement_speed)
84 }
85 "setup_future_usage" => Deserialize::begin(&mut self.setup_future_usage),
86 "target_date" => Deserialize::begin(&mut self.target_date),
87 "verification_method" => Deserialize::begin(&mut self.verification_method),
88 _ => <dyn Visitor>::ignore(),
89 })
90 }
91
92 fn deser_default() -> Self {
93 Self {
94 financial_connections: Deserialize::default(),
95 mandate_options: Deserialize::default(),
96 preferred_settlement_speed: Deserialize::default(),
97 setup_future_usage: Deserialize::default(),
98 target_date: Deserialize::default(),
99 verification_method: Deserialize::default(),
100 }
101 }
102
103 fn take_out(&mut self) -> Option<Self::Out> {
104 let (
105 Some(financial_connections),
106 Some(mandate_options),
107 Some(preferred_settlement_speed),
108 Some(setup_future_usage),
109 Some(target_date),
110 Some(verification_method),
111 ) = (
112 self.financial_connections.take(),
113 self.mandate_options.take(),
114 self.preferred_settlement_speed.take(),
115 self.setup_future_usage.take(),
116 self.target_date.take(),
117 self.verification_method.take(),
118 )
119 else {
120 return None;
121 };
122 Some(Self::Out {
123 financial_connections,
124 mandate_options,
125 preferred_settlement_speed,
126 setup_future_usage,
127 target_date,
128 verification_method,
129 })
130 }
131 }
132
133 impl Map for Builder<'_> {
134 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
135 self.builder.key(k)
136 }
137
138 fn finish(&mut self) -> Result<()> {
139 *self.out = self.builder.take_out();
140 Ok(())
141 }
142 }
143
144 impl ObjectDeser for PaymentIntentPaymentMethodOptionsUsBankAccount {
145 type Builder = PaymentIntentPaymentMethodOptionsUsBankAccountBuilder;
146 }
147
148 impl FromValueOpt for PaymentIntentPaymentMethodOptionsUsBankAccount {
149 fn from_value(v: Value) -> Option<Self> {
150 let Value::Object(obj) = v else {
151 return None;
152 };
153 let mut b = PaymentIntentPaymentMethodOptionsUsBankAccountBuilder::deser_default();
154 for (k, v) in obj {
155 match k.as_str() {
156 "financial_connections" => {
157 b.financial_connections = FromValueOpt::from_value(v)
158 }
159 "mandate_options" => b.mandate_options = FromValueOpt::from_value(v),
160 "preferred_settlement_speed" => {
161 b.preferred_settlement_speed = FromValueOpt::from_value(v)
162 }
163 "setup_future_usage" => b.setup_future_usage = FromValueOpt::from_value(v),
164 "target_date" => b.target_date = FromValueOpt::from_value(v),
165 "verification_method" => b.verification_method = FromValueOpt::from_value(v),
166 _ => {}
167 }
168 }
169 b.take_out()
170 }
171 }
172};
173#[derive(Clone, Eq, PartialEq)]
175#[non_exhaustive]
176pub enum PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed {
177 Fastest,
178 Standard,
179 Unknown(String),
181}
182impl PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed {
183 pub fn as_str(&self) -> &str {
184 use PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*;
185 match self {
186 Fastest => "fastest",
187 Standard => "standard",
188 Unknown(v) => v,
189 }
190 }
191}
192
193impl std::str::FromStr for PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed {
194 type Err = std::convert::Infallible;
195 fn from_str(s: &str) -> Result<Self, Self::Err> {
196 use PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::*;
197 match s {
198 "fastest" => Ok(Fastest),
199 "standard" => Ok(Standard),
200 v => {
201 tracing::warn!(
202 "Unknown value '{}' for enum '{}'",
203 v,
204 "PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed"
205 );
206 Ok(Unknown(v.to_owned()))
207 }
208 }
209 }
210}
211impl std::fmt::Display for PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed {
212 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
213 f.write_str(self.as_str())
214 }
215}
216
217impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed {
218 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
219 f.write_str(self.as_str())
220 }
221}
222#[cfg(feature = "serialize")]
223impl serde::Serialize for PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed {
224 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
225 where
226 S: serde::Serializer,
227 {
228 serializer.serialize_str(self.as_str())
229 }
230}
231impl miniserde::Deserialize
232 for PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed
233{
234 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
235 crate::Place::new(out)
236 }
237}
238
239impl miniserde::de::Visitor
240 for crate::Place<PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed>
241{
242 fn string(&mut self, s: &str) -> miniserde::Result<()> {
243 use std::str::FromStr;
244 self.out = Some(
245 PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed::from_str(s)
246 .expect("infallible"),
247 );
248 Ok(())
249 }
250}
251
252stripe_types::impl_from_val_with_from_str!(
253 PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed
254);
255#[cfg(feature = "deserialize")]
256impl<'de> serde::Deserialize<'de>
257 for PaymentIntentPaymentMethodOptionsUsBankAccountPreferredSettlementSpeed
258{
259 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
260 use std::str::FromStr;
261 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
262 Ok(Self::from_str(&s).expect("infallible"))
263 }
264}
265#[derive(Clone, Eq, PartialEq)]
274#[non_exhaustive]
275pub enum PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
276 None,
277 OffSession,
278 OnSession,
279 Unknown(String),
281}
282impl PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
283 pub fn as_str(&self) -> &str {
284 use PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
285 match self {
286 None => "none",
287 OffSession => "off_session",
288 OnSession => "on_session",
289 Unknown(v) => v,
290 }
291 }
292}
293
294impl std::str::FromStr for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
295 type Err = std::convert::Infallible;
296 fn from_str(s: &str) -> Result<Self, Self::Err> {
297 use PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
298 match s {
299 "none" => Ok(None),
300 "off_session" => Ok(OffSession),
301 "on_session" => Ok(OnSession),
302 v => {
303 tracing::warn!(
304 "Unknown value '{}' for enum '{}'",
305 v,
306 "PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage"
307 );
308 Ok(Unknown(v.to_owned()))
309 }
310 }
311 }
312}
313impl std::fmt::Display for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
314 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
315 f.write_str(self.as_str())
316 }
317}
318
319impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
320 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
321 f.write_str(self.as_str())
322 }
323}
324#[cfg(feature = "serialize")]
325impl serde::Serialize for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
326 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
327 where
328 S: serde::Serializer,
329 {
330 serializer.serialize_str(self.as_str())
331 }
332}
333impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
334 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
335 crate::Place::new(out)
336 }
337}
338
339impl miniserde::de::Visitor
340 for crate::Place<PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>
341{
342 fn string(&mut self, s: &str) -> miniserde::Result<()> {
343 use std::str::FromStr;
344 self.out = Some(
345 PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::from_str(s)
346 .expect("infallible"),
347 );
348 Ok(())
349 }
350}
351
352stripe_types::impl_from_val_with_from_str!(
353 PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
354);
355#[cfg(feature = "deserialize")]
356impl<'de> serde::Deserialize<'de>
357 for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
358{
359 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
360 use std::str::FromStr;
361 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
362 Ok(Self::from_str(&s).expect("infallible"))
363 }
364}
365#[derive(Clone, Eq, PartialEq)]
367#[non_exhaustive]
368pub enum PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
369 Automatic,
370 Instant,
371 Microdeposits,
372 Unknown(String),
374}
375impl PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
376 pub fn as_str(&self) -> &str {
377 use PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
378 match self {
379 Automatic => "automatic",
380 Instant => "instant",
381 Microdeposits => "microdeposits",
382 Unknown(v) => v,
383 }
384 }
385}
386
387impl std::str::FromStr for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
388 type Err = std::convert::Infallible;
389 fn from_str(s: &str) -> Result<Self, Self::Err> {
390 use PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
391 match s {
392 "automatic" => Ok(Automatic),
393 "instant" => Ok(Instant),
394 "microdeposits" => Ok(Microdeposits),
395 v => {
396 tracing::warn!(
397 "Unknown value '{}' for enum '{}'",
398 v,
399 "PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod"
400 );
401 Ok(Unknown(v.to_owned()))
402 }
403 }
404 }
405}
406impl std::fmt::Display for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
407 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
408 f.write_str(self.as_str())
409 }
410}
411
412impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
413 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
414 f.write_str(self.as_str())
415 }
416}
417#[cfg(feature = "serialize")]
418impl serde::Serialize for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
419 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
420 where
421 S: serde::Serializer,
422 {
423 serializer.serialize_str(self.as_str())
424 }
425}
426impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
427 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
428 crate::Place::new(out)
429 }
430}
431
432impl miniserde::de::Visitor
433 for crate::Place<PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>
434{
435 fn string(&mut self, s: &str) -> miniserde::Result<()> {
436 use std::str::FromStr;
437 self.out = Some(
438 PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::from_str(s)
439 .expect("infallible"),
440 );
441 Ok(())
442 }
443}
444
445stripe_types::impl_from_val_with_from_str!(
446 PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
447);
448#[cfg(feature = "deserialize")]
449impl<'de> serde::Deserialize<'de>
450 for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
451{
452 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
453 use std::str::FromStr;
454 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
455 Ok(Self::from_str(&s).expect("infallible"))
456 }
457}