vesant-sdk 1.6.6 → 1.7.0-dev.e0ee6d5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/dist/{client-ePzhQKp9.d.mts → client-BolQlL5e.d.mts} +1 -1
- package/dist/{client-ePzhQKp9.d.ts → client-BolQlL5e.d.ts} +1 -1
- package/dist/client-C3DCmGe9.d.ts +436 -0
- package/dist/{client-C_A7QLcB.d.ts → client-DMIRx7Tu.d.mts} +5 -3
- package/dist/{client-BlCxjbY2.d.mts → client-DoMSYMMR.d.ts} +5 -3
- package/dist/client-ZNdnpWe7.d.mts +436 -0
- package/dist/compliance/index.d.mts +25 -429
- package/dist/compliance/index.d.ts +25 -429
- package/dist/compliance/index.js +187 -103
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +187 -104
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.d.mts +2 -2
- package/dist/decisions/index.d.ts +2 -2
- package/dist/decisions/index.js +1 -1
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +1 -1
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +4 -4
- package/dist/geolocation/index.d.ts +4 -4
- package/dist/geolocation/index.js +7 -24
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +7 -24
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +12 -70
- package/dist/index.d.ts +12 -70
- package/dist/index.js +294 -292
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +293 -291
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +4 -4
- package/dist/kyc/core.d.ts +4 -4
- package/dist/kyc/core.js +78 -23
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +78 -24
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +269 -45
- package/dist/kyc/index.d.ts +269 -45
- package/dist/kyc/index.js +78 -23
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +78 -24
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +42 -7
- package/dist/react.d.ts +42 -7
- package/dist/react.js +663 -277
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +663 -277
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +4 -4
- package/dist/risk-profile/index.d.ts +4 -4
- package/dist/risk-profile/index.js +1 -1
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +1 -1
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.d.mts +2 -2
- package/dist/scores/index.d.ts +2 -2
- package/dist/scores/index.js +1 -1
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +1 -1
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.d.mts +6 -41
- package/dist/tax/index.d.ts +6 -41
- package/dist/tax/index.js +1 -36
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +1 -36
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-1RzYeSal.d.mts → types-BOFaMQxI.d.mts} +2 -2
- package/dist/{types-B4Ezqo7V.d.mts → types-CBQRNL-l.d.mts} +14 -1
- package/dist/{types-B4Ezqo7V.d.ts → types-CBQRNL-l.d.ts} +14 -1
- package/dist/{types-X5Md_dD_.d.ts → types-UGyDl1fd.d.ts} +2 -2
- package/dist/webhooks/index.d.mts +189 -2
- package/dist/webhooks/index.d.ts +189 -2
- package/dist/webhooks/index.js +49 -7
- package/dist/webhooks/index.js.map +1 -1
- package/dist/webhooks/index.mjs +49 -7
- package/dist/webhooks/index.mjs.map +1 -1
- package/package.json +16 -13
- package/dist/fraud/index.d.mts +0 -80
- package/dist/fraud/index.d.ts +0 -80
- package/dist/fraud/index.js +0 -606
- package/dist/fraud/index.js.map +0 -1
- package/dist/fraud/index.mjs +0 -604
- package/dist/fraud/index.mjs.map +0 -1
- package/dist/index-B04H4xfJ.d.mts +0 -320
- package/dist/index-CItMPmLL.d.ts +0 -320
package/dist/kyc/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { B as BaseClient } from '../client-
|
|
1
|
+
import { P as ProfileFilters, b as ProfileListResponse, C as CustomerProfile, a as CreateProfileRequest } from '../types-BOFaMQxI.mjs';
|
|
2
|
+
import { c as Reason, R as RiskLevel, P as PaginationParams } from '../types-CBQRNL-l.mjs';
|
|
3
|
+
import { B as BaseClient } from '../client-BolQlL5e.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* TypeScript type definitions for Vesant KYC Service API
|
|
@@ -12,12 +12,13 @@ import { B as BaseClient } from '../client-ePzhQKp9.mjs';
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
type KycStatus = 'pending' | 'accepted' | 'declined' | 'review.pending' | 'unknown';
|
|
15
|
+
type KycDeclinedCode = 'KYC_DOCUMENT_EXPIRED' | 'KYC_DOCUMENT_INVALID' | 'KYC_FACE_MISMATCH' | 'KYC_AGE_REQUIREMENT' | 'KYC_DUPLICATE_IDENTITY' | 'KYC_ADDRESS_MISMATCH' | 'KYC_NAME_MISMATCH' | 'KYC_PROVIDER_REJECTED' | 'KYC_DECLINED';
|
|
16
|
+
declare const KYC_DECLINED_DESCRIPTIONS: Record<KycDeclinedCode, string>;
|
|
15
17
|
type KycAlertStatus = 'pending' | 'in_progress' | 'resolved' | 'closed' | 'escalated';
|
|
16
18
|
type KycAlertType = 'kyc' | 'fraud';
|
|
17
19
|
type DocumentType = 'id_card' | 'driving_license' | 'passport';
|
|
18
20
|
type ProofType = 'document' | 'document_two' | 'face' | 'address' | 'additional_document';
|
|
19
21
|
type SupportedDocumentType = 'id_card' | 'passport' | 'driving_license';
|
|
20
|
-
type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase' | 'manual' | 'withdrawal' | 'purchase';
|
|
21
22
|
interface KycRequest {
|
|
22
23
|
id: string;
|
|
23
24
|
reference: string;
|
|
@@ -44,9 +45,17 @@ interface KycRequest {
|
|
|
44
45
|
is_age_verification_required: boolean;
|
|
45
46
|
callback_url: string;
|
|
46
47
|
redirect_url?: string;
|
|
48
|
+
/** Structured decline reasons. Present when status is `declined`. */
|
|
49
|
+
declined_reasons?: Reason[];
|
|
50
|
+
/** Structured, non-blocking warnings. */
|
|
51
|
+
warning_reasons?: Reason[];
|
|
52
|
+
/** @deprecated Use {@link declined_reasons}. Comma-joined message text. */
|
|
47
53
|
declined_reason?: string;
|
|
54
|
+
/** @deprecated Use the `code` on {@link declined_reasons}. */
|
|
55
|
+
declined_code?: KycDeclinedCode;
|
|
48
56
|
accepted_reason?: string;
|
|
49
57
|
other_reason?: string;
|
|
58
|
+
/** @deprecated Use {@link warning_reasons}. */
|
|
50
59
|
warnings?: Record<string, Record<string, string>>;
|
|
51
60
|
proofs?: Proof[];
|
|
52
61
|
alerts?: KycAlert[];
|
|
@@ -117,6 +126,65 @@ interface UpdateKycAlertRequest {
|
|
|
117
126
|
alert_type?: KycAlertType;
|
|
118
127
|
status?: KycAlertStatus;
|
|
119
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Threshold-gated trigger for transaction events. Each rule is
|
|
131
|
+
* self-contained — there is no umbrella flag.
|
|
132
|
+
*
|
|
133
|
+
* - `enabled=false` → event blocked.
|
|
134
|
+
* - `enabled=true`, `threshold=0` (or null/omitted) → every event of this
|
|
135
|
+
* type triggers Re-Use KYC, regardless of amount.
|
|
136
|
+
* - `enabled=true`, `threshold>0` → only amounts `>= threshold` trigger.
|
|
137
|
+
*/
|
|
138
|
+
interface ReuseKycThresholdTrigger {
|
|
139
|
+
enabled: boolean;
|
|
140
|
+
/** USD threshold; 0 / null / omitted means "any amount". */
|
|
141
|
+
threshold: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Rate-of-occurrence trigger (used by `high_frequency_betting`). The
|
|
145
|
+
* tenant tells the server how many events have happened over how many
|
|
146
|
+
* minutes via the request body (`event_count`, `event_window_minutes`);
|
|
147
|
+
* the server triggers when `event_count >= count` AND
|
|
148
|
+
* `event_window_minutes <= window_minutes`. Either bound of 0 means
|
|
149
|
+
* "don't enforce that bound".
|
|
150
|
+
*/
|
|
151
|
+
interface ReuseKycFrequencyTrigger {
|
|
152
|
+
enabled: boolean;
|
|
153
|
+
/** Minimum number of events; 0 / null / omitted means "any count". */
|
|
154
|
+
count: number;
|
|
155
|
+
/** Maximum lookback window in minutes; 0 / null / omitted means "any window". */
|
|
156
|
+
window_minutes: number;
|
|
157
|
+
}
|
|
158
|
+
/** Events that can trigger Re-Use KYC for a tenant. */
|
|
159
|
+
interface ReuseKycTriggers {
|
|
160
|
+
login: boolean;
|
|
161
|
+
password_change: boolean;
|
|
162
|
+
name_change: boolean;
|
|
163
|
+
phone_number_change: boolean;
|
|
164
|
+
two_factor_auth_change: boolean;
|
|
165
|
+
new_device_or_location: boolean;
|
|
166
|
+
device_fingerprint_change: boolean;
|
|
167
|
+
payment_method_change: boolean;
|
|
168
|
+
deposit: ReuseKycThresholdTrigger;
|
|
169
|
+
withdrawal: ReuseKycThresholdTrigger;
|
|
170
|
+
large_bet_placement: ReuseKycThresholdTrigger;
|
|
171
|
+
high_frequency_betting: ReuseKycFrequencyTrigger;
|
|
172
|
+
account_balance_transfer: boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Reactions taken when a customer exhausts the Re-Use KYC retry limit.
|
|
176
|
+
* `trigger_alert` is enforced by the server (creates a KYC alert);
|
|
177
|
+
* `enforce_logout` and `freeze_account` are forwarded to the tenant app
|
|
178
|
+
* via the callback `data` field for it to enforce.
|
|
179
|
+
*/
|
|
180
|
+
interface ReuseKycReactions {
|
|
181
|
+
/** Retries after the first attempt; total submissions = this + 1. */
|
|
182
|
+
max_retry_attempts: number;
|
|
183
|
+
trigger_alert: boolean;
|
|
184
|
+
enforce_logout: boolean;
|
|
185
|
+
freeze_account: boolean;
|
|
186
|
+
freeze_duration_minutes: number;
|
|
187
|
+
}
|
|
120
188
|
interface KycPreferences {
|
|
121
189
|
id: string;
|
|
122
190
|
tenant_id: string;
|
|
@@ -125,6 +193,8 @@ interface KycPreferences {
|
|
|
125
193
|
is_face_verification_required: boolean;
|
|
126
194
|
is_address_verification_required: boolean;
|
|
127
195
|
is_age_verification_required: boolean;
|
|
196
|
+
/** Master switch for the Re-Use KYC feature. */
|
|
197
|
+
is_reuse_kyc_enabled?: boolean;
|
|
128
198
|
min_age: number;
|
|
129
199
|
max_age: number;
|
|
130
200
|
required_document_count: number;
|
|
@@ -132,6 +202,10 @@ interface KycPreferences {
|
|
|
132
202
|
high_risk_score: number;
|
|
133
203
|
medium_risk_score: number;
|
|
134
204
|
supported_document_types: SupportedDocumentType[];
|
|
205
|
+
/** Per-event triggers for Re-Use KYC. */
|
|
206
|
+
reuse_kyc_triggers?: ReuseKycTriggers;
|
|
207
|
+
/** Retry / reaction policy for Re-Use KYC. */
|
|
208
|
+
reuse_kyc_reactions?: ReuseKycReactions;
|
|
135
209
|
created_at: string;
|
|
136
210
|
updated_at: string;
|
|
137
211
|
}
|
|
@@ -141,6 +215,7 @@ interface UpdateKycPreferencesRequest {
|
|
|
141
215
|
is_face_verification_required?: boolean;
|
|
142
216
|
is_address_verification_required?: boolean;
|
|
143
217
|
is_age_verification_required?: boolean;
|
|
218
|
+
is_reuse_kyc_enabled?: boolean;
|
|
144
219
|
min_age?: number;
|
|
145
220
|
max_age?: number;
|
|
146
221
|
required_document_count?: number;
|
|
@@ -148,6 +223,10 @@ interface UpdateKycPreferencesRequest {
|
|
|
148
223
|
high_risk_score?: number;
|
|
149
224
|
medium_risk_score?: number;
|
|
150
225
|
supported_document_types?: SupportedDocumentType[];
|
|
226
|
+
/** Partial update — only the events present here are changed. */
|
|
227
|
+
reuse_kyc_triggers?: Partial<ReuseKycTriggers>;
|
|
228
|
+
/** Partial update — only the keys present here are changed. */
|
|
229
|
+
reuse_kyc_reactions?: Partial<ReuseKycReactions>;
|
|
151
230
|
}
|
|
152
231
|
interface Name {
|
|
153
232
|
first_name?: string;
|
|
@@ -223,27 +302,61 @@ interface UpdateKycStatusRequest {
|
|
|
223
302
|
interface RequestKycSubmitLinkRequest {
|
|
224
303
|
/** User ID to generate KYC submission link for */
|
|
225
304
|
user_id: string;
|
|
226
|
-
/** URL to redirect user after KYC submission */
|
|
227
|
-
redirect_url
|
|
228
|
-
/** URL to receive callback notifications via POST request when KYC status changes */
|
|
229
|
-
callback_url
|
|
230
|
-
/** Event that triggered the KYC request */
|
|
231
|
-
trigger_event
|
|
305
|
+
/** URL to redirect user after KYC submission (optional) */
|
|
306
|
+
redirect_url?: string;
|
|
307
|
+
/** URL to receive callback notifications via POST request when KYC status changes (optional) */
|
|
308
|
+
callback_url?: string;
|
|
309
|
+
/** Event that triggered the KYC request (e.g. "onboarding", "login", "transaction") */
|
|
310
|
+
trigger_event?: string;
|
|
232
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Trigger events that can request Re-Use KYC.
|
|
314
|
+
*
|
|
315
|
+
* Account-sensitive: any sensitive change to the account profile.
|
|
316
|
+
* Transaction events: covered by the per-event rules in
|
|
317
|
+
* `ReuseKycTriggers` (`deposit`, `withdrawal`, `large_bet_placement`,
|
|
318
|
+
* `high_frequency_betting`, `account_balance_transfer`).
|
|
319
|
+
*/
|
|
320
|
+
type ReuseKycEvent = 'login' | 'password_change' | 'name_change' | 'phone_number_change' | 'two_factor_auth_change' | 'new_device_or_location' | 'device_fingerprint_change' | 'payment_method_change' | 'deposit' | 'withdrawal' | 'large_bet_placement' | 'high_frequency_betting' | 'account_balance_transfer';
|
|
233
321
|
interface CreateReuseKycSessionRequest {
|
|
234
322
|
/** Unique reference for the KYC session (e.g., customer ID or transaction ID) */
|
|
235
323
|
reference: string;
|
|
236
|
-
/**
|
|
324
|
+
/** Customer ID to associate with the KYC session */
|
|
237
325
|
customer_id: string;
|
|
238
|
-
/**
|
|
239
|
-
|
|
326
|
+
/**
|
|
327
|
+
* The triggering event. One of the `ReuseKycEvent` union members.
|
|
328
|
+
* Required — when empty, the server falls through to the unknown-event
|
|
329
|
+
* passthrough and allows the request silently.
|
|
330
|
+
*/
|
|
331
|
+
event: ReuseKycEvent;
|
|
332
|
+
/**
|
|
333
|
+
* USD amount associated with the event. Required for threshold-gated
|
|
334
|
+
* events (`deposit`, `withdrawal`, `large_bet_placement`); ignored for
|
|
335
|
+
* everything else. Missing/zero with a non-zero threshold blocks the
|
|
336
|
+
* session.
|
|
337
|
+
*/
|
|
338
|
+
amount?: number;
|
|
339
|
+
/**
|
|
340
|
+
* Number of qualifying events the customer has performed in the
|
|
341
|
+
* window described by `event_window_minutes`. Required for
|
|
342
|
+
* frequency-gated events (`high_frequency_betting`); ignored for
|
|
343
|
+
* everything else.
|
|
344
|
+
*/
|
|
345
|
+
event_count?: number;
|
|
346
|
+
/**
|
|
347
|
+
* Lookback window (in minutes) the tenant counted `event_count` over.
|
|
348
|
+
* Required for frequency-gated events alongside `event_count`. A
|
|
349
|
+
* window larger than the tenant's configured `window_minutes`
|
|
350
|
+
* implies a slower rate than "high frequency" and blocks the session.
|
|
351
|
+
*/
|
|
352
|
+
event_window_minutes?: number;
|
|
240
353
|
/** URL to redirect user after validate the facial submission (optional) */
|
|
241
354
|
redirect_url?: string;
|
|
242
355
|
/** URL to receive callback notifications via POST request when reuse KYC status changes (optional) */
|
|
243
356
|
callback_url?: string;
|
|
244
357
|
}
|
|
245
358
|
interface SubmitReuseKycSessionRequest {
|
|
246
|
-
/** Reuse KYC session token generated from
|
|
359
|
+
/** Reuse KYC session token generated from createReuseKycSession */
|
|
247
360
|
token: string;
|
|
248
361
|
/** Base64 encoded face image or selfie for verification */
|
|
249
362
|
proof: string;
|
|
@@ -251,22 +364,94 @@ interface SubmitReuseKycSessionRequest {
|
|
|
251
364
|
reference?: string;
|
|
252
365
|
}
|
|
253
366
|
interface RequestKycSubmitLinkResponse {
|
|
254
|
-
/** Whether KYC is required for this user */
|
|
255
|
-
kyc_required: boolean;
|
|
256
|
-
/** Whether the user can skip KYC */
|
|
257
|
-
can_skip: boolean;
|
|
258
367
|
/** Generated KYC submission redirect URL */
|
|
259
|
-
link
|
|
368
|
+
link: string;
|
|
260
369
|
/** KYC request ID */
|
|
261
|
-
kyc_id
|
|
370
|
+
kyc_id: string;
|
|
262
371
|
}
|
|
372
|
+
/** Device class detected by the SDK (purely client-side — server doesn't care). */
|
|
373
|
+
type ReuseKycDeviceType = 'mobile' | 'desktop';
|
|
263
374
|
interface CreateReuseKycSessionResponse {
|
|
264
|
-
/**
|
|
265
|
-
token: string;
|
|
266
|
-
/** reuse KYC session reference */
|
|
375
|
+
/** Reuse KYC session reference (echo of the request reference) */
|
|
267
376
|
reference: string;
|
|
268
|
-
/**
|
|
377
|
+
/** Generated reuse KYC session token, valid 10 minutes */
|
|
378
|
+
token: string;
|
|
379
|
+
/**
|
|
380
|
+
* Empty string when Re-Use KYC is required. When `is_required` is
|
|
381
|
+
* false, this contains the human-readable reason (e.g. feature
|
|
382
|
+
* disabled, threshold not met, customer has no prior KYC).
|
|
383
|
+
*/
|
|
384
|
+
reason: string;
|
|
385
|
+
/** Whether the caller must complete the face capture before proceeding */
|
|
269
386
|
is_required: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Public HTTPS handoff URL the SDK encodes into a QR code on desktop.
|
|
389
|
+
* The mobile device scans it, lands on the tenant frontend's
|
|
390
|
+
* /reuse-kyc-submit page, and completes the face capture there. Empty
|
|
391
|
+
* when the server has no `BASE_URL_FRONTEND` configured — the SDK
|
|
392
|
+
* falls back to building its own URL in that case.
|
|
393
|
+
*/
|
|
394
|
+
link: string;
|
|
395
|
+
/** Failed face-capture attempts so far on this session. 0 on a fresh session. */
|
|
396
|
+
attempts: number;
|
|
397
|
+
/**
|
|
398
|
+
* Total submissions permitted before reactions fire
|
|
399
|
+
* (`reuse_kyc_reactions.max_retry_attempts + 1`).
|
|
400
|
+
*/
|
|
401
|
+
max_attempts: number;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Reaction outcome returned on every face-submit callback. Tenant apps
|
|
405
|
+
* use this to decide whether to allow another retry, end the session,
|
|
406
|
+
* or freeze the account. Reaction flags are only populated when
|
|
407
|
+
* `retry_limit_exceeded` is true.
|
|
408
|
+
*/
|
|
409
|
+
interface ReuseKycReactionResult {
|
|
410
|
+
/** Submissions the customer still has before the retry limit fires. */
|
|
411
|
+
retries_remaining: number;
|
|
412
|
+
/** True once the latest failed attempt exhausts the retry policy. */
|
|
413
|
+
retry_limit_exceeded: boolean;
|
|
414
|
+
trigger_alert: boolean;
|
|
415
|
+
enforce_logout: boolean;
|
|
416
|
+
freeze_account: boolean;
|
|
417
|
+
freeze_duration_minutes: number;
|
|
418
|
+
/** Set when an alert was raised on the dashboard. */
|
|
419
|
+
alert_id?: string;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Shape of the webhook body POSTed to `callback_url` after a Re-Use KYC
|
|
423
|
+
* submission completes (also returned synchronously from
|
|
424
|
+
* `submitReuseKycSession`).
|
|
425
|
+
*/
|
|
426
|
+
interface ReuseKycCallback {
|
|
427
|
+
event: 'reuse_kyc';
|
|
428
|
+
reference: string;
|
|
429
|
+
resource_id: string;
|
|
430
|
+
status: KycStatus;
|
|
431
|
+
/** Structured decline reasons. */
|
|
432
|
+
declined_reasons?: Reason[];
|
|
433
|
+
/** @deprecated Use {@link declined_reasons}. */
|
|
434
|
+
declined_reason?: string;
|
|
435
|
+
/** @deprecated Use structured reasons. */
|
|
436
|
+
warnings?: Record<string, Record<string, string>>;
|
|
437
|
+
data: ReuseKycReactionResult;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Server-side handoff session backed by Redis (TTL: 15 minutes). Shared
|
|
441
|
+
* with the normal KYC mobile/desktop handoff. Desktop clients poll this
|
|
442
|
+
* to detect when a mobile device has attached to the same token via QR.
|
|
443
|
+
*/
|
|
444
|
+
interface KycHandoffSession {
|
|
445
|
+
document: string;
|
|
446
|
+
document_backside: string;
|
|
447
|
+
document_two: string;
|
|
448
|
+
document_two_backside: string;
|
|
449
|
+
address: string;
|
|
450
|
+
face: string;
|
|
451
|
+
/** True after a mobile device hits PUT /api/v1/kyc/session/connect. */
|
|
452
|
+
mobile_connected: boolean;
|
|
453
|
+
/** True after the (normal-KYC) document submission completes; unused for Re-Use KYC. */
|
|
454
|
+
is_submitted: boolean;
|
|
270
455
|
}
|
|
271
456
|
interface CheckKycStatusRequest {
|
|
272
457
|
/** User ID to check KYC status for */
|
|
@@ -289,9 +474,17 @@ interface CheckKycStatusResponse {
|
|
|
289
474
|
address_verified: boolean;
|
|
290
475
|
face_verified: boolean;
|
|
291
476
|
age_verified: boolean;
|
|
477
|
+
/** Structured decline reasons. Present when status is `declined`. */
|
|
478
|
+
declined_reasons?: Reason[];
|
|
479
|
+
/** Structured, non-blocking warnings. */
|
|
480
|
+
warning_reasons?: Reason[];
|
|
481
|
+
/** @deprecated Use {@link declined_reasons}. */
|
|
292
482
|
declined_reason?: string;
|
|
483
|
+
/** @deprecated Use the `code` on {@link declined_reasons}. */
|
|
484
|
+
declined_code?: KycDeclinedCode;
|
|
293
485
|
other_reason?: string;
|
|
294
486
|
accepted_reason?: string;
|
|
487
|
+
/** @deprecated Use {@link warning_reasons}. */
|
|
295
488
|
warnings?: Record<string, Record<string, string>>;
|
|
296
489
|
required_document_count: number;
|
|
297
490
|
supported_document_types?: SupportedDocumentType[];
|
|
@@ -461,44 +654,75 @@ declare class KycClient extends BaseClient {
|
|
|
461
654
|
*
|
|
462
655
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
463
656
|
*
|
|
464
|
-
* @param request - Request containing the user ID, redirect URL, callback URL
|
|
465
|
-
* @returns Response containing
|
|
657
|
+
* @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)
|
|
658
|
+
* @returns Response containing the redirect link and KYC ID
|
|
466
659
|
*
|
|
467
660
|
* @example
|
|
468
661
|
* ```typescript
|
|
469
662
|
* const result = await client.requestKycSubmitLink({
|
|
470
663
|
* user_id: "user_123",
|
|
471
|
-
* redirect_url: "https://merchant.com/kyc-complete",
|
|
472
|
-
* callback_url: "https://merchant.com/api/kyc-webhook"
|
|
473
|
-
* trigger_event: "onboarding"
|
|
664
|
+
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
665
|
+
* callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
|
|
474
666
|
* });
|
|
475
667
|
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
* } else if (result.can_skip) {
|
|
479
|
-
* console.log("KYC not required, user can proceed");
|
|
480
|
-
* }
|
|
668
|
+
* console.log(`Redirect user to: ${result.link}`);
|
|
669
|
+
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
481
670
|
* ```
|
|
482
671
|
*/
|
|
483
672
|
requestKycSubmitLink(request: RequestKycSubmitLinkRequest): Promise<RequestKycSubmitLinkResponse>;
|
|
484
673
|
/**
|
|
485
|
-
* Create a
|
|
674
|
+
* Create a Re-Use KYC session.
|
|
675
|
+
*
|
|
676
|
+
* Inspect the response before showing UI:
|
|
677
|
+
* - `is_required === false` → skip face capture; `reason` explains why.
|
|
678
|
+
* - `device_type === 'desktop'` → render `qr_payload` as a QR; the
|
|
679
|
+
* mobile device picks up the session via the connect endpoint.
|
|
680
|
+
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
486
681
|
*
|
|
487
|
-
* @param request -
|
|
682
|
+
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
488
683
|
*/
|
|
489
684
|
createReuseKycSession(request: CreateReuseKycSessionRequest): Promise<CreateReuseKycSessionResponse>;
|
|
490
685
|
/**
|
|
491
|
-
* Submit a
|
|
686
|
+
* Submit a real-time face capture for an active Re-Use KYC session.
|
|
492
687
|
*
|
|
493
|
-
*
|
|
688
|
+
* **Mobile-only.** The server rejects desktop User-Agents with HTTP
|
|
689
|
+
* 400 (`face capture must be completed on a mobile device`). Use the
|
|
690
|
+
* QR handoff from `createReuseKycSession` for desktop callers.
|
|
691
|
+
*
|
|
692
|
+
* The `data` field on the response carries `retries_remaining`,
|
|
693
|
+
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
694
|
+
* `freeze_account`, etc.) so the tenant app can act on a final failure.
|
|
695
|
+
*
|
|
696
|
+
* @param request - Token from `createReuseKycSession`, plus the base64 selfie.
|
|
494
697
|
*/
|
|
495
|
-
submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<
|
|
698
|
+
submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<ReuseKycCallback>;
|
|
496
699
|
/**
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
|
|
700
|
+
* Look up the current state of a Re-Use KYC session by its forward
|
|
701
|
+
* reference. Useful for desktop pollers waiting on the mobile handoff.
|
|
702
|
+
*
|
|
703
|
+
* @param reference - The reference used when the session was created.
|
|
704
|
+
*/
|
|
705
|
+
getReuseKycSessionStatus(reference: string): Promise<ReuseKycCallback>;
|
|
706
|
+
/**
|
|
707
|
+
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
708
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
|
|
709
|
+
* callers poll `mobile_connected` to detect when a mobile device has
|
|
710
|
+
* scanned the QR and attached.
|
|
711
|
+
*
|
|
712
|
+
* @param token - The session token returned by `createReuseKycSession`.
|
|
713
|
+
*/
|
|
714
|
+
getHandoffSession(token: string): Promise<KycHandoffSession>;
|
|
715
|
+
/**
|
|
716
|
+
* Attach a mobile device to a desktop-initiated session. The mobile
|
|
717
|
+
* client calls this after scanning the QR code. The desktop poller
|
|
718
|
+
* sees `mobile_connected: true` on the next `getHandoffSession`.
|
|
719
|
+
*
|
|
720
|
+
* @param token - The session token transferred via the QR payload.
|
|
721
|
+
* @param isDisconnect - Pass true to release the session (default false).
|
|
722
|
+
*/
|
|
723
|
+
connectMobileSession(token: string, isDisconnect?: boolean): Promise<{
|
|
724
|
+
mobile_connected: boolean;
|
|
725
|
+
}>;
|
|
502
726
|
/**
|
|
503
727
|
* Check KYC status for a user
|
|
504
728
|
*
|
|
@@ -819,4 +1043,4 @@ declare class KycClient extends BaseClient {
|
|
|
819
1043
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
820
1044
|
}
|
|
821
1045
|
|
|
822
|
-
export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateReuseKycSessionRequest, type CreateReuseKycSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type FaceProof, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerProfile, type KycOverview, type KycPagination, type KycPreferences, type KycRequest, type KycRequestFilters, type KycRequestListResponse, type KycStatus, type
|
|
1046
|
+
export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateReuseKycSessionRequest, type CreateReuseKycSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerProfile, type KycDeclinedCode, type KycHandoffSession, type KycOverview, type KycPagination, type KycPreferences, type KycRequest, type KycRequestFilters, type KycRequestListResponse, type KycStatus, type Name, PaginationParams, type Proof, type ProofDownloadURL, type ProofType, type RequestAdditionalDocumentsRequest, type RequestKycSubmitLinkRequest, type RequestKycSubmitLinkResponse, type ReuseKycCallback, type ReuseKycDeviceType, type ReuseKycEvent, type ReuseKycFrequencyTrigger, type ReuseKycReactionResult, type ReuseKycReactions, type ReuseKycThresholdTrigger, type ReuseKycTriggers, RiskLevel, type SubmitReuseKycSessionRequest, type SubmittedDocument, type SupportedDocumentType, type UpdateKycAlertRequest, type UpdateKycPreferencesRequest, type UpdateKycStatusRequest, type UseKycAlertsOptions, type UseKycAlertsResult, type UseKycOverviewOptions, type UseKycOverviewResult, type UseKycPreferencesResult, type UseKycRequestsOptions, type UseKycRequestsResult, type UseKycSubmissionOptions, type UseKycSubmissionResult };
|