stripe/resources/
issuing_dispute_ext.rs

1use serde::{Deserialize, Serialize};
2
3/// An enum representing the possible values of an `IssuingDispute`'s `reason` field.
4#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
5#[serde(rename_all = "snake_case")]
6pub enum IssuingDisputeReason {
7    Fraudulent,
8    Other,
9}
10
11impl IssuingDisputeReason {
12    pub fn as_str(self) -> &'static str {
13        match self {
14            IssuingDisputeReason::Fraudulent => "fraudulent",
15            IssuingDisputeReason::Other => "other",
16        }
17    }
18}
19
20impl AsRef<str> for IssuingDisputeReason {
21    fn as_ref(&self) -> &str {
22        self.as_str()
23    }
24}
25
26impl std::fmt::Display for IssuingDisputeReason {
27    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
28        self.as_str().fmt(f)
29    }
30}
31
32/// An enum representing the possible values of an `IssuingDispute`'s `status` field.
33#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
34#[serde(rename_all = "snake_case")]
35pub enum IssuingDisputeStatus {
36    Lost,
37    UnderReview,
38    Unsubmitted,
39    Won,
40}
41
42impl IssuingDisputeStatus {
43    pub fn as_str(self) -> &'static str {
44        match self {
45            IssuingDisputeStatus::Lost => "lost",
46            IssuingDisputeStatus::UnderReview => "under_review",
47            IssuingDisputeStatus::Unsubmitted => "unsubmitted",
48            IssuingDisputeStatus::Won => "won",
49        }
50    }
51}
52
53impl AsRef<str> for IssuingDisputeStatus {
54    fn as_ref(&self) -> &str {
55        self.as_str()
56    }
57}
58
59impl std::fmt::Display for IssuingDisputeStatus {
60    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
61        self.as_str().fmt(f)
62    }
63}
64
65impl std::default::Default for IssuingDisputeStatus {
66    fn default() -> Self {
67        Self::Unsubmitted
68    }
69}