vesant-sdk 1.6.1 → 1.6.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/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/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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +177 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -63
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.js +1 -1
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +1 -1
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.js +1 -1
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +1 -1
- 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 +0 -1
- package/dist/tax/index.d.ts +0 -1
- package/dist/tax/index.js +1 -1
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +1 -1
- package/dist/tax/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -195,6 +195,7 @@ interface ValidateCipherTextResponse {
|
|
|
195
195
|
is_vpn: boolean;
|
|
196
196
|
is_proxy: boolean;
|
|
197
197
|
is_tor: boolean;
|
|
198
|
+
is_hosting?: boolean;
|
|
198
199
|
/** Whether access is blocked based on tenant's geofence rules configuration */
|
|
199
200
|
is_blocked: boolean;
|
|
200
201
|
/** Reasons for blocking (only present if is_blocked is true) */
|
|
@@ -205,6 +206,11 @@ interface ValidateCipherTextResponse {
|
|
|
205
206
|
location_mismatch_distance_km?: number;
|
|
206
207
|
};
|
|
207
208
|
errors?: string[];
|
|
209
|
+
is_compliant?: boolean;
|
|
210
|
+
jurisdiction?: JurisdictionConfig;
|
|
211
|
+
geofence_evaluation?: GeofenceEvaluation;
|
|
212
|
+
record_id?: string;
|
|
213
|
+
gps_required?: boolean;
|
|
208
214
|
}
|
|
209
215
|
interface VerifyIPRequest {
|
|
210
216
|
ip_address: string;
|
|
@@ -195,6 +195,7 @@ interface ValidateCipherTextResponse {
|
|
|
195
195
|
is_vpn: boolean;
|
|
196
196
|
is_proxy: boolean;
|
|
197
197
|
is_tor: boolean;
|
|
198
|
+
is_hosting?: boolean;
|
|
198
199
|
/** Whether access is blocked based on tenant's geofence rules configuration */
|
|
199
200
|
is_blocked: boolean;
|
|
200
201
|
/** Reasons for blocking (only present if is_blocked is true) */
|
|
@@ -205,6 +206,11 @@ interface ValidateCipherTextResponse {
|
|
|
205
206
|
location_mismatch_distance_km?: number;
|
|
206
207
|
};
|
|
207
208
|
errors?: string[];
|
|
209
|
+
is_compliant?: boolean;
|
|
210
|
+
jurisdiction?: JurisdictionConfig;
|
|
211
|
+
geofence_evaluation?: GeofenceEvaluation;
|
|
212
|
+
record_id?: string;
|
|
213
|
+
gps_required?: boolean;
|
|
208
214
|
}
|
|
209
215
|
interface VerifyIPRequest {
|
|
210
216
|
ip_address: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceFingerprintRequest, L as LocationVerification, f as ValidateCipherTextResponse, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-
|
|
2
|
-
export { Q as CreateLocationRequestRequest, Y as LocationCaptureRequest, _ as LocationCaptureResponse, O as LocationRequestChannel, R as LocationRequestResult, N as LocationRequestStatus, Z as LocationShareInfo, W as ResendLocationRequestRequest } from '../client-
|
|
1
|
+
import { D as DeviceFingerprintRequest, L as LocationVerification, f as ValidateCipherTextResponse, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-BlCxjbY2.mjs';
|
|
2
|
+
export { Q as CreateLocationRequestRequest, Y as LocationCaptureRequest, _ as LocationCaptureResponse, O as LocationRequestChannel, R as LocationRequestResult, N as LocationRequestStatus, Z as LocationShareInfo, W as ResendLocationRequestRequest } from '../client-BlCxjbY2.mjs';
|
|
3
3
|
import { RiskProfileClient } from '../risk-profile/index.mjs';
|
|
4
4
|
import { V as VesantConfig, R as RequestOptions } from '../client-ePzhQKp9.mjs';
|
|
5
5
|
import { C as CustomerProfile } from '../types-1RzYeSal.mjs';
|
|
@@ -277,6 +277,13 @@ declare class ComplianceClient {
|
|
|
277
277
|
* Returns undefined if cipherText is not provided or validation fails.
|
|
278
278
|
*/
|
|
279
279
|
private executeCipherTextValidation;
|
|
280
|
+
/**
|
|
281
|
+
* Build a LocationVerification from a ValidateCipherTextResponse.
|
|
282
|
+
* The validate-ciphertext endpoint now returns the full geo-verification data
|
|
283
|
+
* (is_compliant, jurisdiction, geofence_evaluation, record_id, gps_required),
|
|
284
|
+
* so a separate verifyIP call is unnecessary.
|
|
285
|
+
*/
|
|
286
|
+
private buildLocationFromCipherText;
|
|
280
287
|
private calculateTransactionRisk;
|
|
281
288
|
private checkJurisdictionLimits;
|
|
282
289
|
private normalizeToUSD;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceFingerprintRequest, L as LocationVerification, f as ValidateCipherTextResponse, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-
|
|
2
|
-
export { Q as CreateLocationRequestRequest, Y as LocationCaptureRequest, _ as LocationCaptureResponse, O as LocationRequestChannel, R as LocationRequestResult, N as LocationRequestStatus, Z as LocationShareInfo, W as ResendLocationRequestRequest } from '../client-
|
|
1
|
+
import { D as DeviceFingerprintRequest, L as LocationVerification, f as ValidateCipherTextResponse, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-C_A7QLcB.js';
|
|
2
|
+
export { Q as CreateLocationRequestRequest, Y as LocationCaptureRequest, _ as LocationCaptureResponse, O as LocationRequestChannel, R as LocationRequestResult, N as LocationRequestStatus, Z as LocationShareInfo, W as ResendLocationRequestRequest } from '../client-C_A7QLcB.js';
|
|
3
3
|
import { RiskProfileClient } from '../risk-profile/index.js';
|
|
4
4
|
import { V as VesantConfig, R as RequestOptions } from '../client-ePzhQKp9.js';
|
|
5
5
|
import { C as CustomerProfile } from '../types-X5Md_dD_.js';
|
|
@@ -277,6 +277,13 @@ declare class ComplianceClient {
|
|
|
277
277
|
* Returns undefined if cipherText is not provided or validation fails.
|
|
278
278
|
*/
|
|
279
279
|
private executeCipherTextValidation;
|
|
280
|
+
/**
|
|
281
|
+
* Build a LocationVerification from a ValidateCipherTextResponse.
|
|
282
|
+
* The validate-ciphertext endpoint now returns the full geo-verification data
|
|
283
|
+
* (is_compliant, jurisdiction, geofence_evaluation, record_id, gps_required),
|
|
284
|
+
* so a separate verifyIP call is unnecessary.
|
|
285
|
+
*/
|
|
286
|
+
private buildLocationFromCipherText;
|
|
280
287
|
private calculateTransactionRisk;
|
|
281
288
|
private checkJurisdictionLimits;
|
|
282
289
|
private normalizeToUSD;
|
package/dist/compliance/index.js
CHANGED
|
@@ -224,7 +224,7 @@ function createConsoleLogger() {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
// src/core/version.ts
|
|
227
|
-
var SDK_VERSION = "1.6.
|
|
227
|
+
var SDK_VERSION = "1.6.2";
|
|
228
228
|
|
|
229
229
|
// src/shared/browser-utils.ts
|
|
230
230
|
function generateUUID() {
|
|
@@ -1038,22 +1038,51 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1038
1038
|
void 0,
|
|
1039
1039
|
requestOptions
|
|
1040
1040
|
);
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1041
|
+
const loc = cipherTextResult.location;
|
|
1042
|
+
const risk = cipherTextResult.risk;
|
|
1043
|
+
if (!risk) {
|
|
1044
|
+
const locationResult = await this.verifyIP({
|
|
1045
|
+
ip_address: ipAddress,
|
|
1046
|
+
user_id: userId,
|
|
1047
|
+
event_type: eventType
|
|
1048
|
+
}, requestOptions);
|
|
1049
|
+
return {
|
|
1050
|
+
ciphertext_valid: cipherTextResult.valid,
|
|
1051
|
+
ciphertext_result: cipherTextResult,
|
|
1052
|
+
location: locationResult
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
const location = {
|
|
1056
|
+
ip_address: cipherTextResult.ip_address,
|
|
1057
|
+
location: {
|
|
1058
|
+
country: loc?.country ?? "",
|
|
1059
|
+
country_iso: loc?.country_iso ?? "",
|
|
1060
|
+
city: loc?.city ?? "",
|
|
1061
|
+
region: loc?.region ?? "",
|
|
1062
|
+
postal_code: "",
|
|
1063
|
+
latitude: loc?.latitude ?? 0,
|
|
1064
|
+
longitude: loc?.longitude ?? 0,
|
|
1065
|
+
timezone: "",
|
|
1066
|
+
is_vpn: risk.is_vpn ?? false,
|
|
1067
|
+
is_proxy: risk.is_proxy ?? false,
|
|
1068
|
+
is_tor: risk.is_tor ?? false,
|
|
1069
|
+
is_hosting: risk.is_hosting ?? false,
|
|
1070
|
+
is_anonymizer: risk.is_vpn || risk.is_proxy || risk.is_tor
|
|
1071
|
+
},
|
|
1072
|
+
is_compliant: cipherTextResult.is_compliant ?? !risk.is_blocked,
|
|
1073
|
+
is_blocked: risk.is_blocked ?? false,
|
|
1074
|
+
risk_level: risk.level ?? "low",
|
|
1075
|
+
risk_score: risk.score ?? 0,
|
|
1076
|
+
risk_reasons: risk.is_blocked && risk.block_reasons ? risk.block_reasons : risk.factors ?? [],
|
|
1077
|
+
jurisdiction: cipherTextResult.jurisdiction,
|
|
1078
|
+
geofence_evaluation: cipherTextResult.geofence_evaluation,
|
|
1079
|
+
record_id: cipherTextResult.record_id ?? "",
|
|
1080
|
+
gps_required: cipherTextResult.gps_required
|
|
1081
|
+
};
|
|
1053
1082
|
return {
|
|
1054
1083
|
ciphertext_valid: cipherTextResult.valid,
|
|
1055
1084
|
ciphertext_result: cipherTextResult,
|
|
1056
|
-
location
|
|
1085
|
+
location
|
|
1057
1086
|
};
|
|
1058
1087
|
}
|
|
1059
1088
|
// ============================================================================
|
|
@@ -1458,28 +1487,34 @@ var ComplianceClient = class {
|
|
|
1458
1487
|
if (this.config.debug) {
|
|
1459
1488
|
this.logger.debug("Starting registration verification", { customerId: request.customerId });
|
|
1460
1489
|
}
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
email: request.emailAddress,
|
|
1464
|
-
phone: request.phoneNumber,
|
|
1465
|
-
date_of_birth: request.dateOfBirth
|
|
1466
|
-
} : void 0;
|
|
1467
|
-
[cipherTextResult, geoVerification] = await Promise.all([
|
|
1468
|
-
this.executeCipherTextValidation(
|
|
1490
|
+
if (request.cipherText) {
|
|
1491
|
+
cipherTextResult = await this.executeCipherTextValidation(
|
|
1469
1492
|
request.cipherText,
|
|
1470
1493
|
request.customerId,
|
|
1471
1494
|
"registration",
|
|
1472
1495
|
request.ipAddress,
|
|
1473
|
-
|
|
1496
|
+
{
|
|
1497
|
+
full_name: request.fullName,
|
|
1498
|
+
email: request.emailAddress,
|
|
1499
|
+
phone: request.phoneNumber,
|
|
1500
|
+
date_of_birth: request.dateOfBirth
|
|
1501
|
+
},
|
|
1474
1502
|
requestOptions
|
|
1475
|
-
)
|
|
1476
|
-
this.geoClient.verifyIP({
|
|
1503
|
+
);
|
|
1504
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1477
1505
|
ip_address: request.ipAddress,
|
|
1478
1506
|
user_id: request.customerId,
|
|
1479
1507
|
event_type: "registration",
|
|
1480
1508
|
device_fingerprint: request.deviceFingerprint
|
|
1481
|
-
}, requestOptions)
|
|
1482
|
-
|
|
1509
|
+
}, requestOptions);
|
|
1510
|
+
} else {
|
|
1511
|
+
geoVerification = await this.geoClient.verifyIP({
|
|
1512
|
+
ip_address: request.ipAddress,
|
|
1513
|
+
user_id: request.customerId,
|
|
1514
|
+
event_type: "registration",
|
|
1515
|
+
device_fingerprint: request.deviceFingerprint
|
|
1516
|
+
}, requestOptions);
|
|
1517
|
+
}
|
|
1483
1518
|
const blockReasons = this.evaluateRegistrationBlock(geoVerification, cipherTextResult);
|
|
1484
1519
|
if (blockReasons.length > 0) {
|
|
1485
1520
|
if (this.config.debug) {
|
|
@@ -1560,7 +1595,7 @@ var ComplianceClient = class {
|
|
|
1560
1595
|
evaluateRegistrationBlock(geoVerification, cipherTextResult) {
|
|
1561
1596
|
const blockReasons = [];
|
|
1562
1597
|
if (geoVerification.is_blocked) {
|
|
1563
|
-
blockReasons.push(...geoVerification.risk_reasons);
|
|
1598
|
+
blockReasons.push(...geoVerification.risk_reasons ?? []);
|
|
1564
1599
|
}
|
|
1565
1600
|
if (!geoVerification.is_compliant) {
|
|
1566
1601
|
if (!blockReasons.includes("non_compliant_jurisdiction")) {
|
|
@@ -1584,7 +1619,7 @@ var ComplianceClient = class {
|
|
|
1584
1619
|
}
|
|
1585
1620
|
}
|
|
1586
1621
|
if (geoVerification.geofence_evaluation?.blocked) {
|
|
1587
|
-
blockReasons.push(...geoVerification.geofence_evaluation.reasons);
|
|
1622
|
+
blockReasons.push(...geoVerification.geofence_evaluation.reasons ?? []);
|
|
1588
1623
|
}
|
|
1589
1624
|
if (geoVerification.risk_level === "critical") {
|
|
1590
1625
|
if (!blockReasons.includes("critical_risk_level")) {
|
|
@@ -1735,23 +1770,39 @@ var ComplianceClient = class {
|
|
|
1735
1770
|
if (this.config.debug) {
|
|
1736
1771
|
this.logger.debug("Starting login verification", { customerId: request.customerId });
|
|
1737
1772
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1773
|
+
let cipherTextResult;
|
|
1774
|
+
let geoVerification;
|
|
1775
|
+
let profileResult;
|
|
1776
|
+
if (request.cipherText) {
|
|
1777
|
+
[cipherTextResult, profileResult] = await Promise.all([
|
|
1778
|
+
this.executeCipherTextValidation(
|
|
1779
|
+
request.cipherText,
|
|
1780
|
+
request.customerId,
|
|
1781
|
+
"login",
|
|
1782
|
+
request.ipAddress,
|
|
1783
|
+
void 0,
|
|
1784
|
+
requestOptions
|
|
1785
|
+
),
|
|
1786
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1787
|
+
]);
|
|
1788
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1748
1789
|
ip_address: request.ipAddress,
|
|
1749
1790
|
user_id: request.customerId,
|
|
1750
1791
|
event_type: "login",
|
|
1751
1792
|
device_fingerprint: request.deviceFingerprint
|
|
1752
|
-
}, requestOptions)
|
|
1753
|
-
|
|
1754
|
-
|
|
1793
|
+
}, requestOptions);
|
|
1794
|
+
} else {
|
|
1795
|
+
[, geoVerification, profileResult] = await Promise.all([
|
|
1796
|
+
Promise.resolve(void 0),
|
|
1797
|
+
this.geoClient.verifyIP({
|
|
1798
|
+
ip_address: request.ipAddress,
|
|
1799
|
+
user_id: request.customerId,
|
|
1800
|
+
event_type: "login",
|
|
1801
|
+
device_fingerprint: request.deviceFingerprint
|
|
1802
|
+
}, requestOptions),
|
|
1803
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1804
|
+
]);
|
|
1805
|
+
}
|
|
1755
1806
|
const loginBlockReasons = this.getBlockReasons(geoVerification, profileResult, cipherTextResult);
|
|
1756
1807
|
const isBlocked = !geoVerification.is_compliant || geoVerification.is_blocked || !!cipherTextResult?.risk?.is_blocked || cipherTextResult?.valid === false || geoVerification.gps_required && !cipherTextResult;
|
|
1757
1808
|
if (isBlocked && !profileResult) {
|
|
@@ -1836,23 +1887,39 @@ var ComplianceClient = class {
|
|
|
1836
1887
|
currency: request.currency
|
|
1837
1888
|
});
|
|
1838
1889
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1890
|
+
let cipherTextResult;
|
|
1891
|
+
let geoVerification;
|
|
1892
|
+
let profileResult;
|
|
1893
|
+
if (request.cipherText) {
|
|
1894
|
+
[cipherTextResult, profileResult] = await Promise.all([
|
|
1895
|
+
this.executeCipherTextValidation(
|
|
1896
|
+
request.cipherText,
|
|
1897
|
+
request.customerId,
|
|
1898
|
+
"transaction",
|
|
1899
|
+
request.ipAddress,
|
|
1900
|
+
void 0,
|
|
1901
|
+
requestOptions
|
|
1902
|
+
),
|
|
1903
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1904
|
+
]);
|
|
1905
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1849
1906
|
ip_address: request.ipAddress,
|
|
1850
1907
|
user_id: request.customerId,
|
|
1851
1908
|
event_type: "transaction",
|
|
1852
1909
|
device_fingerprint: request.deviceFingerprint
|
|
1853
|
-
}, requestOptions)
|
|
1854
|
-
|
|
1855
|
-
|
|
1910
|
+
}, requestOptions);
|
|
1911
|
+
} else {
|
|
1912
|
+
[, geoVerification, profileResult] = await Promise.all([
|
|
1913
|
+
Promise.resolve(void 0),
|
|
1914
|
+
this.geoClient.verifyIP({
|
|
1915
|
+
ip_address: request.ipAddress,
|
|
1916
|
+
user_id: request.customerId,
|
|
1917
|
+
event_type: "transaction",
|
|
1918
|
+
device_fingerprint: request.deviceFingerprint
|
|
1919
|
+
}, requestOptions),
|
|
1920
|
+
this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
|
|
1921
|
+
]);
|
|
1922
|
+
}
|
|
1856
1923
|
const geoBlocked = !geoVerification.is_compliant || geoVerification.is_blocked || !!cipherTextResult?.risk?.is_blocked || cipherTextResult?.valid === false || geoVerification.gps_required && !cipherTextResult;
|
|
1857
1924
|
if (geoBlocked && !profileResult) {
|
|
1858
1925
|
return {
|
|
@@ -1916,22 +1983,31 @@ var ComplianceClient = class {
|
|
|
1916
1983
|
async verifyEvent(request, requestOptions) {
|
|
1917
1984
|
const startTime = Date.now();
|
|
1918
1985
|
this.validateEventRequest(request);
|
|
1919
|
-
|
|
1920
|
-
|
|
1986
|
+
let cipherTextResult;
|
|
1987
|
+
let geoVerification;
|
|
1988
|
+
if (request.cipherText) {
|
|
1989
|
+
cipherTextResult = await this.executeCipherTextValidation(
|
|
1921
1990
|
request.cipherText,
|
|
1922
1991
|
request.customerId,
|
|
1923
1992
|
request.eventType,
|
|
1924
1993
|
request.ipAddress,
|
|
1925
1994
|
void 0,
|
|
1926
1995
|
requestOptions
|
|
1927
|
-
)
|
|
1928
|
-
this.geoClient.verifyIP({
|
|
1996
|
+
);
|
|
1997
|
+
geoVerification = (cipherTextResult && this.buildLocationFromCipherText(cipherTextResult, request.ipAddress)) ?? await this.geoClient.verifyIP({
|
|
1998
|
+
ip_address: request.ipAddress,
|
|
1999
|
+
user_id: request.customerId,
|
|
2000
|
+
event_type: request.eventType,
|
|
2001
|
+
device_fingerprint: request.deviceFingerprint
|
|
2002
|
+
}, requestOptions);
|
|
2003
|
+
} else {
|
|
2004
|
+
geoVerification = await this.geoClient.verifyIP({
|
|
1929
2005
|
ip_address: request.ipAddress,
|
|
1930
2006
|
user_id: request.customerId,
|
|
1931
2007
|
event_type: request.eventType,
|
|
1932
2008
|
device_fingerprint: request.deviceFingerprint
|
|
1933
|
-
}, requestOptions)
|
|
1934
|
-
|
|
2009
|
+
}, requestOptions);
|
|
2010
|
+
}
|
|
1935
2011
|
if (this.config.autoCreateProfiles) {
|
|
1936
2012
|
try {
|
|
1937
2013
|
const profile = await this.riskClient.getProfile(request.customerId, requestOptions);
|
|
@@ -1945,7 +2021,7 @@ var ComplianceClient = class {
|
|
|
1945
2021
|
}
|
|
1946
2022
|
}
|
|
1947
2023
|
const cipherTextBlocked = cipherTextResult ? !cipherTextResult.valid || cipherTextResult.risk?.is_blocked === true : false;
|
|
1948
|
-
const blockReasons = [...geoVerification.risk_reasons];
|
|
2024
|
+
const blockReasons = [...geoVerification.risk_reasons ?? []];
|
|
1949
2025
|
if (cipherTextResult) {
|
|
1950
2026
|
if (!cipherTextResult.valid) {
|
|
1951
2027
|
blockReasons.push("ciphertext_validation_failed");
|
|
@@ -2014,6 +2090,44 @@ var ComplianceClient = class {
|
|
|
2014
2090
|
return void 0;
|
|
2015
2091
|
}
|
|
2016
2092
|
}
|
|
2093
|
+
/**
|
|
2094
|
+
* Build a LocationVerification from a ValidateCipherTextResponse.
|
|
2095
|
+
* The validate-ciphertext endpoint now returns the full geo-verification data
|
|
2096
|
+
* (is_compliant, jurisdiction, geofence_evaluation, record_id, gps_required),
|
|
2097
|
+
* so a separate verifyIP call is unnecessary.
|
|
2098
|
+
*/
|
|
2099
|
+
buildLocationFromCipherText(ct, ipAddress) {
|
|
2100
|
+
const loc = ct.location;
|
|
2101
|
+
const risk = ct.risk;
|
|
2102
|
+
if (!risk) return null;
|
|
2103
|
+
return {
|
|
2104
|
+
ip_address: ct.ip_address || ipAddress,
|
|
2105
|
+
location: {
|
|
2106
|
+
country: loc?.country ?? "",
|
|
2107
|
+
country_iso: loc?.country_iso ?? "",
|
|
2108
|
+
city: loc?.city ?? "",
|
|
2109
|
+
region: loc?.region ?? "",
|
|
2110
|
+
postal_code: "",
|
|
2111
|
+
latitude: loc?.latitude ?? 0,
|
|
2112
|
+
longitude: loc?.longitude ?? 0,
|
|
2113
|
+
timezone: "",
|
|
2114
|
+
is_vpn: risk.is_vpn,
|
|
2115
|
+
is_proxy: risk.is_proxy,
|
|
2116
|
+
is_tor: risk.is_tor,
|
|
2117
|
+
is_hosting: risk.is_hosting ?? false,
|
|
2118
|
+
is_anonymizer: risk.is_vpn || risk.is_proxy || risk.is_tor
|
|
2119
|
+
},
|
|
2120
|
+
is_compliant: ct.is_compliant ?? !risk.is_blocked,
|
|
2121
|
+
is_blocked: risk.is_blocked,
|
|
2122
|
+
risk_level: risk.level,
|
|
2123
|
+
risk_score: risk.score,
|
|
2124
|
+
risk_reasons: risk.is_blocked && risk.block_reasons ? risk.block_reasons : risk.factors ?? [],
|
|
2125
|
+
jurisdiction: ct.jurisdiction,
|
|
2126
|
+
geofence_evaluation: ct.geofence_evaluation,
|
|
2127
|
+
record_id: ct.record_id ?? "",
|
|
2128
|
+
gps_required: ct.gps_required
|
|
2129
|
+
};
|
|
2130
|
+
}
|
|
2017
2131
|
calculateTransactionRisk(amount, currency, geoVerification, profile, cipherTextResult) {
|
|
2018
2132
|
if (!this._currencyRatesCustomized && !this._currencyRatesWarned) {
|
|
2019
2133
|
this._currencyRatesWarned = true;
|
|
@@ -2084,7 +2198,7 @@ var ComplianceClient = class {
|
|
|
2084
2198
|
getBlockReasons(geoVerification, profile, cipherTextResult) {
|
|
2085
2199
|
const reasons = [];
|
|
2086
2200
|
if (geoVerification.is_blocked) {
|
|
2087
|
-
reasons.push(...geoVerification.risk_reasons);
|
|
2201
|
+
reasons.push(...geoVerification.risk_reasons ?? []);
|
|
2088
2202
|
}
|
|
2089
2203
|
if (profile) {
|
|
2090
2204
|
if (profile.customer_status === "suspended") {
|