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(Copy, Clone, Eq, PartialEq)]
434pub enum UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices
435{
436    Merchandise,
437    Services,
438}
439impl UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
440    pub fn as_str(self) -> &'static str {
441        use UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::*;
442        match self {
443Merchandise => "merchandise",
444Services => "services",
445
446        }
447    }
448}
449
450impl std::str::FromStr for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
451    type Err = stripe_types::StripeParseError;
452    fn from_str(s: &str) -> Result<Self, Self::Err> {
453        use UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices::*;
454        match s {
455    "merchandise" => Ok(Merchandise),
456"services" => Ok(Services),
457_ => Err(stripe_types::StripeParseError)
458
459        }
460    }
461}
462impl std::fmt::Display for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
463    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
464        f.write_str(self.as_str())
465    }
466}
467
468impl std::fmt::Debug for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
469    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
470        f.write_str(self.as_str())
471    }
472}
473impl serde::Serialize for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
474    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
475        serializer.serialize_str(self.as_str())
476    }
477}
478#[cfg(feature = "deserialize")]
479impl<'de> serde::Deserialize<'de> for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices {
480    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
481        use std::str::FromStr;
482        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
483        Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3DisputedTransactionMerchandiseOrServices"))
484    }
485}
486/// List of exactly two prior undisputed transaction objects for Visa Compelling Evidence 3.0 evidence submission.
487#[derive(Clone, Debug, serde::Serialize)]
488pub struct UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3PriorUndisputedTransactions {
489    /// Stripe charge ID for the Visa Compelling Evidence 3.0 eligible prior charge.
490    pub charge: String,
491    /// User Account ID used to log into business platform. Must be recognizable by the user.
492    #[serde(skip_serializing_if = "Option::is_none")]
493    pub customer_account_id: Option<String>,
494    /// Unique identifier of the cardholder’s device derived from a combination of at least two hardware and software attributes.
495    /// Must be at least 20 characters.
496    #[serde(skip_serializing_if = "Option::is_none")]
497    pub customer_device_fingerprint: Option<String>,
498    /// Unique identifier of the cardholder’s device such as a device serial number (e.g., International Mobile Equipment Identity [IMEI]).
499    /// Must be at least 15 characters.
500    #[serde(skip_serializing_if = "Option::is_none")]
501    pub customer_device_id: Option<String>,
502    /// The email address of the customer.
503    #[serde(skip_serializing_if = "Option::is_none")]
504    pub customer_email_address: Option<String>,
505    /// The IP address that the customer used when making the purchase.
506    #[serde(skip_serializing_if = "Option::is_none")]
507    pub customer_purchase_ip: Option<String>,
508    /// A description of the product or service that was sold.
509    #[serde(skip_serializing_if = "Option::is_none")]
510    pub product_description: Option<String>,
511    /// The address to which a physical product was shipped.
512    /// All fields are required for Visa Compelling Evidence 3.0 evidence submission.
513    #[serde(skip_serializing_if = "Option::is_none")]
514    pub shipping_address: Option<ShippingAddress>,
515}
516impl UpdateDisputeEvidenceEnhancedEvidenceVisaCompellingEvidence3PriorUndisputedTransactions {
517    pub fn new(charge: impl Into<String>) -> Self {
518        Self {
519            charge: charge.into(),
520            customer_account_id: None,
521            customer_device_fingerprint: None,
522            customer_device_id: None,
523            customer_email_address: None,
524            customer_purchase_ip: None,
525            product_description: None,
526            shipping_address: None,
527        }
528    }
529}
530/// Evidence provided for Visa compliance evidence submission.
531#[derive(Copy, Clone, Debug, serde::Serialize)]
532pub struct UpdateDisputeEvidenceEnhancedEvidenceVisaCompliance {
533    /// A field acknowledging the fee incurred when countering a Visa compliance dispute.
534    /// If this field is set to true, evidence can be submitted for the compliance dispute.
535    /// Stripe collects a 500 USD (or local equivalent) amount to cover the network costs associated with resolving compliance disputes.
536    /// Stripe refunds the 500 USD network fee if you win the dispute.
537    #[serde(skip_serializing_if = "Option::is_none")]
538    pub fee_acknowledged: Option<bool>,
539}
540impl UpdateDisputeEvidenceEnhancedEvidenceVisaCompliance {
541    pub fn new() -> Self {
542        Self { fee_acknowledged: None }
543    }
544}
545impl Default for UpdateDisputeEvidenceEnhancedEvidenceVisaCompliance {
546    fn default() -> Self {
547        Self::new()
548    }
549}
550/// When you get a dispute, contacting your customer is always the best first step.
551/// If that doesn’t work, you can submit evidence to help us resolve the dispute in your favor.
552/// 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.
553///
554/// Depending on your dispute type, different evidence fields will give you a better chance of winning your dispute.
555/// To figure out which evidence fields to provide, see our [guide to dispute types](https://stripe.com/docs/disputes/categories).
556#[derive(Clone, Debug, serde::Serialize)]
557pub struct UpdateDispute {
558    inner: UpdateDisputeBuilder,
559    dispute: stripe_shared::DisputeId,
560}
561impl UpdateDispute {
562    /// Construct a new `UpdateDispute`.
563    pub fn new(dispute: impl Into<stripe_shared::DisputeId>) -> Self {
564        Self { dispute: dispute.into(), inner: UpdateDisputeBuilder::new() }
565    }
566    /// Evidence to upload, to respond to a dispute.
567    /// Updating any field in the hash will submit all fields in the hash for review.
568    /// The combined character count of all fields is limited to 150,000.
569    pub fn evidence(mut self, evidence: impl Into<UpdateDisputeEvidence>) -> Self {
570        self.inner.evidence = Some(evidence.into());
571        self
572    }
573    /// Specifies which fields in the response should be expanded.
574    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
575        self.inner.expand = Some(expand.into());
576        self
577    }
578    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
579    /// This can be useful for storing additional information about the object in a structured format.
580    /// Individual keys can be unset by posting an empty value to them.
581    /// All keys can be unset by posting an empty value to `metadata`.
582    pub fn metadata(
583        mut self,
584        metadata: impl Into<std::collections::HashMap<String, String>>,
585    ) -> Self {
586        self.inner.metadata = Some(metadata.into());
587        self
588    }
589    /// Whether to immediately submit evidence to the bank.
590    /// If `false`, evidence is staged on the dispute.
591    /// 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).
592    pub fn submit(mut self, submit: impl Into<bool>) -> Self {
593        self.inner.submit = Some(submit.into());
594        self
595    }
596}
597impl UpdateDispute {
598    /// Send the request and return the deserialized response.
599    pub async fn send<C: StripeClient>(
600        &self,
601        client: &C,
602    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
603        self.customize().send(client).await
604    }
605
606    /// Send the request and return the deserialized response, blocking until completion.
607    pub fn send_blocking<C: StripeBlockingClient>(
608        &self,
609        client: &C,
610    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
611        self.customize().send_blocking(client)
612    }
613}
614
615impl StripeRequest for UpdateDispute {
616    type Output = stripe_shared::Dispute;
617
618    fn build(&self) -> RequestBuilder {
619        let dispute = &self.dispute;
620        RequestBuilder::new(StripeMethod::Post, format!("/disputes/{dispute}")).form(&self.inner)
621    }
622}
623#[derive(Clone, Debug, serde::Serialize)]
624struct CloseDisputeBuilder {
625    #[serde(skip_serializing_if = "Option::is_none")]
626    expand: Option<Vec<String>>,
627}
628impl CloseDisputeBuilder {
629    fn new() -> Self {
630        Self { expand: None }
631    }
632}
633/// 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.
634///
635/// The status of the dispute will change from `needs_response` to `lost`.
636/// _Closing a dispute is irreversible_.
637#[derive(Clone, Debug, serde::Serialize)]
638pub struct CloseDispute {
639    inner: CloseDisputeBuilder,
640    dispute: stripe_shared::DisputeId,
641}
642impl CloseDispute {
643    /// Construct a new `CloseDispute`.
644    pub fn new(dispute: impl Into<stripe_shared::DisputeId>) -> Self {
645        Self { dispute: dispute.into(), inner: CloseDisputeBuilder::new() }
646    }
647    /// Specifies which fields in the response should be expanded.
648    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
649        self.inner.expand = Some(expand.into());
650        self
651    }
652}
653impl CloseDispute {
654    /// Send the request and return the deserialized response.
655    pub async fn send<C: StripeClient>(
656        &self,
657        client: &C,
658    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
659        self.customize().send(client).await
660    }
661
662    /// Send the request and return the deserialized response, blocking until completion.
663    pub fn send_blocking<C: StripeBlockingClient>(
664        &self,
665        client: &C,
666    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
667        self.customize().send_blocking(client)
668    }
669}
670
671impl StripeRequest for CloseDispute {
672    type Output = stripe_shared::Dispute;
673
674    fn build(&self) -> RequestBuilder {
675        let dispute = &self.dispute;
676        RequestBuilder::new(StripeMethod::Post, format!("/disputes/{dispute}/close"))
677            .form(&self.inner)
678    }
679}
680
681#[derive(Clone, Debug, serde::Serialize)]
682pub struct ShippingAddress {
683    /// City, district, suburb, town, or village.
684    #[serde(skip_serializing_if = "Option::is_none")]
685    pub city: Option<String>,
686    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
687    #[serde(skip_serializing_if = "Option::is_none")]
688    pub country: Option<String>,
689    /// Address line 1, such as the street, PO Box, or company name.
690    #[serde(skip_serializing_if = "Option::is_none")]
691    pub line1: Option<String>,
692    /// Address line 2, such as the apartment, suite, unit, or building.
693    #[serde(skip_serializing_if = "Option::is_none")]
694    pub line2: Option<String>,
695    /// ZIP or postal code.
696    #[serde(skip_serializing_if = "Option::is_none")]
697    pub postal_code: Option<String>,
698    /// State, county, province, or region.
699    #[serde(skip_serializing_if = "Option::is_none")]
700    pub state: Option<String>,
701}
702impl ShippingAddress {
703    pub fn new() -> Self {
704        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
705    }
706}
707impl Default for ShippingAddress {
708    fn default() -> Self {
709        Self::new()
710    }
711}