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 _ => <dyn Visitor>::ignore(),
90 })
91 }
92
93 fn deser_default() -> Self {
94 Self {
95 customer_account_id: Deserialize::default(),
96 customer_device_fingerprint: Deserialize::default(),
97 customer_device_id: Deserialize::default(),
98 customer_email_address: Deserialize::default(),
99 customer_purchase_ip: Deserialize::default(),
100 merchandise_or_services: Deserialize::default(),
101 product_description: Deserialize::default(),
102 shipping_address: Deserialize::default(),
103 }
104 }
105
106 fn take_out(&mut self) -> Option<Self::Out> {
107 let (
108 Some(customer_account_id),
109 Some(customer_device_fingerprint),
110 Some(customer_device_id),
111 Some(customer_email_address),
112 Some(customer_purchase_ip),
113 Some(merchandise_or_services),
114 Some(product_description),
115 Some(shipping_address),
116 ) = (
117 self.customer_account_id.take(),
118 self.customer_device_fingerprint.take(),
119 self.customer_device_id.take(),
120 self.customer_email_address.take(),
121 self.customer_purchase_ip.take(),
122 self.merchandise_or_services,
123 self.product_description.take(),
124 self.shipping_address.take(),
125 )
126 else {
127 return None;
128 };
129 Some(Self::Out {
130 customer_account_id,
131 customer_device_fingerprint,
132 customer_device_id,
133 customer_email_address,
134 customer_purchase_ip,
135 merchandise_or_services,
136 product_description,
137 shipping_address,
138 })
139 }
140 }
141
142 impl Map for Builder<'_> {
143 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
144 self.builder.key(k)
145 }
146
147 fn finish(&mut self) -> Result<()> {
148 *self.out = self.builder.take_out();
149 Ok(())
150 }
151 }
152
153 impl ObjectDeser for DisputeVisaCompellingEvidence3DisputedTransaction {
154 type Builder = DisputeVisaCompellingEvidence3DisputedTransactionBuilder;
155 }
156
157 impl FromValueOpt for DisputeVisaCompellingEvidence3DisputedTransaction {
158 fn from_value(v: Value) -> Option<Self> {
159 let Value::Object(obj) = v else {
160 return None;
161 };
162 let mut b = DisputeVisaCompellingEvidence3DisputedTransactionBuilder::deser_default();
163 for (k, v) in obj {
164 match k.as_str() {
165 "customer_account_id" => b.customer_account_id = FromValueOpt::from_value(v),
166 "customer_device_fingerprint" => {
167 b.customer_device_fingerprint = FromValueOpt::from_value(v)
168 }
169 "customer_device_id" => b.customer_device_id = FromValueOpt::from_value(v),
170 "customer_email_address" => {
171 b.customer_email_address = FromValueOpt::from_value(v)
172 }
173 "customer_purchase_ip" => b.customer_purchase_ip = FromValueOpt::from_value(v),
174 "merchandise_or_services" => {
175 b.merchandise_or_services = FromValueOpt::from_value(v)
176 }
177 "product_description" => b.product_description = FromValueOpt::from_value(v),
178 "shipping_address" => b.shipping_address = FromValueOpt::from_value(v),
179 _ => {}
180 }
181 }
182 b.take_out()
183 }
184 }
185};
186#[derive(Copy, Clone, Eq, PartialEq)]
188pub enum DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
189 Merchandise,
190 Services,
191}
192impl DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
193 pub fn as_str(self) -> &'static str {
194 use DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::*;
195 match self {
196 Merchandise => "merchandise",
197 Services => "services",
198 }
199 }
200}
201
202impl std::str::FromStr for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
203 type Err = stripe_types::StripeParseError;
204 fn from_str(s: &str) -> Result<Self, Self::Err> {
205 use DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::*;
206 match s {
207 "merchandise" => Ok(Merchandise),
208 "services" => Ok(Services),
209 _ => Err(stripe_types::StripeParseError),
210 }
211 }
212}
213impl std::fmt::Display for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
214 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
215 f.write_str(self.as_str())
216 }
217}
218
219impl std::fmt::Debug for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
220 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
221 f.write_str(self.as_str())
222 }
223}
224#[cfg(feature = "serialize")]
225impl serde::Serialize for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
226 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
227 where
228 S: serde::Serializer,
229 {
230 serializer.serialize_str(self.as_str())
231 }
232}
233impl miniserde::Deserialize
234 for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices
235{
236 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
237 crate::Place::new(out)
238 }
239}
240
241impl miniserde::de::Visitor
242 for crate::Place<DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices>
243{
244 fn string(&mut self, s: &str) -> miniserde::Result<()> {
245 use std::str::FromStr;
246 self.out = Some(
247 DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::from_str(s)
248 .map_err(|_| miniserde::Error)?,
249 );
250 Ok(())
251 }
252}
253
254stripe_types::impl_from_val_with_from_str!(
255 DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices
256);
257#[cfg(feature = "deserialize")]
258impl<'de> serde::Deserialize<'de>
259 for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices
260{
261 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
262 use std::str::FromStr;
263 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
264 Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for DisputeVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices"))
265 }
266}