forked from stripe/stripe-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
issuing_dispute.go
120 lines (102 loc) · 4.61 KB
/
issuing_dispute.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package stripe
import "encoding/json"
// IssuingDisputeReason is the list of possible values for status on an issuing dispute.
type IssuingDisputeReason string
// List of values that IssuingDisputeReason can take.
const (
IssuingDisputeReasonFraudulent IssuingDisputeReason = "fraudulent"
IssuingDisputeReasonOther IssuingDisputeReason = "other"
)
// IssuingDisputeStatus is the list of possible values for status on an issuing dispute.
type IssuingDisputeStatus string
// List of values that IssuingDisputeStatus can take.
const (
IssuingDisputeStatusLost IssuingDisputeStatus = "lost"
IssuingDisputeStatusUnderReview IssuingDisputeStatus = "under_review"
IssuingDisputeStatusUnsubmitted IssuingDisputeStatus = "unsubmitted"
IssuingDisputeStatusWon IssuingDisputeStatus = "won"
)
// IssuingDisputeEvidenceFraudulentParams is the subset of parameters that can be sent as evidence for an issuing dispute
// with the reason set as fraudulent.
type IssuingDisputeEvidenceFraudulentParams struct {
DisputeExplanation *string `form:"dispute_explanation"`
UncategorizedFile *string `form:"uncategorized_file"`
}
// IssuingDisputeEvidenceOtherParams is the subset of parameters that can be sent as evidence for an issuing dispute
// with the reason set as other.
type IssuingDisputeEvidenceOtherParams struct {
DisputeExplanation *string `form:"dispute_explanation"`
UncategorizedFile *string `form:"uncategorized_file"`
}
// IssuingDisputeEvidenceParams is the set of parameters that can be sent as evidence for an issuing dispute.
type IssuingDisputeEvidenceParams struct {
Fraudulent *IssuingDisputeEvidenceFraudulentParams `form:"fraudulent"`
Other *IssuingDisputeEvidenceOtherParams `form:"other"`
}
// IssuingDisputeParams is the set of parameters that can be used when creating or updating an issuing dispute.
type IssuingDisputeParams struct {
Params `form:"*"`
Amount *int64 `form:"amount"`
Evidence *IssuingDisputeEvidenceParams `form:"evidence"`
Reason *string `form:"reason"`
DisputedTransaction *string `form:"disputed_transaction"`
}
// IssuingDisputeListParams is the set of parameters that can be used when listing issuing dispute.
type IssuingDisputeListParams struct {
ListParams `form:"*"`
Created *int64 `form:"created"`
CreatedRange *RangeQueryParams `form:"created"`
Transaction *string `form:"transaction"`
}
// IssuingDisputeEvidenceFraudulent is the resource representing the evidence hash on an issuing dispute
// with the reason set as fraudulent.
type IssuingDisputeEvidenceFraudulent struct {
DisputeExplanation string `json:"dispute_explanation"`
UncategorizedFile *File `json:"uncategorized_file"`
}
// IssuingDisputeEvidenceOther is the resource representing the evidence hash on an issuing dispute
// with the reason set as other.
type IssuingDisputeEvidenceOther struct {
DisputeExplanation string `json:"dispute_explanation"`
UncategorizedFile *File `json:"uncategorized_file"`
}
// IssuingDisputeEvidence is the resource representing evidence on an issuing dispute.
type IssuingDisputeEvidence struct {
Fraudulent *IssuingDisputeEvidenceFraudulent `json:"fraudulent"`
Other *IssuingDisputeEvidenceOther `json:"other"`
}
// IssuingDispute is the resource representing an issuing dispute.
type IssuingDispute struct {
Amount int64 `json:"amount"`
Created int64 `json:"created"`
Currency Currency `json:"currency"`
Evidence *IssuingDisputeEvidence `json:"evidence"`
ID string `json:"id"`
Livemode bool `json:"livemode"`
Metadata map[string]string `json:"metadata"`
Object string `json:"object"`
Reason IssuingDisputeReason `json:"reason"`
Status IssuingDisputeStatus `json:"status"`
Transaction *IssuingTransaction `json:"transaction"`
}
// IssuingDisputeList is a list of issuing disputes as retrieved from a list endpoint.
type IssuingDisputeList struct {
ListMeta
Data []*IssuingDispute `json:"data"`
}
// UnmarshalJSON handles deserialization of an IssuingDispute.
// This custom unmarshaling is needed because the resulting
// property may be an id or the full struct if it was expanded.
func (i *IssuingDispute) UnmarshalJSON(data []byte) error {
if id, ok := ParseID(data); ok {
i.ID = id
return nil
}
type issuingDispute IssuingDispute
var v issuingDispute
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*i = IssuingDispute(v)
return nil
}