stripe/resources/generated/
issuing_dispute.rs

1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use crate::ids::IssuingDisputeId;
6use crate::params::{Expandable, Metadata, Object, Timestamp};
7use crate::resources::{
8    BalanceTransaction, Currency, File, IssuingDisputeStatus, IssuingTransaction,
9};
10use serde::{Deserialize, Serialize};
11
12/// The resource representing a Stripe "IssuingDispute".
13///
14/// For more details see <https://stripe.com/docs/api/issuing/disputes/object>
15#[derive(Clone, Debug, Default, Deserialize, Serialize)]
16pub struct IssuingDispute {
17    /// Unique identifier for the object.
18    pub id: IssuingDisputeId,
19
20    /// Disputed amount in the card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
21    ///
22    /// Usually the amount of the `transaction`, but can differ (usually because of currency fluctuation).
23    pub amount: i64,
24
25    /// List of balance transactions associated with the dispute.
26    pub balance_transactions: Option<Vec<BalanceTransaction>>,
27
28    /// Time at which the object was created.
29    ///
30    /// Measured in seconds since the Unix epoch.
31    pub created: Timestamp,
32
33    /// The currency the `transaction` was made in.
34    pub currency: Currency,
35
36    pub evidence: IssuingDisputeEvidence,
37
38    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
39    pub livemode: bool,
40
41    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
42    ///
43    /// This can be useful for storing additional information about the object in a structured format.
44    pub metadata: Metadata,
45
46    /// Current status of the dispute.
47    pub status: IssuingDisputeStatus,
48
49    /// The transaction being disputed.
50    pub transaction: Expandable<IssuingTransaction>,
51
52    /// [Treasury](https://stripe.com/docs/api/treasury) details related to this dispute if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts.
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub treasury: Option<IssuingDisputeTreasury>,
55}
56
57impl Object for IssuingDispute {
58    type Id = IssuingDisputeId;
59    fn id(&self) -> Self::Id {
60        self.id.clone()
61    }
62    fn object(&self) -> &'static str {
63        "issuing.dispute"
64    }
65}
66
67#[derive(Clone, Debug, Default, Deserialize, Serialize)]
68pub struct IssuingDisputeEvidence {
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub canceled: Option<IssuingDisputeCanceledEvidence>,
71
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub duplicate: Option<IssuingDisputeDuplicateEvidence>,
74
75    #[serde(skip_serializing_if = "Option::is_none")]
76    pub fraudulent: Option<IssuingDisputeFraudulentEvidence>,
77
78    #[serde(skip_serializing_if = "Option::is_none")]
79    pub merchandise_not_as_described: Option<IssuingDisputeMerchandiseNotAsDescribedEvidence>,
80
81    #[serde(skip_serializing_if = "Option::is_none")]
82    pub not_received: Option<IssuingDisputeNotReceivedEvidence>,
83
84    #[serde(skip_serializing_if = "Option::is_none")]
85    pub other: Option<IssuingDisputeOtherEvidence>,
86
87    /// The reason for filing the dispute.
88    ///
89    /// Its value will match the field containing the evidence.
90    pub reason: IssuingDisputeEvidenceReason,
91
92    #[serde(skip_serializing_if = "Option::is_none")]
93    pub service_not_as_described: Option<IssuingDisputeServiceNotAsDescribedEvidence>,
94}
95
96#[derive(Clone, Debug, Default, Deserialize, Serialize)]
97pub struct IssuingDisputeCanceledEvidence {
98    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute.
99    pub additional_documentation: Option<Expandable<File>>,
100
101    /// Date when order was canceled.
102    pub canceled_at: Option<Timestamp>,
103
104    /// Whether the cardholder was provided with a cancellation policy.
105    pub cancellation_policy_provided: Option<bool>,
106
107    /// Reason for canceling the order.
108    pub cancellation_reason: Option<String>,
109
110    /// Date when the cardholder expected to receive the product.
111    pub expected_at: Option<Timestamp>,
112
113    /// Explanation of why the cardholder is disputing this transaction.
114    pub explanation: Option<String>,
115
116    /// Description of the merchandise or service that was purchased.
117    pub product_description: Option<String>,
118
119    /// Whether the product was a merchandise or service.
120    pub product_type: Option<IssuingDisputeCanceledEvidenceProductType>,
121
122    /// Result of cardholder's attempt to return the product.
123    pub return_status: Option<IssuingDisputeCanceledEvidenceReturnStatus>,
124
125    /// Date when the product was returned or attempted to be returned.
126    pub returned_at: Option<Timestamp>,
127}
128
129#[derive(Clone, Debug, Default, Deserialize, Serialize)]
130pub struct IssuingDisputeDuplicateEvidence {
131    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute.
132    pub additional_documentation: Option<Expandable<File>>,
133
134    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the card statement showing that the product had already been paid for.
135    pub card_statement: Option<Expandable<File>>,
136
137    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the receipt showing that the product had been paid for in cash.
138    pub cash_receipt: Option<Expandable<File>>,
139
140    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Image of the front and back of the check that was used to pay for the product.
141    pub check_image: Option<Expandable<File>>,
142
143    /// Explanation of why the cardholder is disputing this transaction.
144    pub explanation: Option<String>,
145
146    /// Transaction (e.g., ipi_...) that the disputed transaction is a duplicate of.
147    ///
148    /// Of the two or more transactions that are copies of each other, this is original undisputed one.
149    pub original_transaction: Option<String>,
150}
151
152#[derive(Clone, Debug, Default, Deserialize, Serialize)]
153pub struct IssuingDisputeFraudulentEvidence {
154    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute.
155    pub additional_documentation: Option<Expandable<File>>,
156
157    /// Explanation of why the cardholder is disputing this transaction.
158    pub explanation: Option<String>,
159}
160
161#[derive(Clone, Debug, Default, Deserialize, Serialize)]
162pub struct IssuingDisputeMerchandiseNotAsDescribedEvidence {
163    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute.
164    pub additional_documentation: Option<Expandable<File>>,
165
166    /// Explanation of why the cardholder is disputing this transaction.
167    pub explanation: Option<String>,
168
169    /// Date when the product was received.
170    pub received_at: Option<Timestamp>,
171
172    /// Description of the cardholder's attempt to return the product.
173    pub return_description: Option<String>,
174
175    /// Result of cardholder's attempt to return the product.
176    pub return_status: Option<IssuingDisputeMerchandiseNotAsDescribedEvidenceReturnStatus>,
177
178    /// Date when the product was returned or attempted to be returned.
179    pub returned_at: Option<Timestamp>,
180}
181
182#[derive(Clone, Debug, Default, Deserialize, Serialize)]
183pub struct IssuingDisputeNotReceivedEvidence {
184    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute.
185    pub additional_documentation: Option<Expandable<File>>,
186
187    /// Date when the cardholder expected to receive the product.
188    pub expected_at: Option<Timestamp>,
189
190    /// Explanation of why the cardholder is disputing this transaction.
191    pub explanation: Option<String>,
192
193    /// Description of the merchandise or service that was purchased.
194    pub product_description: Option<String>,
195
196    /// Whether the product was a merchandise or service.
197    pub product_type: Option<IssuingDisputeNotReceivedEvidenceProductType>,
198}
199
200#[derive(Clone, Debug, Default, Deserialize, Serialize)]
201pub struct IssuingDisputeOtherEvidence {
202    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute.
203    pub additional_documentation: Option<Expandable<File>>,
204
205    /// Explanation of why the cardholder is disputing this transaction.
206    pub explanation: Option<String>,
207
208    /// Description of the merchandise or service that was purchased.
209    pub product_description: Option<String>,
210
211    /// Whether the product was a merchandise or service.
212    pub product_type: Option<IssuingDisputeOtherEvidenceProductType>,
213}
214
215#[derive(Clone, Debug, Default, Deserialize, Serialize)]
216pub struct IssuingDisputeServiceNotAsDescribedEvidence {
217    /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute.
218    pub additional_documentation: Option<Expandable<File>>,
219
220    /// Date when order was canceled.
221    pub canceled_at: Option<Timestamp>,
222
223    /// Reason for canceling the order.
224    pub cancellation_reason: Option<String>,
225
226    /// Explanation of why the cardholder is disputing this transaction.
227    pub explanation: Option<String>,
228
229    /// Date when the product was received.
230    pub received_at: Option<Timestamp>,
231}
232
233#[derive(Clone, Debug, Default, Deserialize, Serialize)]
234pub struct IssuingDisputeTreasury {
235    /// The Treasury [DebitReversal](https://stripe.com/docs/api/treasury/debit_reversals) representing this Issuing dispute.
236    pub debit_reversal: Option<String>,
237
238    /// The Treasury [ReceivedDebit](https://stripe.com/docs/api/treasury/received_debits) that is being disputed.
239    pub received_debit: String,
240}
241
242/// An enum representing the possible values of an `IssuingDisputeCanceledEvidence`'s `product_type` field.
243#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
244#[serde(rename_all = "snake_case")]
245pub enum IssuingDisputeCanceledEvidenceProductType {
246    Merchandise,
247    Service,
248}
249
250impl IssuingDisputeCanceledEvidenceProductType {
251    pub fn as_str(self) -> &'static str {
252        match self {
253            IssuingDisputeCanceledEvidenceProductType::Merchandise => "merchandise",
254            IssuingDisputeCanceledEvidenceProductType::Service => "service",
255        }
256    }
257}
258
259impl AsRef<str> for IssuingDisputeCanceledEvidenceProductType {
260    fn as_ref(&self) -> &str {
261        self.as_str()
262    }
263}
264
265impl std::fmt::Display for IssuingDisputeCanceledEvidenceProductType {
266    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
267        self.as_str().fmt(f)
268    }
269}
270impl std::default::Default for IssuingDisputeCanceledEvidenceProductType {
271    fn default() -> Self {
272        Self::Merchandise
273    }
274}
275
276/// An enum representing the possible values of an `IssuingDisputeCanceledEvidence`'s `return_status` field.
277#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
278#[serde(rename_all = "snake_case")]
279pub enum IssuingDisputeCanceledEvidenceReturnStatus {
280    MerchantRejected,
281    Successful,
282}
283
284impl IssuingDisputeCanceledEvidenceReturnStatus {
285    pub fn as_str(self) -> &'static str {
286        match self {
287            IssuingDisputeCanceledEvidenceReturnStatus::MerchantRejected => "merchant_rejected",
288            IssuingDisputeCanceledEvidenceReturnStatus::Successful => "successful",
289        }
290    }
291}
292
293impl AsRef<str> for IssuingDisputeCanceledEvidenceReturnStatus {
294    fn as_ref(&self) -> &str {
295        self.as_str()
296    }
297}
298
299impl std::fmt::Display for IssuingDisputeCanceledEvidenceReturnStatus {
300    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
301        self.as_str().fmt(f)
302    }
303}
304impl std::default::Default for IssuingDisputeCanceledEvidenceReturnStatus {
305    fn default() -> Self {
306        Self::MerchantRejected
307    }
308}
309
310/// An enum representing the possible values of an `IssuingDisputeEvidence`'s `reason` field.
311#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
312#[serde(rename_all = "snake_case")]
313pub enum IssuingDisputeEvidenceReason {
314    Canceled,
315    Duplicate,
316    Fraudulent,
317    MerchandiseNotAsDescribed,
318    NotReceived,
319    Other,
320    ServiceNotAsDescribed,
321}
322
323impl IssuingDisputeEvidenceReason {
324    pub fn as_str(self) -> &'static str {
325        match self {
326            IssuingDisputeEvidenceReason::Canceled => "canceled",
327            IssuingDisputeEvidenceReason::Duplicate => "duplicate",
328            IssuingDisputeEvidenceReason::Fraudulent => "fraudulent",
329            IssuingDisputeEvidenceReason::MerchandiseNotAsDescribed => {
330                "merchandise_not_as_described"
331            }
332            IssuingDisputeEvidenceReason::NotReceived => "not_received",
333            IssuingDisputeEvidenceReason::Other => "other",
334            IssuingDisputeEvidenceReason::ServiceNotAsDescribed => "service_not_as_described",
335        }
336    }
337}
338
339impl AsRef<str> for IssuingDisputeEvidenceReason {
340    fn as_ref(&self) -> &str {
341        self.as_str()
342    }
343}
344
345impl std::fmt::Display for IssuingDisputeEvidenceReason {
346    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
347        self.as_str().fmt(f)
348    }
349}
350impl std::default::Default for IssuingDisputeEvidenceReason {
351    fn default() -> Self {
352        Self::Canceled
353    }
354}
355
356/// An enum representing the possible values of an `IssuingDisputeMerchandiseNotAsDescribedEvidence`'s `return_status` field.
357#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
358#[serde(rename_all = "snake_case")]
359pub enum IssuingDisputeMerchandiseNotAsDescribedEvidenceReturnStatus {
360    MerchantRejected,
361    Successful,
362}
363
364impl IssuingDisputeMerchandiseNotAsDescribedEvidenceReturnStatus {
365    pub fn as_str(self) -> &'static str {
366        match self {
367            IssuingDisputeMerchandiseNotAsDescribedEvidenceReturnStatus::MerchantRejected => {
368                "merchant_rejected"
369            }
370            IssuingDisputeMerchandiseNotAsDescribedEvidenceReturnStatus::Successful => "successful",
371        }
372    }
373}
374
375impl AsRef<str> for IssuingDisputeMerchandiseNotAsDescribedEvidenceReturnStatus {
376    fn as_ref(&self) -> &str {
377        self.as_str()
378    }
379}
380
381impl std::fmt::Display for IssuingDisputeMerchandiseNotAsDescribedEvidenceReturnStatus {
382    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
383        self.as_str().fmt(f)
384    }
385}
386impl std::default::Default for IssuingDisputeMerchandiseNotAsDescribedEvidenceReturnStatus {
387    fn default() -> Self {
388        Self::MerchantRejected
389    }
390}
391
392/// An enum representing the possible values of an `IssuingDisputeNotReceivedEvidence`'s `product_type` field.
393#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
394#[serde(rename_all = "snake_case")]
395pub enum IssuingDisputeNotReceivedEvidenceProductType {
396    Merchandise,
397    Service,
398}
399
400impl IssuingDisputeNotReceivedEvidenceProductType {
401    pub fn as_str(self) -> &'static str {
402        match self {
403            IssuingDisputeNotReceivedEvidenceProductType::Merchandise => "merchandise",
404            IssuingDisputeNotReceivedEvidenceProductType::Service => "service",
405        }
406    }
407}
408
409impl AsRef<str> for IssuingDisputeNotReceivedEvidenceProductType {
410    fn as_ref(&self) -> &str {
411        self.as_str()
412    }
413}
414
415impl std::fmt::Display for IssuingDisputeNotReceivedEvidenceProductType {
416    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
417        self.as_str().fmt(f)
418    }
419}
420impl std::default::Default for IssuingDisputeNotReceivedEvidenceProductType {
421    fn default() -> Self {
422        Self::Merchandise
423    }
424}
425
426/// An enum representing the possible values of an `IssuingDisputeOtherEvidence`'s `product_type` field.
427#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
428#[serde(rename_all = "snake_case")]
429pub enum IssuingDisputeOtherEvidenceProductType {
430    Merchandise,
431    Service,
432}
433
434impl IssuingDisputeOtherEvidenceProductType {
435    pub fn as_str(self) -> &'static str {
436        match self {
437            IssuingDisputeOtherEvidenceProductType::Merchandise => "merchandise",
438            IssuingDisputeOtherEvidenceProductType::Service => "service",
439        }
440    }
441}
442
443impl AsRef<str> for IssuingDisputeOtherEvidenceProductType {
444    fn as_ref(&self) -> &str {
445        self.as_str()
446    }
447}
448
449impl std::fmt::Display for IssuingDisputeOtherEvidenceProductType {
450    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
451        self.as_str().fmt(f)
452    }
453}
454impl std::default::Default for IssuingDisputeOtherEvidenceProductType {
455    fn default() -> Self {
456        Self::Merchandise
457    }
458}