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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
//! Identity verification (KYC, KYB, AML screening, age, proof of address)
//! through a connected identity verification provider account, and the
//! transaction screening and device intelligence of that account.
use serde::Deserialize;
use serde_json::Value;
/// What a provider charged, or is estimated to charge.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct ProviderCost {
/// The amount, in the currency's minor unit.
pub amount: i64,
/// Three-letter ISO 4217 currency code.
#[serde(default)]
pub currency: Option<String>,
/// `reported` or `estimated`.
pub basis: String,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// One check of a verification and its result.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct VerificationCheck {
/// The check.
pub check: String,
/// The check's result.
pub outcome: String,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A verification subject's ongoing AML monitoring.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct AmlMonitoring {
/// Whether monitoring is switched on.
pub enabled: bool,
/// Whether the provider confirmed it monitors the subject.
#[serde(default)]
pub monitored_by_provider: Option<bool>,
/// When monitoring was last switched, ISO 8601.
#[serde(default)]
pub changed_at: Option<String>,
/// `clear`, `in_review` or `hit`.
#[serde(default)]
pub status: Option<String>,
/// How many list hits the provider reports.
#[serde(default)]
pub hits: Option<i64>,
/// When the status last changed, ISO 8601.
#[serde(default)]
pub status_changed_at: Option<String>,
/// What monitoring costs a year.
#[serde(default)]
pub yearly_cost: Option<ProviderCost>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A verification.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct IdentityVerificationResponse {
/// The verification's id.
pub verification_id: String,
/// The shop.
pub profile_id: String,
/// The provider account it runs on.
pub merchant_connector_id: String,
/// The provider.
pub connector: String,
/// `person`, `business`, `aml_screening`, `age`, `proof_of_address` or
/// `payment_method_ownership`.
pub kind: String,
/// Your own id for the person or business.
pub subject_reference: String,
/// The payment that asked for the verification.
#[serde(default)]
pub payment_id: Option<String>,
/// Whether it runs on the account's test credentials.
pub test_mode: bool,
/// The provider-side workflow.
pub provider_flow_id: String,
/// The provider's id for the verification.
#[serde(default)]
pub provider_reference: Option<String>,
/// `pending`, `verified`, `rejected`, `needs_review`, `expired` or
/// `abandoned`.
pub outcome: String,
/// The checks the provider ran.
#[serde(default)]
pub checks: Vec<VerificationCheck>,
/// The provider's page for the subject.
#[serde(default)]
pub verification_url: Option<String>,
/// What the provider charged.
#[serde(default)]
pub provider_cost: Option<ProviderCost>,
/// The subject's ongoing AML monitoring.
pub aml_monitoring: AmlMonitoring,
/// ISO 8601 creation timestamp.
pub created_at: String,
/// ISO 8601 last-modification timestamp.
pub modified_at: String,
/// ISO 8601 completion timestamp.
#[serde(default)]
pub completed_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// One page of verifications, newest first.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct IdentityVerificationListResponse {
/// How many verifications are on this page.
pub count: i64,
/// Every verification matching the filters.
pub total_count: i64,
/// The verifications.
#[serde(default)]
pub data: Vec<IdentityVerificationResponse>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A provider-side workflow an account can run.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct IdentityVerificationFlow {
/// The workflow's id, to pass as `provider_flow_id`.
pub flow_id: String,
/// The workflow's name.
pub name: String,
/// The kind of verification it runs, when known.
#[serde(default)]
pub kind: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// The workflows an account can run in one environment.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct IdentityVerificationFlowsResponse {
/// The provider account.
pub merchant_connector_id: String,
/// Whether these are the test credentials' workflows.
pub test_mode: bool,
/// The workflows.
#[serde(default)]
pub flows: Vec<IdentityVerificationFlow>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A subject's latest verification.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct SubjectVerification {
/// The verification's id.
pub verification_id: String,
/// The kind of verification.
pub kind: String,
/// The verification's result.
pub outcome: String,
/// The checks the provider ran.
#[serde(default)]
pub checks: Vec<VerificationCheck>,
/// Whether it ran on test credentials.
pub test_mode: bool,
/// ISO 8601 creation timestamp.
pub created_at: String,
/// ISO 8601 completion timestamp.
#[serde(default)]
pub completed_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A subject's verification under ongoing AML monitoring.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct SubjectAmlMonitoring {
/// The monitored verification.
pub verification_id: String,
/// The kind of verification.
pub kind: String,
/// The verification's result.
pub outcome: String,
/// Whether it ran on test credentials.
pub test_mode: bool,
/// Whether the provider confirmed it monitors the subject.
#[serde(default)]
pub monitored_by_provider: Option<bool>,
/// `clear`, `in_review` or `hit`.
#[serde(default)]
pub status: Option<String>,
/// How many list hits the provider reports.
#[serde(default)]
pub hits: Option<i64>,
/// When the status last changed, ISO 8601.
#[serde(default)]
pub status_changed_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A subject's latest verification and AML monitoring in one environment.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct SubjectVerificationResponse {
/// Your own id for the person or business.
pub subject_reference: String,
/// The latest verification, or `None` when the subject has none.
#[serde(default)]
pub verification: Option<SubjectVerification>,
/// The verification under monitoring, or `None`.
#[serde(default)]
pub aml_monitoring: Option<SubjectAmlMonitoring>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// One change of a monitored subject's AML result.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct AmlEvent {
/// The event's id.
pub event_id: String,
/// The status before.
#[serde(default)]
pub previous_status: Option<String>,
/// The status after.
#[serde(default)]
pub status: Option<String>,
/// The hits before.
#[serde(default)]
pub previous_hits: Option<i64>,
/// The hits after.
#[serde(default)]
pub hits: Option<i64>,
/// The verification's result before.
pub previous_outcome: String,
/// The verification's result after.
pub outcome: String,
/// ISO 8601 timestamp.
pub created_at: String,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// Every change of a monitored subject's AML result, newest first.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct AmlEventListResponse {
/// The verification.
pub verification_id: String,
/// The events, at most 100.
#[serde(default)]
pub data: Vec<AmlEvent>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A payment's transaction screening.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct PaymentScreeningResponse {
/// The payment.
pub payment_id: String,
/// The shop.
pub profile_id: String,
/// The screening account.
pub merchant_connector_id: String,
/// The provider.
pub connector: String,
/// Whether the payment is a test payment.
pub test_mode: bool,
/// `pending`, `approved`, `in_review`, `declined` or `not_screened`.
pub outcome: String,
/// Why it was not screened.
#[serde(default)]
pub not_screened_reason: Option<String>,
/// The provider's risk score.
#[serde(default)]
pub risk_score: Option<i64>,
/// The provider's id for the screening.
#[serde(default)]
pub provider_reference: Option<String>,
/// What the provider charged.
#[serde(default)]
pub provider_cost: Option<ProviderCost>,
/// ISO 8601 creation timestamp.
pub created_at: String,
/// ISO 8601 screening timestamp.
#[serde(default)]
pub screened_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A refund's or payout's transaction screening.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct OperationScreeningResponse {
/// `payment`, `refund` or `payout`.
pub operation: String,
/// The refund or payout.
pub operation_id: String,
/// The payment it belongs to.
#[serde(default)]
pub payment_id: Option<String>,
/// The shop.
pub profile_id: String,
/// The screening account.
pub merchant_connector_id: String,
/// The provider.
pub connector: String,
/// Whether the operation is a test operation.
pub test_mode: bool,
/// `pending`, `approved`, `in_review`, `declined` or `not_screened`.
pub outcome: String,
/// Why it was not screened.
#[serde(default)]
pub not_screened_reason: Option<String>,
/// The provider's risk score.
#[serde(default)]
pub risk_score: Option<i64>,
/// The provider's id for the screening.
#[serde(default)]
pub provider_reference: Option<String>,
/// What the provider charged.
#[serde(default)]
pub provider_cost: Option<ProviderCost>,
/// ISO 8601 creation timestamp.
pub created_at: String,
/// ISO 8601 screening timestamp.
#[serde(default)]
pub screened_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// Whether an account screens its shop's payments.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct PaymentScreeningSettingResponse {
/// The provider account.
pub merchant_connector_id: String,
/// The account's shop.
pub profile_id: String,
/// Whether screening is switched on.
pub enabled: bool,
/// When it was switched on, ISO 8601.
#[serde(default)]
pub enabled_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// Whether an account assesses its shop's checkout devices.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct DeviceIntelligenceSettingResponse {
/// The provider account.
pub merchant_connector_id: String,
/// The account's shop.
pub profile_id: String,
/// Whether device intelligence is switched on.
pub enabled: bool,
/// When it was switched on, ISO 8601.
#[serde(default)]
pub enabled_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A payment's device signal from its checkout's device assessment.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct DeviceSignalResponse {
/// The payment.
pub payment_id: String,
/// The shop.
pub profile_id: String,
/// The device intelligence account.
pub merchant_connector_id: String,
/// The provider.
pub connector: String,
/// Whether the payment is a test payment.
pub test_mode: bool,
/// `pending`, `assessing`, `recorded` or `not_recorded`.
pub outcome: String,
/// Why no signal was recorded.
#[serde(default)]
pub not_recorded_reason: Option<String>,
/// The provider's risk score.
#[serde(default)]
pub risk_score: Option<i64>,
/// The country of the buyer's IP address.
#[serde(default)]
pub ip_country: Option<String>,
/// Risk labels, for example `vpn`, `tor` or `bot`.
#[serde(default)]
pub risk_labels: Vec<String>,
/// The provider's id for the device.
#[serde(default)]
pub provider_device_id: Option<String>,
/// The provider's own details, as it reported them.
#[serde(default)]
pub provider_details: Value,
/// ISO 8601 creation timestamp.
pub created_at: String,
/// ISO 8601 recording timestamp.
#[serde(default)]
pub recorded_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}