vesant-sdk 1.0.4
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 +247 -0
- package/dist/client-CA9Wr_qb.d.ts +1108 -0
- package/dist/client-DMNkESa0.d.mts +1108 -0
- package/dist/compliance/index.d.mts +543 -0
- package/dist/compliance/index.d.ts +543 -0
- package/dist/compliance/index.js +2133 -0
- package/dist/compliance/index.js.map +1 -0
- package/dist/compliance/index.mjs +2130 -0
- package/dist/compliance/index.mjs.map +1 -0
- package/dist/geolocation/index.d.mts +73 -0
- package/dist/geolocation/index.d.ts +73 -0
- package/dist/geolocation/index.js +1100 -0
- package/dist/geolocation/index.js.map +1 -0
- package/dist/geolocation/index.mjs +1094 -0
- package/dist/geolocation/index.mjs.map +1 -0
- package/dist/index.d.mts +50 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +2968 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2948 -0
- package/dist/index.mjs.map +1 -0
- package/dist/kyc/core.d.mts +3 -0
- package/dist/kyc/core.d.ts +3 -0
- package/dist/kyc/core.js +773 -0
- package/dist/kyc/core.js.map +1 -0
- package/dist/kyc/core.mjs +771 -0
- package/dist/kyc/core.mjs.map +1 -0
- package/dist/kyc/index.d.mts +734 -0
- package/dist/kyc/index.d.ts +734 -0
- package/dist/kyc/index.js +773 -0
- package/dist/kyc/index.js.map +1 -0
- package/dist/kyc/index.mjs +771 -0
- package/dist/kyc/index.mjs.map +1 -0
- package/dist/react.d.mts +487 -0
- package/dist/react.d.ts +487 -0
- package/dist/react.js +1122 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +1102 -0
- package/dist/react.mjs.map +1 -0
- package/dist/risk-profile/index.d.mts +228 -0
- package/dist/risk-profile/index.d.ts +228 -0
- package/dist/risk-profile/index.js +548 -0
- package/dist/risk-profile/index.js.map +1 -0
- package/dist/risk-profile/index.mjs +546 -0
- package/dist/risk-profile/index.mjs.map +1 -0
- package/dist/types-Bnsnejor.d.mts +150 -0
- package/dist/types-Bnsnejor.d.ts +150 -0
- package/dist/types-CFupjwi8.d.ts +213 -0
- package/dist/types-CqOLbaXk.d.mts +213 -0
- package/package.json +94 -0
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
import { e as RiskLevel, P as PaginationParams, B as BaseClient } from '../types-Bnsnejor.mjs';
|
|
2
|
+
import { e as ProfileFilters, f as ProfileListResponse, C as CustomerProfile, d as CreateProfileRequest } from '../types-CqOLbaXk.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TypeScript type definitions for CGS KYC Service API
|
|
6
|
+
*
|
|
7
|
+
* These types match the Go API structures in:
|
|
8
|
+
* - services/kyc-service/internal/domain/
|
|
9
|
+
* - services/kyc-service/internal/service/
|
|
10
|
+
* - services/kyc-service/internal/handler/
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type KycStatus = 'pending' | 'accepted' | 'declined' | 'review.pending' | 'unknown';
|
|
14
|
+
type KycAlertStatus = 'pending' | 'in_progress' | 'resolved' | 'closed' | 'escalated';
|
|
15
|
+
type KycAlertType = 'kyc' | 'fraud';
|
|
16
|
+
type DocumentType = 'id_card' | 'driving_license' | 'passport';
|
|
17
|
+
type ProofType = 'document' | 'document_two' | 'face' | 'address' | 'additional_document';
|
|
18
|
+
type SupportedDocumentType = 'id_card' | 'passport' | 'driving_license';
|
|
19
|
+
interface KycRequest {
|
|
20
|
+
id: string;
|
|
21
|
+
reference: string;
|
|
22
|
+
forward_reference?: string;
|
|
23
|
+
tenant_id: string;
|
|
24
|
+
first_name: string;
|
|
25
|
+
middle_name?: string;
|
|
26
|
+
last_name: string;
|
|
27
|
+
dob?: string;
|
|
28
|
+
full_address?: string;
|
|
29
|
+
email?: string;
|
|
30
|
+
id_verified: boolean;
|
|
31
|
+
address_verified: boolean;
|
|
32
|
+
face_verified: boolean;
|
|
33
|
+
age_verified: boolean;
|
|
34
|
+
status: KycStatus;
|
|
35
|
+
location?: string;
|
|
36
|
+
identity_hash?: string;
|
|
37
|
+
required_document_count: number;
|
|
38
|
+
supported_document_types?: SupportedDocumentType[];
|
|
39
|
+
is_id_verification_required: boolean;
|
|
40
|
+
is_face_verification_required: boolean;
|
|
41
|
+
is_address_verification_required: boolean;
|
|
42
|
+
is_age_verification_required: boolean;
|
|
43
|
+
callback_url: string;
|
|
44
|
+
redirect_url?: string;
|
|
45
|
+
declined_reason?: string;
|
|
46
|
+
accepted_reason?: string;
|
|
47
|
+
other_reason?: string;
|
|
48
|
+
warnings?: Record<string, Record<string, string>>;
|
|
49
|
+
proofs?: Proof[];
|
|
50
|
+
alerts?: KycAlert[];
|
|
51
|
+
risk_profile?: KycCustomerProfile;
|
|
52
|
+
created_at: string;
|
|
53
|
+
updated_at: string;
|
|
54
|
+
}
|
|
55
|
+
interface Proof {
|
|
56
|
+
id: string;
|
|
57
|
+
kyc_id: string;
|
|
58
|
+
type: ProofType;
|
|
59
|
+
document: string;
|
|
60
|
+
document_number?: string;
|
|
61
|
+
created_at: string;
|
|
62
|
+
}
|
|
63
|
+
interface ProofDownloadURL {
|
|
64
|
+
type: ProofType;
|
|
65
|
+
url: string;
|
|
66
|
+
expires_at: string;
|
|
67
|
+
}
|
|
68
|
+
interface KycCustomerProfile {
|
|
69
|
+
id: string;
|
|
70
|
+
tenant_id: string;
|
|
71
|
+
customer_id: string;
|
|
72
|
+
first_name?: string;
|
|
73
|
+
last_name?: string;
|
|
74
|
+
email?: string;
|
|
75
|
+
risk_score: number;
|
|
76
|
+
risk_level: RiskLevel;
|
|
77
|
+
kyc_status?: string;
|
|
78
|
+
pep_status?: boolean;
|
|
79
|
+
sanctions_status?: boolean;
|
|
80
|
+
created_at: string;
|
|
81
|
+
updated_at: string;
|
|
82
|
+
}
|
|
83
|
+
interface KycAlert {
|
|
84
|
+
id: string;
|
|
85
|
+
kyc_id: string;
|
|
86
|
+
tenant_id: string;
|
|
87
|
+
alert_type: KycAlertType;
|
|
88
|
+
alert_text: string;
|
|
89
|
+
risk: RiskLevel;
|
|
90
|
+
assigned_for?: string;
|
|
91
|
+
reason?: string;
|
|
92
|
+
status: KycAlertStatus;
|
|
93
|
+
created_at: string;
|
|
94
|
+
updated_at: string;
|
|
95
|
+
}
|
|
96
|
+
interface KycAlertFilters {
|
|
97
|
+
kyc_id?: string | string[];
|
|
98
|
+
alert_type?: KycAlertType | KycAlertType[];
|
|
99
|
+
assigned_for?: string | string[];
|
|
100
|
+
status?: KycAlertStatus | KycAlertStatus[];
|
|
101
|
+
risk?: RiskLevel | RiskLevel[];
|
|
102
|
+
search?: string;
|
|
103
|
+
fromDate?: string;
|
|
104
|
+
toDate?: string;
|
|
105
|
+
sort_by?: string;
|
|
106
|
+
order?: 'ASC' | 'DESC';
|
|
107
|
+
}
|
|
108
|
+
interface KycAlertListResponse {
|
|
109
|
+
alerts: KycAlert[];
|
|
110
|
+
pagination: KycPagination;
|
|
111
|
+
}
|
|
112
|
+
interface UpdateKycAlertRequest {
|
|
113
|
+
assigned_for?: string;
|
|
114
|
+
reason?: string;
|
|
115
|
+
alert_type?: KycAlertType;
|
|
116
|
+
status?: KycAlertStatus;
|
|
117
|
+
}
|
|
118
|
+
interface KycPreferences {
|
|
119
|
+
id: string;
|
|
120
|
+
tenant_id: string;
|
|
121
|
+
approve_kyc_reasons: string[];
|
|
122
|
+
is_document_verification_required: boolean;
|
|
123
|
+
is_face_verification_required: boolean;
|
|
124
|
+
is_address_verification_required: boolean;
|
|
125
|
+
is_age_verification_required: boolean;
|
|
126
|
+
min_age: number;
|
|
127
|
+
max_age: number;
|
|
128
|
+
required_document_count: number;
|
|
129
|
+
critical_risk_score: number;
|
|
130
|
+
high_risk_score: number;
|
|
131
|
+
medium_risk_score: number;
|
|
132
|
+
supported_document_types: SupportedDocumentType[];
|
|
133
|
+
created_at: string;
|
|
134
|
+
updated_at: string;
|
|
135
|
+
}
|
|
136
|
+
interface UpdateKycPreferencesRequest {
|
|
137
|
+
reasons?: string[];
|
|
138
|
+
is_document_verification_required?: boolean;
|
|
139
|
+
is_face_verification_required?: boolean;
|
|
140
|
+
is_address_verification_required?: boolean;
|
|
141
|
+
is_age_verification_required?: boolean;
|
|
142
|
+
min_age?: number;
|
|
143
|
+
max_age?: number;
|
|
144
|
+
required_document_count?: number;
|
|
145
|
+
critical_risk_score?: number;
|
|
146
|
+
high_risk_score?: number;
|
|
147
|
+
medium_risk_score?: number;
|
|
148
|
+
supported_document_types?: SupportedDocumentType[];
|
|
149
|
+
}
|
|
150
|
+
interface Name {
|
|
151
|
+
first_name?: string;
|
|
152
|
+
middle_name?: string;
|
|
153
|
+
last_name?: string;
|
|
154
|
+
full_name?: string;
|
|
155
|
+
}
|
|
156
|
+
interface SubmittedDocument {
|
|
157
|
+
/** Base64 encoded document image */
|
|
158
|
+
proof: string;
|
|
159
|
+
/** Base64 additional document image (back side, etc.) */
|
|
160
|
+
additional_proof?: string;
|
|
161
|
+
/** Document number for search/verification */
|
|
162
|
+
document_number?: string;
|
|
163
|
+
/** Document types to verify against */
|
|
164
|
+
selected_type?: DocumentType[];
|
|
165
|
+
/** Extracted/provided name */
|
|
166
|
+
name?: Name;
|
|
167
|
+
/** Date of birth (YYYY-MM-DD) */
|
|
168
|
+
dob?: string;
|
|
169
|
+
/** Issue date (YYYY-MM-DD) */
|
|
170
|
+
issue_date?: string;
|
|
171
|
+
/** Expiry date (YYYY-MM-DD) */
|
|
172
|
+
expiry_date?: string;
|
|
173
|
+
/** Gender */
|
|
174
|
+
gender?: string;
|
|
175
|
+
}
|
|
176
|
+
interface FaceProof {
|
|
177
|
+
/** Base64 encoded face image or selfie */
|
|
178
|
+
proof: string;
|
|
179
|
+
}
|
|
180
|
+
interface DocumentVerificationRequest {
|
|
181
|
+
/** Customer reference ID */
|
|
182
|
+
reference: string;
|
|
183
|
+
/** Callback URL for async verification results */
|
|
184
|
+
callback_url: string;
|
|
185
|
+
/** Customer email */
|
|
186
|
+
email: string;
|
|
187
|
+
/** Country code (ISO 3166-1 alpha-2) */
|
|
188
|
+
country: string;
|
|
189
|
+
/** Language code */
|
|
190
|
+
language: string;
|
|
191
|
+
/** Full address for verification */
|
|
192
|
+
full_address?: string;
|
|
193
|
+
/** Base64 encoded address proof document */
|
|
194
|
+
address_proof?: string;
|
|
195
|
+
/** Primary document */
|
|
196
|
+
document: SubmittedDocument;
|
|
197
|
+
/** Secondary document (optional) */
|
|
198
|
+
document_two?: SubmittedDocument;
|
|
199
|
+
/** Face verification proof (optional) */
|
|
200
|
+
face?: FaceProof;
|
|
201
|
+
/** Additional metadata */
|
|
202
|
+
token?: string;
|
|
203
|
+
}
|
|
204
|
+
interface DocumentVerificationResponse {
|
|
205
|
+
id: string;
|
|
206
|
+
reference: string;
|
|
207
|
+
status: KycStatus;
|
|
208
|
+
verification_url?: string;
|
|
209
|
+
message?: string;
|
|
210
|
+
}
|
|
211
|
+
interface UpdateKycStatusRequest {
|
|
212
|
+
/** Shufti reference or KYC ID */
|
|
213
|
+
reference: string;
|
|
214
|
+
/** Target status */
|
|
215
|
+
status: KycStatus;
|
|
216
|
+
/** Acceptance/decline reason */
|
|
217
|
+
reason?: string;
|
|
218
|
+
/** Shufti warnings data */
|
|
219
|
+
warnings?: Record<string, Record<string, string>>;
|
|
220
|
+
}
|
|
221
|
+
interface RequestKycSubmitLinkRequest {
|
|
222
|
+
/** User ID to generate KYC submission link for */
|
|
223
|
+
user_id: string;
|
|
224
|
+
}
|
|
225
|
+
interface RequestKycSubmitLinkResponse {
|
|
226
|
+
/** Generated KYC submission redirect URL */
|
|
227
|
+
link: string;
|
|
228
|
+
}
|
|
229
|
+
interface CheckKycStatusRequest {
|
|
230
|
+
/** User ID to check KYC status for */
|
|
231
|
+
user_id: string;
|
|
232
|
+
/** Authentication token */
|
|
233
|
+
kyc_id: string;
|
|
234
|
+
}
|
|
235
|
+
interface CheckKycStatusResponse {
|
|
236
|
+
/** User ID */
|
|
237
|
+
user_id?: string;
|
|
238
|
+
/** Token generated from cgs-server */
|
|
239
|
+
kyc_id: string;
|
|
240
|
+
/** Current KYC status */
|
|
241
|
+
status: string;
|
|
242
|
+
/** Reason/message for the status */
|
|
243
|
+
message: string;
|
|
244
|
+
}
|
|
245
|
+
interface RequestAdditionalDocumentsRequest {
|
|
246
|
+
/** KYC request ID */
|
|
247
|
+
id: string;
|
|
248
|
+
/** Document types to request */
|
|
249
|
+
document_types: ProofType[];
|
|
250
|
+
/** Message to customer */
|
|
251
|
+
message?: string;
|
|
252
|
+
}
|
|
253
|
+
interface KycOverview {
|
|
254
|
+
total: number;
|
|
255
|
+
pending: number;
|
|
256
|
+
approved: number;
|
|
257
|
+
high_risk: number;
|
|
258
|
+
rejected: number;
|
|
259
|
+
id_verified: number;
|
|
260
|
+
address_verified: number;
|
|
261
|
+
face_verified: number;
|
|
262
|
+
rejections: number;
|
|
263
|
+
total_alerts: number;
|
|
264
|
+
pending_alerts: number;
|
|
265
|
+
resolved_alerts: number;
|
|
266
|
+
}
|
|
267
|
+
interface KycRequestFilters {
|
|
268
|
+
status?: KycStatus | KycStatus[];
|
|
269
|
+
search?: string;
|
|
270
|
+
fromDate?: string;
|
|
271
|
+
toDate?: string;
|
|
272
|
+
sortBy?: string;
|
|
273
|
+
order?: 'ASC' | 'DESC';
|
|
274
|
+
}
|
|
275
|
+
interface KycPagination {
|
|
276
|
+
limit: number;
|
|
277
|
+
page: number;
|
|
278
|
+
total: number;
|
|
279
|
+
totalPages: number;
|
|
280
|
+
}
|
|
281
|
+
interface KycRequestListResponse {
|
|
282
|
+
data: KycRequest[];
|
|
283
|
+
pagination: KycPagination;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
interface KycClientConfig {
|
|
287
|
+
/** Base URL of the KYC Service API (e.g., "http://localhost:8088") */
|
|
288
|
+
baseURL: string;
|
|
289
|
+
/** Base URL of the Customer Risk Profile Service API (e.g., "http://localhost:8094") */
|
|
290
|
+
riskProfileBaseURL?: string;
|
|
291
|
+
/** Tenant ID for multi-tenancy */
|
|
292
|
+
tenantId: string;
|
|
293
|
+
/** API key or JWT token for authentication */
|
|
294
|
+
apiKey?: string;
|
|
295
|
+
/** User ID for operations requiring user context */
|
|
296
|
+
userId?: string;
|
|
297
|
+
/** Custom headers to include in every request */
|
|
298
|
+
headers?: Record<string, string>;
|
|
299
|
+
/** Request timeout in milliseconds (default: 10000) */
|
|
300
|
+
timeout?: number;
|
|
301
|
+
/** Enable debug logging */
|
|
302
|
+
debug?: boolean;
|
|
303
|
+
}
|
|
304
|
+
/** Base hook state with loading and error */
|
|
305
|
+
interface BaseHookState {
|
|
306
|
+
loading: boolean;
|
|
307
|
+
error: Error | null;
|
|
308
|
+
}
|
|
309
|
+
/** Base options for hooks with auto-fetch capability */
|
|
310
|
+
interface BaseAutoFetchOptions {
|
|
311
|
+
autoFetch?: boolean;
|
|
312
|
+
}
|
|
313
|
+
/** Base options for hooks with polling capability */
|
|
314
|
+
interface BasePollOptions extends BaseAutoFetchOptions {
|
|
315
|
+
pollInterval?: number;
|
|
316
|
+
}
|
|
317
|
+
/** Base options for list hooks with filters and pagination */
|
|
318
|
+
interface BaseListOptions<TFilters> extends BasePollOptions {
|
|
319
|
+
filters?: TFilters;
|
|
320
|
+
pagination?: PaginationParams;
|
|
321
|
+
}
|
|
322
|
+
interface UseKycSubmissionOptions {
|
|
323
|
+
onComplete?: (result: DocumentVerificationResponse) => void;
|
|
324
|
+
onError?: (error: Error) => void;
|
|
325
|
+
}
|
|
326
|
+
interface UseKycSubmissionResult extends BaseHookState {
|
|
327
|
+
submit: (request: DocumentVerificationRequest) => Promise<DocumentVerificationResponse>;
|
|
328
|
+
submission: DocumentVerificationResponse | null;
|
|
329
|
+
reset: () => void;
|
|
330
|
+
}
|
|
331
|
+
type UseKycRequestsOptions = BaseListOptions<KycRequestFilters>;
|
|
332
|
+
interface UseKycRequestsResult extends BaseHookState {
|
|
333
|
+
requests: KycRequest[];
|
|
334
|
+
pagination: KycPagination | null;
|
|
335
|
+
fetchRequests: (filters?: KycRequestFilters, pagination?: PaginationParams) => Promise<void>;
|
|
336
|
+
getRequest: (id: string) => Promise<KycRequest>;
|
|
337
|
+
updateStatus: (reference: string, status: KycStatus, reason?: string) => Promise<void>;
|
|
338
|
+
refresh: () => Promise<void>;
|
|
339
|
+
}
|
|
340
|
+
type UseKycAlertsOptions = BaseListOptions<KycAlertFilters>;
|
|
341
|
+
interface UseKycAlertsResult extends BaseHookState {
|
|
342
|
+
alerts: KycAlert[];
|
|
343
|
+
pagination: KycPagination | null;
|
|
344
|
+
fetchAlerts: (filters?: KycAlertFilters, pagination?: PaginationParams) => Promise<void>;
|
|
345
|
+
getAlert: (id: string) => Promise<KycAlert>;
|
|
346
|
+
updateAlert: (id: string, update: UpdateKycAlertRequest) => Promise<void>;
|
|
347
|
+
refresh: () => Promise<void>;
|
|
348
|
+
}
|
|
349
|
+
interface UseKycOverviewOptions extends BaseAutoFetchOptions {
|
|
350
|
+
fromDate?: string;
|
|
351
|
+
toDate?: string;
|
|
352
|
+
}
|
|
353
|
+
interface UseKycOverviewResult extends BaseHookState {
|
|
354
|
+
overview: KycOverview | null;
|
|
355
|
+
refresh: (fromDate?: string, toDate?: string) => Promise<void>;
|
|
356
|
+
}
|
|
357
|
+
interface UseKycPreferencesResult extends BaseHookState {
|
|
358
|
+
preferences: KycPreferences | null;
|
|
359
|
+
updatePreferences: (update: UpdateKycPreferencesRequest) => Promise<void>;
|
|
360
|
+
refresh: () => Promise<void>;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* KycClient - TypeScript SDK for CGS KYC (Know Your Customer) Service
|
|
365
|
+
*
|
|
366
|
+
* Provides type-safe methods to interact with the KYC service API.
|
|
367
|
+
* Extends BaseClient for consistent retry logic, timeout handling, and error management.
|
|
368
|
+
*/
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* KycClient extends BaseClient for:
|
|
372
|
+
* - Consistent retry logic with exponential backoff
|
|
373
|
+
* - Unified error handling (CGSError, NetworkError, TimeoutError, etc.)
|
|
374
|
+
* - Automatic timeout management
|
|
375
|
+
* - Debug logging
|
|
376
|
+
*
|
|
377
|
+
* All KYC verification calls use requestWithRetry() to handle
|
|
378
|
+
* transient failures gracefully.
|
|
379
|
+
*/
|
|
380
|
+
declare class KycClient extends BaseClient {
|
|
381
|
+
private userId?;
|
|
382
|
+
private riskProfileBaseURL?;
|
|
383
|
+
constructor(config: KycClientConfig);
|
|
384
|
+
/**
|
|
385
|
+
* Set the user ID for operations requiring user context
|
|
386
|
+
*/
|
|
387
|
+
setUserId(userId: string): void;
|
|
388
|
+
/**
|
|
389
|
+
* Get current user ID
|
|
390
|
+
*/
|
|
391
|
+
getUserId(): string | undefined;
|
|
392
|
+
/**
|
|
393
|
+
* Build headers including user ID if available
|
|
394
|
+
*/
|
|
395
|
+
private getUserHeaders;
|
|
396
|
+
/**
|
|
397
|
+
* Request a KYC submission redirect URL for a user
|
|
398
|
+
*
|
|
399
|
+
* Generates a link that the user can visit to submit their KYC documents.
|
|
400
|
+
*
|
|
401
|
+
* @param request - Request containing the user ID
|
|
402
|
+
* @returns Response containing the redirect link
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* const result = await client.requestKycSubmitLink({
|
|
407
|
+
* user_id: "user_123"
|
|
408
|
+
* });
|
|
409
|
+
*
|
|
410
|
+
* console.log(`Redirect user to: ${result.link}`);
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
requestKycSubmitLink(request: RequestKycSubmitLinkRequest): Promise<RequestKycSubmitLinkResponse>;
|
|
414
|
+
/**
|
|
415
|
+
* Check KYC status for a user
|
|
416
|
+
*
|
|
417
|
+
* Returns the current KYC status:
|
|
418
|
+
* - "complete" → KYC verified, show "Continue to Login"
|
|
419
|
+
* - "processing" → Under review, show "Continue to Login"
|
|
420
|
+
* - "failed" / "declined" → Show error + retry option
|
|
421
|
+
* - "pending" / "in_progress" → Keep polling
|
|
422
|
+
*
|
|
423
|
+
* @param request - Request containing user_id and token
|
|
424
|
+
* @returns Response with kyc_status and message (reason)
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* ```typescript
|
|
428
|
+
* const result = await client.checkKycStatus({
|
|
429
|
+
* user_id: "user_123",
|
|
430
|
+
* token: "auth_token_xyz"
|
|
431
|
+
* });
|
|
432
|
+
*
|
|
433
|
+
* if (result.kyc_status === 'complete') {
|
|
434
|
+
* // Show "Continue to Login"
|
|
435
|
+
* } else if (result.kyc_status === 'failed' || result.kyc_status === 'declined') {
|
|
436
|
+
* // Show error + retry option
|
|
437
|
+
* } else {
|
|
438
|
+
* // Keep polling
|
|
439
|
+
* }
|
|
440
|
+
* ```
|
|
441
|
+
*/
|
|
442
|
+
checkKycStatus(request: CheckKycStatusRequest): Promise<CheckKycStatusResponse>;
|
|
443
|
+
/**
|
|
444
|
+
* Submit a document verification request with OCR
|
|
445
|
+
*
|
|
446
|
+
* Uses requestWithRetry() for automatic retry on transient failures.
|
|
447
|
+
*
|
|
448
|
+
* @param request - Document verification request with documents and customer info
|
|
449
|
+
* @returns Verification response with status and reference
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```typescript
|
|
453
|
+
* const result = await client.submitVerification({
|
|
454
|
+
* reference: "customer_123",
|
|
455
|
+
* email: "customer@example.com",
|
|
456
|
+
* country: "US",
|
|
457
|
+
* document: {
|
|
458
|
+
* proof: base64EncodedImage,
|
|
459
|
+
* selected_type: ["id_card", "passport"],
|
|
460
|
+
* name: { first_name: "John", last_name: "Doe" },
|
|
461
|
+
* dob: "1990-01-15"
|
|
462
|
+
* },
|
|
463
|
+
* face: {
|
|
464
|
+
* proof: base64EncodedSelfie
|
|
465
|
+
* }
|
|
466
|
+
* });
|
|
467
|
+
*
|
|
468
|
+
* console.log(`Verification submitted: ${result.reference}`);
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
submitVerification(request: DocumentVerificationRequest): Promise<DocumentVerificationResponse>;
|
|
472
|
+
/**
|
|
473
|
+
* Get a KYC request by ID
|
|
474
|
+
*
|
|
475
|
+
* @param id - KYC request ID
|
|
476
|
+
* @returns KYC request details including proofs and alerts
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```typescript
|
|
480
|
+
* const kyc = await client.getKycRequest("kyc_abc123");
|
|
481
|
+
* console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
484
|
+
getKycRequest(id: string): Promise<KycRequest>;
|
|
485
|
+
/**
|
|
486
|
+
* List KYC requests with filters and pagination
|
|
487
|
+
*
|
|
488
|
+
* @param filters - Optional filters (status, search, date range)
|
|
489
|
+
* @param pagination - Optional pagination (page, page_size)
|
|
490
|
+
* @returns Paginated list of KYC requests
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```typescript
|
|
494
|
+
* const requests = await client.listKycRequests(
|
|
495
|
+
* { status: "pending", search: "john" },
|
|
496
|
+
* { page: 1, page_size: 20 }
|
|
497
|
+
* );
|
|
498
|
+
* console.log(`Found ${requests.total} pending requests`);
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
listKycRequests(filters?: KycRequestFilters, pagination?: PaginationParams): Promise<KycRequestListResponse>;
|
|
502
|
+
/**
|
|
503
|
+
* Update KYC request status (accept/decline)
|
|
504
|
+
*
|
|
505
|
+
* @param request - Status update request with reference, status, and reason
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```typescript
|
|
509
|
+
* // Accept a KYC request
|
|
510
|
+
* await client.updateKycStatus({
|
|
511
|
+
* reference: "shufti_ref_123",
|
|
512
|
+
* status: "accepted",
|
|
513
|
+
* reason: "All documents verified successfully"
|
|
514
|
+
* });
|
|
515
|
+
*
|
|
516
|
+
* // Decline a KYC request
|
|
517
|
+
* await client.updateKycStatus({
|
|
518
|
+
* reference: "shufti_ref_456",
|
|
519
|
+
* status: "declined",
|
|
520
|
+
* reason: "Document expired"
|
|
521
|
+
* });
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
updateKycStatus(request: UpdateKycStatusRequest): Promise<void>;
|
|
525
|
+
/**
|
|
526
|
+
* Request additional documents from customer
|
|
527
|
+
*
|
|
528
|
+
* @param request - Request with KYC ID and document types needed
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* ```typescript
|
|
532
|
+
* await client.requestAdditionalDocuments({
|
|
533
|
+
* id: "kyc_abc123",
|
|
534
|
+
* document_types: ["address", "document_two"],
|
|
535
|
+
* message: "Please provide proof of address and secondary ID"
|
|
536
|
+
* });
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
requestAdditionalDocuments(request: RequestAdditionalDocumentsRequest): Promise<void>;
|
|
540
|
+
/**
|
|
541
|
+
* Get downloadable URLs for KYC proofs/documents
|
|
542
|
+
*
|
|
543
|
+
* @param kycId - KYC request ID
|
|
544
|
+
* @returns Array of proof download URLs with expiration
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```typescript
|
|
548
|
+
* const proofs = await client.getProofDownloadURLs("kyc_abc123");
|
|
549
|
+
* proofs.forEach(proof => {
|
|
550
|
+
* console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
|
|
551
|
+
* });
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
getProofDownloadURLs(kycId: string): Promise<ProofDownloadURL[]>;
|
|
555
|
+
/**
|
|
556
|
+
* Get KYC overview statistics
|
|
557
|
+
*
|
|
558
|
+
* @param fromDate - Optional start date (ISO 8601)
|
|
559
|
+
* @param toDate - Optional end date (ISO 8601)
|
|
560
|
+
* @returns KYC statistics including counts by status
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```typescript
|
|
564
|
+
* const overview = await client.getOverview(
|
|
565
|
+
* "2024-01-01T00:00:00Z",
|
|
566
|
+
* "2024-12-31T23:59:59Z"
|
|
567
|
+
* );
|
|
568
|
+
* console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
|
|
569
|
+
* console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
getOverview(fromDate?: string, toDate?: string): Promise<KycOverview>;
|
|
573
|
+
/**
|
|
574
|
+
* Get a KYC alert by ID
|
|
575
|
+
*
|
|
576
|
+
* @param alertId - Alert ID
|
|
577
|
+
* @returns Alert details
|
|
578
|
+
*/
|
|
579
|
+
getAlert(alertId: string): Promise<KycAlert>;
|
|
580
|
+
/**
|
|
581
|
+
* List KYC alerts with filters and pagination
|
|
582
|
+
*
|
|
583
|
+
* @param filters - Optional filters (status, risk, alert_type, assigned_for, etc.)
|
|
584
|
+
* @param pagination - Optional pagination (page, page_size)
|
|
585
|
+
* @returns Paginated list of alerts
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* ```typescript
|
|
589
|
+
* const alerts = await client.listAlerts(
|
|
590
|
+
* {
|
|
591
|
+
* status: ["pending", "in_progress"],
|
|
592
|
+
* risk: "critical",
|
|
593
|
+
* alert_type: "kyc"
|
|
594
|
+
* },
|
|
595
|
+
* { page: 1, page_size: 20 }
|
|
596
|
+
* );
|
|
597
|
+
* console.log(`Found ${alerts.total} alerts`);
|
|
598
|
+
* ```
|
|
599
|
+
*/
|
|
600
|
+
listAlerts(filters?: KycAlertFilters, pagination?: PaginationParams): Promise<KycAlertListResponse>;
|
|
601
|
+
/**
|
|
602
|
+
* Update a KYC alert
|
|
603
|
+
*
|
|
604
|
+
* @param alertId - Alert ID
|
|
605
|
+
* @param update - Fields to update (status, assigned_for, reason, alert_type)
|
|
606
|
+
*
|
|
607
|
+
* @example
|
|
608
|
+
* ```typescript
|
|
609
|
+
* // Assign an alert
|
|
610
|
+
* await client.updateAlert("alert_123", {
|
|
611
|
+
* assigned_for: "analyst_user_id",
|
|
612
|
+
* status: "in_progress"
|
|
613
|
+
* });
|
|
614
|
+
*
|
|
615
|
+
* // Resolve an alert
|
|
616
|
+
* await client.updateAlert("alert_123", {
|
|
617
|
+
* status: "resolved",
|
|
618
|
+
* reason: "Customer verified via phone call"
|
|
619
|
+
* });
|
|
620
|
+
*
|
|
621
|
+
* // Escalate an alert
|
|
622
|
+
* await client.updateAlert("alert_123", {
|
|
623
|
+
* status: "escalated",
|
|
624
|
+
* assigned_for: "manager_user_id",
|
|
625
|
+
* reason: "Requires senior review - suspicious documents"
|
|
626
|
+
* });
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
629
|
+
updateAlert(alertId: string, update: UpdateKycAlertRequest): Promise<void>;
|
|
630
|
+
/**
|
|
631
|
+
* Get KYC preferences for the tenant
|
|
632
|
+
*
|
|
633
|
+
* @returns KYC preferences configuration
|
|
634
|
+
*
|
|
635
|
+
* @example
|
|
636
|
+
* ```typescript
|
|
637
|
+
* const prefs = await client.getPreferences();
|
|
638
|
+
* console.log(`Face verification required: ${prefs.is_face_verification_required}`);
|
|
639
|
+
* console.log(`Required documents: ${prefs.required_document_count}`);
|
|
640
|
+
* ```
|
|
641
|
+
*/
|
|
642
|
+
getPreferences(): Promise<KycPreferences>;
|
|
643
|
+
/**
|
|
644
|
+
* Update KYC preferences for the tenant
|
|
645
|
+
*
|
|
646
|
+
* @param update - Fields to update
|
|
647
|
+
* @returns Updated preferences
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```typescript
|
|
651
|
+
* await client.updatePreferences({
|
|
652
|
+
* is_face_verification_required: true,
|
|
653
|
+
* is_address_verification_required: true,
|
|
654
|
+
* required_document_count: 2,
|
|
655
|
+
* reasons: [
|
|
656
|
+
* "Documents verified",
|
|
657
|
+
* "Identity confirmed",
|
|
658
|
+
* "Address matched"
|
|
659
|
+
* ]
|
|
660
|
+
* });
|
|
661
|
+
* ```
|
|
662
|
+
*/
|
|
663
|
+
updatePreferences(update: UpdateKycPreferencesRequest): Promise<KycPreferences>;
|
|
664
|
+
/**
|
|
665
|
+
* Make a request to the Risk Profile Service
|
|
666
|
+
* Uses riskProfileBaseURL if configured, otherwise falls back to baseURL
|
|
667
|
+
*/
|
|
668
|
+
private riskProfileRequest;
|
|
669
|
+
/**
|
|
670
|
+
* List customer profiles for the tenant
|
|
671
|
+
*
|
|
672
|
+
* @param filters - Optional filters (risk_category, entity_type, status, search, etc.)
|
|
673
|
+
* @param pagination - Optional pagination (limit, offset)
|
|
674
|
+
* @returns Paginated list of customer profiles
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```typescript
|
|
678
|
+
* const profiles = await client.listCustomerProfiles(
|
|
679
|
+
* { risk_category: 'high', entity_type: 'individual' },
|
|
680
|
+
* { limit: 20, offset: 0 }
|
|
681
|
+
* );
|
|
682
|
+
* console.log(`Found ${profiles.total} profiles`);
|
|
683
|
+
* profiles.profiles.forEach(p => console.log(p.customer_id, p.full_name));
|
|
684
|
+
* ```
|
|
685
|
+
*/
|
|
686
|
+
listCustomerProfiles(filters?: ProfileFilters, pagination?: {
|
|
687
|
+
limit?: number;
|
|
688
|
+
offset?: number;
|
|
689
|
+
}): Promise<ProfileListResponse>;
|
|
690
|
+
/**
|
|
691
|
+
* Get a customer profile by ID
|
|
692
|
+
*
|
|
693
|
+
* @param profileId - The profile UUID
|
|
694
|
+
* @returns Customer profile details
|
|
695
|
+
*
|
|
696
|
+
* @example
|
|
697
|
+
* ```typescript
|
|
698
|
+
* const profile = await client.getCustomerProfile('uuid-here');
|
|
699
|
+
* console.log(`Customer: ${profile.full_name}, Risk: ${profile.risk_category}`);
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
|
+
getCustomerProfile(profileId: string): Promise<CustomerProfile>;
|
|
703
|
+
/**
|
|
704
|
+
* Create a new customer profile
|
|
705
|
+
*
|
|
706
|
+
* A customer profile must exist before submitting KYC verification.
|
|
707
|
+
* The customer_id field will be used as the 'reference' in KYC submissions.
|
|
708
|
+
*
|
|
709
|
+
* @param profile - Customer profile data
|
|
710
|
+
* @returns Created customer profile
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* ```typescript
|
|
714
|
+
* const profile = await client.createCustomerProfile({
|
|
715
|
+
* customer_id: 'cust_123',
|
|
716
|
+
* entity_type: 'individual',
|
|
717
|
+
* full_name: 'John Doe',
|
|
718
|
+
* email_address: 'john@example.com',
|
|
719
|
+
* country_of_residence: 'US'
|
|
720
|
+
* });
|
|
721
|
+
* console.log(`Created profile: ${profile.id}`);
|
|
722
|
+
*
|
|
723
|
+
* // Now you can submit KYC using the customer_id as reference
|
|
724
|
+
* await client.submitVerification({
|
|
725
|
+
* reference: profile.customer_id, // 'cust_123'
|
|
726
|
+
* email: 'john@example.com',
|
|
727
|
+
* // ... other fields
|
|
728
|
+
* });
|
|
729
|
+
* ```
|
|
730
|
+
*/
|
|
731
|
+
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, 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 Name, PaginationParams, type Proof, type ProofDownloadURL, type ProofType, type RequestAdditionalDocumentsRequest, type RequestKycSubmitLinkRequest, type RequestKycSubmitLinkResponse, RiskLevel, 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 };
|