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
89                _ => <dyn Visitor>::ignore(),
90            })
91        }
92
93        fn deser_default() -> Self {
94            Self {
95                charge: Deserialize::default(),
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                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(charge),
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(product_description),
115                Some(shipping_address),
116            ) = (
117                self.charge.take(),
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.product_description.take(),
124                self.shipping_address.take(),
125            )
126            else {
127                return None;
128            };
129            Some(Self::Out {
130                charge,
131                customer_account_id,
132                customer_device_fingerprint,
133                customer_device_id,
134                customer_email_address,
135                customer_purchase_ip,
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 DisputeVisaCompellingEvidence3PriorUndisputedTransaction {
154        type Builder = DisputeVisaCompellingEvidence3PriorUndisputedTransactionBuilder;
155    }
156
157    impl FromValueOpt for DisputeVisaCompellingEvidence3PriorUndisputedTransaction {
158        fn from_value(v: Value) -> Option<Self> {
159            let Value::Object(obj) = v else {
160                return None;
161            };
162            let mut b =
163                DisputeVisaCompellingEvidence3PriorUndisputedTransactionBuilder::deser_default();
164            for (k, v) in obj {
165                match k.as_str() {
166                    "charge" => b.charge = FromValueOpt::from_value(v),
167                    "customer_account_id" => b.customer_account_id = FromValueOpt::from_value(v),
168                    "customer_device_fingerprint" => {
169                        b.customer_device_fingerprint = FromValueOpt::from_value(v)
170                    }
171                    "customer_device_id" => b.customer_device_id = FromValueOpt::from_value(v),
172                    "customer_email_address" => {
173                        b.customer_email_address = FromValueOpt::from_value(v)
174                    }
175                    "customer_purchase_ip" => b.customer_purchase_ip = FromValueOpt::from_value(v),
176                    "product_description" => b.product_description = FromValueOpt::from_value(v),
177                    "shipping_address" => b.shipping_address = FromValueOpt::from_value(v),
178
179                    _ => {}
180                }
181            }
182            b.take_out()
183        }
184    }
185};