stripe_shared/
dispute_evidence.rs

1/// For more details see <<https://stripe.com/docs/api/disputes/evidence_object>>.
2#[derive(Clone, Debug)]
3#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
4#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
5pub struct DisputeEvidence {
6    /// Any server or activity logs showing proof that the customer accessed or downloaded the purchased digital product.
7    /// This information should include IP addresses, corresponding timestamps, and any detailed recorded activity.
8    pub access_activity_log: Option<String>,
9    /// The billing address provided by the customer.
10    pub billing_address: Option<String>,
11    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Your subscription cancellation policy, as shown to the customer.
12    pub cancellation_policy: Option<stripe_types::Expandable<stripe_shared::File>>,
13    /// An explanation of how and when the customer was shown your refund policy prior to purchase.
14    pub cancellation_policy_disclosure: Option<String>,
15    /// A justification for why the customer's subscription was not canceled.
16    pub cancellation_rebuttal: Option<String>,
17    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any communication with the customer that you feel is relevant to your case.
18    /// Examples include emails proving that the customer received the product or service, or demonstrating their use of or satisfaction with the product or service.
19    pub customer_communication: Option<stripe_types::Expandable<stripe_shared::File>>,
20    /// The email address of the customer.
21    pub customer_email_address: Option<String>,
22    /// The name of the customer.
23    pub customer_name: Option<String>,
24    /// The IP address that the customer used when making the purchase.
25    pub customer_purchase_ip: Option<String>,
26    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A relevant document or contract showing the customer's signature.
27    pub customer_signature: Option<stripe_types::Expandable<stripe_shared::File>>,
28    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation for the prior charge that can uniquely identify the charge, such as a receipt, shipping label, work order, etc.
29    /// This document should be paired with a similar document from the disputed payment that proves the two payments are separate.
30    pub duplicate_charge_documentation: Option<stripe_types::Expandable<stripe_shared::File>>,
31    /// An explanation of the difference between the disputed charge versus the prior charge that appears to be a duplicate.
32    pub duplicate_charge_explanation: Option<String>,
33    /// The Stripe ID for the prior charge which appears to be a duplicate of the disputed charge.
34    pub duplicate_charge_id: Option<String>,
35    pub enhanced_evidence: stripe_shared::DisputeEnhancedEvidence,
36    /// A description of the product or service that was sold.
37    pub product_description: Option<String>,
38    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any receipt or message sent to the customer notifying them of the charge.
39    pub receipt: Option<stripe_types::Expandable<stripe_shared::File>>,
40    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Your refund policy, as shown to the customer.
41    pub refund_policy: Option<stripe_types::Expandable<stripe_shared::File>>,
42    /// Documentation demonstrating that the customer was shown your refund policy prior to purchase.
43    pub refund_policy_disclosure: Option<String>,
44    /// A justification for why the customer is not entitled to a refund.
45    pub refund_refusal_explanation: Option<String>,
46    /// The date on which the customer received or began receiving the purchased service, in a clear human-readable format.
47    pub service_date: Option<String>,
48    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation showing proof that a service was provided to the customer.
49    /// This could include a copy of a signed contract, work order, or other form of written agreement.
50    pub service_documentation: Option<stripe_types::Expandable<stripe_shared::File>>,
51    /// The address to which a physical product was shipped.
52    /// You should try to include as complete address information as possible.
53    pub shipping_address: Option<String>,
54    /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
55    /// If multiple carriers were used for this purchase, please separate them with commas.
56    pub shipping_carrier: Option<String>,
57    /// The date on which a physical product began its route to the shipping address, in a clear human-readable format.
58    pub shipping_date: Option<String>,
59    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation showing proof that a product was shipped to the customer at the same address the customer provided to you.
60    /// This could include a copy of the shipment receipt, shipping label, etc.
61    /// It should show the customer's full shipping address, if possible.
62    pub shipping_documentation: Option<stripe_types::Expandable<stripe_shared::File>>,
63    /// The tracking number for a physical product, obtained from the delivery service.
64    /// If multiple tracking numbers were generated for this purchase, please separate them with commas.
65    pub shipping_tracking_number: Option<String>,
66    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any additional evidence or statements.
67    pub uncategorized_file: Option<stripe_types::Expandable<stripe_shared::File>>,
68    /// Any additional evidence or statements.
69    pub uncategorized_text: Option<String>,
70}
71#[doc(hidden)]
72pub struct DisputeEvidenceBuilder {
73    access_activity_log: Option<Option<String>>,
74    billing_address: Option<Option<String>>,
75    cancellation_policy: Option<Option<stripe_types::Expandable<stripe_shared::File>>>,
76    cancellation_policy_disclosure: Option<Option<String>>,
77    cancellation_rebuttal: Option<Option<String>>,
78    customer_communication: Option<Option<stripe_types::Expandable<stripe_shared::File>>>,
79    customer_email_address: Option<Option<String>>,
80    customer_name: Option<Option<String>>,
81    customer_purchase_ip: Option<Option<String>>,
82    customer_signature: Option<Option<stripe_types::Expandable<stripe_shared::File>>>,
83    duplicate_charge_documentation: Option<Option<stripe_types::Expandable<stripe_shared::File>>>,
84    duplicate_charge_explanation: Option<Option<String>>,
85    duplicate_charge_id: Option<Option<String>>,
86    enhanced_evidence: Option<stripe_shared::DisputeEnhancedEvidence>,
87    product_description: Option<Option<String>>,
88    receipt: Option<Option<stripe_types::Expandable<stripe_shared::File>>>,
89    refund_policy: Option<Option<stripe_types::Expandable<stripe_shared::File>>>,
90    refund_policy_disclosure: Option<Option<String>>,
91    refund_refusal_explanation: Option<Option<String>>,
92    service_date: Option<Option<String>>,
93    service_documentation: Option<Option<stripe_types::Expandable<stripe_shared::File>>>,
94    shipping_address: Option<Option<String>>,
95    shipping_carrier: Option<Option<String>>,
96    shipping_date: Option<Option<String>>,
97    shipping_documentation: Option<Option<stripe_types::Expandable<stripe_shared::File>>>,
98    shipping_tracking_number: Option<Option<String>>,
99    uncategorized_file: Option<Option<stripe_types::Expandable<stripe_shared::File>>>,
100    uncategorized_text: Option<Option<String>>,
101}
102
103#[allow(
104    unused_variables,
105    irrefutable_let_patterns,
106    clippy::let_unit_value,
107    clippy::match_single_binding,
108    clippy::single_match
109)]
110const _: () = {
111    use miniserde::de::{Map, Visitor};
112    use miniserde::json::Value;
113    use miniserde::{make_place, Deserialize, Result};
114    use stripe_types::miniserde_helpers::FromValueOpt;
115    use stripe_types::{MapBuilder, ObjectDeser};
116
117    make_place!(Place);
118
119    impl Deserialize for DisputeEvidence {
120        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
121            Place::new(out)
122        }
123    }
124
125    struct Builder<'a> {
126        out: &'a mut Option<DisputeEvidence>,
127        builder: DisputeEvidenceBuilder,
128    }
129
130    impl Visitor for Place<DisputeEvidence> {
131        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
132            Ok(Box::new(Builder {
133                out: &mut self.out,
134                builder: DisputeEvidenceBuilder::deser_default(),
135            }))
136        }
137    }
138
139    impl MapBuilder for DisputeEvidenceBuilder {
140        type Out = DisputeEvidence;
141        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
142            Ok(match k {
143                "access_activity_log" => Deserialize::begin(&mut self.access_activity_log),
144                "billing_address" => Deserialize::begin(&mut self.billing_address),
145                "cancellation_policy" => Deserialize::begin(&mut self.cancellation_policy),
146                "cancellation_policy_disclosure" => {
147                    Deserialize::begin(&mut self.cancellation_policy_disclosure)
148                }
149                "cancellation_rebuttal" => Deserialize::begin(&mut self.cancellation_rebuttal),
150                "customer_communication" => Deserialize::begin(&mut self.customer_communication),
151                "customer_email_address" => Deserialize::begin(&mut self.customer_email_address),
152                "customer_name" => Deserialize::begin(&mut self.customer_name),
153                "customer_purchase_ip" => Deserialize::begin(&mut self.customer_purchase_ip),
154                "customer_signature" => Deserialize::begin(&mut self.customer_signature),
155                "duplicate_charge_documentation" => {
156                    Deserialize::begin(&mut self.duplicate_charge_documentation)
157                }
158                "duplicate_charge_explanation" => {
159                    Deserialize::begin(&mut self.duplicate_charge_explanation)
160                }
161                "duplicate_charge_id" => Deserialize::begin(&mut self.duplicate_charge_id),
162                "enhanced_evidence" => Deserialize::begin(&mut self.enhanced_evidence),
163                "product_description" => Deserialize::begin(&mut self.product_description),
164                "receipt" => Deserialize::begin(&mut self.receipt),
165                "refund_policy" => Deserialize::begin(&mut self.refund_policy),
166                "refund_policy_disclosure" => {
167                    Deserialize::begin(&mut self.refund_policy_disclosure)
168                }
169                "refund_refusal_explanation" => {
170                    Deserialize::begin(&mut self.refund_refusal_explanation)
171                }
172                "service_date" => Deserialize::begin(&mut self.service_date),
173                "service_documentation" => Deserialize::begin(&mut self.service_documentation),
174                "shipping_address" => Deserialize::begin(&mut self.shipping_address),
175                "shipping_carrier" => Deserialize::begin(&mut self.shipping_carrier),
176                "shipping_date" => Deserialize::begin(&mut self.shipping_date),
177                "shipping_documentation" => Deserialize::begin(&mut self.shipping_documentation),
178                "shipping_tracking_number" => {
179                    Deserialize::begin(&mut self.shipping_tracking_number)
180                }
181                "uncategorized_file" => Deserialize::begin(&mut self.uncategorized_file),
182                "uncategorized_text" => Deserialize::begin(&mut self.uncategorized_text),
183
184                _ => <dyn Visitor>::ignore(),
185            })
186        }
187
188        fn deser_default() -> Self {
189            Self {
190                access_activity_log: Deserialize::default(),
191                billing_address: Deserialize::default(),
192                cancellation_policy: Deserialize::default(),
193                cancellation_policy_disclosure: Deserialize::default(),
194                cancellation_rebuttal: Deserialize::default(),
195                customer_communication: Deserialize::default(),
196                customer_email_address: Deserialize::default(),
197                customer_name: Deserialize::default(),
198                customer_purchase_ip: Deserialize::default(),
199                customer_signature: Deserialize::default(),
200                duplicate_charge_documentation: Deserialize::default(),
201                duplicate_charge_explanation: Deserialize::default(),
202                duplicate_charge_id: Deserialize::default(),
203                enhanced_evidence: Deserialize::default(),
204                product_description: Deserialize::default(),
205                receipt: Deserialize::default(),
206                refund_policy: Deserialize::default(),
207                refund_policy_disclosure: Deserialize::default(),
208                refund_refusal_explanation: Deserialize::default(),
209                service_date: Deserialize::default(),
210                service_documentation: Deserialize::default(),
211                shipping_address: Deserialize::default(),
212                shipping_carrier: Deserialize::default(),
213                shipping_date: Deserialize::default(),
214                shipping_documentation: Deserialize::default(),
215                shipping_tracking_number: Deserialize::default(),
216                uncategorized_file: Deserialize::default(),
217                uncategorized_text: Deserialize::default(),
218            }
219        }
220
221        fn take_out(&mut self) -> Option<Self::Out> {
222            let (
223                Some(access_activity_log),
224                Some(billing_address),
225                Some(cancellation_policy),
226                Some(cancellation_policy_disclosure),
227                Some(cancellation_rebuttal),
228                Some(customer_communication),
229                Some(customer_email_address),
230                Some(customer_name),
231                Some(customer_purchase_ip),
232                Some(customer_signature),
233                Some(duplicate_charge_documentation),
234                Some(duplicate_charge_explanation),
235                Some(duplicate_charge_id),
236                Some(enhanced_evidence),
237                Some(product_description),
238                Some(receipt),
239                Some(refund_policy),
240                Some(refund_policy_disclosure),
241                Some(refund_refusal_explanation),
242                Some(service_date),
243                Some(service_documentation),
244                Some(shipping_address),
245                Some(shipping_carrier),
246                Some(shipping_date),
247                Some(shipping_documentation),
248                Some(shipping_tracking_number),
249                Some(uncategorized_file),
250                Some(uncategorized_text),
251            ) = (
252                self.access_activity_log.take(),
253                self.billing_address.take(),
254                self.cancellation_policy.take(),
255                self.cancellation_policy_disclosure.take(),
256                self.cancellation_rebuttal.take(),
257                self.customer_communication.take(),
258                self.customer_email_address.take(),
259                self.customer_name.take(),
260                self.customer_purchase_ip.take(),
261                self.customer_signature.take(),
262                self.duplicate_charge_documentation.take(),
263                self.duplicate_charge_explanation.take(),
264                self.duplicate_charge_id.take(),
265                self.enhanced_evidence.take(),
266                self.product_description.take(),
267                self.receipt.take(),
268                self.refund_policy.take(),
269                self.refund_policy_disclosure.take(),
270                self.refund_refusal_explanation.take(),
271                self.service_date.take(),
272                self.service_documentation.take(),
273                self.shipping_address.take(),
274                self.shipping_carrier.take(),
275                self.shipping_date.take(),
276                self.shipping_documentation.take(),
277                self.shipping_tracking_number.take(),
278                self.uncategorized_file.take(),
279                self.uncategorized_text.take(),
280            )
281            else {
282                return None;
283            };
284            Some(Self::Out {
285                access_activity_log,
286                billing_address,
287                cancellation_policy,
288                cancellation_policy_disclosure,
289                cancellation_rebuttal,
290                customer_communication,
291                customer_email_address,
292                customer_name,
293                customer_purchase_ip,
294                customer_signature,
295                duplicate_charge_documentation,
296                duplicate_charge_explanation,
297                duplicate_charge_id,
298                enhanced_evidence,
299                product_description,
300                receipt,
301                refund_policy,
302                refund_policy_disclosure,
303                refund_refusal_explanation,
304                service_date,
305                service_documentation,
306                shipping_address,
307                shipping_carrier,
308                shipping_date,
309                shipping_documentation,
310                shipping_tracking_number,
311                uncategorized_file,
312                uncategorized_text,
313            })
314        }
315    }
316
317    impl Map for Builder<'_> {
318        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
319            self.builder.key(k)
320        }
321
322        fn finish(&mut self) -> Result<()> {
323            *self.out = self.builder.take_out();
324            Ok(())
325        }
326    }
327
328    impl ObjectDeser for DisputeEvidence {
329        type Builder = DisputeEvidenceBuilder;
330    }
331
332    impl FromValueOpt for DisputeEvidence {
333        fn from_value(v: Value) -> Option<Self> {
334            let Value::Object(obj) = v else {
335                return None;
336            };
337            let mut b = DisputeEvidenceBuilder::deser_default();
338            for (k, v) in obj {
339                match k.as_str() {
340                    "access_activity_log" => b.access_activity_log = FromValueOpt::from_value(v),
341                    "billing_address" => b.billing_address = FromValueOpt::from_value(v),
342                    "cancellation_policy" => b.cancellation_policy = FromValueOpt::from_value(v),
343                    "cancellation_policy_disclosure" => {
344                        b.cancellation_policy_disclosure = FromValueOpt::from_value(v)
345                    }
346                    "cancellation_rebuttal" => {
347                        b.cancellation_rebuttal = FromValueOpt::from_value(v)
348                    }
349                    "customer_communication" => {
350                        b.customer_communication = FromValueOpt::from_value(v)
351                    }
352                    "customer_email_address" => {
353                        b.customer_email_address = FromValueOpt::from_value(v)
354                    }
355                    "customer_name" => b.customer_name = FromValueOpt::from_value(v),
356                    "customer_purchase_ip" => b.customer_purchase_ip = FromValueOpt::from_value(v),
357                    "customer_signature" => b.customer_signature = FromValueOpt::from_value(v),
358                    "duplicate_charge_documentation" => {
359                        b.duplicate_charge_documentation = FromValueOpt::from_value(v)
360                    }
361                    "duplicate_charge_explanation" => {
362                        b.duplicate_charge_explanation = FromValueOpt::from_value(v)
363                    }
364                    "duplicate_charge_id" => b.duplicate_charge_id = FromValueOpt::from_value(v),
365                    "enhanced_evidence" => b.enhanced_evidence = FromValueOpt::from_value(v),
366                    "product_description" => b.product_description = FromValueOpt::from_value(v),
367                    "receipt" => b.receipt = FromValueOpt::from_value(v),
368                    "refund_policy" => b.refund_policy = FromValueOpt::from_value(v),
369                    "refund_policy_disclosure" => {
370                        b.refund_policy_disclosure = FromValueOpt::from_value(v)
371                    }
372                    "refund_refusal_explanation" => {
373                        b.refund_refusal_explanation = FromValueOpt::from_value(v)
374                    }
375                    "service_date" => b.service_date = FromValueOpt::from_value(v),
376                    "service_documentation" => {
377                        b.service_documentation = FromValueOpt::from_value(v)
378                    }
379                    "shipping_address" => b.shipping_address = FromValueOpt::from_value(v),
380                    "shipping_carrier" => b.shipping_carrier = FromValueOpt::from_value(v),
381                    "shipping_date" => b.shipping_date = FromValueOpt::from_value(v),
382                    "shipping_documentation" => {
383                        b.shipping_documentation = FromValueOpt::from_value(v)
384                    }
385                    "shipping_tracking_number" => {
386                        b.shipping_tracking_number = FromValueOpt::from_value(v)
387                    }
388                    "uncategorized_file" => b.uncategorized_file = FromValueOpt::from_value(v),
389                    "uncategorized_text" => b.uncategorized_text = FromValueOpt::from_value(v),
390
391                    _ => {}
392                }
393            }
394            b.take_out()
395        }
396    }
397};