vesant-sdk 1.6.1 → 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/{client-DW1Xiz6a.d.mts → client-BlCxjbY2.d.mts} +6 -0
- package/dist/{client-eLbtPRkh.d.ts → client-C_A7QLcB.d.ts} +6 -0
- package/dist/compliance/index.d.mts +9 -2
- package/dist/compliance/index.d.ts +9 -2
- package/dist/compliance/index.js +177 -63
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +177 -63
- package/dist/compliance/index.mjs.map +1 -1
- 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/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/geolocation/index.d.mts +2 -2
- package/dist/geolocation/index.d.ts +2 -2
- package/dist/geolocation/index.js +43 -14
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +43 -14
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index-B04H4xfJ.d.mts +320 -0
- package/dist/index-CItMPmLL.d.ts +320 -0
- package/dist/index.d.mts +9 -109
- package/dist/index.d.ts +9 -109
- package/dist/index.js +281 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +281 -70
- 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 +11 -7
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +11 -7
- 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 +11 -7
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +11 -7
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- 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.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.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 +36 -2
- package/dist/tax/index.d.ts +36 -2
- package/dist/tax/index.js +36 -1
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +36 -1
- 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.mjs
CHANGED
|
@@ -240,7 +240,7 @@ var noopLogger = {
|
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
// src/core/version.ts
|
|
243
|
-
var SDK_VERSION = "1.6.
|
|
243
|
+
var SDK_VERSION = "1.6.2";
|
|
244
244
|
|
|
245
245
|
// src/shared/browser-utils.ts
|
|
246
246
|
function generateUUID() {
|
|
@@ -1121,22 +1121,51 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1121
1121
|
void 0,
|
|
1122
1122
|
requestOptions
|
|
1123
1123
|
);
|
|
1124
|
-
const
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1124
|
+
const loc = cipherTextResult.location;
|
|
1125
|
+
const risk = cipherTextResult.risk;
|
|
1126
|
+
if (!risk) {
|
|
1127
|
+
const locationResult = await this.verifyIP({
|
|
1128
|
+
ip_address: ipAddress,
|
|
1129
|
+
user_id: userId,
|
|
1130
|
+
event_type: eventType
|
|
1131
|
+
}, requestOptions);
|
|
1132
|
+
return {
|
|
1133
|
+
ciphertext_valid: cipherTextResult.valid,
|
|
1134
|
+
ciphertext_result: cipherTextResult,
|
|
1135
|
+
location: locationResult
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
const location = {
|
|
1139
|
+
ip_address: cipherTextResult.ip_address,
|
|
1140
|
+
location: {
|
|
1141
|
+
country: loc?.country ?? "",
|
|
1142
|
+
country_iso: loc?.country_iso ?? "",
|
|
1143
|
+
city: loc?.city ?? "",
|
|
1144
|
+
region: loc?.region ?? "",
|
|
1145
|
+
postal_code: "",
|
|
1146
|
+
latitude: loc?.latitude ?? 0,
|
|
1147
|
+
longitude: loc?.longitude ?? 0,
|
|
1148
|
+
timezone: "",
|
|
1149
|
+
is_vpn: risk.is_vpn ?? false,
|
|
1150
|
+
is_proxy: risk.is_proxy ?? false,
|
|
1151
|
+
is_tor: risk.is_tor ?? false,
|
|
1152
|
+
is_hosting: risk.is_hosting ?? false,
|
|
1153
|
+
is_anonymizer: risk.is_vpn || risk.is_proxy || risk.is_tor
|
|
1154
|
+
},
|
|
1155
|
+
is_compliant: cipherTextResult.is_compliant ?? !risk.is_blocked,
|
|
1156
|
+
is_blocked: risk.is_blocked ?? false,
|
|
1157
|
+
risk_level: risk.level ?? "low",
|
|
1158
|
+
risk_score: risk.score ?? 0,
|
|
1159
|
+
risk_reasons: risk.is_blocked && risk.block_reasons ? risk.block_reasons : risk.factors ?? [],
|
|
1160
|
+
jurisdiction: cipherTextResult.jurisdiction,
|
|
1161
|
+
geofence_evaluation: cipherTextResult.geofence_evaluation,
|
|
1162
|
+
record_id: cipherTextResult.record_id ?? "",
|
|
1163
|
+
gps_required: cipherTextResult.gps_required
|
|
1164
|
+
};
|
|
1136
1165
|
return {
|
|
1137
1166
|
ciphertext_valid: cipherTextResult.valid,
|
|
1138
1167
|
ciphertext_result: cipherTextResult,
|
|
1139
|
-
location
|
|
1168
|
+
location
|
|
1140
1169
|
};
|
|
1141
1170
|
}
|
|
1142
1171
|
// ============================================================================
|
|
@@ -1541,28 +1570,34 @@ var ComplianceClient = class {
|
|
|
1541
1570
|
if (this.config.debug) {
|
|
1542
1571
|
this.logger.debug("Starting registration verification", { customerId: request.customerId });
|
|
1543
1572
|
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
email: request.emailAddress,
|
|
1547
|
-
phone: request.phoneNumber,
|
|
1548
|
-
date_of_birth: request.dateOfBirth
|
|
1549
|
-
} : void 0;
|
|
1550
|
-
[cipherTextResult, geoVerification] = await Promise.all([
|
|
1551
|
-
this.executeCipherTextValidation(
|
|
1573
|
+
if (request.cipherText) {
|
|
1574
|
+
cipherTextResult = await this.executeCipherTextValidation(
|
|
1552
1575
|
request.cipherText,
|
|
1553
1576
|
request.customerId,
|
|
1554
1577
|
"registration",
|
|
1555
1578
|
request.ipAddress,
|
|
1556
|
-
|
|
1579
|
+
{
|
|
1580
|
+
full_name: request.fullName,
|
|
1581
|
+
email: request.emailAddress,
|
|
1582
|
+
phone: request.phoneNumber,
|
|
1583
|
+
date_of_birth: request.dateOfBirth
|
|
1584
|
+
},
|
|
1557
1585
|
requestOptions
|
|
1558
|
-
)
|
|
1559
|
-
this.geoClient.verifyIP({
|
|
1586
|
+
);
|
|
1587
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1560
1588
|
ip_address: request.ipAddress,
|
|
1561
1589
|
user_id: request.customerId,
|
|
1562
1590
|
event_type: "registration",
|
|
1563
1591
|
device_fingerprint: request.deviceFingerprint
|
|
1564
|
-
}, requestOptions)
|
|
1565
|
-
|
|
1592
|
+
}, requestOptions);
|
|
1593
|
+
} else {
|
|
1594
|
+
geoVerification = await this.geoClient.verifyIP({
|
|
1595
|
+
ip_address: request.ipAddress,
|
|
1596
|
+
user_id: request.customerId,
|
|
1597
|
+
event_type: "registration",
|
|
1598
|
+
device_fingerprint: request.deviceFingerprint
|
|
1599
|
+
}, requestOptions);
|
|
1600
|
+
}
|
|
1566
1601
|
const blockReasons = this.evaluateRegistrationBlock(geoVerification, cipherTextResult);
|
|
1567
1602
|
if (blockReasons.length > 0) {
|
|
1568
1603
|
if (this.config.debug) {
|
|
@@ -1643,7 +1678,7 @@ var ComplianceClient = class {
|
|
|
1643
1678
|
evaluateRegistrationBlock(geoVerification, cipherTextResult) {
|
|
1644
1679
|
const blockReasons = [];
|
|
1645
1680
|
if (geoVerification.is_blocked) {
|
|
1646
|
-
blockReasons.push(...geoVerification.risk_reasons);
|
|
1681
|
+
blockReasons.push(...geoVerification.risk_reasons ?? []);
|
|
1647
1682
|
}
|
|
1648
1683
|
if (!geoVerification.is_compliant) {
|
|
1649
1684
|
if (!blockReasons.includes("non_compliant_jurisdiction")) {
|
|
@@ -1667,7 +1702,7 @@ var ComplianceClient = class {
|
|
|
1667
1702
|
}
|
|
1668
1703
|
}
|
|
1669
1704
|
if (geoVerification.geofence_evaluation?.blocked) {
|
|
1670
|
-
blockReasons.push(...geoVerification.geofence_evaluation.reasons);
|
|
1705
|
+
blockReasons.push(...geoVerification.geofence_evaluation.reasons ?? []);
|
|
1671
1706
|
}
|
|
1672
1707
|
if (geoVerification.risk_level === "critical") {
|
|
1673
1708
|
if (!blockReasons.includes("critical_risk_level")) {
|
|
@@ -1818,23 +1853,39 @@ var ComplianceClient = class {
|
|
|
1818
1853
|
if (this.config.debug) {
|
|
1819
1854
|
this.logger.debug("Starting login verification", { customerId: request.customerId });
|
|
1820
1855
|
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1856
|
+
let cipherTextResult;
|
|
1857
|
+
let geoVerification;
|
|
1858
|
+
let profileResult;
|
|
1859
|
+
if (request.cipherText) {
|
|
1860
|
+
[cipherTextResult, profileResult] = await Promise.all([
|
|
1861
|
+
this.executeCipherTextValidation(
|
|
1862
|
+
request.cipherText,
|
|
1863
|
+
request.customerId,
|
|
1864
|
+
"login",
|
|
1865
|
+
request.ipAddress,
|
|
1866
|
+
void 0,
|
|
1867
|
+
requestOptions
|
|
1868
|
+
),
|
|
1869
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1870
|
+
]);
|
|
1871
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1831
1872
|
ip_address: request.ipAddress,
|
|
1832
1873
|
user_id: request.customerId,
|
|
1833
1874
|
event_type: "login",
|
|
1834
1875
|
device_fingerprint: request.deviceFingerprint
|
|
1835
|
-
}, requestOptions)
|
|
1836
|
-
|
|
1837
|
-
|
|
1876
|
+
}, requestOptions);
|
|
1877
|
+
} else {
|
|
1878
|
+
[, geoVerification, profileResult] = await Promise.all([
|
|
1879
|
+
Promise.resolve(void 0),
|
|
1880
|
+
this.geoClient.verifyIP({
|
|
1881
|
+
ip_address: request.ipAddress,
|
|
1882
|
+
user_id: request.customerId,
|
|
1883
|
+
event_type: "login",
|
|
1884
|
+
device_fingerprint: request.deviceFingerprint
|
|
1885
|
+
}, requestOptions),
|
|
1886
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1887
|
+
]);
|
|
1888
|
+
}
|
|
1838
1889
|
const loginBlockReasons = this.getBlockReasons(geoVerification, profileResult, cipherTextResult);
|
|
1839
1890
|
const isBlocked = !geoVerification.is_compliant || geoVerification.is_blocked || !!cipherTextResult?.risk?.is_blocked || cipherTextResult?.valid === false || geoVerification.gps_required && !cipherTextResult;
|
|
1840
1891
|
if (isBlocked && !profileResult) {
|
|
@@ -1919,23 +1970,39 @@ var ComplianceClient = class {
|
|
|
1919
1970
|
currency: request.currency
|
|
1920
1971
|
});
|
|
1921
1972
|
}
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1973
|
+
let cipherTextResult;
|
|
1974
|
+
let geoVerification;
|
|
1975
|
+
let profileResult;
|
|
1976
|
+
if (request.cipherText) {
|
|
1977
|
+
[cipherTextResult, profileResult] = await Promise.all([
|
|
1978
|
+
this.executeCipherTextValidation(
|
|
1979
|
+
request.cipherText,
|
|
1980
|
+
request.customerId,
|
|
1981
|
+
"transaction",
|
|
1982
|
+
request.ipAddress,
|
|
1983
|
+
void 0,
|
|
1984
|
+
requestOptions
|
|
1985
|
+
),
|
|
1986
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1987
|
+
]);
|
|
1988
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1932
1989
|
ip_address: request.ipAddress,
|
|
1933
1990
|
user_id: request.customerId,
|
|
1934
1991
|
event_type: "transaction",
|
|
1935
1992
|
device_fingerprint: request.deviceFingerprint
|
|
1936
|
-
}, requestOptions)
|
|
1937
|
-
|
|
1938
|
-
|
|
1993
|
+
}, requestOptions);
|
|
1994
|
+
} else {
|
|
1995
|
+
[, geoVerification, profileResult] = await Promise.all([
|
|
1996
|
+
Promise.resolve(void 0),
|
|
1997
|
+
this.geoClient.verifyIP({
|
|
1998
|
+
ip_address: request.ipAddress,
|
|
1999
|
+
user_id: request.customerId,
|
|
2000
|
+
event_type: "transaction",
|
|
2001
|
+
device_fingerprint: request.deviceFingerprint
|
|
2002
|
+
}, requestOptions),
|
|
2003
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
2004
|
+
]);
|
|
2005
|
+
}
|
|
1939
2006
|
const geoBlocked = !geoVerification.is_compliant || geoVerification.is_blocked || !!cipherTextResult?.risk?.is_blocked || cipherTextResult?.valid === false || geoVerification.gps_required && !cipherTextResult;
|
|
1940
2007
|
if (geoBlocked && !profileResult) {
|
|
1941
2008
|
return {
|
|
@@ -1999,22 +2066,31 @@ var ComplianceClient = class {
|
|
|
1999
2066
|
async verifyEvent(request, requestOptions) {
|
|
2000
2067
|
const startTime = Date.now();
|
|
2001
2068
|
this.validateEventRequest(request);
|
|
2002
|
-
|
|
2003
|
-
|
|
2069
|
+
let cipherTextResult;
|
|
2070
|
+
let geoVerification;
|
|
2071
|
+
if (request.cipherText) {
|
|
2072
|
+
cipherTextResult = await this.executeCipherTextValidation(
|
|
2004
2073
|
request.cipherText,
|
|
2005
2074
|
request.customerId,
|
|
2006
2075
|
request.eventType,
|
|
2007
2076
|
request.ipAddress,
|
|
2008
2077
|
void 0,
|
|
2009
2078
|
requestOptions
|
|
2010
|
-
)
|
|
2011
|
-
this.geoClient.verifyIP({
|
|
2079
|
+
);
|
|
2080
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
2081
|
+
ip_address: request.ipAddress,
|
|
2082
|
+
user_id: request.customerId,
|
|
2083
|
+
event_type: request.eventType,
|
|
2084
|
+
device_fingerprint: request.deviceFingerprint
|
|
2085
|
+
}, requestOptions);
|
|
2086
|
+
} else {
|
|
2087
|
+
geoVerification = await this.geoClient.verifyIP({
|
|
2012
2088
|
ip_address: request.ipAddress,
|
|
2013
2089
|
user_id: request.customerId,
|
|
2014
2090
|
event_type: request.eventType,
|
|
2015
2091
|
device_fingerprint: request.deviceFingerprint
|
|
2016
|
-
}, requestOptions)
|
|
2017
|
-
|
|
2092
|
+
}, requestOptions);
|
|
2093
|
+
}
|
|
2018
2094
|
if (this.config.autoCreateProfiles) {
|
|
2019
2095
|
try {
|
|
2020
2096
|
const profile = await this.riskClient.getProfile(request.customerId, requestOptions);
|
|
@@ -2028,7 +2104,7 @@ var ComplianceClient = class {
|
|
|
2028
2104
|
}
|
|
2029
2105
|
}
|
|
2030
2106
|
const cipherTextBlocked = cipherTextResult ? !cipherTextResult.valid || cipherTextResult.risk?.is_blocked === true : false;
|
|
2031
|
-
const blockReasons = [...geoVerification.risk_reasons];
|
|
2107
|
+
const blockReasons = [...geoVerification.risk_reasons ?? []];
|
|
2032
2108
|
if (cipherTextResult) {
|
|
2033
2109
|
if (!cipherTextResult.valid) {
|
|
2034
2110
|
blockReasons.push("ciphertext_validation_failed");
|
|
@@ -2097,6 +2173,44 @@ var ComplianceClient = class {
|
|
|
2097
2173
|
return void 0;
|
|
2098
2174
|
}
|
|
2099
2175
|
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Build a LocationVerification from a ValidateCipherTextResponse.
|
|
2178
|
+
* The validate-ciphertext endpoint now returns the full geo-verification data
|
|
2179
|
+
* (is_compliant, jurisdiction, geofence_evaluation, record_id, gps_required),
|
|
2180
|
+
* so a separate verifyIP call is unnecessary.
|
|
2181
|
+
*/
|
|
2182
|
+
buildLocationFromCipherText(ct, ipAddress) {
|
|
2183
|
+
const loc = ct.location;
|
|
2184
|
+
const risk = ct.risk;
|
|
2185
|
+
if (!risk) return null;
|
|
2186
|
+
return {
|
|
2187
|
+
ip_address: ct.ip_address || ipAddress,
|
|
2188
|
+
location: {
|
|
2189
|
+
country: loc?.country ?? "",
|
|
2190
|
+
country_iso: loc?.country_iso ?? "",
|
|
2191
|
+
city: loc?.city ?? "",
|
|
2192
|
+
region: loc?.region ?? "",
|
|
2193
|
+
postal_code: "",
|
|
2194
|
+
latitude: loc?.latitude ?? 0,
|
|
2195
|
+
longitude: loc?.longitude ?? 0,
|
|
2196
|
+
timezone: "",
|
|
2197
|
+
is_vpn: risk.is_vpn,
|
|
2198
|
+
is_proxy: risk.is_proxy,
|
|
2199
|
+
is_tor: risk.is_tor,
|
|
2200
|
+
is_hosting: risk.is_hosting ?? false,
|
|
2201
|
+
is_anonymizer: risk.is_vpn || risk.is_proxy || risk.is_tor
|
|
2202
|
+
},
|
|
2203
|
+
is_compliant: ct.is_compliant ?? !risk.is_blocked,
|
|
2204
|
+
is_blocked: risk.is_blocked,
|
|
2205
|
+
risk_level: risk.level,
|
|
2206
|
+
risk_score: risk.score,
|
|
2207
|
+
risk_reasons: risk.is_blocked && risk.block_reasons ? risk.block_reasons : risk.factors ?? [],
|
|
2208
|
+
jurisdiction: ct.jurisdiction,
|
|
2209
|
+
geofence_evaluation: ct.geofence_evaluation,
|
|
2210
|
+
record_id: ct.record_id ?? "",
|
|
2211
|
+
gps_required: ct.gps_required
|
|
2212
|
+
};
|
|
2213
|
+
}
|
|
2100
2214
|
calculateTransactionRisk(amount, currency, geoVerification, profile, cipherTextResult) {
|
|
2101
2215
|
if (!this._currencyRatesCustomized && !this._currencyRatesWarned) {
|
|
2102
2216
|
this._currencyRatesWarned = true;
|
|
@@ -2167,7 +2281,7 @@ var ComplianceClient = class {
|
|
|
2167
2281
|
getBlockReasons(geoVerification, profile, cipherTextResult) {
|
|
2168
2282
|
const reasons = [];
|
|
2169
2283
|
if (geoVerification.is_blocked) {
|
|
2170
|
-
reasons.push(...geoVerification.risk_reasons);
|
|
2284
|
+
reasons.push(...geoVerification.risk_reasons ?? []);
|
|
2171
2285
|
}
|
|
2172
2286
|
if (profile) {
|
|
2173
2287
|
if (profile.customer_status === "suspended") {
|
|
@@ -2490,19 +2604,23 @@ var KycClient = class extends BaseClient {
|
|
|
2490
2604
|
*
|
|
2491
2605
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
2492
2606
|
*
|
|
2493
|
-
* @param request - Request containing the user ID,
|
|
2494
|
-
* @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
|
|
2495
2609
|
*
|
|
2496
2610
|
* @example
|
|
2497
2611
|
* ```typescript
|
|
2498
2612
|
* const result = await client.requestKycSubmitLink({
|
|
2499
2613
|
* user_id: "user_123",
|
|
2500
|
-
* redirect_url: "https://merchant.com/kyc-complete",
|
|
2501
|
-
* callback_url: "https://merchant.com/api/kyc-webhook"
|
|
2614
|
+
* redirect_url: "https://merchant.com/kyc-complete",
|
|
2615
|
+
* callback_url: "https://merchant.com/api/kyc-webhook",
|
|
2616
|
+
* trigger_event: "onboarding"
|
|
2502
2617
|
* });
|
|
2503
2618
|
*
|
|
2504
|
-
*
|
|
2505
|
-
*
|
|
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
|
+
* }
|
|
2506
2624
|
* ```
|
|
2507
2625
|
*/
|
|
2508
2626
|
async requestKycSubmitLink(request) {
|
|
@@ -3079,6 +3197,41 @@ var TaxClient = class extends BaseClient {
|
|
|
3079
3197
|
{ ...requestOptions, responseType: "arraybuffer" }
|
|
3080
3198
|
);
|
|
3081
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
|
+
}
|
|
3082
3235
|
// ==========================================================================
|
|
3083
3236
|
// P2 — Tenant Tax Rules
|
|
3084
3237
|
// ==========================================================================
|
|
@@ -3187,6 +3340,64 @@ var TransactionClient = class extends BaseClient {
|
|
|
3187
3340
|
}
|
|
3188
3341
|
};
|
|
3189
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
|
+
|
|
3190
3401
|
// src/webhooks/handler.ts
|
|
3191
3402
|
var WebhookHandler = class {
|
|
3192
3403
|
constructor(config) {
|
|
@@ -3330,6 +3541,6 @@ function buildHandler(options) {
|
|
|
3330
3541
|
return handler;
|
|
3331
3542
|
}
|
|
3332
3543
|
|
|
3333
|
-
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 };
|
|
3334
3545
|
//# sourceMappingURL=index.mjs.map
|
|
3335
3546
|
//# sourceMappingURL=index.mjs.map
|