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/index.mjs CHANGED
@@ -2604,19 +2604,23 @@ var KycClient = class extends BaseClient {
2604
2604
  *
2605
2605
  * Generates a link that the user can visit to submit their KYC documents.
2606
2606
  *
2607
- * @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)
2608
- * @returns Response containing the redirect link and KYC ID
2607
+ * @param request - Request containing the user ID, redirect URL, callback URL, and trigger event
2608
+ * @returns Response containing kyc_required, can_skip, and optionally the redirect link and KYC ID
2609
2609
  *
2610
2610
  * @example
2611
2611
  * ```typescript
2612
2612
  * const result = await client.requestKycSubmitLink({
2613
2613
  * user_id: "user_123",
2614
- * redirect_url: "https://merchant.com/kyc-complete", // optional
2615
- * callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
2614
+ * redirect_url: "https://merchant.com/kyc-complete",
2615
+ * callback_url: "https://merchant.com/api/kyc-webhook",
2616
+ * trigger_event: "onboarding"
2616
2617
  * });
2617
2618
  *
2618
- * console.log(`Redirect user to: ${result.link}`);
2619
- * console.log(`KYC ID: ${result.kyc_id}`);
2619
+ * if (result.kyc_required && result.link) {
2620
+ * console.log(`Redirect user to: ${result.link}`);
2621
+ * } else if (result.can_skip) {
2622
+ * console.log("KYC not required, user can proceed");
2623
+ * }
2620
2624
  * ```
2621
2625
  */
2622
2626
  async requestKycSubmitLink(request) {
@@ -3193,6 +3197,41 @@ var TaxClient = class extends BaseClient {
3193
3197
  { ...requestOptions, responseType: "arraybuffer" }
3194
3198
  );
3195
3199
  }
3200
+ async runReminders() {
3201
+ return this.request("/api/v1/tax/reminders/run", {
3202
+ method: "POST"
3203
+ });
3204
+ }
3205
+ /**
3206
+ * Update only the reminder configuration (frequency + max count) without
3207
+ * touching any other tax rule settings. Fetches current rules first and
3208
+ * merges the reminder fields before sending the update.
3209
+ *
3210
+ * Requires the caller to be authenticated as a Tenant Super Admin.
3211
+ * Throws VesantError with status 403 if the role requirement is not met.
3212
+ */
3213
+ async updateReminderConfig(input) {
3214
+ const current = await this.getTaxRules();
3215
+ return this.updateTaxRules({
3216
+ trigger_account_creation: current.trigger_account_creation,
3217
+ trigger_first_withdrawal: current.trigger_first_withdrawal,
3218
+ trigger_threshold: current.trigger_threshold,
3219
+ trigger_manual: current.trigger_manual,
3220
+ trigger_tin_invalid: current.trigger_tin_invalid,
3221
+ trigger_w8ben_expiry: current.trigger_w8ben_expiry,
3222
+ trigger_tin_expired: current.trigger_tin_expired,
3223
+ us_withholding_enabled: current.us_withholding_enabled,
3224
+ non_us_withholding_enabled: current.non_us_withholding_enabled,
3225
+ transaction_action: current.transaction_action,
3226
+ w8ben_expiry_warning_days: current.w8ben_expiry_warning_days,
3227
+ tin_verification_due_date: current.tin_verification_due_date,
3228
+ email_sending_method: current.email_sending_method,
3229
+ display_tin_links_on_platform: current.display_tin_links_on_platform,
3230
+ tax_treaty_support: current.tax_treaty_support,
3231
+ reminder_frequency_days: input.reminder_frequency_days,
3232
+ reminder_max_count: input.reminder_max_count
3233
+ });
3234
+ }
3196
3235
  // ==========================================================================
3197
3236
  // P2 — Tenant Tax Rules
3198
3237
  // ==========================================================================
@@ -3301,6 +3340,64 @@ var TransactionClient = class extends BaseClient {
3301
3340
  }
3302
3341
  };
3303
3342
 
3343
+ // src/fraud/client.ts
3344
+ var FraudClient = class extends BaseClient {
3345
+ /**
3346
+ * Submit a single fraud event for scoring.
3347
+ */
3348
+ async scoreEvent(request, requestOptions) {
3349
+ this.validateScoreRequest(request);
3350
+ return this.requestWithRetry(
3351
+ "/api/v1/fraud/score",
3352
+ {
3353
+ method: "POST",
3354
+ body: JSON.stringify(request)
3355
+ },
3356
+ void 0,
3357
+ void 0,
3358
+ requestOptions
3359
+ );
3360
+ }
3361
+ /**
3362
+ * Submit multiple fraud events for scoring.
3363
+ */
3364
+ async scoreEventsBulk(requests, requestOptions) {
3365
+ if (!Array.isArray(requests) || requests.length === 0) {
3366
+ throw new ValidationError(
3367
+ "Invalid bulk score request: at least one score request is required",
3368
+ ["requests"]
3369
+ );
3370
+ }
3371
+ requests.forEach((request, index) => this.validateScoreRequest(request, index));
3372
+ return this.requestWithRetry(
3373
+ "/api/v1/fraud/score/bulk",
3374
+ {
3375
+ method: "POST",
3376
+ body: JSON.stringify(requests)
3377
+ },
3378
+ void 0,
3379
+ void 0,
3380
+ requestOptions
3381
+ );
3382
+ }
3383
+ validateScoreRequest(request, index) {
3384
+ const errors = [];
3385
+ const prefix = index === void 0 ? "" : `requests[${index}].`;
3386
+ if (!request.customer_id?.trim()) {
3387
+ errors.push(`${prefix}customer_id is required`);
3388
+ }
3389
+ if (!request.sift_user_id?.trim()) {
3390
+ errors.push(`${prefix}sift_user_id is required`);
3391
+ }
3392
+ if (!request.event_type?.trim()) {
3393
+ errors.push(`${prefix}event_type is required`);
3394
+ }
3395
+ if (errors.length > 0) {
3396
+ throw new ValidationError(`Invalid fraud score request: ${errors.join(", ")}`, errors);
3397
+ }
3398
+ }
3399
+ };
3400
+
3304
3401
  // src/webhooks/handler.ts
3305
3402
  var WebhookHandler = class {
3306
3403
  constructor(config) {
@@ -3444,6 +3541,6 @@ function buildHandler(options) {
3444
3541
  return handler;
3445
3542
  }
3446
3543
 
3447
- export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, GeolocationClient, KycClient, NetworkError, RateLimitError, RateLimitTracker, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, TaxClient, TimeoutError, TransactionClient, ValidationError, VesantError, WebhookHandler, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, isCipherTextExpired, noopLogger, verifyWebhookSignature };
3544
+ export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, FraudClient, GeolocationClient, KycClient, NetworkError, RateLimitError, RateLimitTracker, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, TaxClient, TimeoutError, TransactionClient, ValidationError, VesantError, WebhookHandler, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, isCipherTextExpired, noopLogger, verifyWebhookSignature };
3448
3545
  //# sourceMappingURL=index.mjs.map
3449
3546
  //# sourceMappingURL=index.mjs.map