1#[derive(Clone, Eq, PartialEq)]
2#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
4#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
5pub struct PaymentIntentPaymentMethodOptionsAcssDebit {
6 pub mandate_options:
7 Option<stripe_shared::PaymentIntentPaymentMethodOptionsMandateOptionsAcssDebit>,
8 pub setup_future_usage: Option<PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage>,
17 pub target_date: Option<String>,
21 pub verification_method: Option<PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod>,
23}
24#[cfg(feature = "redact-generated-debug")]
25impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsAcssDebit {
26 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
27 f.debug_struct("PaymentIntentPaymentMethodOptionsAcssDebit").finish_non_exhaustive()
28 }
29}
30#[doc(hidden)]
31pub struct PaymentIntentPaymentMethodOptionsAcssDebitBuilder {
32 mandate_options:
33 Option<Option<stripe_shared::PaymentIntentPaymentMethodOptionsMandateOptionsAcssDebit>>,
34 setup_future_usage: Option<Option<PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage>>,
35 target_date: Option<Option<String>>,
36 verification_method:
37 Option<Option<PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod>>,
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 PaymentIntentPaymentMethodOptionsAcssDebit {
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<PaymentIntentPaymentMethodOptionsAcssDebit>,
64 builder: PaymentIntentPaymentMethodOptionsAcssDebitBuilder,
65 }
66
67 impl Visitor for Place<PaymentIntentPaymentMethodOptionsAcssDebit> {
68 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
69 Ok(Box::new(Builder {
70 out: &mut self.out,
71 builder: PaymentIntentPaymentMethodOptionsAcssDebitBuilder::deser_default(),
72 }))
73 }
74 }
75
76 impl MapBuilder for PaymentIntentPaymentMethodOptionsAcssDebitBuilder {
77 type Out = PaymentIntentPaymentMethodOptionsAcssDebit;
78 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
79 Ok(match k {
80 "mandate_options" => Deserialize::begin(&mut self.mandate_options),
81 "setup_future_usage" => Deserialize::begin(&mut self.setup_future_usage),
82 "target_date" => Deserialize::begin(&mut self.target_date),
83 "verification_method" => Deserialize::begin(&mut self.verification_method),
84 _ => <dyn Visitor>::ignore(),
85 })
86 }
87
88 fn deser_default() -> Self {
89 Self {
90 mandate_options: Deserialize::default(),
91 setup_future_usage: Deserialize::default(),
92 target_date: Deserialize::default(),
93 verification_method: Deserialize::default(),
94 }
95 }
96
97 fn take_out(&mut self) -> Option<Self::Out> {
98 let (
99 Some(mandate_options),
100 Some(setup_future_usage),
101 Some(target_date),
102 Some(verification_method),
103 ) = (
104 self.mandate_options.take(),
105 self.setup_future_usage.take(),
106 self.target_date.take(),
107 self.verification_method.take(),
108 )
109 else {
110 return None;
111 };
112 Some(Self::Out {
113 mandate_options,
114 setup_future_usage,
115 target_date,
116 verification_method,
117 })
118 }
119 }
120
121 impl Map for Builder<'_> {
122 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
123 self.builder.key(k)
124 }
125
126 fn finish(&mut self) -> Result<()> {
127 *self.out = self.builder.take_out();
128 Ok(())
129 }
130 }
131
132 impl ObjectDeser for PaymentIntentPaymentMethodOptionsAcssDebit {
133 type Builder = PaymentIntentPaymentMethodOptionsAcssDebitBuilder;
134 }
135
136 impl FromValueOpt for PaymentIntentPaymentMethodOptionsAcssDebit {
137 fn from_value(v: Value) -> Option<Self> {
138 let Value::Object(obj) = v else {
139 return None;
140 };
141 let mut b = PaymentIntentPaymentMethodOptionsAcssDebitBuilder::deser_default();
142 for (k, v) in obj {
143 match k.as_str() {
144 "mandate_options" => b.mandate_options = FromValueOpt::from_value(v),
145 "setup_future_usage" => b.setup_future_usage = FromValueOpt::from_value(v),
146 "target_date" => b.target_date = FromValueOpt::from_value(v),
147 "verification_method" => b.verification_method = FromValueOpt::from_value(v),
148 _ => {}
149 }
150 }
151 b.take_out()
152 }
153 }
154};
155#[derive(Clone, Eq, PartialEq)]
164#[non_exhaustive]
165pub enum PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
166 None,
167 OffSession,
168 OnSession,
169 Unknown(String),
171}
172impl PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
173 pub fn as_str(&self) -> &str {
174 use PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*;
175 match self {
176 None => "none",
177 OffSession => "off_session",
178 OnSession => "on_session",
179 Unknown(v) => v,
180 }
181 }
182}
183
184impl std::str::FromStr for PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
185 type Err = std::convert::Infallible;
186 fn from_str(s: &str) -> Result<Self, Self::Err> {
187 use PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*;
188 match s {
189 "none" => Ok(None),
190 "off_session" => Ok(OffSession),
191 "on_session" => Ok(OnSession),
192 v => {
193 tracing::warn!(
194 "Unknown value '{}' for enum '{}'",
195 v,
196 "PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage"
197 );
198 Ok(Unknown(v.to_owned()))
199 }
200 }
201 }
202}
203impl std::fmt::Display for PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
204 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
205 f.write_str(self.as_str())
206 }
207}
208
209#[cfg(not(feature = "redact-generated-debug"))]
210impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
211 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
212 f.write_str(self.as_str())
213 }
214}
215#[cfg(feature = "redact-generated-debug")]
216impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
217 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
218 f.debug_struct(stringify!(PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage))
219 .finish_non_exhaustive()
220 }
221}
222#[cfg(feature = "serialize")]
223impl serde::Serialize for PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
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 for PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
232 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
233 crate::Place::new(out)
234 }
235}
236
237impl miniserde::de::Visitor
238 for crate::Place<PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage>
239{
240 fn string(&mut self, s: &str) -> miniserde::Result<()> {
241 use std::str::FromStr;
242 self.out = Some(
243 PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::from_str(s)
244 .expect("infallible"),
245 );
246 Ok(())
247 }
248}
249
250stripe_types::impl_from_val_with_from_str!(
251 PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage
252);
253#[cfg(feature = "deserialize")]
254impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
255 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
256 use std::str::FromStr;
257 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
258 Ok(Self::from_str(&s).expect("infallible"))
259 }
260}
261#[derive(Clone, Eq, PartialEq)]
263#[non_exhaustive]
264pub enum PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
265 Automatic,
266 Instant,
267 Microdeposits,
268 Unknown(String),
270}
271impl PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
272 pub fn as_str(&self) -> &str {
273 use PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*;
274 match self {
275 Automatic => "automatic",
276 Instant => "instant",
277 Microdeposits => "microdeposits",
278 Unknown(v) => v,
279 }
280 }
281}
282
283impl std::str::FromStr for PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
284 type Err = std::convert::Infallible;
285 fn from_str(s: &str) -> Result<Self, Self::Err> {
286 use PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*;
287 match s {
288 "automatic" => Ok(Automatic),
289 "instant" => Ok(Instant),
290 "microdeposits" => Ok(Microdeposits),
291 v => {
292 tracing::warn!(
293 "Unknown value '{}' for enum '{}'",
294 v,
295 "PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod"
296 );
297 Ok(Unknown(v.to_owned()))
298 }
299 }
300 }
301}
302impl std::fmt::Display for PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
303 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
304 f.write_str(self.as_str())
305 }
306}
307
308#[cfg(not(feature = "redact-generated-debug"))]
309impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
310 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
311 f.write_str(self.as_str())
312 }
313}
314#[cfg(feature = "redact-generated-debug")]
315impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
316 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
317 f.debug_struct(stringify!(PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod))
318 .finish_non_exhaustive()
319 }
320}
321#[cfg(feature = "serialize")]
322impl serde::Serialize for PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
323 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
324 where
325 S: serde::Serializer,
326 {
327 serializer.serialize_str(self.as_str())
328 }
329}
330impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
331 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
332 crate::Place::new(out)
333 }
334}
335
336impl miniserde::de::Visitor
337 for crate::Place<PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod>
338{
339 fn string(&mut self, s: &str) -> miniserde::Result<()> {
340 use std::str::FromStr;
341 self.out = Some(
342 PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::from_str(s)
343 .expect("infallible"),
344 );
345 Ok(())
346 }
347}
348
349stripe_types::impl_from_val_with_from_str!(
350 PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod
351);
352#[cfg(feature = "deserialize")]
353impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
354 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
355 use std::str::FromStr;
356 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
357 Ok(Self::from_str(&s).expect("infallible"))
358 }
359}