1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct DisputeVisaCompellingEvidence3DisputedTransaction {
5 pub customer_account_id: Option<String>,
7 pub customer_device_fingerprint: Option<String>,
10 pub customer_device_id: Option<String>,
13 pub customer_email_address: Option<String>,
15 pub customer_purchase_ip: Option<String>,
17 pub merchandise_or_services:
19 Option<DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices>,
20 pub product_description: Option<String>,
22 pub shipping_address: Option<stripe_shared::DisputeTransactionShippingAddress>,
25}
26#[doc(hidden)]
27pub struct DisputeVisaCompellingEvidence3DisputedTransactionBuilder {
28 customer_account_id: Option<Option<String>>,
29 customer_device_fingerprint: Option<Option<String>>,
30 customer_device_id: Option<Option<String>>,
31 customer_email_address: Option<Option<String>>,
32 customer_purchase_ip: Option<Option<String>>,
33 merchandise_or_services:
34 Option<Option<DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices>>,
35 product_description: Option<Option<String>>,
36 shipping_address: Option<Option<stripe_shared::DisputeTransactionShippingAddress>>,
37}
38
39#[allow(
40 unused_variables,
41 irrefutable_let_patterns,
42 clippy::let_unit_value,
43 clippy::match_single_binding,
44 clippy::single_match
45)]
46const _: () = {
47 use miniserde::de::{Map, Visitor};
48 use miniserde::json::Value;
49 use miniserde::{Deserialize, Result, make_place};
50 use stripe_types::miniserde_helpers::FromValueOpt;
51 use stripe_types::{MapBuilder, ObjectDeser};
52
53 make_place!(Place);
54
55 impl Deserialize for DisputeVisaCompellingEvidence3DisputedTransaction {
56 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
57 Place::new(out)
58 }
59 }
60
61 struct Builder<'a> {
62 out: &'a mut Option<DisputeVisaCompellingEvidence3DisputedTransaction>,
63 builder: DisputeVisaCompellingEvidence3DisputedTransactionBuilder,
64 }
65
66 impl Visitor for Place<DisputeVisaCompellingEvidence3DisputedTransaction> {
67 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
68 Ok(Box::new(Builder {
69 out: &mut self.out,
70 builder: DisputeVisaCompellingEvidence3DisputedTransactionBuilder::deser_default(),
71 }))
72 }
73 }
74
75 impl MapBuilder for DisputeVisaCompellingEvidence3DisputedTransactionBuilder {
76 type Out = DisputeVisaCompellingEvidence3DisputedTransaction;
77 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
78 Ok(match k {
79 "customer_account_id" => Deserialize::begin(&mut self.customer_account_id),
80 "customer_device_fingerprint" => {
81 Deserialize::begin(&mut self.customer_device_fingerprint)
82 }
83 "customer_device_id" => Deserialize::begin(&mut self.customer_device_id),
84 "customer_email_address" => Deserialize::begin(&mut self.customer_email_address),
85 "customer_purchase_ip" => Deserialize::begin(&mut self.customer_purchase_ip),
86 "merchandise_or_services" => Deserialize::begin(&mut self.merchandise_or_services),
87 "product_description" => Deserialize::begin(&mut self.product_description),
88 "shipping_address" => Deserialize::begin(&mut self.shipping_address),
89
90 _ => <dyn Visitor>::ignore(),
91 })
92 }
93
94 fn deser_default() -> Self {
95 Self {
96 customer_account_id: Deserialize::default(),
97 customer_device_fingerprint: Deserialize::default(),
98 customer_device_id: Deserialize::default(),
99 customer_email_address: Deserialize::default(),
100 customer_purchase_ip: Deserialize::default(),
101 merchandise_or_services: Deserialize::default(),
102 product_description: Deserialize::default(),
103 shipping_address: Deserialize::default(),
104 }
105 }
106
107 fn take_out(&mut self) -> Option<Self::Out> {
108 let (
109 Some(customer_account_id),
110 Some(customer_device_fingerprint),
111 Some(customer_device_id),
112 Some(customer_email_address),
113 Some(customer_purchase_ip),
114 Some(merchandise_or_services),
115 Some(product_description),
116 Some(shipping_address),
117 ) = (
118 self.customer_account_id.take(),
119 self.customer_device_fingerprint.take(),
120 self.customer_device_id.take(),
121 self.customer_email_address.take(),
122 self.customer_purchase_ip.take(),
123 self.merchandise_or_services,
124 self.product_description.take(),
125 self.shipping_address.take(),
126 )
127 else {
128 return None;
129 };
130 Some(Self::Out {
131 customer_account_id,
132 customer_device_fingerprint,
133 customer_device_id,
134 customer_email_address,
135 customer_purchase_ip,
136 merchandise_or_services,
137 product_description,
138 shipping_address,
139 })
140 }
141 }
142
143 impl Map for Builder<'_> {
144 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
145 self.builder.key(k)
146 }
147
148 fn finish(&mut self) -> Result<()> {
149 *self.out = self.builder.take_out();
150 Ok(())
151 }
152 }
153
154 impl ObjectDeser for DisputeVisaCompellingEvidence3DisputedTransaction {
155 type Builder = DisputeVisaCompellingEvidence3DisputedTransactionBuilder;
156 }
157
158 impl FromValueOpt for DisputeVisaCompellingEvidence3DisputedTransaction {
159 fn from_value(v: Value) -> Option<Self> {
160 let Value::Object(obj) = v else {
161 return None;
162 };
163 let mut b = DisputeVisaCompellingEvidence3DisputedTransactionBuilder::deser_default();
164 for (k, v) in obj {
165 match k.as_str() {
166 "customer_account_id" => b.customer_account_id = FromValueOpt::from_value(v),
167 "customer_device_fingerprint" => {
168 b.customer_device_fingerprint = FromValueOpt::from_value(v)
169 }
170 "customer_device_id" => b.customer_device_id = FromValueOpt::from_value(v),
171 "customer_email_address" => {
172 b.customer_email_address = FromValueOpt::from_value(v)
173 }
174 "customer_purchase_ip" => b.customer_purchase_ip = FromValueOpt::from_value(v),
175 "merchandise_or_services" => {
176 b.merchandise_or_services = FromValueOpt::from_value(v)
177 }
178 "product_description" => b.product_description = FromValueOpt::from_value(v),
179 "shipping_address" => b.shipping_address = FromValueOpt::from_value(v),
180
181 _ => {}
182 }
183 }
184 b.take_out()
185 }
186 }
187};
188#[derive(Copy, Clone, Eq, PartialEq)]
190pub enum DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
191 Merchandise,
192 Services,
193}
194impl DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
195 pub fn as_str(self) -> &'static str {
196 use DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::*;
197 match self {
198 Merchandise => "merchandise",
199 Services => "services",
200 }
201 }
202}
203
204impl std::str::FromStr for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
205 type Err = stripe_types::StripeParseError;
206 fn from_str(s: &str) -> Result<Self, Self::Err> {
207 use DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::*;
208 match s {
209 "merchandise" => Ok(Merchandise),
210 "services" => Ok(Services),
211 _ => Err(stripe_types::StripeParseError),
212 }
213 }
214}
215impl std::fmt::Display for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
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 DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
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 DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
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
236 for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices
237{
238 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
239 crate::Place::new(out)
240 }
241}
242
243impl miniserde::de::Visitor
244 for crate::Place<DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices>
245{
246 fn string(&mut self, s: &str) -> miniserde::Result<()> {
247 use std::str::FromStr;
248 self.out = Some(
249 DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::from_str(s)
250 .map_err(|_| miniserde::Error)?,
251 );
252 Ok(())
253 }
254}
255
256stripe_types::impl_from_val_with_from_str!(
257 DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices
258);
259#[cfg(feature = "deserialize")]
260impl<'de> serde::Deserialize<'de>
261 for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices
262{
263 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
264 use std::str::FromStr;
265 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
266 Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices"))
267 }
268}