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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
//! The evidence buyers hand in for a shop's cases, as the shop's team reads
//! and reviews it.
use serde::Deserialize;
use serde_json::Value;
use crate::core::models::buyer_case::BuyerEvidenceFile;
/// A case with buyer evidence, as the review queue lists it.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct BuyerEvidenceSummary {
/// The evidence's id.
pub id: String,
/// The merchant.
pub merchant_id: String,
/// The shop.
pub profile_id: String,
/// The buyer.
pub customer_id: String,
/// `refund_request` or `dispute`.
pub case_kind: String,
/// For example `refund_request`, `inquiry`, `dispute` or
/// `bank_chargeback`.
pub case_category: String,
/// When the case was opened, ISO 8601.
pub case_opened_at: String,
/// Whether the case is a test case.
pub test_mode: bool,
/// `awaiting_buyer`, `awaiting_review`, `information_requested` or
/// `reviewed`.
pub state: String,
/// Who acts next: `buyer`, `reviewer` or `nobody`.
pub next_actor: String,
/// When the buyer's evidence is due, ISO 8601.
#[serde(default)]
pub buyer_due_at: Option<String>,
/// `initial` or `supplement`.
#[serde(default)]
pub buyer_due_kind: Option<String>,
/// When the review is due, ISO 8601.
#[serde(default)]
pub review_due_at: Option<String>,
/// Whether the next step is overdue.
pub overdue: bool,
/// The reviewer.
#[serde(default)]
pub reviewer_id: Option<String>,
/// The review's result: `supports_buyer`, `does_not_support_buyer` or
/// `inconclusive`.
#[serde(default)]
pub outcome: Option<String>,
/// When the buyer asked for more time, ISO 8601.
#[serde(default)]
pub extension_requested_at: Option<String>,
/// Where the evidence policy came from.
pub policy_source: String,
/// ISO 8601 creation timestamp.
pub created_at: String,
/// ISO 8601 last-modification timestamp.
pub modified_at: String,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// The shop's cases with buyer evidence, the nearest target first.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct BuyerEvidenceQueue {
/// The cases on this page.
#[serde(default)]
pub data: Vec<BuyerEvidenceSummary>,
/// Every case matching the filters.
pub total: i64,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// The evidence policy that applied when the evidence was first opened.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct BuyerEvidencePolicy {
/// The case categories the policy covers.
#[serde(default)]
pub case_categories: Vec<String>,
/// The most files a buyer may hand in.
pub max_files: i64,
/// The largest file, in megabytes.
pub max_file_megabytes: i64,
/// The file types accepted: `pdf`, `png`, `jpeg`, `webp`, `text`.
#[serde(default)]
pub file_types: Vec<String>,
/// Whether the buyer must explain in writing.
pub explanation_required: bool,
/// Hours the buyer has for the first evidence.
pub initial_hours: i64,
/// Hours the buyer has to answer a request for more.
pub supplement_hours: i64,
/// Hours the review should take.
pub review_target_hours: i64,
/// Hours before a cut-off the buyer is reminded.
#[serde(default)]
pub reminder_hours: Option<i64>,
/// What the shop may do: `none`, `view` or `review`.
pub merchant_access: String,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A file of the evidence, as the review reads it.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct BuyerEvidenceReviewFile {
/// The file's id.
pub id: String,
/// The file's name.
pub file_name: String,
/// `pdf`, `png`, `jpeg`, `webp` or `text`.
pub file_type: String,
/// The file's size in bytes.
pub size_bytes: i64,
/// When it was uploaded, ISO 8601.
pub uploaded_at: String,
/// Whether the buyer submitted it.
pub submitted: bool,
/// The file's SHA-256 digest, hex-encoded.
pub sha256: String,
/// When the file was removed, ISO 8601.
#[serde(default)]
pub removed_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// One step of the evidence's history.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct BuyerEvidenceReviewEntry {
/// The step's id.
pub id: String,
/// What happened.
pub kind: String,
/// Who took the step.
pub actor: String,
/// When, ISO 8601.
pub at: String,
/// The step's text.
#[serde(default)]
pub body: Option<String>,
/// Why, for a step that carries a reason.
#[serde(default)]
pub reason: Option<String>,
/// The cut-off the step set, ISO 8601.
#[serde(default)]
pub due_at: Option<String>,
/// The cut-off the step replaced, ISO 8601.
#[serde(default)]
pub previous_due_at: Option<String>,
/// The result a review step recorded.
#[serde(default)]
pub outcome: Option<String>,
/// Files attached to the step.
#[serde(default)]
pub files: Vec<BuyerEvidenceFile>,
/// The user who took the step, for a reviewer or the shop's team.
#[serde(default)]
pub actor_id: Option<String>,
/// Whether the buyer sees the step.
pub public: bool,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// One case with its evidence, history and files.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct BuyerEvidenceReviewDetail {
/// The evidence's id.
pub id: String,
/// The merchant.
pub merchant_id: String,
/// The shop.
pub profile_id: String,
/// The buyer.
pub customer_id: String,
/// `refund_request` or `dispute`.
pub case_kind: String,
/// For example `refund_request`, `inquiry`, `dispute` or
/// `bank_chargeback`.
pub case_category: String,
/// When the case was opened, ISO 8601.
pub case_opened_at: String,
/// Whether the case is a test case.
pub test_mode: bool,
/// `awaiting_buyer`, `awaiting_review`, `information_requested` or
/// `reviewed`.
pub state: String,
/// Who acts next: `buyer`, `reviewer` or `nobody`.
pub next_actor: String,
/// When the buyer's evidence is due, ISO 8601.
#[serde(default)]
pub buyer_due_at: Option<String>,
/// `initial` or `supplement`.
#[serde(default)]
pub buyer_due_kind: Option<String>,
/// When the review is due, ISO 8601.
#[serde(default)]
pub review_due_at: Option<String>,
/// Whether the next step is overdue.
pub overdue: bool,
/// The reviewer.
#[serde(default)]
pub reviewer_id: Option<String>,
/// The review's result.
#[serde(default)]
pub outcome: Option<String>,
/// When the buyer asked for more time, ISO 8601.
#[serde(default)]
pub extension_requested_at: Option<String>,
/// Where the evidence policy came from.
pub policy_source: String,
/// ISO 8601 creation timestamp.
pub created_at: String,
/// ISO 8601 last-modification timestamp.
pub modified_at: String,
/// The case as the buyer's case list shows it, kept as raw JSON. `None`
/// when it can no longer be read.
#[serde(default)]
pub case: Option<Value>,
/// The policy that applied when the evidence was first opened.
pub policy: BuyerEvidencePolicy,
/// Every step, oldest first.
#[serde(default)]
pub history: Vec<BuyerEvidenceReviewEntry>,
/// Every file of the evidence.
#[serde(default)]
pub files: Vec<BuyerEvidenceReviewFile>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}