stripe_shared/
dispute_visa_compelling_evidence3_prior_undisputed_transaction.rs

1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct DisputeVisaCompellingEvidence3PriorUndisputedTransaction {
5    /// Stripe charge ID for the Visa Compelling Evidence 3.0 eligible prior charge.
6    pub charge: String,
7    /// User Account ID used to log into business platform. Must be recognizable by the user.
8    pub customer_account_id: Option<String>,
9    /// Unique identifier of the cardholder’s device derived from a combination of at least two hardware and software attributes.
10    /// Must be at least 20 characters.
11    pub customer_device_fingerprint: Option<String>,
12    /// Unique identifier of the cardholder’s device such as a device serial number (e.g., International Mobile Equipment Identity [IMEI]).
13    /// Must be at least 15 characters.
14    pub customer_device_id: Option<String>,
15    /// The email address of the customer.
16    pub customer_email_address: Option<String>,
17    /// The IP address that the customer used when making the purchase.
18    pub customer_purchase_ip: Option<String>,
19    /// A description of the product or service that was sold.
20    pub product_description: Option<String>,
21    /// The address to which a physical product was shipped.
22    /// All fields are required for Visa Compelling Evidence 3.0 evidence submission.
23    pub shipping_address: Option<stripe_shared::DisputeTransactionShippingAddress>,
24}
25#[doc(hidden)]
26pub struct DisputeVisaCompellingEvidence3PriorUndisputedTransactionBuilder {
27    charge: Option<String>,
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    product_description: Option<Option<String>>,
34    shipping_address: Option<Option<stripe_shared::DisputeTransactionShippingAddress>>,
35}
36
37#[allow(
38    unused_variables,
39    irrefutable_let_patterns,
40    clippy::let_unit_value,
41    clippy::match_single_binding,
42    clippy::single_match
43)]
44const _: () = {
45    use miniserde::de::{Map, Visitor};
46    use miniserde::json::Value;
47    use miniserde::{Deserialize, Result, make_place};
48    use stripe_types::miniserde_helpers::FromValueOpt;
49    use stripe_types::{MapBuilder, ObjectDeser};
50
51    make_place!(Place);
52
53    impl Deserialize for DisputeVisaCompellingEvidence3PriorUndisputedTransaction {
54        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
55            Place::new(out)
56        }
57    }
58
59    struct Builder<'a> {
60        out: &'a mut Option<DisputeVisaCompellingEvidence3PriorUndisputedTransaction>,
61        builder: DisputeVisaCompellingEvidence3PriorUndisputedTransactionBuilder,
62    }
63
64    impl Visitor for Place<DisputeVisaCompellingEvidence3PriorUndisputedTransaction> {
65        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
66            Ok(Box::new(Builder {
67                out: &mut self.out,
68                builder:
69                    DisputeVisaCompellingEvidence3PriorUndisputedTransactionBuilder::deser_default(),
70            }))
71        }
72    }
73
74    impl MapBuilder for DisputeVisaCompellingEvidence3PriorUndisputedTransactionBuilder {
75        type Out = DisputeVisaCompellingEvidence3PriorUndisputedTransaction;
76        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
77            Ok(match k {
78                "charge" => Deserialize::begin(&mut self.charge),
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                "product_description" => Deserialize::begin(&mut self.product_description),
87                "shipping_address" => Deserialize::begin(&mut self.shipping_address),
88                _ => <dyn Visitor>::ignore(),
89            })
90        }
91
92        fn deser_default() -> Self {
93            Self {
94                charge: Deserialize::default(),
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                product_description: Deserialize::default(),
101                shipping_address: Deserialize::default(),
102            }
103        }
104
105        fn take_out(&mut self) -> Option<Self::Out> {
106            let (
107                Some(charge),
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(product_description),
114                Some(shipping_address),
115            ) = (
116                self.charge.take(),
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.product_description.take(),
123                self.shipping_address.take(),
124            )
125            else {
126                return None;
127            };
128            Some(Self::Out {
129                charge,
130                customer_account_id,
131                customer_device_fingerprint,
132                customer_device_id,
133                customer_email_address,
134                customer_purchase_ip,
135                product_description,
136                shipping_address,
137            })
138        }
139    }
140
141    impl Map for Builder<'_> {
142        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
143            self.builder.key(k)
144        }
145
146        fn finish(&mut self) -> Result<()> {
147            *self.out = self.builder.take_out();
148            Ok(())
149        }
150    }
151
152    impl ObjectDeser for DisputeVisaCompellingEvidence3PriorUndisputedTransaction {
153        type Builder = DisputeVisaCompellingEvidence3PriorUndisputedTransactionBuilder;
154    }
155
156    impl FromValueOpt for DisputeVisaCompellingEvidence3PriorUndisputedTransaction {
157        fn from_value(v: Value) -> Option<Self> {
158            let Value::Object(obj) = v else {
159                return None;
160            };
161            let mut b =
162                DisputeVisaCompellingEvidence3PriorUndisputedTransactionBuilder::deser_default();
163            for (k, v) in obj {
164                match k.as_str() {
165                    "charge" => b.charge = FromValueOpt::from_value(v),
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                    "product_description" => b.product_description = FromValueOpt::from_value(v),
176                    "shipping_address" => b.shipping_address = FromValueOpt::from_value(v),
177                    _ => {}
178                }
179            }
180            b.take_out()
181        }
182    }
183};