stripe_core/dispute/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
6struct ListDisputeBuilder {
7    #[serde(skip_serializing_if = "Option::is_none")]
8    charge: Option<String>,
9    #[serde(skip_serializing_if = "Option::is_none")]
10    created: Option<stripe_types::RangeQueryTs>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    ending_before: Option<String>,
13    #[serde(skip_serializing_if = "Option::is_none")]
14    expand: Option<Vec<String>>,
15    #[serde(skip_serializing_if = "Option::is_none")]
16    limit: Option<i64>,
17    #[serde(skip_serializing_if = "Option::is_none")]
18    payment_intent: Option<String>,
19    #[serde(skip_serializing_if = "Option::is_none")]
20    starting_after: Option<String>,
21}
22impl ListDisputeBuilder {
23    fn new() -> Self {
24        Self {
25            charge: None,
26            created: None,
27            ending_before: None,
28            expand: None,
29            limit: None,
30            payment_intent: None,
31            starting_after: None,
32        }
33    }
34}
35/// Returns a list of your disputes.
36#[derive(Clone, Debug, serde::Serialize)]
37pub struct ListDispute {
38    inner: ListDisputeBuilder,
39}
40impl ListDispute {
41    /// Construct a new `ListDispute`.
42    pub fn new() -> Self {
43        Self { inner: ListDisputeBuilder::new() }
44    }
45    /// Only return disputes associated to the charge specified by this charge ID.
46    pub fn charge(mut self, charge: impl Into<String>) -> Self {
47        self.inner.charge = Some(charge.into());
48        self
49    }
50    /// Only return disputes that were created during the given date interval.
51    pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
52        self.inner.created = Some(created.into());
53        self
54    }
55    /// A cursor for use in pagination.
56    /// `ending_before` is an object ID that defines your place in the list.
57    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
58    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
59        self.inner.ending_before = Some(ending_before.into());
60        self
61    }
62    /// Specifies which fields in the response should be expanded.
63    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
64        self.inner.expand = Some(expand.into());
65        self
66    }
67    /// A limit on the number of objects to be returned.
68    /// Limit can range between 1 and 100, and the default is 10.
69    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
70        self.inner.limit = Some(limit.into());
71        self
72    }
73    /// Only return disputes associated to the PaymentIntent specified by this PaymentIntent ID.
74    pub fn payment_intent(mut self, payment_intent: impl Into<String>) -> Self {
75        self.inner.payment_intent = Some(payment_intent.into());
76        self
77    }
78    /// A cursor for use in pagination.
79    /// `starting_after` is an object ID that defines your place in the list.
80    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
81    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
82        self.inner.starting_after = Some(starting_after.into());
83        self
84    }
85}
86impl Default for ListDispute {
87    fn default() -> Self {
88        Self::new()
89    }
90}
91impl ListDispute {
92    /// Send the request and return the deserialized response.
93    pub async fn send<C: StripeClient>(
94        &self,
95        client: &C,
96    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
97        self.customize().send(client).await
98    }
99
100    /// Send the request and return the deserialized response, blocking until completion.
101    pub fn send_blocking<C: StripeBlockingClient>(
102        &self,
103        client: &C,
104    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
105        self.customize().send_blocking(client)
106    }
107
108    pub fn paginate(
109        &self,
110    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::Dispute>> {
111        stripe_client_core::ListPaginator::new_list("/disputes", &self.inner)
112    }
113}
114
115impl StripeRequest for ListDispute {
116    type Output = stripe_types::List<stripe_shared::Dispute>;
117
118    fn build(&self) -> RequestBuilder {
119        RequestBuilder::new(StripeMethod::Get, "/disputes").query(&self.inner)
120    }
121}
122#[derive(Clone, Debug, serde::Serialize)]
123struct RetrieveDisputeBuilder {
124    #[serde(skip_serializing_if = "Option::is_none")]
125    expand: Option<Vec<String>>,
126}
127impl RetrieveDisputeBuilder {
128    fn new() -> Self {
129        Self { expand: None }
130    }
131}
132/// Retrieves the dispute with the given ID.
133#[derive(Clone, Debug, serde::Serialize)]
134pub struct RetrieveDispute {
135    inner: RetrieveDisputeBuilder,
136    dispute: stripe_shared::DisputeId,
137}
138impl RetrieveDispute {
139    /// Construct a new `RetrieveDispute`.
140    pub fn new(dispute: impl Into<stripe_shared::DisputeId>) -> Self {
141        Self { dispute: dispute.into(), inner: RetrieveDisputeBuilder::new() }
142    }
143    /// Specifies which fields in the response should be expanded.
144    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
145        self.inner.expand = Some(expand.into());
146        self
147    }
148}
149impl RetrieveDispute {
150    /// Send the request and return the deserialized response.
151    pub async fn send<C: StripeClient>(
152        &self,
153        client: &C,
154    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
155        self.customize().send(client).await
156    }
157
158    /// Send the request and return the deserialized response, blocking until completion.
159    pub fn send_blocking<C: StripeBlockingClient>(
160        &self,
161        client: &C,
162    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
163        self.customize().send_blocking(client)
164    }
165}
166
167impl StripeRequest for RetrieveDispute {
168    type Output = stripe_shared::Dispute;
169
170    fn build(&self) -> RequestBuilder {
171        let dispute = &self.dispute;
172        RequestBuilder::new(StripeMethod::Get, format!("/disputes/{dispute}")).query(&self.inner)
173    }
174}
175#[derive(Clone, Debug, serde::Serialize)]
176struct UpdateDisputeBuilder {
177    #[serde(skip_serializing_if = "Option::is_none")]
178    evidence: Option<UpdateDisputeEvidence>,
179    #[serde(skip_serializing_if = "Option::is_none")]
180    expand: Option<Vec<String>>,
181    #[serde(skip_serializing_if = "Option::is_none")]
182    metadata: Option<std::collections::HashMap<String, String>>,
183    #[serde(skip_serializing_if = "Option::is_none")]
184    submit: Option<bool>,
185}
186impl UpdateDisputeBuilder {
187    fn new() -> Self {
188        Self { evidence: None, expand: None, metadata: None, submit: None }
189    }
190}
191/// Evidence to upload, to respond to a dispute.
192/// Updating any field in the hash will submit all fields in the hash for review.
193/// The combined character count of all fields is limited to 150,000.
194#[derive(Clone, Debug, serde::Serialize)]
195pub struct UpdateDisputeEvidence {
196    /// Any server or activity logs showing proof that the customer accessed or downloaded the purchased digital product.
197    /// This information should include IP addresses, corresponding timestamps, and any detailed recorded activity.
198    /// Has a maximum character count of 20,000.
199    #[serde(skip_serializing_if = "Option::is_none")]
200    pub access_activity_log: Option<String>,
201    /// The billing address provided by the customer.
202    #[serde(skip_serializing_if = "Option::is_none")]
203    pub billing_address: Option<String>,
204    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Your subscription cancellation policy, as shown to the customer.
205    #[serde(skip_serializing_if = "Option::is_none")]
206    pub cancellation_policy: Option<String>,
207    /// An explanation of how and when the customer was shown your refund policy prior to purchase.
208    /// Has a maximum character count of 20,000.
209    #[serde(skip_serializing_if = "Option::is_none")]
210    pub cancellation_policy_disclosure: Option<String>,
211    /// A justification for why the customer's subscription was not canceled.
212    /// Has a maximum character count of 20,000.
213    #[serde(skip_serializing_if = "Option::is_none")]
214    pub cancellation_rebuttal: Option<String>,
215    /// (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.
216    /// Examples include emails proving that the customer received the product or service, or demonstrating their use of or satisfaction with the product or service.
217    #[serde(skip_serializing_if = "Option::is_none")]
218    pub customer_communication: Option<String>,
219    /// The email address of the customer.
220    #[serde(skip_serializing_if = "Option::is_none")]
221    pub customer_email_address: Option<String>,
222    /// The name of the customer.
223    #[serde(skip_serializing_if = "Option::is_none")]
224    pub customer_name: Option<String>,
225    /// The IP address that the customer used when making the purchase.
226    #[serde(skip_serializing_if = "Option::is_none")]
227    pub customer_purchase_ip: Option<String>,
228    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A relevant document or contract showing the customer's signature.
229    #[serde(skip_serializing_if = "Option::is_none")]
230    pub customer_signature: Option<String>,
231    /// (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.
232    /// This document should be paired with a similar document from the disputed payment that proves the two payments are separate.
233    #[serde(skip_serializing_if = "Option::is_none")]
234    pub duplicate_charge_documentation: Option<String>,
235    /// An explanation of the difference between the disputed charge versus the prior charge that appears to be a duplicate.
236    /// Has a maximum character count of 20,000.
237    #[serde(skip_serializing_if = "Option::is_none")]
238    pub duplicate_charge_explanation: Option<String>,
239    /// The Stripe ID for the prior charge which appears to be a duplicate of the disputed charge.
240    #[serde(skip_serializing_if = "Option::is_none")]
241    pub duplicate_charge_id: Option<String>,
242    /// Additional evidence for qualifying evidence programs.
243    #[serde(skip_serializing_if = "Option::is_none")]
244    pub enhanced_evidence: Option<UpdateDisputeEvidenceEnhancedEvidence>,
245    /// A description of the product or service that was sold. Has a maximum character count of 20,000.
246    #[serde(skip_serializing_if = "Option::is_none")]
247    pub product_description: Option<String>,
248    /// (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.
249    #[serde(skip_serializing_if = "Option::is_none")]
250    pub receipt: Option<String>,
251    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Your refund policy, as shown to the customer.
252    #[serde(skip_serializing_if = "Option::is_none")]
253    pub refund_policy: Option<String>,
254    /// Documentation demonstrating that the customer was shown your refund policy prior to purchase.
255    /// Has a maximum character count of 20,000.
256    #[serde(skip_serializing_if = "Option::is_none")]
257    pub refund_policy_disclosure: Option<String>,
258    /// A justification for why the customer is not entitled to a refund.
259    /// Has a maximum character count of 20,000.
260    #[serde(skip_serializing_if = "Option::is_none")]
261    pub refund_refusal_explanation: Option<String>,
262    /// The date on which the customer received or began receiving the purchased service, in a clear human-readable format.
263    #[serde(skip_serializing_if = "Option::is_none")]
264    pub service_date: Option<String>,
265    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Documentation showing proof that a service was provided to the customer.
266    /// This could include a copy of a signed contract, work order, or other form of written agreement.
267    #[serde(skip_serializing_if = "Option::is_none")]
268    pub service_documentation: Option<String>,
269    /// The address to which a physical product was shipped.
270    /// You should try to include as complete address information as possible.
271    #[serde(skip_serializing_if = "Option::is_none")]
272    pub shipping_address: Option<String>,
273    /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
274    /// If multiple carriers were used for this purchase, please separate them with commas.
275    #[serde(skip_serializing_if = "Option::is_none")]
276    pub shipping_carrier: Option<String>,
277    /// The date on which a physical product began its route to the shipping address, in a clear human-readable format.
278    #[serde(skip_serializing_if = "Option::is_none")]
279    pub shipping_date: Option<String>,
280    /// (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.
281    /// This could include a copy of the shipment receipt, shipping label, etc.
282    /// It should show the customer's full shipping address, if possible.
283    #[serde(skip_serializing_if = "Option::is_none")]
284    pub shipping_documentation: Option<String>,
285    /// The tracking number for a physical product, obtained from the delivery service.
286    /// If multiple tracking numbers were generated for this purchase, please separate them with commas.
287    #[serde(skip_serializing_if = "Option::is_none")]
288    pub shipping_tracking_number: Option<String>,
289    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Any additional evidence or statements.
290    #[serde(skip_serializing_if = "Option::is_none")]
291    pub uncategorized_file: Option<String>,
292    /// Any additional evidence or statements. Has a maximum character count of 20,000.
293    #[serde(skip_serializing_if = "Option::is_none")]
294    pub uncategorized_text: Option<String>,
295}
296impl UpdateDisputeEvidence {
297    pub fn new() -> Self {
298        Self {
299            access_activity_log: None,
300            billing_address: None,
301            cancellation_policy: None,
302            cancellation_policy_disclosure: None,
303            cancellation_rebuttal: None,
304            customer_communication: None,
305            customer_email_address: None,
306            customer_name: None,
307            customer_purchase_ip: None,
308            customer_signature: None,
309            duplicate_charge_documentation: None,
310            duplicate_charge_explanation: None,
311            duplicate_charge_id: None,
312            enhanced_evidence: None,
313            product_description: None,
314            receipt: None,
315            refund_policy: None,
316            refund_policy_disclosure: None,
317            refund_refusal_explanation: None,
318            service_date: None,
319            service_documentation: None,
320            shipping_address: None,
321            shipping_carrier: None,
322            shipping_date: None,
323            shipping_documentation: None,
324            shipping_tracking_number: None,
325            uncategorized_file: None,
326            uncategorized_text: None,
327        }
328    }
329}
330impl Default for UpdateDisputeEvidence {
331    fn default() -> Self {
332        Self::new()
333    }
334}
335/// Additional evidence for qualifying evidence programs.
336#[derive(Clone, Debug, serde::Serialize)]
337pub struct UpdateDisputeEvidenceEnhancedEvidence {
338    /// Evidence provided for Visa Compelling Evidence 3.0 evidence submission.
339    #[serde(skip_serializing_if = "Option::is_none")]
340    pub visa_compelling_evidence_3:
341        Option<UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3>,
342    /// Evidence provided for Visa compliance evidence submission.
343    #[serde(skip_serializing_if = "Option::is_none")]
344    pub visa_compliance: Option<UpdateDisputeEvidenceEnhancedEvidenceVisaCompliance>,
345}
346impl UpdateDisputeEvidenceEnhancedEvidence {
347    pub fn new() -> Self {
348        Self { visa_compelling_evidence_3: None, visa_compliance: None }
349    }
350}
351impl Default for UpdateDisputeEvidenceEnhancedEvidence {
352    fn default() -> Self {
353        Self::new()
354    }
355}
356/// Evidence provided for Visa Compelling Evidence 3.0 evidence submission.
357#[derive(Clone, Debug, serde::Serialize)]
358pub struct UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3 {
359    /// Disputed transaction details for Visa Compelling Evidence 3.0 evidence submission.
360    #[serde(skip_serializing_if = "Option::is_none")]
361    pub disputed_transaction:
362        Option<UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransaction>,
363    /// List of exactly two prior undisputed transaction objects for Visa Compelling Evidence 3.0 evidence submission.
364    #[serde(skip_serializing_if = "Option::is_none")]
365    pub prior_undisputed_transactions: Option<
366        Vec<
367            UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3PriorUndisputedTransactions,
368        >,
369    >,
370}
371impl UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3 {
372    pub fn new() -> Self {
373        Self { disputed_transaction: None, prior_undisputed_transactions: None }
374    }
375}
376impl Default for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3 {
377    fn default() -> Self {
378        Self::new()
379    }
380}
381/// Disputed transaction details for Visa Compelling Evidence 3.0 evidence submission.
382#[derive(Clone, Debug, serde::Serialize)]
383pub struct UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransaction {
384    /// User Account ID used to log into business platform. Must be recognizable by the user.
385#[serde(skip_serializing_if = "Option::is_none")]
386pub customer_account_id: Option<String>,
387        /// Unique identifier of the cardholder’s device derived from a combination of at least two hardware and software attributes.
388    /// Must be at least 20 characters.
389#[serde(skip_serializing_if = "Option::is_none")]
390pub customer_device_fingerprint: Option<String>,
391        /// Unique identifier of the cardholder’s device such as a device serial number (e.g., International Mobile Equipment Identity [IMEI]).
392    /// Must be at least 15 characters.
393#[serde(skip_serializing_if = "Option::is_none")]
394pub customer_device_id: Option<String>,
395    /// The email address of the customer.
396#[serde(skip_serializing_if = "Option::is_none")]
397pub customer_email_address: Option<String>,
398    /// The IP address that the customer used when making the purchase.
399#[serde(skip_serializing_if = "Option::is_none")]
400pub customer_purchase_ip: Option<String>,
401    /// Categorization of disputed payment.
402#[serde(skip_serializing_if = "Option::is_none")]
403pub merchandise_or_services: Option<UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices>,
404    /// A description of the product or service that was sold.
405#[serde(skip_serializing_if = "Option::is_none")]
406pub product_description: Option<String>,
407        /// The address to which a physical product was shipped.
408    /// All fields are required for Visa Compelling Evidence 3.0 evidence submission.
409#[serde(skip_serializing_if = "Option::is_none")]
410pub shipping_address: Option<ShippingAddress>,
411
412}
413impl UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransaction {
414    pub fn new() -> Self {
415        Self {
416            customer_account_id: None,
417            customer_device_fingerprint: None,
418            customer_device_id: None,
419            customer_email_address: None,
420            customer_purchase_ip: None,
421            merchandise_or_services: None,
422            product_description: None,
423            shipping_address: None,
424        }
425    }
426}
427impl Default for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransaction {
428    fn default() -> Self {
429        Self::new()
430    }
431}
432/// Categorization of disputed payment.
433#[derive(Clone, Eq, PartialEq)]
434#[non_exhaustive]
435pub enum UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices
436{
437    Merchandise,
438    Services,
439    /// An unrecognized value from Stripe. Should not be used as a request parameter.
440    Unknown(String),
441}
442impl UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
443    pub fn as_str(&self) -> &str {
444        use UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::*;
445        match self {
446Merchandise => "merchandise",
447Services => "services",
448Unknown(v) => v,
449
450        }
451    }
452}
453
454impl std::str::FromStr for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
455    type Err = std::convert::Infallible;
456    fn from_str(s: &str) -> Result<Self, Self::Err> {
457        use UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::*;
458        match s {
459    "merchandise" => Ok(Merchandise),
460"services" => Ok(Services),
461v => { tracing::warn!("Unknown value '{}' for enum '{}'", v, "UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices"); Ok(Unknown(v.to_owned())) }
462
463        }
464    }
465}
466impl std::fmt::Display for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
467    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
468        f.write_str(self.as_str())
469    }
470}
471
472impl std::fmt::Debug for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
473    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
474        f.write_str(self.as_str())
475    }
476}
477impl serde::Serialize for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
478    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
479        serializer.serialize_str(self.as_str())
480    }
481}
482#[cfg(feature = "deserialize")]
483impl<'de> serde::Deserialize<'de> for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
484    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
485        use std::str::FromStr;
486        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
487        Ok(Self::from_str(&s).expect("infallible"))
488    }
489}
490/// List of exactly two prior undisputed transaction objects for Visa Compelling Evidence 3.0 evidence submission.
491#[derive(Clone, Debug, serde::Serialize)]
492pub struct UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3PriorUndisputedTransactions {
493    /// Stripe charge ID for the Visa Compelling Evidence 3.0 eligible prior charge.
494    pub charge: String,
495    /// User Account ID used to log into business platform. Must be recognizable by the user.
496    #[serde(skip_serializing_if = "Option::is_none")]
497    pub customer_account_id: Option<String>,
498    /// Unique identifier of the cardholder’s device derived from a combination of at least two hardware and software attributes.
499    /// Must be at least 20 characters.
500    #[serde(skip_serializing_if = "Option::is_none")]
501    pub customer_device_fingerprint: Option<String>,
502    /// Unique identifier of the cardholder’s device such as a device serial number (e.g., International Mobile Equipment Identity [IMEI]).
503    /// Must be at least 15 characters.
504    #[serde(skip_serializing_if = "Option::is_none")]
505    pub customer_device_id: Option<String>,
506    /// The email address of the customer.
507    #[serde(skip_serializing_if = "Option::is_none")]
508    pub customer_email_address: Option<String>,
509    /// The IP address that the customer used when making the purchase.
510    #[serde(skip_serializing_if = "Option::is_none")]
511    pub customer_purchase_ip: Option<String>,
512    /// A description of the product or service that was sold.
513    #[serde(skip_serializing_if = "Option::is_none")]
514    pub product_description: Option<String>,
515    /// The address to which a physical product was shipped.
516    /// All fields are required for Visa Compelling Evidence 3.0 evidence submission.
517    #[serde(skip_serializing_if = "Option::is_none")]
518    pub shipping_address: Option<ShippingAddress>,
519}
520impl UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3PriorUndisputedTransactions {
521    pub fn new(charge: impl Into<String>) -> Self {
522        Self {
523            charge: charge.into(),
524            customer_account_id: None,
525            customer_device_fingerprint: None,
526            customer_device_id: None,
527            customer_email_address: None,
528            customer_purchase_ip: None,
529            product_description: None,
530            shipping_address: None,
531        }
532    }
533}
534/// Evidence provided for Visa compliance evidence submission.
535#[derive(Copy, Clone, Debug, serde::Serialize)]
536pub struct UpdateDisputeEvidenceEnhancedEvidenceVisaCompliance {
537    /// A field acknowledging the fee incurred when countering a Visa compliance dispute.
538    /// If this field is set to true, evidence can be submitted for the compliance dispute.
539    /// Stripe collects a 500 USD (or local equivalent) amount to cover the network costs associated with resolving compliance disputes.
540    /// Stripe refunds the 500 USD network fee if you win the dispute.
541    #[serde(skip_serializing_if = "Option::is_none")]
542    pub fee_acknowledged: Option<bool>,
543}
544impl UpdateDisputeEvidenceEnhancedEvidenceVisaCompliance {
545    pub fn new() -> Self {
546        Self { fee_acknowledged: None }
547    }
548}
549impl Default for UpdateDisputeEvidenceEnhancedEvidenceVisaCompliance {
550    fn default() -> Self {
551        Self::new()
552    }
553}
554/// When you get a dispute, contacting your customer is always the best first step.
555/// If that doesn’t work, you can submit evidence to help us resolve the dispute in your favor.
556/// You can do this in your [dashboard](https://dashboard.stripe.com/disputes), but if you prefer, you can use the API to submit evidence programmatically.
557///
558/// Depending on your dispute type, different evidence fields will give you a better chance of winning your dispute.
559/// To figure out which evidence fields to provide, see our [guide to dispute types](https://stripe.com/docs/disputes/categories).
560#[derive(Clone, Debug, serde::Serialize)]
561pub struct UpdateDispute {
562    inner: UpdateDisputeBuilder,
563    dispute: stripe_shared::DisputeId,
564}
565impl UpdateDispute {
566    /// Construct a new `UpdateDispute`.
567    pub fn new(dispute: impl Into<stripe_shared::DisputeId>) -> Self {
568        Self { dispute: dispute.into(), inner: UpdateDisputeBuilder::new() }
569    }
570    /// Evidence to upload, to respond to a dispute.
571    /// Updating any field in the hash will submit all fields in the hash for review.
572    /// The combined character count of all fields is limited to 150,000.
573    pub fn evidence(mut self, evidence: impl Into<UpdateDisputeEvidence>) -> Self {
574        self.inner.evidence = Some(evidence.into());
575        self
576    }
577    /// Specifies which fields in the response should be expanded.
578    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
579        self.inner.expand = Some(expand.into());
580        self
581    }
582    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
583    /// This can be useful for storing additional information about the object in a structured format.
584    /// Individual keys can be unset by posting an empty value to them.
585    /// All keys can be unset by posting an empty value to `metadata`.
586    pub fn metadata(
587        mut self,
588        metadata: impl Into<std::collections::HashMap<String, String>>,
589    ) -> Self {
590        self.inner.metadata = Some(metadata.into());
591        self
592    }
593    /// Whether to immediately submit evidence to the bank.
594    /// If `false`, evidence is staged on the dispute.
595    /// Staged evidence is visible in the API and Dashboard, and can be submitted to the bank by making another request with this attribute set to `true` (the default).
596    pub fn submit(mut self, submit: impl Into<bool>) -> Self {
597        self.inner.submit = Some(submit.into());
598        self
599    }
600}
601impl UpdateDispute {
602    /// Send the request and return the deserialized response.
603    pub async fn send<C: StripeClient>(
604        &self,
605        client: &C,
606    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
607        self.customize().send(client).await
608    }
609
610    /// Send the request and return the deserialized response, blocking until completion.
611    pub fn send_blocking<C: StripeBlockingClient>(
612        &self,
613        client: &C,
614    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
615        self.customize().send_blocking(client)
616    }
617}
618
619impl StripeRequest for UpdateDispute {
620    type Output = stripe_shared::Dispute;
621
622    fn build(&self) -> RequestBuilder {
623        let dispute = &self.dispute;
624        RequestBuilder::new(StripeMethod::Post, format!("/disputes/{dispute}")).form(&self.inner)
625    }
626}
627#[derive(Clone, Debug, serde::Serialize)]
628struct CloseDisputeBuilder {
629    #[serde(skip_serializing_if = "Option::is_none")]
630    expand: Option<Vec<String>>,
631}
632impl CloseDisputeBuilder {
633    fn new() -> Self {
634        Self { expand: None }
635    }
636}
637/// Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute, acknowledging it as lost.
638///
639/// The status of the dispute will change from `needs_response` to `lost`.
640/// _Closing a dispute is irreversible_.
641#[derive(Clone, Debug, serde::Serialize)]
642pub struct CloseDispute {
643    inner: CloseDisputeBuilder,
644    dispute: stripe_shared::DisputeId,
645}
646impl CloseDispute {
647    /// Construct a new `CloseDispute`.
648    pub fn new(dispute: impl Into<stripe_shared::DisputeId>) -> Self {
649        Self { dispute: dispute.into(), inner: CloseDisputeBuilder::new() }
650    }
651    /// Specifies which fields in the response should be expanded.
652    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
653        self.inner.expand = Some(expand.into());
654        self
655    }
656}
657impl CloseDispute {
658    /// Send the request and return the deserialized response.
659    pub async fn send<C: StripeClient>(
660        &self,
661        client: &C,
662    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
663        self.customize().send(client).await
664    }
665
666    /// Send the request and return the deserialized response, blocking until completion.
667    pub fn send_blocking<C: StripeBlockingClient>(
668        &self,
669        client: &C,
670    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
671        self.customize().send_blocking(client)
672    }
673}
674
675impl StripeRequest for CloseDispute {
676    type Output = stripe_shared::Dispute;
677
678    fn build(&self) -> RequestBuilder {
679        let dispute = &self.dispute;
680        RequestBuilder::new(StripeMethod::Post, format!("/disputes/{dispute}/close"))
681            .form(&self.inner)
682    }
683}
684
685#[derive(Clone, Debug, serde::Serialize)]
686pub struct ShippingAddress {
687    /// City, district, suburb, town, or village.
688    #[serde(skip_serializing_if = "Option::is_none")]
689    pub city: Option<String>,
690    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
691    #[serde(skip_serializing_if = "Option::is_none")]
692    pub country: Option<String>,
693    /// Address line 1, such as the street, PO Box, or company name.
694    #[serde(skip_serializing_if = "Option::is_none")]
695    pub line1: Option<String>,
696    /// Address line 2, such as the apartment, suite, unit, or building.
697    #[serde(skip_serializing_if = "Option::is_none")]
698    pub line2: Option<String>,
699    /// ZIP or postal code.
700    #[serde(skip_serializing_if = "Option::is_none")]
701    pub postal_code: Option<String>,
702    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
703    #[serde(skip_serializing_if = "Option::is_none")]
704    pub state: Option<String>,
705}
706impl ShippingAddress {
707    pub fn new() -> Self {
708        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
709    }
710}
711impl Default for ShippingAddress {
712    fn default() -> Self {
713        Self::new()
714    }
715}