stripe_shared/
dispute_enhanced_eligibility_visa_compelling_evidence3.rs1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct DisputeEnhancedEligibilityVisaCompellingEvidence3 {
5 pub required_actions: Vec<DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions>,
7 pub status: DisputeEnhancedEligibilityVisaCompellingEvidence3Status,
9}
10#[doc(hidden)]
11pub struct DisputeEnhancedEligibilityVisaCompellingEvidence3Builder {
12 required_actions: Option<Vec<DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions>>,
13 status: Option<DisputeEnhancedEligibilityVisaCompellingEvidence3Status>,
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 DisputeEnhancedEligibilityVisaCompellingEvidence3 {
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<DisputeEnhancedEligibilityVisaCompellingEvidence3>,
40 builder: DisputeEnhancedEligibilityVisaCompellingEvidence3Builder,
41 }
42
43 impl Visitor for Place<DisputeEnhancedEligibilityVisaCompellingEvidence3> {
44 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
45 Ok(Box::new(Builder {
46 out: &mut self.out,
47 builder: DisputeEnhancedEligibilityVisaCompellingEvidence3Builder::deser_default(),
48 }))
49 }
50 }
51
52 impl MapBuilder for DisputeEnhancedEligibilityVisaCompellingEvidence3Builder {
53 type Out = DisputeEnhancedEligibilityVisaCompellingEvidence3;
54 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
55 Ok(match k {
56 "required_actions" => Deserialize::begin(&mut self.required_actions),
57 "status" => Deserialize::begin(&mut self.status),
58 _ => <dyn Visitor>::ignore(),
59 })
60 }
61
62 fn deser_default() -> Self {
63 Self { required_actions: Deserialize::default(), status: Deserialize::default() }
64 }
65
66 fn take_out(&mut self) -> Option<Self::Out> {
67 let (Some(required_actions), Some(status)) =
68 (self.required_actions.take(), self.status.take())
69 else {
70 return None;
71 };
72 Some(Self::Out { required_actions, status })
73 }
74 }
75
76 impl Map for Builder<'_> {
77 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
78 self.builder.key(k)
79 }
80
81 fn finish(&mut self) -> Result<()> {
82 *self.out = self.builder.take_out();
83 Ok(())
84 }
85 }
86
87 impl ObjectDeser for DisputeEnhancedEligibilityVisaCompellingEvidence3 {
88 type Builder = DisputeEnhancedEligibilityVisaCompellingEvidence3Builder;
89 }
90
91 impl FromValueOpt for DisputeEnhancedEligibilityVisaCompellingEvidence3 {
92 fn from_value(v: Value) -> Option<Self> {
93 let Value::Object(obj) = v else {
94 return None;
95 };
96 let mut b = DisputeEnhancedEligibilityVisaCompellingEvidence3Builder::deser_default();
97 for (k, v) in obj {
98 match k.as_str() {
99 "required_actions" => b.required_actions = FromValueOpt::from_value(v),
100 "status" => b.status = FromValueOpt::from_value(v),
101 _ => {}
102 }
103 }
104 b.take_out()
105 }
106 }
107};
108#[derive(Clone, Eq, PartialEq)]
110#[non_exhaustive]
111pub enum DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions {
112 MissingCustomerIdentifiers,
113 MissingDisputedTransactionDescription,
114 MissingMerchandiseOrServices,
115 MissingPriorUndisputedTransactionDescription,
116 MissingPriorUndisputedTransactions,
117 Unknown(String),
119}
120impl DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions {
121 pub fn as_str(&self) -> &str {
122 use DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions::*;
123 match self {
124 MissingCustomerIdentifiers => "missing_customer_identifiers",
125 MissingDisputedTransactionDescription => "missing_disputed_transaction_description",
126 MissingMerchandiseOrServices => "missing_merchandise_or_services",
127 MissingPriorUndisputedTransactionDescription => {
128 "missing_prior_undisputed_transaction_description"
129 }
130 MissingPriorUndisputedTransactions => "missing_prior_undisputed_transactions",
131 Unknown(v) => v,
132 }
133 }
134}
135
136impl std::str::FromStr for DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions {
137 type Err = std::convert::Infallible;
138 fn from_str(s: &str) -> Result<Self, Self::Err> {
139 use DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions::*;
140 match s {
141 "missing_customer_identifiers" => Ok(MissingCustomerIdentifiers),
142 "missing_disputed_transaction_description" => Ok(MissingDisputedTransactionDescription),
143 "missing_merchandise_or_services" => Ok(MissingMerchandiseOrServices),
144 "missing_prior_undisputed_transaction_description" => {
145 Ok(MissingPriorUndisputedTransactionDescription)
146 }
147 "missing_prior_undisputed_transactions" => Ok(MissingPriorUndisputedTransactions),
148 v => {
149 tracing::warn!(
150 "Unknown value '{}' for enum '{}'",
151 v,
152 "DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions"
153 );
154 Ok(Unknown(v.to_owned()))
155 }
156 }
157 }
158}
159impl std::fmt::Display for DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions {
160 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
161 f.write_str(self.as_str())
162 }
163}
164
165impl std::fmt::Debug for DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions {
166 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
167 f.write_str(self.as_str())
168 }
169}
170#[cfg(feature = "serialize")]
171impl serde::Serialize for DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions {
172 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
173 where
174 S: serde::Serializer,
175 {
176 serializer.serialize_str(self.as_str())
177 }
178}
179impl miniserde::Deserialize for DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions {
180 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
181 crate::Place::new(out)
182 }
183}
184
185impl miniserde::de::Visitor
186 for crate::Place<DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions>
187{
188 fn string(&mut self, s: &str) -> miniserde::Result<()> {
189 use std::str::FromStr;
190 self.out = Some(
191 DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions::from_str(s)
192 .expect("infallible"),
193 );
194 Ok(())
195 }
196}
197
198stripe_types::impl_from_val_with_from_str!(
199 DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions
200);
201#[cfg(feature = "deserialize")]
202impl<'de> serde::Deserialize<'de>
203 for DisputeEnhancedEligibilityVisaCompellingEvidence3RequiredActions
204{
205 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
206 use std::str::FromStr;
207 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
208 Ok(Self::from_str(&s).expect("infallible"))
209 }
210}
211#[derive(Clone, Eq, PartialEq)]
213#[non_exhaustive]
214pub enum DisputeEnhancedEligibilityVisaCompellingEvidence3Status {
215 NotQualified,
216 Qualified,
217 RequiresAction,
218 Unknown(String),
220}
221impl DisputeEnhancedEligibilityVisaCompellingEvidence3Status {
222 pub fn as_str(&self) -> &str {
223 use DisputeEnhancedEligibilityVisaCompellingEvidence3Status::*;
224 match self {
225 NotQualified => "not_qualified",
226 Qualified => "qualified",
227 RequiresAction => "requires_action",
228 Unknown(v) => v,
229 }
230 }
231}
232
233impl std::str::FromStr for DisputeEnhancedEligibilityVisaCompellingEvidence3Status {
234 type Err = std::convert::Infallible;
235 fn from_str(s: &str) -> Result<Self, Self::Err> {
236 use DisputeEnhancedEligibilityVisaCompellingEvidence3Status::*;
237 match s {
238 "not_qualified" => Ok(NotQualified),
239 "qualified" => Ok(Qualified),
240 "requires_action" => Ok(RequiresAction),
241 v => {
242 tracing::warn!(
243 "Unknown value '{}' for enum '{}'",
244 v,
245 "DisputeEnhancedEligibilityVisaCompellingEvidence3Status"
246 );
247 Ok(Unknown(v.to_owned()))
248 }
249 }
250 }
251}
252impl std::fmt::Display for DisputeEnhancedEligibilityVisaCompellingEvidence3Status {
253 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
254 f.write_str(self.as_str())
255 }
256}
257
258impl std::fmt::Debug for DisputeEnhancedEligibilityVisaCompellingEvidence3Status {
259 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
260 f.write_str(self.as_str())
261 }
262}
263#[cfg(feature = "serialize")]
264impl serde::Serialize for DisputeEnhancedEligibilityVisaCompellingEvidence3Status {
265 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
266 where
267 S: serde::Serializer,
268 {
269 serializer.serialize_str(self.as_str())
270 }
271}
272impl miniserde::Deserialize for DisputeEnhancedEligibilityVisaCompellingEvidence3Status {
273 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
274 crate::Place::new(out)
275 }
276}
277
278impl miniserde::de::Visitor
279 for crate::Place<DisputeEnhancedEligibilityVisaCompellingEvidence3Status>
280{
281 fn string(&mut self, s: &str) -> miniserde::Result<()> {
282 use std::str::FromStr;
283 self.out = Some(
284 DisputeEnhancedEligibilityVisaCompellingEvidence3Status::from_str(s)
285 .expect("infallible"),
286 );
287 Ok(())
288 }
289}
290
291stripe_types::impl_from_val_with_from_str!(DisputeEnhancedEligibilityVisaCompellingEvidence3Status);
292#[cfg(feature = "deserialize")]
293impl<'de> serde::Deserialize<'de> for DisputeEnhancedEligibilityVisaCompellingEvidence3Status {
294 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
295 use std::str::FromStr;
296 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
297 Ok(Self::from_str(&s).expect("infallible"))
298 }
299}