1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct IssuingPersonalizationDesignRejectionReasons {
5 pub card_logo: Option<Vec<IssuingPersonalizationDesignRejectionReasonsCardLogo>>,
7 pub carrier_text: Option<Vec<IssuingPersonalizationDesignRejectionReasonsCarrierText>>,
9}
10#[doc(hidden)]
11pub struct IssuingPersonalizationDesignRejectionReasonsBuilder {
12 card_logo: Option<Option<Vec<IssuingPersonalizationDesignRejectionReasonsCardLogo>>>,
13 carrier_text: Option<Option<Vec<IssuingPersonalizationDesignRejectionReasonsCarrierText>>>,
14}
15
16#[allow(
17 unused_variables,
18 irrefutable_let_patterns,
19 clippy::let_unit_value,
20 clippy::match_single_binding,
21 clippy::single_match
22)]
23const _: () = {
24 use miniserde::de::{Map, Visitor};
25 use miniserde::json::Value;
26 use miniserde::{Deserialize, Result, make_place};
27 use stripe_types::miniserde_helpers::FromValueOpt;
28 use stripe_types::{MapBuilder, ObjectDeser};
29
30 make_place!(Place);
31
32 impl Deserialize for IssuingPersonalizationDesignRejectionReasons {
33 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
34 Place::new(out)
35 }
36 }
37
38 struct Builder<'a> {
39 out: &'a mut Option<IssuingPersonalizationDesignRejectionReasons>,
40 builder: IssuingPersonalizationDesignRejectionReasonsBuilder,
41 }
42
43 impl Visitor for Place<IssuingPersonalizationDesignRejectionReasons> {
44 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
45 Ok(Box::new(Builder {
46 out: &mut self.out,
47 builder: IssuingPersonalizationDesignRejectionReasonsBuilder::deser_default(),
48 }))
49 }
50 }
51
52 impl MapBuilder for IssuingPersonalizationDesignRejectionReasonsBuilder {
53 type Out = IssuingPersonalizationDesignRejectionReasons;
54 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
55 Ok(match k {
56 "card_logo" => Deserialize::begin(&mut self.card_logo),
57 "carrier_text" => Deserialize::begin(&mut self.carrier_text),
58
59 _ => <dyn Visitor>::ignore(),
60 })
61 }
62
63 fn deser_default() -> Self {
64 Self { card_logo: Deserialize::default(), carrier_text: Deserialize::default() }
65 }
66
67 fn take_out(&mut self) -> Option<Self::Out> {
68 let (Some(card_logo), Some(carrier_text)) =
69 (self.card_logo.take(), self.carrier_text.take())
70 else {
71 return None;
72 };
73 Some(Self::Out { card_logo, carrier_text })
74 }
75 }
76
77 impl Map for Builder<'_> {
78 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
79 self.builder.key(k)
80 }
81
82 fn finish(&mut self) -> Result<()> {
83 *self.out = self.builder.take_out();
84 Ok(())
85 }
86 }
87
88 impl ObjectDeser for IssuingPersonalizationDesignRejectionReasons {
89 type Builder = IssuingPersonalizationDesignRejectionReasonsBuilder;
90 }
91
92 impl FromValueOpt for IssuingPersonalizationDesignRejectionReasons {
93 fn from_value(v: Value) -> Option<Self> {
94 let Value::Object(obj) = v else {
95 return None;
96 };
97 let mut b = IssuingPersonalizationDesignRejectionReasonsBuilder::deser_default();
98 for (k, v) in obj {
99 match k.as_str() {
100 "card_logo" => b.card_logo = FromValueOpt::from_value(v),
101 "carrier_text" => b.carrier_text = FromValueOpt::from_value(v),
102
103 _ => {}
104 }
105 }
106 b.take_out()
107 }
108 }
109};
110#[derive(Copy, Clone, Eq, PartialEq)]
112pub enum IssuingPersonalizationDesignRejectionReasonsCardLogo {
113 GeographicLocation,
114 Inappropriate,
115 NetworkName,
116 NonBinaryImage,
117 NonFiatCurrency,
118 Other,
119 OtherEntity,
120 PromotionalMaterial,
121}
122impl IssuingPersonalizationDesignRejectionReasonsCardLogo {
123 pub fn as_str(self) -> &'static str {
124 use IssuingPersonalizationDesignRejectionReasonsCardLogo::*;
125 match self {
126 GeographicLocation => "geographic_location",
127 Inappropriate => "inappropriate",
128 NetworkName => "network_name",
129 NonBinaryImage => "non_binary_image",
130 NonFiatCurrency => "non_fiat_currency",
131 Other => "other",
132 OtherEntity => "other_entity",
133 PromotionalMaterial => "promotional_material",
134 }
135 }
136}
137
138impl std::str::FromStr for IssuingPersonalizationDesignRejectionReasonsCardLogo {
139 type Err = stripe_types::StripeParseError;
140 fn from_str(s: &str) -> Result<Self, Self::Err> {
141 use IssuingPersonalizationDesignRejectionReasonsCardLogo::*;
142 match s {
143 "geographic_location" => Ok(GeographicLocation),
144 "inappropriate" => Ok(Inappropriate),
145 "network_name" => Ok(NetworkName),
146 "non_binary_image" => Ok(NonBinaryImage),
147 "non_fiat_currency" => Ok(NonFiatCurrency),
148 "other" => Ok(Other),
149 "other_entity" => Ok(OtherEntity),
150 "promotional_material" => Ok(PromotionalMaterial),
151 _ => Err(stripe_types::StripeParseError),
152 }
153 }
154}
155impl std::fmt::Display for IssuingPersonalizationDesignRejectionReasonsCardLogo {
156 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
157 f.write_str(self.as_str())
158 }
159}
160
161impl std::fmt::Debug for IssuingPersonalizationDesignRejectionReasonsCardLogo {
162 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
163 f.write_str(self.as_str())
164 }
165}
166#[cfg(feature = "serialize")]
167impl serde::Serialize for IssuingPersonalizationDesignRejectionReasonsCardLogo {
168 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
169 where
170 S: serde::Serializer,
171 {
172 serializer.serialize_str(self.as_str())
173 }
174}
175impl miniserde::Deserialize for IssuingPersonalizationDesignRejectionReasonsCardLogo {
176 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
177 crate::Place::new(out)
178 }
179}
180
181impl miniserde::de::Visitor for crate::Place<IssuingPersonalizationDesignRejectionReasonsCardLogo> {
182 fn string(&mut self, s: &str) -> miniserde::Result<()> {
183 use std::str::FromStr;
184 self.out = Some(
185 IssuingPersonalizationDesignRejectionReasonsCardLogo::from_str(s)
186 .map_err(|_| miniserde::Error)?,
187 );
188 Ok(())
189 }
190}
191
192stripe_types::impl_from_val_with_from_str!(IssuingPersonalizationDesignRejectionReasonsCardLogo);
193#[cfg(feature = "deserialize")]
194impl<'de> serde::Deserialize<'de> for IssuingPersonalizationDesignRejectionReasonsCardLogo {
195 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
196 use std::str::FromStr;
197 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
198 Self::from_str(&s).map_err(|_| {
199 serde::de::Error::custom(
200 "Unknown value for IssuingPersonalizationDesignRejectionReasonsCardLogo",
201 )
202 })
203 }
204}
205#[derive(Copy, Clone, Eq, PartialEq)]
207pub enum IssuingPersonalizationDesignRejectionReasonsCarrierText {
208 GeographicLocation,
209 Inappropriate,
210 NetworkName,
211 NonFiatCurrency,
212 Other,
213 OtherEntity,
214 PromotionalMaterial,
215}
216impl IssuingPersonalizationDesignRejectionReasonsCarrierText {
217 pub fn as_str(self) -> &'static str {
218 use IssuingPersonalizationDesignRejectionReasonsCarrierText::*;
219 match self {
220 GeographicLocation => "geographic_location",
221 Inappropriate => "inappropriate",
222 NetworkName => "network_name",
223 NonFiatCurrency => "non_fiat_currency",
224 Other => "other",
225 OtherEntity => "other_entity",
226 PromotionalMaterial => "promotional_material",
227 }
228 }
229}
230
231impl std::str::FromStr for IssuingPersonalizationDesignRejectionReasonsCarrierText {
232 type Err = stripe_types::StripeParseError;
233 fn from_str(s: &str) -> Result<Self, Self::Err> {
234 use IssuingPersonalizationDesignRejectionReasonsCarrierText::*;
235 match s {
236 "geographic_location" => Ok(GeographicLocation),
237 "inappropriate" => Ok(Inappropriate),
238 "network_name" => Ok(NetworkName),
239 "non_fiat_currency" => Ok(NonFiatCurrency),
240 "other" => Ok(Other),
241 "other_entity" => Ok(OtherEntity),
242 "promotional_material" => Ok(PromotionalMaterial),
243 _ => Err(stripe_types::StripeParseError),
244 }
245 }
246}
247impl std::fmt::Display for IssuingPersonalizationDesignRejectionReasonsCarrierText {
248 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
249 f.write_str(self.as_str())
250 }
251}
252
253impl std::fmt::Debug for IssuingPersonalizationDesignRejectionReasonsCarrierText {
254 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
255 f.write_str(self.as_str())
256 }
257}
258#[cfg(feature = "serialize")]
259impl serde::Serialize for IssuingPersonalizationDesignRejectionReasonsCarrierText {
260 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
261 where
262 S: serde::Serializer,
263 {
264 serializer.serialize_str(self.as_str())
265 }
266}
267impl miniserde::Deserialize for IssuingPersonalizationDesignRejectionReasonsCarrierText {
268 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
269 crate::Place::new(out)
270 }
271}
272
273impl miniserde::de::Visitor
274 for crate::Place<IssuingPersonalizationDesignRejectionReasonsCarrierText>
275{
276 fn string(&mut self, s: &str) -> miniserde::Result<()> {
277 use std::str::FromStr;
278 self.out = Some(
279 IssuingPersonalizationDesignRejectionReasonsCarrierText::from_str(s)
280 .map_err(|_| miniserde::Error)?,
281 );
282 Ok(())
283 }
284}
285
286stripe_types::impl_from_val_with_from_str!(IssuingPersonalizationDesignRejectionReasonsCarrierText);
287#[cfg(feature = "deserialize")]
288impl<'de> serde::Deserialize<'de> for IssuingPersonalizationDesignRejectionReasonsCarrierText {
289 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
290 use std::str::FromStr;
291 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
292 Self::from_str(&s).map_err(|_| {
293 serde::de::Error::custom(
294 "Unknown value for IssuingPersonalizationDesignRejectionReasonsCarrierText",
295 )
296 })
297 }
298}