vesant-sdk 1.6.6 → 2.0.0-dev.03b7c82
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-BJ87_Vv5.d.ts +430 -0
- 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-BlCxjbY2.d.mts → client-Bvp-f05-.d.ts} +7 -7
- package/dist/{client-C_A7QLcB.d.ts → client-CIEa7xYG.d.mts} +7 -7
- package/dist/client-IAOGCBfm.d.mts +430 -0
- package/dist/compliance/index.d.mts +25 -429
- package/dist/compliance/index.d.ts +25 -429
- package/dist/compliance/index.js +137 -58
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +137 -59
- 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 +6 -24
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +6 -24
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +14 -71
- package/dist/index.d.ts +14 -71
- package/dist/index.js +244 -247
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +243 -246
- 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 +267 -44
- package/dist/kyc/index.d.ts +267 -44
- 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 +621 -277
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +621 -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-X5Md_dD_.d.ts → types-2utj53GK.d.ts} +2 -2
- package/dist/{types-1RzYeSal.d.mts → types-C4Zx0d_u.d.mts} +2 -2
- package/dist/{types-B4Ezqo7V.d.mts → types-QUCWam16.d.mts} +7 -1
- package/dist/{types-B4Ezqo7V.d.ts → types-QUCWam16.d.ts} +7 -1
- package/dist/webhooks/index.d.mts +181 -2
- package/dist/webhooks/index.d.ts +181 -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.ts
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-2utj53GK.js';
|
|
2
|
+
import { R as RiskLevel, P as PaginationParams } from '../types-QUCWam16.js';
|
|
3
|
+
import { B as BaseClient } from '../client-BolQlL5e.js';
|
|
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.js';
|
|
|
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;
|
|
@@ -45,6 +46,7 @@ interface KycRequest {
|
|
|
45
46
|
callback_url: string;
|
|
46
47
|
redirect_url?: string;
|
|
47
48
|
declined_reason?: string;
|
|
49
|
+
declined_code?: KycDeclinedCode;
|
|
48
50
|
accepted_reason?: string;
|
|
49
51
|
other_reason?: string;
|
|
50
52
|
warnings?: Record<string, Record<string, string>>;
|
|
@@ -117,6 +119,71 @@ interface UpdateKycAlertRequest {
|
|
|
117
119
|
alert_type?: KycAlertType;
|
|
118
120
|
status?: KycAlertStatus;
|
|
119
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Threshold-gated trigger for transaction events.
|
|
124
|
+
*
|
|
125
|
+
* - `enabled=false` + umbrella `transaction=false` → event blocked.
|
|
126
|
+
* - `enabled=true`, `threshold=0` (or null/omitted) → every event of this
|
|
127
|
+
* type triggers Re-Use KYC, regardless of amount.
|
|
128
|
+
* - `enabled=true`, `threshold>0` → only amounts `>= threshold` trigger.
|
|
129
|
+
* - `enabled=false` + umbrella `transaction=true` → triggers on any
|
|
130
|
+
* amount; the threshold is ignored when the specific rule is disabled.
|
|
131
|
+
*/
|
|
132
|
+
interface ReuseKycThresholdTrigger {
|
|
133
|
+
enabled: boolean;
|
|
134
|
+
/** USD threshold; 0 / null / omitted means "any amount". */
|
|
135
|
+
threshold: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Rate-of-occurrence trigger (used by `high_frequency_betting`). The
|
|
139
|
+
* tenant tells the server how many events have happened over how many
|
|
140
|
+
* minutes via the request body (`event_count`, `event_window_minutes`);
|
|
141
|
+
* the server triggers when `event_count >= count` AND
|
|
142
|
+
* `event_window_minutes <= window_minutes`. Either bound of 0 means
|
|
143
|
+
* "don't enforce that bound".
|
|
144
|
+
*/
|
|
145
|
+
interface ReuseKycFrequencyTrigger {
|
|
146
|
+
enabled: boolean;
|
|
147
|
+
/** Minimum number of events; 0 / null / omitted means "any count". */
|
|
148
|
+
count: number;
|
|
149
|
+
/** Maximum lookback window in minutes; 0 / null / omitted means "any window". */
|
|
150
|
+
window_minutes: number;
|
|
151
|
+
}
|
|
152
|
+
/** Events that can trigger Re-Use KYC for a tenant. */
|
|
153
|
+
interface ReuseKycTriggers {
|
|
154
|
+
login: boolean;
|
|
155
|
+
password_change: boolean;
|
|
156
|
+
name_change: boolean;
|
|
157
|
+
phone_number_change: boolean;
|
|
158
|
+
two_factor_auth_change: boolean;
|
|
159
|
+
new_device_or_location: boolean;
|
|
160
|
+
device_fingerprint_change: boolean;
|
|
161
|
+
payment_method_change: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Legacy umbrella flag. When true and a specific transaction rule is
|
|
164
|
+
* not configured, any transaction triggers Re-Use KYC.
|
|
165
|
+
*/
|
|
166
|
+
transaction: boolean;
|
|
167
|
+
deposit: ReuseKycThresholdTrigger;
|
|
168
|
+
withdrawal: ReuseKycThresholdTrigger;
|
|
169
|
+
large_bet_placement: ReuseKycThresholdTrigger;
|
|
170
|
+
high_frequency_betting: ReuseKycFrequencyTrigger;
|
|
171
|
+
account_balance_transfer: boolean;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Reactions taken when a customer exhausts the Re-Use KYC retry limit.
|
|
175
|
+
* `trigger_alert` is enforced by the server (creates a KYC alert);
|
|
176
|
+
* `enforce_logout` and `freeze_account` are forwarded to the tenant app
|
|
177
|
+
* via the callback `data` field for it to enforce.
|
|
178
|
+
*/
|
|
179
|
+
interface ReuseKycReactions {
|
|
180
|
+
/** Retries after the first attempt; total submissions = this + 1. */
|
|
181
|
+
max_retry_attempts: number;
|
|
182
|
+
trigger_alert: boolean;
|
|
183
|
+
enforce_logout: boolean;
|
|
184
|
+
freeze_account: boolean;
|
|
185
|
+
freeze_duration_minutes: number;
|
|
186
|
+
}
|
|
120
187
|
interface KycPreferences {
|
|
121
188
|
id: string;
|
|
122
189
|
tenant_id: string;
|
|
@@ -125,6 +192,8 @@ interface KycPreferences {
|
|
|
125
192
|
is_face_verification_required: boolean;
|
|
126
193
|
is_address_verification_required: boolean;
|
|
127
194
|
is_age_verification_required: boolean;
|
|
195
|
+
/** Master switch for the Re-Use KYC feature. */
|
|
196
|
+
is_reuse_kyc_enabled?: boolean;
|
|
128
197
|
min_age: number;
|
|
129
198
|
max_age: number;
|
|
130
199
|
required_document_count: number;
|
|
@@ -132,6 +201,10 @@ interface KycPreferences {
|
|
|
132
201
|
high_risk_score: number;
|
|
133
202
|
medium_risk_score: number;
|
|
134
203
|
supported_document_types: SupportedDocumentType[];
|
|
204
|
+
/** Per-event triggers for Re-Use KYC. */
|
|
205
|
+
reuse_kyc_triggers?: ReuseKycTriggers;
|
|
206
|
+
/** Retry / reaction policy for Re-Use KYC. */
|
|
207
|
+
reuse_kyc_reactions?: ReuseKycReactions;
|
|
135
208
|
created_at: string;
|
|
136
209
|
updated_at: string;
|
|
137
210
|
}
|
|
@@ -141,6 +214,7 @@ interface UpdateKycPreferencesRequest {
|
|
|
141
214
|
is_face_verification_required?: boolean;
|
|
142
215
|
is_address_verification_required?: boolean;
|
|
143
216
|
is_age_verification_required?: boolean;
|
|
217
|
+
is_reuse_kyc_enabled?: boolean;
|
|
144
218
|
min_age?: number;
|
|
145
219
|
max_age?: number;
|
|
146
220
|
required_document_count?: number;
|
|
@@ -148,6 +222,10 @@ interface UpdateKycPreferencesRequest {
|
|
|
148
222
|
high_risk_score?: number;
|
|
149
223
|
medium_risk_score?: number;
|
|
150
224
|
supported_document_types?: SupportedDocumentType[];
|
|
225
|
+
/** Partial update — only the events present here are changed. */
|
|
226
|
+
reuse_kyc_triggers?: Partial<ReuseKycTriggers>;
|
|
227
|
+
/** Partial update — only the keys present here are changed. */
|
|
228
|
+
reuse_kyc_reactions?: Partial<ReuseKycReactions>;
|
|
151
229
|
}
|
|
152
230
|
interface Name {
|
|
153
231
|
first_name?: string;
|
|
@@ -223,27 +301,72 @@ interface UpdateKycStatusRequest {
|
|
|
223
301
|
interface RequestKycSubmitLinkRequest {
|
|
224
302
|
/** User ID to generate KYC submission link for */
|
|
225
303
|
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
|
|
304
|
+
/** URL to redirect user after KYC submission (optional) */
|
|
305
|
+
redirect_url?: string;
|
|
306
|
+
/** URL to receive callback notifications via POST request when KYC status changes (optional) */
|
|
307
|
+
callback_url?: string;
|
|
308
|
+
/** Event that triggered the KYC request (e.g. "onboarding", "login", "transaction") */
|
|
309
|
+
trigger_event?: string;
|
|
232
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Trigger events that can request Re-Use KYC.
|
|
313
|
+
*
|
|
314
|
+
* Account-sensitive: any sensitive change to the account profile.
|
|
315
|
+
* Transaction events: covered by the per-event threshold rules in
|
|
316
|
+
* `ReuseKycTriggers` (`deposit`, `withdrawal`, `large_bet_placement`) or
|
|
317
|
+
* the umbrella `transaction` flag.
|
|
318
|
+
*
|
|
319
|
+
* The legacy `"login"` and `"transactions"` strings are accepted for
|
|
320
|
+
* backwards compatibility with older SDK clients that didn't have the
|
|
321
|
+
* fine-grained event enum.
|
|
322
|
+
*/
|
|
323
|
+
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'
|
|
324
|
+
/** Legacy umbrella string accepted by the server. */
|
|
325
|
+
| 'transactions';
|
|
233
326
|
interface CreateReuseKycSessionRequest {
|
|
234
327
|
/** Unique reference for the KYC session (e.g., customer ID or transaction ID) */
|
|
235
328
|
reference: string;
|
|
236
|
-
/**
|
|
329
|
+
/** Customer ID to associate with the KYC session */
|
|
237
330
|
customer_id: string;
|
|
238
|
-
/**
|
|
331
|
+
/**
|
|
332
|
+
* The triggering event. Preferred over `path`. When both are sent, the
|
|
333
|
+
* server uses `event` and silently ignores `path`.
|
|
334
|
+
*/
|
|
335
|
+
event?: ReuseKycEvent;
|
|
336
|
+
/**
|
|
337
|
+
* USD amount associated with the event. Required for threshold-gated
|
|
338
|
+
* events (`deposit`, `withdrawal`, `large_bet_placement`); ignored for
|
|
339
|
+
* everything else. Missing/zero with a non-zero threshold blocks the
|
|
340
|
+
* session.
|
|
341
|
+
*/
|
|
342
|
+
amount?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Legacy path field — `"login"` or `"transactions"`. Use `event`
|
|
345
|
+
* instead. Kept for older SDK clients.
|
|
346
|
+
* @deprecated Send `event` instead.
|
|
347
|
+
*/
|
|
239
348
|
path?: string;
|
|
349
|
+
/**
|
|
350
|
+
* Number of qualifying events the customer has performed in the
|
|
351
|
+
* window described by `event_window_minutes`. Required for
|
|
352
|
+
* frequency-gated events (`high_frequency_betting`); ignored for
|
|
353
|
+
* everything else.
|
|
354
|
+
*/
|
|
355
|
+
event_count?: number;
|
|
356
|
+
/**
|
|
357
|
+
* Lookback window (in minutes) the tenant counted `event_count` over.
|
|
358
|
+
* Required for frequency-gated events alongside `event_count`. A
|
|
359
|
+
* window larger than the tenant's configured `window_minutes`
|
|
360
|
+
* implies a slower rate than "high frequency" and blocks the session.
|
|
361
|
+
*/
|
|
362
|
+
event_window_minutes?: number;
|
|
240
363
|
/** URL to redirect user after validate the facial submission (optional) */
|
|
241
364
|
redirect_url?: string;
|
|
242
365
|
/** URL to receive callback notifications via POST request when reuse KYC status changes (optional) */
|
|
243
366
|
callback_url?: string;
|
|
244
367
|
}
|
|
245
368
|
interface SubmitReuseKycSessionRequest {
|
|
246
|
-
/** Reuse KYC session token generated from
|
|
369
|
+
/** Reuse KYC session token generated from createReuseKycSession */
|
|
247
370
|
token: string;
|
|
248
371
|
/** Base64 encoded face image or selfie for verification */
|
|
249
372
|
proof: string;
|
|
@@ -251,22 +374,90 @@ interface SubmitReuseKycSessionRequest {
|
|
|
251
374
|
reference?: string;
|
|
252
375
|
}
|
|
253
376
|
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
377
|
/** Generated KYC submission redirect URL */
|
|
259
|
-
link
|
|
378
|
+
link: string;
|
|
260
379
|
/** KYC request ID */
|
|
261
|
-
kyc_id
|
|
380
|
+
kyc_id: string;
|
|
262
381
|
}
|
|
382
|
+
/** Device class detected by the SDK (purely client-side — server doesn't care). */
|
|
383
|
+
type ReuseKycDeviceType = 'mobile' | 'desktop';
|
|
263
384
|
interface CreateReuseKycSessionResponse {
|
|
264
|
-
/**
|
|
265
|
-
token: string;
|
|
266
|
-
/** reuse KYC session reference */
|
|
385
|
+
/** Reuse KYC session reference (echo of the request reference) */
|
|
267
386
|
reference: string;
|
|
268
|
-
/**
|
|
387
|
+
/** Generated reuse KYC session token, valid 10 minutes */
|
|
388
|
+
token: string;
|
|
389
|
+
/**
|
|
390
|
+
* Empty string when Re-Use KYC is required. When `is_required` is
|
|
391
|
+
* false, this contains the human-readable reason (e.g. feature
|
|
392
|
+
* disabled, threshold not met, customer has no prior KYC).
|
|
393
|
+
*/
|
|
394
|
+
reason: string;
|
|
395
|
+
/** Whether the caller must complete the face capture before proceeding */
|
|
269
396
|
is_required: boolean;
|
|
397
|
+
/**
|
|
398
|
+
* Public HTTPS handoff URL the SDK encodes into a QR code on desktop.
|
|
399
|
+
* The mobile device scans it, lands on the tenant frontend's
|
|
400
|
+
* /reuse-kyc-submit page, and completes the face capture there. Empty
|
|
401
|
+
* when the server has no `BASE_URL_FRONTEND` configured — the SDK
|
|
402
|
+
* falls back to building its own URL in that case.
|
|
403
|
+
*/
|
|
404
|
+
link: string;
|
|
405
|
+
/** Failed face-capture attempts so far on this session. 0 on a fresh session. */
|
|
406
|
+
attempts: number;
|
|
407
|
+
/**
|
|
408
|
+
* Total submissions permitted before reactions fire
|
|
409
|
+
* (`reuse_kyc_reactions.max_retry_attempts + 1`).
|
|
410
|
+
*/
|
|
411
|
+
max_attempts: number;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Reaction outcome returned on every face-submit callback. Tenant apps
|
|
415
|
+
* use this to decide whether to allow another retry, end the session,
|
|
416
|
+
* or freeze the account. Reaction flags are only populated when
|
|
417
|
+
* `retry_limit_exceeded` is true.
|
|
418
|
+
*/
|
|
419
|
+
interface ReuseKycReactionResult {
|
|
420
|
+
/** Submissions the customer still has before the retry limit fires. */
|
|
421
|
+
retries_remaining: number;
|
|
422
|
+
/** True once the latest failed attempt exhausts the retry policy. */
|
|
423
|
+
retry_limit_exceeded: boolean;
|
|
424
|
+
trigger_alert: boolean;
|
|
425
|
+
enforce_logout: boolean;
|
|
426
|
+
freeze_account: boolean;
|
|
427
|
+
freeze_duration_minutes: number;
|
|
428
|
+
/** Set when an alert was raised on the dashboard. */
|
|
429
|
+
alert_id?: string;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Shape of the webhook body POSTed to `callback_url` after a Re-Use KYC
|
|
433
|
+
* submission completes (also returned synchronously from
|
|
434
|
+
* `submitReuseKycSession`).
|
|
435
|
+
*/
|
|
436
|
+
interface ReuseKycCallback {
|
|
437
|
+
event: 'reuse_kyc';
|
|
438
|
+
reference: string;
|
|
439
|
+
resource_id: string;
|
|
440
|
+
status: KycStatus;
|
|
441
|
+
declined_reason?: string;
|
|
442
|
+
warnings?: Record<string, Record<string, string>>;
|
|
443
|
+
data: ReuseKycReactionResult;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Server-side handoff session backed by Redis (TTL: 15 minutes). Shared
|
|
447
|
+
* with the normal KYC mobile/desktop handoff. Desktop clients poll this
|
|
448
|
+
* to detect when a mobile device has attached to the same token via QR.
|
|
449
|
+
*/
|
|
450
|
+
interface KycHandoffSession {
|
|
451
|
+
document: string;
|
|
452
|
+
document_backside: string;
|
|
453
|
+
document_two: string;
|
|
454
|
+
document_two_backside: string;
|
|
455
|
+
address: string;
|
|
456
|
+
face: string;
|
|
457
|
+
/** True after a mobile device hits PUT /api/v1/kyc/session/connect. */
|
|
458
|
+
mobile_connected: boolean;
|
|
459
|
+
/** True after the (normal-KYC) document submission completes; unused for Re-Use KYC. */
|
|
460
|
+
is_submitted: boolean;
|
|
270
461
|
}
|
|
271
462
|
interface CheckKycStatusRequest {
|
|
272
463
|
/** User ID to check KYC status for */
|
|
@@ -290,6 +481,7 @@ interface CheckKycStatusResponse {
|
|
|
290
481
|
face_verified: boolean;
|
|
291
482
|
age_verified: boolean;
|
|
292
483
|
declined_reason?: string;
|
|
484
|
+
declined_code?: KycDeclinedCode;
|
|
293
485
|
other_reason?: string;
|
|
294
486
|
accepted_reason?: string;
|
|
295
487
|
warnings?: Record<string, Record<string, string>>;
|
|
@@ -461,44 +653,75 @@ declare class KycClient extends BaseClient {
|
|
|
461
653
|
*
|
|
462
654
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
463
655
|
*
|
|
464
|
-
* @param request - Request containing the user ID, redirect URL, callback URL
|
|
465
|
-
* @returns Response containing
|
|
656
|
+
* @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)
|
|
657
|
+
* @returns Response containing the redirect link and KYC ID
|
|
466
658
|
*
|
|
467
659
|
* @example
|
|
468
660
|
* ```typescript
|
|
469
661
|
* const result = await client.requestKycSubmitLink({
|
|
470
662
|
* 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"
|
|
663
|
+
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
664
|
+
* callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
|
|
474
665
|
* });
|
|
475
666
|
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
* } else if (result.can_skip) {
|
|
479
|
-
* console.log("KYC not required, user can proceed");
|
|
480
|
-
* }
|
|
667
|
+
* console.log(`Redirect user to: ${result.link}`);
|
|
668
|
+
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
481
669
|
* ```
|
|
482
670
|
*/
|
|
483
671
|
requestKycSubmitLink(request: RequestKycSubmitLinkRequest): Promise<RequestKycSubmitLinkResponse>;
|
|
484
672
|
/**
|
|
485
|
-
* Create a
|
|
673
|
+
* Create a Re-Use KYC session.
|
|
486
674
|
*
|
|
487
|
-
*
|
|
675
|
+
* Inspect the response before showing UI:
|
|
676
|
+
* - `is_required === false` → skip face capture; `reason` explains why.
|
|
677
|
+
* - `device_type === 'desktop'` → render `qr_payload` as a QR; the
|
|
678
|
+
* mobile device picks up the session via the connect endpoint.
|
|
679
|
+
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
680
|
+
*
|
|
681
|
+
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
488
682
|
*/
|
|
489
683
|
createReuseKycSession(request: CreateReuseKycSessionRequest): Promise<CreateReuseKycSessionResponse>;
|
|
490
684
|
/**
|
|
491
|
-
* Submit a
|
|
685
|
+
* Submit a real-time face capture for an active Re-Use KYC session.
|
|
686
|
+
*
|
|
687
|
+
* **Mobile-only.** The server rejects desktop User-Agents with HTTP
|
|
688
|
+
* 400 (`face capture must be completed on a mobile device`). Use the
|
|
689
|
+
* QR handoff from `createReuseKycSession` for desktop callers.
|
|
492
690
|
*
|
|
493
|
-
*
|
|
691
|
+
* The `data` field on the response carries `retries_remaining`,
|
|
692
|
+
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
693
|
+
* `freeze_account`, etc.) so the tenant app can act on a final failure.
|
|
694
|
+
*
|
|
695
|
+
* @param request - Token from `createReuseKycSession`, plus the base64 selfie.
|
|
494
696
|
*/
|
|
495
|
-
submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<
|
|
697
|
+
submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<ReuseKycCallback>;
|
|
496
698
|
/**
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
|
|
699
|
+
* Look up the current state of a Re-Use KYC session by its forward
|
|
700
|
+
* reference. Useful for desktop pollers waiting on the mobile handoff.
|
|
701
|
+
*
|
|
702
|
+
* @param reference - The reference used when the session was created.
|
|
703
|
+
*/
|
|
704
|
+
getReuseKycSessionStatus(reference: string): Promise<ReuseKycCallback>;
|
|
705
|
+
/**
|
|
706
|
+
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
707
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
|
|
708
|
+
* callers poll `mobile_connected` to detect when a mobile device has
|
|
709
|
+
* scanned the QR and attached.
|
|
710
|
+
*
|
|
711
|
+
* @param token - The session token returned by `createReuseKycSession`.
|
|
712
|
+
*/
|
|
713
|
+
getHandoffSession(token: string): Promise<KycHandoffSession>;
|
|
714
|
+
/**
|
|
715
|
+
* Attach a mobile device to a desktop-initiated session. The mobile
|
|
716
|
+
* client calls this after scanning the QR code. The desktop poller
|
|
717
|
+
* sees `mobile_connected: true` on the next `getHandoffSession`.
|
|
718
|
+
*
|
|
719
|
+
* @param token - The session token transferred via the QR payload.
|
|
720
|
+
* @param isDisconnect - Pass true to release the session (default false).
|
|
721
|
+
*/
|
|
722
|
+
connectMobileSession(token: string, isDisconnect?: boolean): Promise<{
|
|
723
|
+
mobile_connected: boolean;
|
|
724
|
+
}>;
|
|
502
725
|
/**
|
|
503
726
|
* Check KYC status for a user
|
|
504
727
|
*
|
|
@@ -819,4 +1042,4 @@ declare class KycClient extends BaseClient {
|
|
|
819
1042
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
820
1043
|
}
|
|
821
1044
|
|
|
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
|
|
1045
|
+
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 };
|
package/dist/kyc/index.js
CHANGED
|
@@ -216,7 +216,7 @@ function createConsoleLogger() {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
// src/core/version.ts
|
|
219
|
-
var SDK_VERSION = "
|
|
219
|
+
var SDK_VERSION = "2.0.0";
|
|
220
220
|
|
|
221
221
|
// src/shared/browser-utils.ts
|
|
222
222
|
function generateUUID() {
|
|
@@ -603,23 +603,19 @@ var KycClient = class extends BaseClient {
|
|
|
603
603
|
*
|
|
604
604
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
605
605
|
*
|
|
606
|
-
* @param request - Request containing the user ID, redirect URL, callback URL
|
|
607
|
-
* @returns Response containing
|
|
606
|
+
* @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)
|
|
607
|
+
* @returns Response containing the redirect link and KYC ID
|
|
608
608
|
*
|
|
609
609
|
* @example
|
|
610
610
|
* ```typescript
|
|
611
611
|
* const result = await client.requestKycSubmitLink({
|
|
612
612
|
* user_id: "user_123",
|
|
613
|
-
* redirect_url: "https://merchant.com/kyc-complete",
|
|
614
|
-
* callback_url: "https://merchant.com/api/kyc-webhook"
|
|
615
|
-
* trigger_event: "onboarding"
|
|
613
|
+
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
614
|
+
* callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
|
|
616
615
|
* });
|
|
617
616
|
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
* } else if (result.can_skip) {
|
|
621
|
-
* console.log("KYC not required, user can proceed");
|
|
622
|
-
* }
|
|
617
|
+
* console.log(`Redirect user to: ${result.link}`);
|
|
618
|
+
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
623
619
|
* ```
|
|
624
620
|
*/
|
|
625
621
|
async requestKycSubmitLink(request) {
|
|
@@ -630,40 +626,84 @@ var KycClient = class extends BaseClient {
|
|
|
630
626
|
});
|
|
631
627
|
}
|
|
632
628
|
/**
|
|
633
|
-
* Create a
|
|
629
|
+
* Create a Re-Use KYC session.
|
|
630
|
+
*
|
|
631
|
+
* Inspect the response before showing UI:
|
|
632
|
+
* - `is_required === false` → skip face capture; `reason` explains why.
|
|
633
|
+
* - `device_type === 'desktop'` → render `qr_payload` as a QR; the
|
|
634
|
+
* mobile device picks up the session via the connect endpoint.
|
|
635
|
+
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
634
636
|
*
|
|
635
|
-
* @param request -
|
|
637
|
+
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
636
638
|
*/
|
|
637
639
|
async createReuseKycSession(request) {
|
|
638
|
-
return this.
|
|
640
|
+
return this.request("/api/v1/kyc/face/session", {
|
|
639
641
|
method: "POST",
|
|
640
642
|
body: JSON.stringify(request),
|
|
641
643
|
headers: this.getUserHeaders()
|
|
642
644
|
});
|
|
643
645
|
}
|
|
644
646
|
/**
|
|
645
|
-
* Submit a
|
|
647
|
+
* Submit a real-time face capture for an active Re-Use KYC session.
|
|
648
|
+
*
|
|
649
|
+
* **Mobile-only.** The server rejects desktop User-Agents with HTTP
|
|
650
|
+
* 400 (`face capture must be completed on a mobile device`). Use the
|
|
651
|
+
* QR handoff from `createReuseKycSession` for desktop callers.
|
|
646
652
|
*
|
|
647
|
-
*
|
|
653
|
+
* The `data` field on the response carries `retries_remaining`,
|
|
654
|
+
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
655
|
+
* `freeze_account`, etc.) so the tenant app can act on a final failure.
|
|
656
|
+
*
|
|
657
|
+
* @param request - Token from `createReuseKycSession`, plus the base64 selfie.
|
|
648
658
|
*/
|
|
649
659
|
async submitReuseKycSession(request) {
|
|
650
|
-
return this.
|
|
660
|
+
return this.request("/api/v1/kyc/face/submit", {
|
|
651
661
|
method: "POST",
|
|
652
662
|
body: JSON.stringify(request),
|
|
653
663
|
headers: this.getUserHeaders()
|
|
654
664
|
});
|
|
655
665
|
}
|
|
656
666
|
/**
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
667
|
+
* Look up the current state of a Re-Use KYC session by its forward
|
|
668
|
+
* reference. Useful for desktop pollers waiting on the mobile handoff.
|
|
669
|
+
*
|
|
670
|
+
* @param reference - The reference used when the session was created.
|
|
671
|
+
*/
|
|
661
672
|
async getReuseKycSessionStatus(reference) {
|
|
662
673
|
return this.requestWithRetry(`/api/v1/kyc/face/verify/${encodeURIComponent(reference)}`, {
|
|
663
674
|
method: "GET",
|
|
664
675
|
headers: this.getUserHeaders()
|
|
665
676
|
});
|
|
666
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
680
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
|
|
681
|
+
* callers poll `mobile_connected` to detect when a mobile device has
|
|
682
|
+
* scanned the QR and attached.
|
|
683
|
+
*
|
|
684
|
+
* @param token - The session token returned by `createReuseKycSession`.
|
|
685
|
+
*/
|
|
686
|
+
async getHandoffSession(token) {
|
|
687
|
+
return this.request(
|
|
688
|
+
`/api/v1/kyc/session${this.buildQueryString({ token })}`,
|
|
689
|
+
{ headers: this.getUserHeaders() }
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Attach a mobile device to a desktop-initiated session. The mobile
|
|
694
|
+
* client calls this after scanning the QR code. The desktop poller
|
|
695
|
+
* sees `mobile_connected: true` on the next `getHandoffSession`.
|
|
696
|
+
*
|
|
697
|
+
* @param token - The session token transferred via the QR payload.
|
|
698
|
+
* @param isDisconnect - Pass true to release the session (default false).
|
|
699
|
+
*/
|
|
700
|
+
async connectMobileSession(token, isDisconnect = false) {
|
|
701
|
+
return this.request("/api/v1/kyc/session/connect", {
|
|
702
|
+
method: "PUT",
|
|
703
|
+
body: JSON.stringify({ token, is_disconnect: isDisconnect }),
|
|
704
|
+
headers: this.getUserHeaders()
|
|
705
|
+
});
|
|
706
|
+
}
|
|
667
707
|
/**
|
|
668
708
|
* Check KYC status for a user
|
|
669
709
|
*
|
|
@@ -1022,8 +1062,9 @@ var KycClient = class extends BaseClient {
|
|
|
1022
1062
|
*/
|
|
1023
1063
|
async riskProfileRequest(path, options = {}) {
|
|
1024
1064
|
if (!this.riskProfileBaseURL) {
|
|
1025
|
-
throw new
|
|
1026
|
-
"Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig."
|
|
1065
|
+
throw new ValidationError(
|
|
1066
|
+
"Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig.",
|
|
1067
|
+
["riskProfileBaseURL"]
|
|
1027
1068
|
);
|
|
1028
1069
|
}
|
|
1029
1070
|
return this.request(path, {
|
|
@@ -1135,6 +1176,20 @@ var KycClient = class extends BaseClient {
|
|
|
1135
1176
|
// ============================================================================
|
|
1136
1177
|
};
|
|
1137
1178
|
|
|
1179
|
+
// src/kyc/types.ts
|
|
1180
|
+
var KYC_DECLINED_DESCRIPTIONS = {
|
|
1181
|
+
KYC_DOCUMENT_EXPIRED: "The submitted document has expired",
|
|
1182
|
+
KYC_DOCUMENT_INVALID: "The submitted document could not be verified",
|
|
1183
|
+
KYC_FACE_MISMATCH: "Face verification did not match the identity document",
|
|
1184
|
+
KYC_AGE_REQUIREMENT: "Age requirement not met",
|
|
1185
|
+
KYC_DUPLICATE_IDENTITY: "This identity has already been verified under another account",
|
|
1186
|
+
KYC_ADDRESS_MISMATCH: "Address verification failed",
|
|
1187
|
+
KYC_NAME_MISMATCH: "Name on document does not match the registered name",
|
|
1188
|
+
KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
|
|
1189
|
+
KYC_DECLINED: "Identity verification was declined"
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
|
|
1138
1193
|
exports.KycClient = KycClient;
|
|
1139
1194
|
//# sourceMappingURL=index.js.map
|
|
1140
1195
|
//# sourceMappingURL=index.js.map
|