vesant-sdk 1.5.0 → 1.5.2
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 +5 -3
- package/dist/{client-3cBb_Pp-.d.ts → client-B8pFrXx_.d.ts} +9 -3
- package/dist/{client-DKqyESgT.d.mts → client-BZxzOidG.d.mts} +9 -3
- package/dist/{client-BQRONu8q.d.mts → client-CIon-bGS.d.mts} +1 -1
- package/dist/{client-BQRONu8q.d.ts → client-CIon-bGS.d.ts} +1 -1
- package/dist/compliance/index.d.mts +5 -5
- package/dist/compliance/index.d.ts +5 -5
- package/dist/compliance/index.js +3 -1
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +3 -1
- 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 +3 -1
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +3 -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 +3 -1
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +3 -1
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +537 -9
- package/dist/index.d.ts +537 -9
- package/dist/index.js +274 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +273 -108
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +3 -3
- package/dist/kyc/core.d.ts +3 -3
- package/dist/kyc/core.js +3 -1
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +3 -1
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +7 -3
- package/dist/kyc/index.d.ts +7 -3
- package/dist/kyc/index.js +3 -1
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +3 -1
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- 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 +3 -1
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +3 -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 +3 -1
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +3 -1
- package/dist/scores/index.mjs.map +1 -1
- package/dist/{types-_hsTA3Ez.d.mts → types-1RzYeSal.d.mts} +1 -1
- package/dist/{types-B1OzEQR3.d.mts → types-B4Ezqo7V.d.mts} +1 -1
- package/dist/{types-B1OzEQR3.d.ts → types-B4Ezqo7V.d.ts} +1 -1
- package/dist/{types-BnL66DB3.d.ts → types-X5Md_dD_.d.ts} +1 -1
- package/dist/webhooks/index.d.mts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/package.json +6 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { L as Logger } from './client-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { L as Logger, B as BaseClient, a as BaseClientConfig, R as RequestOptions } from './client-CIon-bGS.mjs';
|
|
2
|
+
export { d as CGSConfig, i as CircuitBreaker, C as CircuitBreakerConfig, g as CircuitBreakerState, h as CircuitBreakerStatus, j as RateLimitStatus, k as RateLimitTracker, b as RequestInterceptor, f as RequiredBaseClientConfig, e as RequiredCGSConfig, c as RequiredVesantConfig, V as VesantConfig } from './client-CIon-bGS.mjs';
|
|
3
|
+
import { T as Timestamp } from './types-B4Ezqo7V.mjs';
|
|
4
|
+
export { A as APIResponse, C as CustomerStatus, E as EntityType, b as ErrorResponse, L as LocationCompliance, a as PaginatedResponse, P as PaginationParams, c as Result, R as RiskLevel, S as SuccessResponse, U as UUID, V as VerificationEventType } from './types-B4Ezqo7V.mjs';
|
|
4
5
|
export { BaseWebhookEvent, ComplianceCheckFailedPayload, DecisionRecordedPayload, GeolocationBlockedPayload, GeolocationVerifiedPayload, KycStatusChangedPayload, LabelAppliedPayload, LocationRequestCompletedPayload, ProfileCreatedPayload, ProfileUpdatedPayload, RiskCategoryChangedPayload, RiskScoreChangedPayload, WebhookAnyHandler, WebhookEvent, WebhookEventHandler, WebhookEventType, WebhookHandler, WebhookHandlerConfig, WebhookMiddlewareOptions, createNextWebhookHandler, createWebhookMiddleware, verifyWebhookSignature } from './webhooks/index.mjs';
|
|
5
|
-
export {
|
|
6
|
+
export { M as APIError, u as AlertFilters, v as AlertListResponse, r as AlertSeverity, A as AlertStatus, s as AlertType, j as CipherTextCustomerData, C as CipherTextOptions, g as CipherTextPayload, h as CipherTextReason, f as CipherTextResult, q as ComplianceCheckResponse, F as CreateGeofenceRuleRequest, x as CreateJurisdictionRequest, W as CreateLocationRequestRequest, w as DashboardMetrics, i as DecryptedCipherText, o as DeviceFingerprint, D as DeviceFingerprintRequest, p as DeviceTrustResult, m as GeoIPResult, B as GeofenceAction, n as GeofenceEvaluation, E as GeofenceRule, z as GeofenceRuleType, t as GeolocationAlert, G as GeolocationClient, O as GeolocationClientConfig, N as GeolocationConfigResponse, K as GeolocationRecord, J as JurisdictionConfig, a0 as LocationCaptureRequest, a2 as LocationCaptureResponse, T as LocationRequest, S as LocationRequestChannel, Y as LocationRequestFilters, Z as LocationRequestListResponse, X as LocationRequestResult, R as LocationRequestStatus, a1 as LocationShareInfo, L as LocationVerification, _ as ResendLocationRequestRequest, I as UpdateDeviceTrustRequest, H as UpdateGeofenceRuleRequest, y as UpdateJurisdictionRequest, P as UseAlertsOptions, Q as UseAlertsResult, U as UseGeolocationOptions, a as UseGeolocationResult, d as UseLocationCaptureOptions, e as UseLocationCaptureResult, b as UseLocationRequestsOptions, c as UseLocationRequestsResult, V as ValidateCipherTextRequest, k as ValidateCipherTextResponse, l as VerifyIPRequest, $ as WiFiNetwork } from './client-BZxzOidG.mjs';
|
|
6
7
|
export { decodeCipherText, generateCipherText, isCipherTextExpired } from './geolocation/index.mjs';
|
|
7
8
|
export { RiskProfileClient } from './risk-profile/index.mjs';
|
|
8
|
-
export { d as CreateCustomerProfileRequest, d as CreateProfileRequest, C as CustomerProfile, e as CustomerProfileFilters, f as CustomerProfileListResponse, E as EmploymentType, L as LegalForm, P as ProfileDetailsResponse, e as ProfileFilters, f as ProfileListResponse, R as RiskCategory, h as RiskConfiguration, g as RiskDashboardMetrics, a as RiskFactor, b as RiskFactorType, c as RiskHistory, S as ScreeningStatus, U as UpdateProfileRequest } from './types-
|
|
9
|
+
export { d as CreateCustomerProfileRequest, d as CreateProfileRequest, C as CustomerProfile, e as CustomerProfileFilters, f as CustomerProfileListResponse, E as EmploymentType, L as LegalForm, P as ProfileDetailsResponse, e as ProfileFilters, f as ProfileListResponse, R as RiskCategory, h as RiskConfiguration, g as RiskDashboardMetrics, a as RiskFactor, b as RiskFactorType, c as RiskHistory, S as ScreeningStatus, U as UpdateProfileRequest } from './types-1RzYeSal.mjs';
|
|
9
10
|
export { ComplianceClient, ComplianceLocationRequestInput, ComplianceLocationRequestResult, CurrencyRates, DEFAULT_CURRENCY_RATES, EventVerificationRequest, EventVerificationResponse, LoginVerificationRequest, LoginVerificationResponse, RegistrationVerificationRequest, RegistrationVerificationResponse, TransactionRiskResult, TransactionVerificationRequest, TransactionVerificationResponse } from './compliance/index.mjs';
|
|
10
11
|
export { CheckKycStatusRequest, CheckKycStatusResponse, CreateReuseKycSessionRequest, CreateReuseKycSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, FaceProof, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerProfile, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycStatus, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitReuseKycSessionRequest, SubmittedDocument, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.mjs';
|
|
11
|
-
export { ApplyLabelRequest, Decision, DecisionCategory, DecisionFilters, DecisionListResponse, DecisionSource, DecisionType, DecisionsClient, Label, LabelListResponse, LabelType, RecordDecisionRequest } from './decisions/index.mjs';
|
|
12
|
-
export { CustomerScore, ScoreBreakdown, ScoreFactor, ScoreHistoryEntry, ScoresClient, Workflow, WorkflowClient, WorkflowFilters, WorkflowListResponse, WorkflowStatus, WorkflowStep, WorkflowStepType } from './scores/index.mjs';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Error hierarchy for Vesant SDK
|
|
@@ -66,6 +65,535 @@ declare const noopLogger: Logger;
|
|
|
66
65
|
/**
|
|
67
66
|
* Single source of truth for the SDK version.
|
|
68
67
|
*/
|
|
69
|
-
declare const SDK_VERSION = "1.5.
|
|
68
|
+
declare const SDK_VERSION = "1.5.2";
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* TypeScript type definitions for Vesant Tax Service API
|
|
72
|
+
*
|
|
73
|
+
* These types match the Go API structures in:
|
|
74
|
+
* - services/transaction-monitoring-service/internal/domain/
|
|
75
|
+
* - services/transaction-monitoring-service/internal/service/
|
|
76
|
+
* - services/transaction-monitoring-service/internal/handler/
|
|
77
|
+
*/
|
|
78
|
+
interface TaxConfig {
|
|
79
|
+
/** Whether tax compliance features are enabled for this tenant */
|
|
80
|
+
tax_enabled: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface UpdateTaxConfigRequest {
|
|
83
|
+
tax_enabled: boolean;
|
|
84
|
+
}
|
|
85
|
+
interface TaxConfigResponse {
|
|
86
|
+
tax_config: TaxConfig;
|
|
87
|
+
}
|
|
88
|
+
type SolicitationTriggerType = 'account_creation' | 'first_withdrawal' | 'threshold_based' | 'manual_admin' | 'irs_compliance_fallback' | 'w8ben_validity_expiry';
|
|
89
|
+
interface SolicitationTrigger {
|
|
90
|
+
type: SolicitationTriggerType;
|
|
91
|
+
enabled: boolean;
|
|
92
|
+
label: string;
|
|
93
|
+
description: string;
|
|
94
|
+
/** Dollar threshold for threshold_based trigger */
|
|
95
|
+
threshold_amount?: number;
|
|
96
|
+
}
|
|
97
|
+
interface UpdateSolicitationTriggersRequest {
|
|
98
|
+
solicitation_triggers: SolicitationTrigger[];
|
|
99
|
+
}
|
|
100
|
+
interface ReminderConfig {
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
max_reminders: number;
|
|
103
|
+
frequency_days: number;
|
|
104
|
+
}
|
|
105
|
+
interface UpdateReminderConfigRequest {
|
|
106
|
+
reminder_config: ReminderConfig;
|
|
107
|
+
}
|
|
108
|
+
type TaxFormType = 'W-9' | 'W-8BEN' | 'W-8BEN-E';
|
|
109
|
+
type TaxFormStatus = 'Requested' | 'Pending' | 'Submitted' | 'Failed' | 'Verified';
|
|
110
|
+
type TINStatus = 'Pending' | 'Verified' | 'Rejected' | 'Deceased' | 'NotSubmitted';
|
|
111
|
+
type CustomerType = 'US_PERSON' | 'NON_US_PERSON' | 'NON_US_ENTITY';
|
|
112
|
+
interface TaxForm {
|
|
113
|
+
id: string;
|
|
114
|
+
tenant_id: string;
|
|
115
|
+
customer_id: string;
|
|
116
|
+
form_type: TaxFormType;
|
|
117
|
+
form_status: TaxFormStatus;
|
|
118
|
+
customer_type?: CustomerType;
|
|
119
|
+
tin?: string;
|
|
120
|
+
tin_type?: string;
|
|
121
|
+
tin_status: TINStatus;
|
|
122
|
+
tin_verified_at?: string;
|
|
123
|
+
tin_verification_error?: string;
|
|
124
|
+
name?: string;
|
|
125
|
+
business_name?: string;
|
|
126
|
+
address?: string;
|
|
127
|
+
city?: string;
|
|
128
|
+
state?: string;
|
|
129
|
+
zip_code?: string;
|
|
130
|
+
country?: string;
|
|
131
|
+
country_of_citizenship?: string;
|
|
132
|
+
country_of_incorporation?: string;
|
|
133
|
+
foreign_tin?: string;
|
|
134
|
+
entity_type?: string;
|
|
135
|
+
entity_name?: string;
|
|
136
|
+
signer_name?: string;
|
|
137
|
+
signer_capacity?: string;
|
|
138
|
+
email?: string;
|
|
139
|
+
phone?: string;
|
|
140
|
+
e_delivery_consent: boolean;
|
|
141
|
+
backup_withholding: boolean;
|
|
142
|
+
form_file_url?: string;
|
|
143
|
+
validated_form_url?: string;
|
|
144
|
+
file_name?: string;
|
|
145
|
+
address_verified: 'verified' | 'mismatch' | 'unverified';
|
|
146
|
+
avalara_form_id?: string;
|
|
147
|
+
avalara_payee_id?: string;
|
|
148
|
+
avalara_company_id?: string;
|
|
149
|
+
requested_at: string;
|
|
150
|
+
submitted_at?: string;
|
|
151
|
+
due_date?: string;
|
|
152
|
+
last_reminder_sent_at?: string;
|
|
153
|
+
reminder_count: number;
|
|
154
|
+
is_re_request: boolean;
|
|
155
|
+
previous_form_id?: string;
|
|
156
|
+
re_request_reason?: string;
|
|
157
|
+
created_at: string;
|
|
158
|
+
updated_at: string;
|
|
159
|
+
}
|
|
160
|
+
interface TaxFormFilters {
|
|
161
|
+
customer_id?: string;
|
|
162
|
+
form_type?: TaxFormType;
|
|
163
|
+
form_status?: TaxFormStatus;
|
|
164
|
+
tin_status?: TINStatus;
|
|
165
|
+
avalara_company_id?: string;
|
|
166
|
+
search?: string;
|
|
167
|
+
start_date?: string;
|
|
168
|
+
end_date?: string;
|
|
169
|
+
page?: number;
|
|
170
|
+
page_size?: number;
|
|
171
|
+
}
|
|
172
|
+
interface TaxFormListResponse {
|
|
173
|
+
data: TaxForm[];
|
|
174
|
+
total: number;
|
|
175
|
+
page: number;
|
|
176
|
+
page_size: number;
|
|
177
|
+
}
|
|
178
|
+
interface TaxFormLifecycleEvent {
|
|
179
|
+
id: string;
|
|
180
|
+
tenant_id: string;
|
|
181
|
+
tax_form_id: string;
|
|
182
|
+
customer_id: string;
|
|
183
|
+
event_type: string;
|
|
184
|
+
event_status?: string;
|
|
185
|
+
event_data?: Record<string, unknown>;
|
|
186
|
+
error_message?: string;
|
|
187
|
+
created_by?: string;
|
|
188
|
+
created_at: string;
|
|
189
|
+
}
|
|
190
|
+
interface TaxCompany {
|
|
191
|
+
id: string;
|
|
192
|
+
tenant_id: string;
|
|
193
|
+
avalara_company_id: string;
|
|
194
|
+
name: string;
|
|
195
|
+
dba_name?: string;
|
|
196
|
+
email?: string;
|
|
197
|
+
address: string;
|
|
198
|
+
city: string;
|
|
199
|
+
state?: string;
|
|
200
|
+
zip?: string;
|
|
201
|
+
telephone?: string;
|
|
202
|
+
tin?: string;
|
|
203
|
+
reference_id?: string;
|
|
204
|
+
group_name?: string;
|
|
205
|
+
country_code: string;
|
|
206
|
+
is_foreign: boolean;
|
|
207
|
+
resend_requests: boolean;
|
|
208
|
+
resend_interval_days: number;
|
|
209
|
+
max_reminder_attempts: number;
|
|
210
|
+
created_at: string;
|
|
211
|
+
updated_at: string;
|
|
212
|
+
}
|
|
213
|
+
interface TaxCompanyListResponse {
|
|
214
|
+
data: TaxCompany[];
|
|
215
|
+
total: number;
|
|
216
|
+
page: number;
|
|
217
|
+
page_size: number;
|
|
218
|
+
}
|
|
219
|
+
/** form_status values for CustomerTaxProfileRecord */
|
|
220
|
+
type CTPFormStatus = 'not_requested' | 'requested' | 'pending' | 'submitted' | 'verified' | 'rejected' | 'expired' | 're_requested' | 're_submitted';
|
|
221
|
+
/** tin_status values for CustomerTaxProfileRecord */
|
|
222
|
+
type CTPTINStatus = 'not_required' | 'pending' | 'submitted' | 'verified' | 'rejected' | 'error';
|
|
223
|
+
/**
|
|
224
|
+
* CustomerTaxProfileRecord mirrors the customer_tax_profiles table in
|
|
225
|
+
* transaction-monitoring-service.
|
|
226
|
+
*
|
|
227
|
+
* One record per customer — tracks the entire tax lifecycle from first form
|
|
228
|
+
* request through TIN verification to year-end 1099 filing.
|
|
229
|
+
*/
|
|
230
|
+
interface CustomerTaxProfileRecord {
|
|
231
|
+
id: string;
|
|
232
|
+
tenant_id: string;
|
|
233
|
+
customer_id: string;
|
|
234
|
+
form_type?: TaxFormType;
|
|
235
|
+
form_status: CTPFormStatus;
|
|
236
|
+
tin_status: CTPTINStatus;
|
|
237
|
+
tin_value?: string;
|
|
238
|
+
avalara_form_id?: string;
|
|
239
|
+
avalara_company_id?: string;
|
|
240
|
+
signed_at?: string;
|
|
241
|
+
verified_at?: string;
|
|
242
|
+
/** ISO date — for W-8BEN / W-8BEN-E (3 years from signed_at) */
|
|
243
|
+
expiry_date?: string;
|
|
244
|
+
backup_withholding: boolean;
|
|
245
|
+
b_notice_received: boolean;
|
|
246
|
+
e_delivery_consent: boolean;
|
|
247
|
+
reminders_sent: number;
|
|
248
|
+
last_reminder_at?: string;
|
|
249
|
+
created_at: string;
|
|
250
|
+
updated_at: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Request body for POST /api/v1/tax/customer-tax-profiles/{customerID}/request-form
|
|
254
|
+
*
|
|
255
|
+
* Customer data should be sourced from customer_profiles
|
|
256
|
+
* (customer-risk-profile-service) before calling this endpoint.
|
|
257
|
+
*/
|
|
258
|
+
interface RequestTaxFormRequest {
|
|
259
|
+
/** Customer email address — Avalara sends the form invitation here */
|
|
260
|
+
email: string;
|
|
261
|
+
/** Customer full name (or business name for entities) */
|
|
262
|
+
name: string;
|
|
263
|
+
/**
|
|
264
|
+
* Customer type — drives which IRS form is sent.
|
|
265
|
+
* US_PERSON → W-9 | NON_US_PERSON → W-8BEN | NON_US_ENTITY → W-8BEN-E
|
|
266
|
+
*/
|
|
267
|
+
customer_type: CustomerType | 'us_individual' | 'non_us_individual' | 'non_us_entity';
|
|
268
|
+
}
|
|
269
|
+
/** @deprecated Use CustomerTaxProfileRecord for the per-customer DB record. */
|
|
270
|
+
interface CustomerTaxProfile {
|
|
271
|
+
customer_id: string;
|
|
272
|
+
tax_forms: TaxForm[];
|
|
273
|
+
lifecycle_events: TaxFormLifecycleEvent[];
|
|
274
|
+
}
|
|
275
|
+
interface TaxClientConfig {
|
|
276
|
+
/** Base URL of the Transaction Monitoring Service API (e.g., "http://localhost:8085") */
|
|
277
|
+
baseURL: string;
|
|
278
|
+
/** Tenant ID for multi-tenancy */
|
|
279
|
+
tenantId: string;
|
|
280
|
+
/** API key or JWT token for authentication */
|
|
281
|
+
apiKey?: string;
|
|
282
|
+
/** Custom headers to include in every request */
|
|
283
|
+
headers?: Record<string, string>;
|
|
284
|
+
/** Request timeout in milliseconds (default: 10000) */
|
|
285
|
+
timeout?: number;
|
|
286
|
+
/** Enable debug logging */
|
|
287
|
+
debug?: boolean;
|
|
288
|
+
/** Environment mode */
|
|
289
|
+
environment?: 'production' | 'sandbox';
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* TaxClient - TypeScript SDK for Vesant Tax Compliance Service
|
|
294
|
+
*
|
|
295
|
+
* Provides type-safe methods to interact with the Tax Compliance service API.
|
|
296
|
+
* Extends BaseClient for consistent retry logic, timeout handling, and error management.
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
declare class TaxClient extends BaseClient {
|
|
300
|
+
constructor(config: TaxClientConfig);
|
|
301
|
+
/**
|
|
302
|
+
* Get the tax enabled/disabled state for the tenant
|
|
303
|
+
*
|
|
304
|
+
* @returns The current tax config (tax_enabled flag)
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```typescript
|
|
308
|
+
* const config = await client.getTaxConfig();
|
|
309
|
+
* console.log(`Tax enabled: ${config.tax_enabled}`);
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
getTaxConfig(): Promise<TaxConfig>;
|
|
313
|
+
/**
|
|
314
|
+
* Enable or disable tax compliance features for the tenant
|
|
315
|
+
*
|
|
316
|
+
* @param request - Object with tax_enabled boolean
|
|
317
|
+
* @returns Updated tax config
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* // Enable tax
|
|
322
|
+
* const config = await client.updateTaxConfig({ tax_enabled: true });
|
|
323
|
+
*
|
|
324
|
+
* // Disable tax
|
|
325
|
+
* const config = await client.updateTaxConfig({ tax_enabled: false });
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
updateTaxConfig(request: UpdateTaxConfigRequest): Promise<TaxConfig>;
|
|
329
|
+
/**
|
|
330
|
+
* Get solicitation triggers for the tenant
|
|
331
|
+
*
|
|
332
|
+
* @returns List of solicitation triggers with their enabled state
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```typescript
|
|
336
|
+
* const triggers = await client.getSolicitationTriggers();
|
|
337
|
+
* triggers.forEach(t => console.log(`${t.label}: ${t.enabled}`));
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
getSolicitationTriggers(): Promise<SolicitationTrigger[]>;
|
|
341
|
+
/**
|
|
342
|
+
* Update solicitation triggers for the tenant
|
|
343
|
+
*
|
|
344
|
+
* @param triggers - Array of triggers with updated enabled/threshold values
|
|
345
|
+
* @returns Updated triggers
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```typescript
|
|
349
|
+
* const triggers = await client.updateSolicitationTriggers([
|
|
350
|
+
* { type: 'first_withdrawal', enabled: true, label: 'First Withdrawal', description: '...' },
|
|
351
|
+
* { type: 'threshold_based', enabled: true, label: 'Threshold', description: '...', threshold_amount: 600 },
|
|
352
|
+
* ]);
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
updateSolicitationTriggers(triggers: SolicitationTrigger[]): Promise<SolicitationTrigger[]>;
|
|
356
|
+
/**
|
|
357
|
+
* Get the reminder configuration for the tenant
|
|
358
|
+
*
|
|
359
|
+
* @returns Reminder config (enabled, max_reminders, frequency_days)
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* ```typescript
|
|
363
|
+
* const config = await client.getReminderConfig();
|
|
364
|
+
* console.log(`Reminders enabled: ${config.enabled}, every ${config.frequency_days} days`);
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
getReminderConfig(): Promise<ReminderConfig>;
|
|
368
|
+
/**
|
|
369
|
+
* Update the reminder configuration for the tenant
|
|
370
|
+
*
|
|
371
|
+
* @param config - Reminder configuration to set
|
|
372
|
+
* @returns Updated reminder config
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```typescript
|
|
376
|
+
* const updated = await client.updateReminderConfig({
|
|
377
|
+
* enabled: true,
|
|
378
|
+
* max_reminders: 3,
|
|
379
|
+
* frequency_days: 7,
|
|
380
|
+
* });
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
updateReminderConfig(config: ReminderConfig): Promise<ReminderConfig>;
|
|
384
|
+
/**
|
|
385
|
+
* List tax forms with optional filters and pagination
|
|
386
|
+
*
|
|
387
|
+
* @param filters - Optional filters (customer_id, form_type, form_status, etc.)
|
|
388
|
+
* @returns Paginated list of tax forms
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```typescript
|
|
392
|
+
* const result = await client.listTaxForms({ form_type: 'W-9', form_status: 'Pending' });
|
|
393
|
+
* console.log(`Found ${result.total} forms`);
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
listTaxForms(filters?: TaxFormFilters): Promise<TaxFormListResponse>;
|
|
397
|
+
/**
|
|
398
|
+
* Get a tax form by ID
|
|
399
|
+
*
|
|
400
|
+
* @param formId - Tax form UUID
|
|
401
|
+
* @returns Tax form details
|
|
402
|
+
*/
|
|
403
|
+
getTaxForm(formId: string): Promise<TaxForm>;
|
|
404
|
+
/**
|
|
405
|
+
* Get lifecycle events for a tax form
|
|
406
|
+
*
|
|
407
|
+
* @param formId - Tax form UUID
|
|
408
|
+
* @returns List of lifecycle events
|
|
409
|
+
*/
|
|
410
|
+
getTaxFormLifecycleEvents(formId: string): Promise<TaxFormLifecycleEvent[]>;
|
|
411
|
+
/**
|
|
412
|
+
* Get the full tax profile for a customer (all forms + lifecycle events)
|
|
413
|
+
*
|
|
414
|
+
* @param customerID - Customer ID
|
|
415
|
+
* @returns Customer tax profile with all forms and events
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```typescript
|
|
419
|
+
* const profile = await client.getCustomerTaxProfile('cust_123');
|
|
420
|
+
* console.log(`Customer has ${profile.tax_forms.length} tax forms`);
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
getCustomerTaxProfile(customerID: string): Promise<CustomerTaxProfile>;
|
|
424
|
+
/**
|
|
425
|
+
* List Avalara tax companies for the tenant
|
|
426
|
+
*
|
|
427
|
+
* @param page - Page number (default: 1)
|
|
428
|
+
* @param pageSize - Items per page (default: 20)
|
|
429
|
+
* @returns Paginated list of tax companies
|
|
430
|
+
*/
|
|
431
|
+
listTaxCompanies(page?: number, pageSize?: number): Promise<TaxCompanyListResponse>;
|
|
432
|
+
/**
|
|
433
|
+
* Get a tax company by ID
|
|
434
|
+
*
|
|
435
|
+
* @param companyId - Tax company UUID
|
|
436
|
+
* @returns Tax company details
|
|
437
|
+
*/
|
|
438
|
+
getTaxCompany(companyId: string): Promise<TaxCompany>;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* TypeScript types for the Transaction Monitoring (TM) Service
|
|
443
|
+
*
|
|
444
|
+
* These definitions mirror the Go structs used in
|
|
445
|
+
* services/transaction-monitoring-service/internal/domain/
|
|
446
|
+
*
|
|
447
|
+
* Only a subset of fields is included; additional helpers may be
|
|
448
|
+
* added as the SDK grows.
|
|
449
|
+
*/
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Supported transaction types.
|
|
453
|
+
* See domain/transaction.go TransactionType constants.
|
|
454
|
+
*/
|
|
455
|
+
type TransactionType = "deposit" | "withdrawal" | "transfer" | "payment" | "refund" | "fee" | "adjustment";
|
|
456
|
+
/**
|
|
457
|
+
* Modes or channels by which the transaction was carried out.
|
|
458
|
+
*/
|
|
459
|
+
type TransactionMode = "fiat" | "crypto" | "bank_transfer" | "card" | "wallet";
|
|
460
|
+
/**
|
|
461
|
+
* Current status of the transaction record.
|
|
462
|
+
*/
|
|
463
|
+
type TransactionStatus = "pending" | "processing" | "completed" | "failed" | "cancelled" | "reversed";
|
|
464
|
+
/**
|
|
465
|
+
* Payload sent when creating a new transaction via the TM API.
|
|
466
|
+
*
|
|
467
|
+
* Numeric decimal types in Go are represented as strings in the SDK to avoid
|
|
468
|
+
* precision loss in JavaScript. Dates are ISO strings.
|
|
469
|
+
*/
|
|
470
|
+
interface TransactionCreateDTO {
|
|
471
|
+
tx_id: string;
|
|
472
|
+
reference: string;
|
|
473
|
+
tenant_id: string;
|
|
474
|
+
customer_id: string;
|
|
475
|
+
transaction_type: TransactionType;
|
|
476
|
+
transaction_mode: TransactionMode;
|
|
477
|
+
amount: string;
|
|
478
|
+
currency: string;
|
|
479
|
+
status: TransactionStatus;
|
|
480
|
+
source_account: string;
|
|
481
|
+
destination_account: string;
|
|
482
|
+
country: string;
|
|
483
|
+
ip_address: string;
|
|
484
|
+
metadata: Record<string, any>;
|
|
485
|
+
benificiary_comment: string;
|
|
486
|
+
transaction_date: Timestamp;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Representation of a transaction record returned from the TM service.
|
|
490
|
+
*/
|
|
491
|
+
type WithholdingType = "none" | "backup_us" | "backup_non_us" | "treaty";
|
|
492
|
+
type JSONB = Record<string, any>;
|
|
493
|
+
type Transaction = {
|
|
494
|
+
id: string;
|
|
495
|
+
tx_id: string;
|
|
496
|
+
reference: string;
|
|
497
|
+
tenant_id: string;
|
|
498
|
+
customer_id: string;
|
|
499
|
+
transaction_type: TransactionType;
|
|
500
|
+
transaction_mode: TransactionMode;
|
|
501
|
+
amount: string;
|
|
502
|
+
withheld_amount: string;
|
|
503
|
+
released_amount: string;
|
|
504
|
+
withholding_rate: number;
|
|
505
|
+
withholding_reason?: string;
|
|
506
|
+
withholding_type?: WithholdingType;
|
|
507
|
+
tax_year: number;
|
|
508
|
+
currency: string;
|
|
509
|
+
status: TransactionStatus;
|
|
510
|
+
source_account?: string;
|
|
511
|
+
destination_account?: string;
|
|
512
|
+
country?: string;
|
|
513
|
+
ip_address?: string;
|
|
514
|
+
risk_score: number;
|
|
515
|
+
metadata?: JSONB;
|
|
516
|
+
benificiary_comment?: string;
|
|
517
|
+
transaction_date: string;
|
|
518
|
+
created_at: string;
|
|
519
|
+
updated_at: string;
|
|
520
|
+
deleted_at?: string | null;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Configuration object consumed by {@link TransactionClient}.
|
|
524
|
+
* Currently identical to {@link import('../core/types').BaseClientConfig},
|
|
525
|
+
* exported here for future extensibility.
|
|
526
|
+
*/
|
|
527
|
+
interface TransactionClientConfig {
|
|
528
|
+
baseURL: string;
|
|
529
|
+
tenantId: string;
|
|
530
|
+
apiKey?: string;
|
|
531
|
+
headers?: Record<string, string>;
|
|
532
|
+
timeout?: number;
|
|
533
|
+
retries?: number;
|
|
534
|
+
debug?: boolean;
|
|
535
|
+
environment?: 'production' | 'sandbox';
|
|
536
|
+
}
|
|
537
|
+
type TransactionCreateResponse = {
|
|
538
|
+
transaction: Transaction;
|
|
539
|
+
message: string;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* TransactionClient - TypeScript SDK for the Transaction Monitoring service
|
|
544
|
+
*
|
|
545
|
+
* Provides a thin wrapper around the TM service endpoints. Currently only the
|
|
546
|
+
* creation endpoint is implemented, but additional helpers (list, getById,
|
|
547
|
+
* etc.) can be added later.
|
|
548
|
+
*/
|
|
549
|
+
|
|
550
|
+
declare class TransactionClient extends BaseClient {
|
|
551
|
+
constructor(config: BaseClientConfig);
|
|
552
|
+
/**
|
|
553
|
+
* Submit a new transaction record to the monitoring service.
|
|
554
|
+
*
|
|
555
|
+
* The gateway endpoint is `POST /api/v1/tm/transactions` and returns 201
|
|
556
|
+
* with no body on success. The SDK method resolves to `void` to reflect
|
|
557
|
+
* that behaviour.
|
|
558
|
+
*
|
|
559
|
+
* @param request - Data required to create the transaction
|
|
560
|
+
* @param requestOptions - Optional request options (e.g. AbortSignal)
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```ts
|
|
564
|
+
* const client = new TransactionClient({
|
|
565
|
+
* baseURL: process.env.API_GATEWAY_URL!,
|
|
566
|
+
* tenantId: 'tenant-123',
|
|
567
|
+
* apiKey: 'pk_test_...',
|
|
568
|
+
* });
|
|
569
|
+
*
|
|
570
|
+
* await client.createTransaction({
|
|
571
|
+
* tx_id: 'tx-1',
|
|
572
|
+
* reference: 'ref-1',
|
|
573
|
+
* tenant_id: 'tenant-123',
|
|
574
|
+
* customer_id: 'cust-1',
|
|
575
|
+
* transaction_type: 'deposit',
|
|
576
|
+
* transaction_mode: 'ach',
|
|
577
|
+
* amount: '100.00',
|
|
578
|
+
* currency: 'USD',
|
|
579
|
+
* status: 'pending',
|
|
580
|
+
* source_account: 'acct-1',
|
|
581
|
+
* destination_account: 'acct-2',
|
|
582
|
+
* country: 'US',
|
|
583
|
+
* ip_address: '10.0.0.1',
|
|
584
|
+
* metadata: {},
|
|
585
|
+
* benificiary_comment: '',
|
|
586
|
+
* transaction_date: new Date().toISOString(),
|
|
587
|
+
* });
|
|
588
|
+
* ```
|
|
589
|
+
*/
|
|
590
|
+
createTransaction(request: TransactionCreateDTO, requestOptions?: RequestOptions): Promise<TransactionCreateResponse>;
|
|
591
|
+
/**
|
|
592
|
+
*
|
|
593
|
+
* @param transactionId tx_id of the transaction
|
|
594
|
+
* @param requestOptions optional request options (e.g. AbortSignal)
|
|
595
|
+
*/
|
|
596
|
+
getTransaction(transactionId: string, requestOptions?: RequestOptions): Promise<void>;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
export { AuthenticationError, BaseClient, BaseClientConfig, CGSError, type CTPFormStatus, type CTPTINStatus, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceError, type CustomerTaxProfile, type CustomerTaxProfileRecord, type CustomerType, type JSONB, Logger, NetworkError, RateLimitError, type ReminderConfig, RequestOptions, type RequestTaxFormRequest, SDK_VERSION, ServiceUnavailableError, type SolicitationTrigger, type SolicitationTriggerType, type TINStatus, TaxClient, type TaxClientConfig, type TaxCompany, type TaxCompanyListResponse, type TaxConfig, type TaxConfigResponse, type TaxForm, type TaxFormFilters, type TaxFormLifecycleEvent, type TaxFormListResponse, type TaxFormStatus, type TaxFormType, TimeoutError, Timestamp, type Transaction, TransactionClient, type TransactionClientConfig, type TransactionCreateDTO, type TransactionCreateResponse, type TransactionMode, type TransactionStatus, type TransactionType, type UpdateReminderConfigRequest, type UpdateSolicitationTriggersRequest, type UpdateTaxConfigRequest, ValidationError, VesantError, type WithholdingType, createConsoleLogger, noopLogger };
|