-
Notifications
You must be signed in to change notification settings - Fork 69
/
disputes.d.ts
189 lines (176 loc) · 4.56 KB
/
disputes.d.ts
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
// eslint-disable-next-line wpcalypso/import-docblock
import { Charge } from './charges';
import { BalanceTransaction } from './balance-transactions';
import { TableCardColumn } from '@woocommerce/components';
interface Evidence {
[ key: string ]:
| string
| Record< string, boolean >
| Record< string, string >;
}
interface EvidenceDetails {
/**
* Whether evidence has been staged for this dispute.
*/
has_evidence: boolean;
/**
* Date by which evidence must be submitted in order to successfully challenge dispute.
*/
due_by: number;
/**
* Whether the last evidence submission was submitted past the due date. Defaults to false if no evidence submissions have occurred. If true, then delivery of the latest evidence is not guaranteed.
*/
past_due: boolean;
/**
* The number of times evidence has been submitted. Typically, the merchant may only submit evidence once.
*/
submission_count: number;
}
/**
* See https://stripe.com/docs/api/disputes/object#dispute_object-issuer_evidence
*/
interface IssuerEvidence {
/**
* Type of issuer evidence supplied.
*/
evidence_type: 'retrieval' | 'chargeback' | 'response';
/**
* List of up to 5 (ID of a file upload) File-based issuer evidence.
*/
file_evidence: string[];
/**
* Free-form, text-based issuer evidence.
*/
text_evidence: string | null;
}
export type DisputeReason =
| 'bank_cannot_process'
| 'check_returned'
| 'credit_not_processed'
| 'customer_initiated'
| 'debit_not_authorized'
| 'duplicate'
| 'fraudulent'
| 'general'
| 'incorrect_account_details'
| 'insufficient_funds'
| 'product_not_received'
| 'product_unacceptable'
| 'subscription_canceled'
| 'unrecognized';
export type DisputeStatus =
| 'warning_needs_response'
| 'warning_under_review'
| 'warning_closed'
| 'needs_response'
| 'under_review'
| 'charge_refunded'
| 'won'
| 'lost';
export interface Dispute {
status: DisputeStatus;
id: string;
evidence_details?: EvidenceDetails;
metadata: {
/* eslint-disable @typescript-eslint/naming-convention -- required to allow underscores in keys */
/**
* '1' if the dispute was closed/accepted by the merchant, '0' if the dispute was closed by Stripe.
*/
__closed_by_merchant?: '1' | '0';
/**
* Unix timestamp of when the dispute was closed.
*/
__dispute_closed_at?: string;
/**
* Unix timestamp of when dispute evidence was submitted.
*/
__evidence_submitted_at?: string;
/* eslint-enable @typescript-eslint/naming-convention */
};
order: null | OrderDetails;
evidence: Evidence;
issuer_evidence: IssuerEvidence | null;
fileSize?: Record< string, number >;
reason: DisputeReason;
charge: Charge | string;
amount: number;
currency: string;
created: number;
/**
* List of zero, one, or two balance transactions that show funds withdrawn and reinstated to the Stripe account as a result of this dispute.
* One balance transaction with `reporting_category: 'dispute'` will be present if funds have been withdrawn from the account.
* A second balance transaction with the `reporting_category: 'dispute_reversal'` will be present if funds have been reinstated to the account.
*/
balance_transactions: BalanceTransaction[];
payment_intent: string;
}
export interface CachedDispute {
wcpay_disputes_cache_id: number;
stripe_account_id: string;
dispute_id: string;
charge_id: string;
amount: number;
currency: string;
reason: DisputeReason;
source: string;
order_number: number;
order: null | OrderDetails;
customer_name: string;
customer_email: string;
customer_country: string;
status: DisputeStatus;
created: string;
due_by: string;
}
interface UploadFieldObject {
key: string;
label: string;
}
export interface FileUploadControlProps {
field: UploadFieldObject;
fileName: string;
disabled?: boolean;
isDone: boolean;
isLoading: boolean;
accept: string;
error?: string;
onFileChange( key: string, file: File ): Promise< void >;
onFileRemove( key: string ): void;
help?: string;
showPreview?: boolean;
uploadButtonLabel?: string;
type?: string;
}
export interface DisputesSummary {
disputesSummary: {
count?: number;
currencies?: string[];
};
isLoading: boolean;
}
export interface Disputes {
disputes: Dispute[];
isLoading: boolean;
}
export interface CachedDisputes {
disputes: CachedDispute[];
isLoading: boolean;
}
export interface DisputesTableHeader extends TableCardColumn {
key:
| 'details'
| 'amount'
| 'currency'
| 'status'
| 'reason'
| 'source'
| 'order'
| 'customerName'
| 'customerEmail'
| 'customerCountry'
| 'created'
| 'dueBy'
| 'action';
cellClassName?: string;
visible?: boolean;
}