1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct PaymentMethodEps {
5 pub bank: Option<PaymentMethodEpsBank>,
8}
9#[doc(hidden)]
10pub struct PaymentMethodEpsBuilder {
11 bank: Option<Option<PaymentMethodEpsBank>>,
12}
13
14#[allow(
15 unused_variables,
16 irrefutable_let_patterns,
17 clippy::let_unit_value,
18 clippy::match_single_binding,
19 clippy::single_match
20)]
21const _: () = {
22 use miniserde::de::{Map, Visitor};
23 use miniserde::json::Value;
24 use miniserde::{Deserialize, Result, make_place};
25 use stripe_types::miniserde_helpers::FromValueOpt;
26 use stripe_types::{MapBuilder, ObjectDeser};
27
28 make_place!(Place);
29
30 impl Deserialize for PaymentMethodEps {
31 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
32 Place::new(out)
33 }
34 }
35
36 struct Builder<'a> {
37 out: &'a mut Option<PaymentMethodEps>,
38 builder: PaymentMethodEpsBuilder,
39 }
40
41 impl Visitor for Place<PaymentMethodEps> {
42 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
43 Ok(Box::new(Builder {
44 out: &mut self.out,
45 builder: PaymentMethodEpsBuilder::deser_default(),
46 }))
47 }
48 }
49
50 impl MapBuilder for PaymentMethodEpsBuilder {
51 type Out = PaymentMethodEps;
52 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
53 Ok(match k {
54 "bank" => Deserialize::begin(&mut self.bank),
55 _ => <dyn Visitor>::ignore(),
56 })
57 }
58
59 fn deser_default() -> Self {
60 Self { bank: Deserialize::default() }
61 }
62
63 fn take_out(&mut self) -> Option<Self::Out> {
64 let (Some(bank),) = (self.bank.take(),) else {
65 return None;
66 };
67 Some(Self::Out { bank })
68 }
69 }
70
71 impl Map for Builder<'_> {
72 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
73 self.builder.key(k)
74 }
75
76 fn finish(&mut self) -> Result<()> {
77 *self.out = self.builder.take_out();
78 Ok(())
79 }
80 }
81
82 impl ObjectDeser for PaymentMethodEps {
83 type Builder = PaymentMethodEpsBuilder;
84 }
85
86 impl FromValueOpt for PaymentMethodEps {
87 fn from_value(v: Value) -> Option<Self> {
88 let Value::Object(obj) = v else {
89 return None;
90 };
91 let mut b = PaymentMethodEpsBuilder::deser_default();
92 for (k, v) in obj {
93 match k.as_str() {
94 "bank" => b.bank = FromValueOpt::from_value(v),
95 _ => {}
96 }
97 }
98 b.take_out()
99 }
100 }
101};
102#[derive(Clone, Eq, PartialEq)]
105#[non_exhaustive]
106pub enum PaymentMethodEpsBank {
107 ArzteUndApothekerBank,
108 AustrianAnadiBankAg,
109 BankAustria,
110 BankhausCarlSpangler,
111 BankhausSchelhammerUndSchatteraAg,
112 BawagPskAg,
113 BksBankAg,
114 BrullKallmusBankAg,
115 BtvVierLanderBank,
116 CapitalBankGraweGruppeAg,
117 DeutscheBankAg,
118 Dolomitenbank,
119 EasybankAg,
120 ErsteBankUndSparkassen,
121 HypoAlpeadriabankInternationalAg,
122 HypoBankBurgenlandAktiengesellschaft,
123 HypoNoeLbFurNiederosterreichUWien,
124 HypoOberosterreichSalzburgSteiermark,
125 HypoTirolBankAg,
126 HypoVorarlbergBankAg,
127 MarchfelderBank,
128 OberbankAg,
129 RaiffeisenBankengruppeOsterreich,
130 SchoellerbankAg,
131 SpardaBankWien,
132 VolksbankGruppe,
133 VolkskreditbankAg,
134 VrBankBraunau,
135 Unknown(String),
137}
138impl PaymentMethodEpsBank {
139 pub fn as_str(&self) -> &str {
140 use PaymentMethodEpsBank::*;
141 match self {
142 ArzteUndApothekerBank => "arzte_und_apotheker_bank",
143 AustrianAnadiBankAg => "austrian_anadi_bank_ag",
144 BankAustria => "bank_austria",
145 BankhausCarlSpangler => "bankhaus_carl_spangler",
146 BankhausSchelhammerUndSchatteraAg => "bankhaus_schelhammer_und_schattera_ag",
147 BawagPskAg => "bawag_psk_ag",
148 BksBankAg => "bks_bank_ag",
149 BrullKallmusBankAg => "brull_kallmus_bank_ag",
150 BtvVierLanderBank => "btv_vier_lander_bank",
151 CapitalBankGraweGruppeAg => "capital_bank_grawe_gruppe_ag",
152 DeutscheBankAg => "deutsche_bank_ag",
153 Dolomitenbank => "dolomitenbank",
154 EasybankAg => "easybank_ag",
155 ErsteBankUndSparkassen => "erste_bank_und_sparkassen",
156 HypoAlpeadriabankInternationalAg => "hypo_alpeadriabank_international_ag",
157 HypoBankBurgenlandAktiengesellschaft => "hypo_bank_burgenland_aktiengesellschaft",
158 HypoNoeLbFurNiederosterreichUWien => "hypo_noe_lb_fur_niederosterreich_u_wien",
159 HypoOberosterreichSalzburgSteiermark => "hypo_oberosterreich_salzburg_steiermark",
160 HypoTirolBankAg => "hypo_tirol_bank_ag",
161 HypoVorarlbergBankAg => "hypo_vorarlberg_bank_ag",
162 MarchfelderBank => "marchfelder_bank",
163 OberbankAg => "oberbank_ag",
164 RaiffeisenBankengruppeOsterreich => "raiffeisen_bankengruppe_osterreich",
165 SchoellerbankAg => "schoellerbank_ag",
166 SpardaBankWien => "sparda_bank_wien",
167 VolksbankGruppe => "volksbank_gruppe",
168 VolkskreditbankAg => "volkskreditbank_ag",
169 VrBankBraunau => "vr_bank_braunau",
170 Unknown(v) => v,
171 }
172 }
173}
174
175impl std::str::FromStr for PaymentMethodEpsBank {
176 type Err = std::convert::Infallible;
177 fn from_str(s: &str) -> Result<Self, Self::Err> {
178 use PaymentMethodEpsBank::*;
179 match s {
180 "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank),
181 "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg),
182 "bank_austria" => Ok(BankAustria),
183 "bankhaus_carl_spangler" => Ok(BankhausCarlSpangler),
184 "bankhaus_schelhammer_und_schattera_ag" => Ok(BankhausSchelhammerUndSchatteraAg),
185 "bawag_psk_ag" => Ok(BawagPskAg),
186 "bks_bank_ag" => Ok(BksBankAg),
187 "brull_kallmus_bank_ag" => Ok(BrullKallmusBankAg),
188 "btv_vier_lander_bank" => Ok(BtvVierLanderBank),
189 "capital_bank_grawe_gruppe_ag" => Ok(CapitalBankGraweGruppeAg),
190 "deutsche_bank_ag" => Ok(DeutscheBankAg),
191 "dolomitenbank" => Ok(Dolomitenbank),
192 "easybank_ag" => Ok(EasybankAg),
193 "erste_bank_und_sparkassen" => Ok(ErsteBankUndSparkassen),
194 "hypo_alpeadriabank_international_ag" => Ok(HypoAlpeadriabankInternationalAg),
195 "hypo_bank_burgenland_aktiengesellschaft" => Ok(HypoBankBurgenlandAktiengesellschaft),
196 "hypo_noe_lb_fur_niederosterreich_u_wien" => Ok(HypoNoeLbFurNiederosterreichUWien),
197 "hypo_oberosterreich_salzburg_steiermark" => Ok(HypoOberosterreichSalzburgSteiermark),
198 "hypo_tirol_bank_ag" => Ok(HypoTirolBankAg),
199 "hypo_vorarlberg_bank_ag" => Ok(HypoVorarlbergBankAg),
200 "marchfelder_bank" => Ok(MarchfelderBank),
201 "oberbank_ag" => Ok(OberbankAg),
202 "raiffeisen_bankengruppe_osterreich" => Ok(RaiffeisenBankengruppeOsterreich),
203 "schoellerbank_ag" => Ok(SchoellerbankAg),
204 "sparda_bank_wien" => Ok(SpardaBankWien),
205 "volksbank_gruppe" => Ok(VolksbankGruppe),
206 "volkskreditbank_ag" => Ok(VolkskreditbankAg),
207 "vr_bank_braunau" => Ok(VrBankBraunau),
208 v => {
209 tracing::warn!("Unknown value '{}' for enum '{}'", v, "PaymentMethodEpsBank");
210 Ok(Unknown(v.to_owned()))
211 }
212 }
213 }
214}
215impl std::fmt::Display for PaymentMethodEpsBank {
216 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
217 f.write_str(self.as_str())
218 }
219}
220
221impl std::fmt::Debug for PaymentMethodEpsBank {
222 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
223 f.write_str(self.as_str())
224 }
225}
226#[cfg(feature = "serialize")]
227impl serde::Serialize for PaymentMethodEpsBank {
228 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
229 where
230 S: serde::Serializer,
231 {
232 serializer.serialize_str(self.as_str())
233 }
234}
235impl miniserde::Deserialize for PaymentMethodEpsBank {
236 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
237 crate::Place::new(out)
238 }
239}
240
241impl miniserde::de::Visitor for crate::Place<PaymentMethodEpsBank> {
242 fn string(&mut self, s: &str) -> miniserde::Result<()> {
243 use std::str::FromStr;
244 self.out = Some(PaymentMethodEpsBank::from_str(s).expect("infallible"));
245 Ok(())
246 }
247}
248
249stripe_types::impl_from_val_with_from_str!(PaymentMethodEpsBank);
250#[cfg(feature = "deserialize")]
251impl<'de> serde::Deserialize<'de> for PaymentMethodEpsBank {
252 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
253 use std::str::FromStr;
254 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
255 Ok(Self::from_str(&s).expect("infallible"))
256 }
257}