vesant-sdk 1.6.2 → 1.6.3
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/dist/fraud/index.d.mts +80 -0
- package/dist/fraud/index.d.ts +80 -0
- package/dist/fraud/index.js +606 -0
- package/dist/fraud/index.js.map +1 -0
- package/dist/fraud/index.mjs +604 -0
- package/dist/fraud/index.mjs.map +1 -0
- package/dist/index-B04H4xfJ.d.mts +320 -0
- package/dist/index-CItMPmLL.d.ts +320 -0
- package/dist/index.d.mts +7 -107
- package/dist/index.d.ts +7 -107
- package/dist/index.js +104 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -7
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +1 -1
- package/dist/kyc/core.d.ts +1 -1
- package/dist/kyc/core.js +10 -6
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +10 -6
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +24 -13
- package/dist/kyc/index.d.ts +24 -13
- package/dist/kyc/index.js +10 -6
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +10 -6
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/tax/index.d.mts +36 -1
- package/dist/tax/index.d.ts +36 -1
- package/dist/tax/index.js +35 -0
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +35 -0
- package/dist/tax/index.mjs.map +1 -1
- package/dist/webhooks/index.d.mts +2 -177
- package/dist/webhooks/index.d.ts +2 -177
- package/package.json +6 -1
package/dist/index.js
CHANGED
|
@@ -2606,19 +2606,23 @@ var KycClient = class extends BaseClient {
|
|
|
2606
2606
|
*
|
|
2607
2607
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
2608
2608
|
*
|
|
2609
|
-
* @param request - Request containing the user ID,
|
|
2610
|
-
* @returns Response containing the redirect link and KYC ID
|
|
2609
|
+
* @param request - Request containing the user ID, redirect URL, callback URL, and trigger event
|
|
2610
|
+
* @returns Response containing kyc_required, can_skip, and optionally the redirect link and KYC ID
|
|
2611
2611
|
*
|
|
2612
2612
|
* @example
|
|
2613
2613
|
* ```typescript
|
|
2614
2614
|
* const result = await client.requestKycSubmitLink({
|
|
2615
2615
|
* user_id: "user_123",
|
|
2616
|
-
* redirect_url: "https://merchant.com/kyc-complete",
|
|
2617
|
-
* callback_url: "https://merchant.com/api/kyc-webhook"
|
|
2616
|
+
* redirect_url: "https://merchant.com/kyc-complete",
|
|
2617
|
+
* callback_url: "https://merchant.com/api/kyc-webhook",
|
|
2618
|
+
* trigger_event: "onboarding"
|
|
2618
2619
|
* });
|
|
2619
2620
|
*
|
|
2620
|
-
*
|
|
2621
|
-
*
|
|
2621
|
+
* if (result.kyc_required && result.link) {
|
|
2622
|
+
* console.log(`Redirect user to: ${result.link}`);
|
|
2623
|
+
* } else if (result.can_skip) {
|
|
2624
|
+
* console.log("KYC not required, user can proceed");
|
|
2625
|
+
* }
|
|
2622
2626
|
* ```
|
|
2623
2627
|
*/
|
|
2624
2628
|
async requestKycSubmitLink(request) {
|
|
@@ -3195,6 +3199,41 @@ var TaxClient = class extends BaseClient {
|
|
|
3195
3199
|
{ ...requestOptions, responseType: "arraybuffer" }
|
|
3196
3200
|
);
|
|
3197
3201
|
}
|
|
3202
|
+
async runReminders() {
|
|
3203
|
+
return this.request("/api/v1/tax/reminders/run", {
|
|
3204
|
+
method: "POST"
|
|
3205
|
+
});
|
|
3206
|
+
}
|
|
3207
|
+
/**
|
|
3208
|
+
* Update only the reminder configuration (frequency + max count) without
|
|
3209
|
+
* touching any other tax rule settings. Fetches current rules first and
|
|
3210
|
+
* merges the reminder fields before sending the update.
|
|
3211
|
+
*
|
|
3212
|
+
* Requires the caller to be authenticated as a Tenant Super Admin.
|
|
3213
|
+
* Throws VesantError with status 403 if the role requirement is not met.
|
|
3214
|
+
*/
|
|
3215
|
+
async updateReminderConfig(input) {
|
|
3216
|
+
const current = await this.getTaxRules();
|
|
3217
|
+
return this.updateTaxRules({
|
|
3218
|
+
trigger_account_creation: current.trigger_account_creation,
|
|
3219
|
+
trigger_first_withdrawal: current.trigger_first_withdrawal,
|
|
3220
|
+
trigger_threshold: current.trigger_threshold,
|
|
3221
|
+
trigger_manual: current.trigger_manual,
|
|
3222
|
+
trigger_tin_invalid: current.trigger_tin_invalid,
|
|
3223
|
+
trigger_w8ben_expiry: current.trigger_w8ben_expiry,
|
|
3224
|
+
trigger_tin_expired: current.trigger_tin_expired,
|
|
3225
|
+
us_withholding_enabled: current.us_withholding_enabled,
|
|
3226
|
+
non_us_withholding_enabled: current.non_us_withholding_enabled,
|
|
3227
|
+
transaction_action: current.transaction_action,
|
|
3228
|
+
w8ben_expiry_warning_days: current.w8ben_expiry_warning_days,
|
|
3229
|
+
tin_verification_due_date: current.tin_verification_due_date,
|
|
3230
|
+
email_sending_method: current.email_sending_method,
|
|
3231
|
+
display_tin_links_on_platform: current.display_tin_links_on_platform,
|
|
3232
|
+
tax_treaty_support: current.tax_treaty_support,
|
|
3233
|
+
reminder_frequency_days: input.reminder_frequency_days,
|
|
3234
|
+
reminder_max_count: input.reminder_max_count
|
|
3235
|
+
});
|
|
3236
|
+
}
|
|
3198
3237
|
// ==========================================================================
|
|
3199
3238
|
// P2 — Tenant Tax Rules
|
|
3200
3239
|
// ==========================================================================
|
|
@@ -3303,6 +3342,64 @@ var TransactionClient = class extends BaseClient {
|
|
|
3303
3342
|
}
|
|
3304
3343
|
};
|
|
3305
3344
|
|
|
3345
|
+
// src/fraud/client.ts
|
|
3346
|
+
var FraudClient = class extends BaseClient {
|
|
3347
|
+
/**
|
|
3348
|
+
* Submit a single fraud event for scoring.
|
|
3349
|
+
*/
|
|
3350
|
+
async scoreEvent(request, requestOptions) {
|
|
3351
|
+
this.validateScoreRequest(request);
|
|
3352
|
+
return this.requestWithRetry(
|
|
3353
|
+
"/api/v1/fraud/score",
|
|
3354
|
+
{
|
|
3355
|
+
method: "POST",
|
|
3356
|
+
body: JSON.stringify(request)
|
|
3357
|
+
},
|
|
3358
|
+
void 0,
|
|
3359
|
+
void 0,
|
|
3360
|
+
requestOptions
|
|
3361
|
+
);
|
|
3362
|
+
}
|
|
3363
|
+
/**
|
|
3364
|
+
* Submit multiple fraud events for scoring.
|
|
3365
|
+
*/
|
|
3366
|
+
async scoreEventsBulk(requests, requestOptions) {
|
|
3367
|
+
if (!Array.isArray(requests) || requests.length === 0) {
|
|
3368
|
+
throw new ValidationError(
|
|
3369
|
+
"Invalid bulk score request: at least one score request is required",
|
|
3370
|
+
["requests"]
|
|
3371
|
+
);
|
|
3372
|
+
}
|
|
3373
|
+
requests.forEach((request, index) => this.validateScoreRequest(request, index));
|
|
3374
|
+
return this.requestWithRetry(
|
|
3375
|
+
"/api/v1/fraud/score/bulk",
|
|
3376
|
+
{
|
|
3377
|
+
method: "POST",
|
|
3378
|
+
body: JSON.stringify(requests)
|
|
3379
|
+
},
|
|
3380
|
+
void 0,
|
|
3381
|
+
void 0,
|
|
3382
|
+
requestOptions
|
|
3383
|
+
);
|
|
3384
|
+
}
|
|
3385
|
+
validateScoreRequest(request, index) {
|
|
3386
|
+
const errors = [];
|
|
3387
|
+
const prefix = index === void 0 ? "" : `requests[${index}].`;
|
|
3388
|
+
if (!request.customer_id?.trim()) {
|
|
3389
|
+
errors.push(`${prefix}customer_id is required`);
|
|
3390
|
+
}
|
|
3391
|
+
if (!request.sift_user_id?.trim()) {
|
|
3392
|
+
errors.push(`${prefix}sift_user_id is required`);
|
|
3393
|
+
}
|
|
3394
|
+
if (!request.event_type?.trim()) {
|
|
3395
|
+
errors.push(`${prefix}event_type is required`);
|
|
3396
|
+
}
|
|
3397
|
+
if (errors.length > 0) {
|
|
3398
|
+
throw new ValidationError(`Invalid fraud score request: ${errors.join(", ")}`, errors);
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
};
|
|
3402
|
+
|
|
3306
3403
|
// src/webhooks/handler.ts
|
|
3307
3404
|
var WebhookHandler = class {
|
|
3308
3405
|
constructor(config) {
|
|
@@ -3455,6 +3552,7 @@ exports.ComplianceBlockedError = ComplianceBlockedError;
|
|
|
3455
3552
|
exports.ComplianceClient = ComplianceClient;
|
|
3456
3553
|
exports.ComplianceError = ComplianceError;
|
|
3457
3554
|
exports.DEFAULT_CURRENCY_RATES = DEFAULT_CURRENCY_RATES;
|
|
3555
|
+
exports.FraudClient = FraudClient;
|
|
3458
3556
|
exports.GeolocationClient = GeolocationClient;
|
|
3459
3557
|
exports.KycClient = KycClient;
|
|
3460
3558
|
exports.NetworkError = NetworkError;
|