stripe_shared/
payment_method_details_eps.rs

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