@agent-cards/sdk 0.23.24 → 0.23.26
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/CHANGELOG.md +14 -0
- package/README.md +34 -1
- package/dist/agent-amount.generated.js +1 -1
- package/dist/barion.d.ts +44 -0
- package/dist/barion.js +84 -0
- package/dist/capabilities.generated.js +1 -1
- package/dist/card-fields.generated.js +209 -119
- package/dist/cdp.js +4 -0
- package/dist/client.d.ts +42 -0
- package/dist/client.js +45 -1
- package/dist/hosted-entry.js +2 -0
- package/dist/pre-claim.d.ts +1 -0
- package/dist/pre-claim.js +18 -1
- package/dist/primer.generated.js +224 -134
- package/dist/stripe-checkout.generated.js +76 -46
- package/dist/tap-payments.generated.d.ts +10 -9
- package/dist/tap-payments.generated.js +28 -43
- package/dist/tokenex-iframe.generated.d.ts +18 -6
- package/dist/tokenex-iframe.generated.js +3 -3
- package/package.json +2 -2
package/dist/primer.generated.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Generated from @agent-cards/payment-core. Do not edit.
|
|
3
|
-
// artifact-sha256:
|
|
3
|
+
// artifact-sha256: f3160b14c70e44a64e4799066f3afca92b1e372e427c60aaee5b8c2ae401fd6e
|
|
4
4
|
// src/card-number-key.js
|
|
5
5
|
var CARD_NUMBER_KEY = /^(number|card_number|cardnumber|cardNum|card_num|pan)$/i;
|
|
6
6
|
// src/json-path.js
|
|
@@ -109,8 +109,8 @@ function parseConvergeBody(body) {
|
|
|
109
109
|
return parsed;
|
|
110
110
|
}
|
|
111
111
|
function convergeAmountCents(value) {
|
|
112
|
-
const
|
|
113
|
-
const m = typeof
|
|
112
|
+
const text10 = typeof value === "number" && Number.isFinite(value) ? String(value) : value;
|
|
113
|
+
const m = typeof text10 === "string" ? AMOUNT.exec(text10) : null;
|
|
114
114
|
if (!m)
|
|
115
115
|
return null;
|
|
116
116
|
const cents2 = Number(m[1]) * 100 + Number(((m[2] ?? "") + "00").slice(0, 2));
|
|
@@ -365,8 +365,8 @@ var CONTROL = /[\u0000-\u001f\u007f]/;
|
|
|
365
365
|
var cardLikeName = (name) => (name.match(/[0-9]/g) ?? []).length >= 12;
|
|
366
366
|
var record3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
367
367
|
var sameKeys = (value, keys) => {
|
|
368
|
-
const
|
|
369
|
-
return
|
|
368
|
+
const own13 = Object.keys(value);
|
|
369
|
+
return own13.length === keys.length && own13.every((key, at) => key === keys[at]);
|
|
370
370
|
};
|
|
371
371
|
var refuse4 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
372
372
|
var CARD4 = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
@@ -590,9 +590,9 @@ var K = /* @__PURE__ */ new Uint32Array([
|
|
|
590
590
|
3329325298
|
|
591
591
|
]);
|
|
592
592
|
var rotr = (x, n) => x >>> n | x << 32 - n;
|
|
593
|
-
function utf8(
|
|
593
|
+
function utf8(text10) {
|
|
594
594
|
const out = [];
|
|
595
|
-
for (const char of
|
|
595
|
+
for (const char of text10) {
|
|
596
596
|
let cp = char.codePointAt(0);
|
|
597
597
|
if (cp >= 55296 && cp <= 57343)
|
|
598
598
|
cp = 65533;
|
|
@@ -671,13 +671,13 @@ var TYPED_ARRAY = Object.getPrototypeOf(Uint8Array.prototype);
|
|
|
671
671
|
var typedArrayName = Object.getOwnPropertyDescriptor(TYPED_ARRAY, Symbol.toStringTag).get;
|
|
672
672
|
function parseRsaPublicKey(key) {
|
|
673
673
|
const spki = key && typeof key === "object" ? key.spki : void 0;
|
|
674
|
-
const
|
|
674
|
+
const pin10 = key && typeof key === "object" ? key.sha256 : void 0;
|
|
675
675
|
const named = key && typeof key === "object" && Object.prototype.hasOwnProperty.call(key, "exponent") ? key.exponent : void 0;
|
|
676
676
|
if (named !== void 0 && named !== 17)
|
|
677
677
|
throw refuse6("key");
|
|
678
678
|
if (typeof spki !== "string" || spki.length > 1024 || spki.length % 4 !== 0 || !BASE64.test(spki))
|
|
679
679
|
throw refuse6("key");
|
|
680
|
-
if (typeof
|
|
680
|
+
if (typeof pin10 !== "string" || !SHA256_HEX.test(pin10))
|
|
681
681
|
throw refuse6("key");
|
|
682
682
|
let binary;
|
|
683
683
|
try {
|
|
@@ -689,7 +689,7 @@ function parseRsaPublicKey(key) {
|
|
|
689
689
|
if (btoa(binary) !== spki)
|
|
690
690
|
throw refuse6("key");
|
|
691
691
|
const der = Uint8Array.from(binary, (c) => c.charCodeAt(0));
|
|
692
|
-
if (sha256Hex(der) !==
|
|
692
|
+
if (sha256Hex(der) !== pin10)
|
|
693
693
|
throw refuse6("key");
|
|
694
694
|
const outer = readElement(der, 0, 48);
|
|
695
695
|
if (outer.end !== der.length || outer.start + RSA_ALGORITHM.length > der.length)
|
|
@@ -779,8 +779,8 @@ var PADDLE_TOKENEX_PSP = "paddle_tokenex";
|
|
|
779
779
|
var PADDLE_TOKENEX_FACT_KEYS = /* @__PURE__ */ Object.freeze(["card_first_six", "card_last_four", "expiry_month", "expiry_year", "card_brand"]);
|
|
780
780
|
var record4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
781
781
|
var sameKeys2 = (value, keys) => {
|
|
782
|
-
const
|
|
783
|
-
return
|
|
782
|
+
const own13 = Object.keys(value);
|
|
783
|
+
return own13.length === keys.length && own13.every((key, at) => key === keys[at]);
|
|
784
784
|
};
|
|
785
785
|
var refuse7 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
786
786
|
var CARD6 = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
@@ -1269,8 +1269,8 @@ var TEXT_LIMIT = 256;
|
|
|
1269
1269
|
var CONTROL4 = /[\u0000-\u001f\u007f]/;
|
|
1270
1270
|
var record6 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1271
1271
|
var sameKeys3 = (value, keys) => {
|
|
1272
|
-
const
|
|
1273
|
-
return
|
|
1272
|
+
const own13 = Object.keys(value);
|
|
1273
|
+
return own13.length === keys.length && own13.every((key, at) => key === keys[at]);
|
|
1274
1274
|
};
|
|
1275
1275
|
var plainText = (value) => typeof value === "string" && value.length <= TEXT_LIMIT && !CONTROL4.test(value) && (value.match(/[0-9]/g) ?? []).length < 12;
|
|
1276
1276
|
var refuse9 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
@@ -1472,8 +1472,8 @@ var EXPIRATION = /^[0-9]{2}(?:0[1-9]|1[0-2])$/;
|
|
|
1472
1472
|
var CARD_PAYMENT = "PAYMENT_CARD";
|
|
1473
1473
|
var record8 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1474
1474
|
var sameKeys4 = (value, keys) => {
|
|
1475
|
-
const
|
|
1476
|
-
return
|
|
1475
|
+
const own13 = Object.keys(value);
|
|
1476
|
+
return own13.length === keys.length && own13.every((key, at) => key === keys[at]);
|
|
1477
1477
|
};
|
|
1478
1478
|
var refuse11 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
1479
1479
|
var CARD10 = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
@@ -1703,8 +1703,8 @@ var LOCALE = /^[a-z]{2}(?:-[A-Za-z]{2,4})?$/;
|
|
|
1703
1703
|
var PAN_LIKE3 = /(?:[0-9][ _.:-]*){12,}/;
|
|
1704
1704
|
var record9 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1705
1705
|
var sameKeys5 = (value, keys) => {
|
|
1706
|
-
const
|
|
1707
|
-
return
|
|
1706
|
+
const own13 = Object.keys(value);
|
|
1707
|
+
return own13.length === keys.length && own13.every((key, at) => key === keys[at]);
|
|
1708
1708
|
};
|
|
1709
1709
|
var refuse13 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
1710
1710
|
var CARD12 = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
@@ -2120,7 +2120,7 @@ var luhn2 = (digits4) => {
|
|
|
2120
2120
|
return sum % 10 === 0;
|
|
2121
2121
|
};
|
|
2122
2122
|
var ANY_NETWORK = /^[2-6][0-9]{12,18}$/;
|
|
2123
|
-
var holdsCardShape = (
|
|
2123
|
+
var holdsCardShape = (text10, shape = NETWORK) => (text10.match(/[0-9]{13,}/g) ?? []).some((run) => run.length > 19 || shape.test(run) && luhn2(run));
|
|
2124
2124
|
var phone = (value) => typeof value === "string" && PHONE.test(value) && (value.match(/[0-9]/g) ?? []).length >= 6 && (value.match(/[0-9]/g) ?? []).length <= 15;
|
|
2125
2125
|
var refuse16 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
2126
2126
|
var CARD15 = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
@@ -2348,13 +2348,13 @@ var printable = (value) => [...value].every((ch) => ch.charCodeAt(0) >= 32 && ch
|
|
|
2348
2348
|
function typed(value, limit = 256) {
|
|
2349
2349
|
return typeof value === "string" && value.length >= 1 && value.length <= limit && !PAN_LIKE4.test(value) && printable(value);
|
|
2350
2350
|
}
|
|
2351
|
-
function decodeBase64(
|
|
2352
|
-
if (typeof
|
|
2351
|
+
function decodeBase64(text10) {
|
|
2352
|
+
if (typeof text10 !== "string" || !BASE643.test(text10) || text10.length % 4 !== 0)
|
|
2353
2353
|
return null;
|
|
2354
2354
|
let bits = 0;
|
|
2355
2355
|
let value = 0;
|
|
2356
2356
|
let out = "";
|
|
2357
|
-
for (const ch of
|
|
2357
|
+
for (const ch of text10.replace(/=+$/, "")) {
|
|
2358
2358
|
value = (value << 6 | BASE64_ALPHABET.indexOf(ch)) & 16777215;
|
|
2359
2359
|
bits += 6;
|
|
2360
2360
|
if (bits >= 8) {
|
|
@@ -2364,8 +2364,8 @@ function decodeBase64(text9) {
|
|
|
2364
2364
|
}
|
|
2365
2365
|
return out;
|
|
2366
2366
|
}
|
|
2367
|
-
function soundDevice(
|
|
2368
|
-
const json = decodeBase64(
|
|
2367
|
+
function soundDevice(text10) {
|
|
2368
|
+
const json = decodeBase64(text10);
|
|
2369
2369
|
if (json === null)
|
|
2370
2370
|
return false;
|
|
2371
2371
|
let value;
|
|
@@ -2483,17 +2483,17 @@ function sumupBodyVerdict(body, url) {
|
|
|
2483
2483
|
var SALTED = /* @__PURE__ */ Object.freeze([83, 97, 108, 116, 101, 100, 95, 95]);
|
|
2484
2484
|
var B64 = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
2485
2485
|
var FIELD_LIMIT = 1024;
|
|
2486
|
-
function decodeCanonical(
|
|
2487
|
-
if (typeof
|
|
2486
|
+
function decodeCanonical(text10) {
|
|
2487
|
+
if (typeof text10 !== "string" || text10.length === 0 || text10.length % 4 !== 0 || !B64.test(text10))
|
|
2488
2488
|
return null;
|
|
2489
2489
|
let binary;
|
|
2490
2490
|
try {
|
|
2491
|
-
binary = atob(
|
|
2491
|
+
binary = atob(text10);
|
|
2492
2492
|
}
|
|
2493
2493
|
catch {
|
|
2494
2494
|
return null;
|
|
2495
2495
|
}
|
|
2496
|
-
if (btoa(binary) !==
|
|
2496
|
+
if (btoa(binary) !== text10)
|
|
2497
2497
|
return null;
|
|
2498
2498
|
return Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
2499
2499
|
}
|
|
@@ -2735,8 +2735,8 @@ var TEXT_LIMIT3 = 256;
|
|
|
2735
2735
|
var CONTROL7 = /[\u0000-\u001f\u007f]/;
|
|
2736
2736
|
var record13 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
2737
2737
|
var sameKeys7 = (value, keys) => {
|
|
2738
|
-
const
|
|
2739
|
-
return
|
|
2738
|
+
const own13 = Object.keys(value);
|
|
2739
|
+
return own13.length === keys.length && own13.every((key, at) => key === keys[at]);
|
|
2740
2740
|
};
|
|
2741
2741
|
var plainText3 = (value) => typeof value === "string" && value.length <= TEXT_LIMIT3 && !CONTROL7.test(value) && (value.match(/[0-9]/g) ?? []).length < 12;
|
|
2742
2742
|
var refuse19 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
@@ -3186,31 +3186,6 @@ var record16 = (value) => value !== null && typeof value === "object" && !Array.
|
|
|
3186
3186
|
function isTapPaymentsTokenUrl(url) {
|
|
3187
3187
|
return url === TAP_PAYMENTS_TOKEN_URL;
|
|
3188
3188
|
}
|
|
3189
|
-
var pin7 = (fields) => Object.freeze({
|
|
3190
|
-
...fields,
|
|
3191
|
-
origins: Object.freeze([...fields.origins]),
|
|
3192
|
-
sessions: Object.freeze({ ...fields.sessions }),
|
|
3193
|
-
key: Object.freeze({ ...fields.key })
|
|
3194
|
-
});
|
|
3195
|
-
var TAP_PAYMENTS_MERCHANT_PINS = /* @__PURE__ */ Object.freeze([
|
|
3196
|
-
pin7({
|
|
3197
|
-
id: "casefilegame",
|
|
3198
|
-
merchant: "Casefilegame",
|
|
3199
|
-
tapMerchantId: "67977048",
|
|
3200
|
-
publishableKey: "pk_live_ydlRjrWcLXaVvpsSBQKOie86",
|
|
3201
|
-
environment: "production",
|
|
3202
|
-
origins: ["https://checkout.tap.company"],
|
|
3203
|
-
// The WooCommerce plugin's redirect (Plugin-WooCommerce-All-in-one tap.php 567-586, read 2026-10-17)
|
|
3204
|
-
// creates the src_all charge with save_card false and names no agreement, subscription or destinations.
|
|
3205
|
-
sessions: { saveCard: false, agreement: false, subscription: false, destinations: false },
|
|
3206
|
-
key: {
|
|
3207
|
-
spki: "MIIBIDANBgkqhkiG9w0BAQEFAAOCAQ0AMIIBCAKCAQEAzja2vB+Iyafj2Mm3pFg65z7Yvj9ZeoFLdMBgWFyyjF020r5HSPKVhuZ39uJkjs0U/kWgEpKDzHZAKdtGv36dS33NjMAzYpgFkD8j+9/YWqpvAGRj5nv1b/q7NaiZk3b1wm7aXHJOx5L6rPQf2qDQxhcSNHocU+Uy8wGmGxRRu6QRKN3khaz4o4jJDzqxns4h/ShzHjdZeWIVfpCAyVoED0IESBYrvGEhJeyKnga5XdHdBU2yP8P1huO4RbSKcZv00ZgxVHAQQ9CqArW3TE8SyLLnJPkSpSHHBnIPSQS1z3ld1mImy/zqTd4ltkV6XHpYqVvoPmys2EuZX3pMvCcPGwIBEQ==",
|
|
3208
|
-
sha256: "6eb4e89a1e05a06a39d631f6fb450c052a9cad9935edc1921e84e80207470552",
|
|
3209
|
-
// The shared parser takes exponent 17 only under a pin that names it (rsa-pkcs1v15.js).
|
|
3210
|
-
exponent: 17
|
|
3211
|
-
}
|
|
3212
|
-
})
|
|
3213
|
-
]);
|
|
3214
3189
|
var BODY_LIMIT19 = 16384;
|
|
3215
3190
|
var ROOT_KEYS7 = /* @__PURE__ */ Object.freeze([
|
|
3216
3191
|
"encryptedData",
|
|
@@ -3457,7 +3432,7 @@ var YEAR11 = /^[0-9]{2}$/;
|
|
|
3457
3432
|
var CODE4 = /^[0-9]{3}$/;
|
|
3458
3433
|
var NAME_LIMIT3 = 100;
|
|
3459
3434
|
var NAME_WORD = /[a-z]+/gi;
|
|
3460
|
-
var printable2 = (
|
|
3435
|
+
var printable2 = (text10) => [...text10].every((character) => {
|
|
3461
3436
|
const point = character.codePointAt(0);
|
|
3462
3437
|
return point >= 32 && !(point >= 127 && point <= 159) && point !== 8232 && point !== 8233;
|
|
3463
3438
|
});
|
|
@@ -3466,8 +3441,8 @@ var HOSTNAME = /^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](
|
|
|
3466
3441
|
var PUBLISHABLE_KEY = /^[A-Za-z0-9]{16,64}$/;
|
|
3467
3442
|
var record18 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3468
3443
|
var sameKeys8 = (value, keys) => {
|
|
3469
|
-
const
|
|
3470
|
-
return
|
|
3444
|
+
const own13 = Object.keys(value);
|
|
3445
|
+
return own13.length === keys.length && own13.every((key, at) => key === keys[at]);
|
|
3471
3446
|
};
|
|
3472
3447
|
var refuse24 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
3473
3448
|
var CARD23 = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
@@ -3569,11 +3544,11 @@ var TOKENEX_IFRAME_BODY_KEYS = Object.freeze([
|
|
|
3569
3544
|
]);
|
|
3570
3545
|
var TOKENEX_IFRAME_TOKEN_SCHEMES = Object.freeze(["sixTOKENfour"]);
|
|
3571
3546
|
var TOKENEX_IFRAME_REVIEWED_ACCOUNTS = Object.freeze({
|
|
3572
|
-
"htp.tokenex.com": Object.freeze({}),
|
|
3547
|
+
"htp.tokenex.com": Object.freeze({ "9014311640612780": "https://www.jetblue.com" }),
|
|
3573
3548
|
"test-htp.tokenex.com": Object.freeze({})
|
|
3574
3549
|
});
|
|
3575
3550
|
var TOKENEX_IFRAME_ACCOUNT_NAMES = Object.freeze({
|
|
3576
|
-
"htp.tokenex.com": Object.freeze({}),
|
|
3551
|
+
"htp.tokenex.com": Object.freeze({ "9014311640612780": "JetBlue" }),
|
|
3577
3552
|
"test-htp.tokenex.com": Object.freeze({})
|
|
3578
3553
|
});
|
|
3579
3554
|
var BODY_LIMIT22 = 8192;
|
|
@@ -3803,9 +3778,9 @@ function openpayBodyVerdict(body, url) {
|
|
|
3803
3778
|
}
|
|
3804
3779
|
return CARD24;
|
|
3805
3780
|
}
|
|
3806
|
-
var
|
|
3781
|
+
var pin7 = (fields) => Object.freeze({ ...fields, origins: Object.freeze([...fields.origins]), publicKeys: Object.freeze([...fields.publicKeys]) });
|
|
3807
3782
|
var OPENPAY_MERCHANT_PINS = /* @__PURE__ */ Object.freeze([
|
|
3808
|
-
|
|
3783
|
+
pin7({
|
|
3809
3784
|
id: "diario_de_yucatan",
|
|
3810
3785
|
merchant: "Diario de Yucatán",
|
|
3811
3786
|
origins: ["https://www.yucatan.com.mx"],
|
|
@@ -3837,7 +3812,7 @@ var POSTAL_CODE3 = /^[A-Za-z0-9_]{0,16}$/;
|
|
|
3837
3812
|
var COUNTRY4 = /^[A-Z]{2}$/;
|
|
3838
3813
|
var TEXT_LIMIT7 = 256;
|
|
3839
3814
|
var CONTROL10 = /[\u0000-\u001f\u007f]/;
|
|
3840
|
-
var cardLike2 = (
|
|
3815
|
+
var cardLike2 = (text10) => (text10.match(/[0-9]/g) ?? []).length >= 12;
|
|
3841
3816
|
var text5 = (value) => typeof value === "string" && value.length <= TEXT_LIMIT7 && !CONTROL10.test(value) && !cardLike2(value);
|
|
3842
3817
|
var record21 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3843
3818
|
var own5 = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
@@ -3895,15 +3870,15 @@ function poyntBodyVerdict(body) {
|
|
|
3895
3870
|
return refuse26("poynt_body_unsupported");
|
|
3896
3871
|
return CARD25;
|
|
3897
3872
|
}
|
|
3898
|
-
var
|
|
3873
|
+
var pin8 = (fields) => Object.freeze({ ...fields, origins: Object.freeze([...fields.origins]), storeIds: Object.freeze([...fields.storeIds]) });
|
|
3899
3874
|
var POYNT_MERCHANT_PINS = /* @__PURE__ */ Object.freeze([
|
|
3900
|
-
|
|
3875
|
+
pin8({
|
|
3901
3876
|
id: "yearning_for_learning",
|
|
3902
3877
|
merchant: "Yearning for Learning Publishing & Coaching",
|
|
3903
3878
|
origins: ["https://ff305485-ba6c-423a-87b0-cebe3f83ffe9.mysimplestore.com"],
|
|
3904
3879
|
storeIds: ["71ac12ed-e61f-4318-95db-db0e7c649d6f"]
|
|
3905
3880
|
}),
|
|
3906
|
-
|
|
3881
|
+
pin8({
|
|
3907
3882
|
id: "timber_ridge_bookkeeping",
|
|
3908
3883
|
merchant: "Timber Ridge Bookkeeping",
|
|
3909
3884
|
origins: ["https://d7d64ac3-0352-4e53-af9a-f6d8e7b5fb71.mysimplestore.com"],
|
|
@@ -4158,11 +4133,11 @@ var LONG_TEXT_LIMIT = BODY_LIMIT25;
|
|
|
4158
4133
|
var record22 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4159
4134
|
var owns6 = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
4160
4135
|
var sameKeys9 = (value, keys) => {
|
|
4161
|
-
const
|
|
4162
|
-
return
|
|
4136
|
+
const own13 = Object.keys(value);
|
|
4137
|
+
return own13.length === keys.length && own13.every((key, at) => key === keys[at]);
|
|
4163
4138
|
};
|
|
4164
4139
|
var exact3 = (pattern, value) => typeof value === "string" && pattern.test(value);
|
|
4165
|
-
var printable3 = (
|
|
4140
|
+
var printable3 = (text10) => [...text10].every((character) => {
|
|
4166
4141
|
const point = character.codePointAt(0);
|
|
4167
4142
|
return point >= 32 && !(point >= 127 && point <= 159) && point !== 8232 && point !== 8233;
|
|
4168
4143
|
});
|
|
@@ -4235,7 +4210,7 @@ function companyStore(value) {
|
|
|
4235
4210
|
return record22(value) && sameKeys9(value, COMPANY_KEYS) && whole(value.CompanyNumber, 1) && COMPANY_KEYS.slice(1).every((key) => key.startsWith("Show") ? flag(value[key]) : pageText(value[key]));
|
|
4236
4211
|
}
|
|
4237
4212
|
var SUM_TEXT = /^(?:0*[1-9][0-9]*(?:\.[0-9]+)?|0+\.[0-9]*[1-9][0-9]*)$/;
|
|
4238
|
-
var sumText = (
|
|
4213
|
+
var sumText = (text10, sum) => text10 === null || typeof text10 === "string" && SUM_TEXT.test(text10) && Number.parseFloat(text10) === sum;
|
|
4239
4214
|
function chosenProduct(value) {
|
|
4240
4215
|
return record22(value) && sameKeys9(value, PRODUCT_KEYS) && whole(value.MinQuantity) && whole(value.MaxQuantity) && whole(value.JumpsInQuantity) && value.SelectedBuyQuantity === 1 && Array.isArray(value.QuantityOptions) && value.QuantityOptions.length === 0 && pageText(value.Comments) && flag(value.IsManualSum) && Array.isArray(value.PaymentsOptions) && flag(value.IsCouponActive) && typeof value.ManualPrice === "number" && sumText(value.ManualPriceTxt, value.ManualPrice) && flag(value.IsVatFree) && Array.isArray(value.SpecialPrices) && (value.PreConfiguredPrice === null || typeof value.PreConfiguredPrice === "number") && flag(value.IsPreSelected) && typeof value.CurrentInventory === "number" && flag(value.CheckInventory) && exact3(PRODUCT_ID, value.uid) && pageText(value.imageUrl) && typeof value.name === "string" && pageText(value.name) && pageText(value.description) && typeof value.BasePrice === "number" && typeof value.PriceBeforeDiscount === "number" && whole(value.BaseISOCurrency) && typeof value.PriceToShow === "number" && typeof value.PriceBeforeDiscountToShow === "number" && flag(value.IsCurrent);
|
|
4241
4216
|
}
|
|
@@ -4466,7 +4441,7 @@ var sameKeys10 = (value, keys) => {
|
|
|
4466
4441
|
};
|
|
4467
4442
|
var refuse28 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
4468
4443
|
var CARD27 = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
4469
|
-
var printable4 = (
|
|
4444
|
+
var printable4 = (text10) => [...text10].every((character) => {
|
|
4470
4445
|
const point = character.codePointAt(0);
|
|
4471
4446
|
return point >= 32 && !(point >= 127 && point <= 159) && point !== 8232 && point !== 8233;
|
|
4472
4447
|
});
|
|
@@ -4558,8 +4533,8 @@ var POSTAL_CODE4 = /^[A-Za-z0-9 -]{0,16}$/;
|
|
|
4558
4533
|
var CIPHERTEXT_B64 = /^[A-Za-z0-9+/]{341}[AQgw]==$/;
|
|
4559
4534
|
var record24 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4560
4535
|
var sameKeys11 = (value, keys) => {
|
|
4561
|
-
const
|
|
4562
|
-
return
|
|
4536
|
+
const own13 = Object.keys(value);
|
|
4537
|
+
return own13.length === keys.length && own13.every((key, at) => key === keys[at]);
|
|
4563
4538
|
};
|
|
4564
4539
|
var refuse29 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
4565
4540
|
var failed = (code) => (
|
|
@@ -4932,11 +4907,11 @@ function omiseBodyVerdict(body) {
|
|
|
4932
4907
|
return refuse31("omise_body_unsupported");
|
|
4933
4908
|
return CARD30;
|
|
4934
4909
|
}
|
|
4935
|
-
var
|
|
4910
|
+
var pin9 = (fields) => Object.freeze({ ...fields, origins: Object.freeze([...fields.origins]), keys: Object.freeze([...fields.keys]) });
|
|
4936
4911
|
var OMISE_MERCHANT_PINS = /* @__PURE__ */ Object.freeze([
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4912
|
+
pin9({ id: "taejai", merchant: "Taejai", origins: ["https://taejai.com"], keys: ["pkey_53q6mm66esjr563ob0h"] }),
|
|
4913
|
+
pin9({ id: "socialgiver", merchant: "Socialgiver", origins: ["https://www.socialgiver.com"], keys: ["pkey_5d5o2iahksmyrkybemg"] }),
|
|
4914
|
+
pin9({ id: "thireq_pecko_links", merchant: "Thireq Pecko", origins: ["https://linksplus.omise.co"], keys: ["pkey_65w70xniwsinf0gm680"] })
|
|
4940
4915
|
]);
|
|
4941
4916
|
// src/xendit.js
|
|
4942
4917
|
var XENDIT_PSP = "xendit";
|
|
@@ -5028,10 +5003,10 @@ function readBody18(body) {
|
|
|
5028
5003
|
function amountValue(value) {
|
|
5029
5004
|
if (typeof value === "number" && !Number.isFinite(value))
|
|
5030
5005
|
return false;
|
|
5031
|
-
const
|
|
5032
|
-
if (typeof
|
|
5006
|
+
const text10 = typeof value === "number" ? String(value) : value;
|
|
5007
|
+
if (typeof text10 !== "string" || !AMOUNT_TEXT.test(text10))
|
|
5033
5008
|
return false;
|
|
5034
|
-
const amount2 = Number(
|
|
5009
|
+
const amount2 = Number(text10);
|
|
5035
5010
|
return amount2 > 0 && amount2 <= AMOUNT_LIMIT3;
|
|
5036
5011
|
}
|
|
5037
5012
|
function billingDetails(value) {
|
|
@@ -5229,10 +5204,10 @@ function isPaymobPayUrl(url) {
|
|
|
5229
5204
|
var BASE645 = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
5230
5205
|
var BASE64URL = /^[A-Za-z0-9_-]+$/;
|
|
5231
5206
|
var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
5232
|
-
function decodeBase642(
|
|
5233
|
-
if (typeof
|
|
5207
|
+
function decodeBase642(text10, url) {
|
|
5208
|
+
if (typeof text10 !== "string" || text10 === "")
|
|
5234
5209
|
return null;
|
|
5235
|
-
let body =
|
|
5210
|
+
let body = text10;
|
|
5236
5211
|
if (url) {
|
|
5237
5212
|
if (!BASE64URL.test(body) || body.length % 4 === 1)
|
|
5238
5213
|
return null;
|
|
@@ -5265,15 +5240,15 @@ function decodeBase642(text9, url) {
|
|
|
5265
5240
|
function jsonOf(bytes) {
|
|
5266
5241
|
if (!bytes)
|
|
5267
5242
|
return null;
|
|
5268
|
-
let
|
|
5243
|
+
let text10;
|
|
5269
5244
|
try {
|
|
5270
|
-
|
|
5245
|
+
text10 = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
5271
5246
|
}
|
|
5272
5247
|
catch {
|
|
5273
5248
|
return null;
|
|
5274
5249
|
}
|
|
5275
5250
|
try {
|
|
5276
|
-
const value = JSON.parse(
|
|
5251
|
+
const value = JSON.parse(text10);
|
|
5277
5252
|
return record29(value) ? value : null;
|
|
5278
5253
|
}
|
|
5279
5254
|
catch {
|
|
@@ -5374,7 +5349,7 @@ function namesCardValue3(parsed) {
|
|
|
5374
5349
|
return false;
|
|
5375
5350
|
}
|
|
5376
5351
|
function addressBlock(value) {
|
|
5377
|
-
return record29(value) && Object.keys(value).length <= 32 && Object.entries(value).every(([key,
|
|
5352
|
+
return record29(value) && Object.keys(value).length <= 32 && Object.entries(value).every(([key, text10]) => FIELD.test(key) && !CARD_MEMBER4.test(key) && (text10 === null || typeof text10 === "string" && TEXT3.test(text10)));
|
|
5378
5353
|
}
|
|
5379
5354
|
function judgeCardPayment(parsed) {
|
|
5380
5355
|
const source = parsed.source;
|
|
@@ -5872,8 +5847,8 @@ function cardNamed2(key) {
|
|
|
5872
5847
|
const phrase = words.join(" ");
|
|
5873
5848
|
return words.some((word) => CARD_WORDS.includes(word)) || ["security code", "codigo seguridad", "codigo verificacion"].some((said) => phrase.includes(said));
|
|
5874
5849
|
}
|
|
5875
|
-
function carriesCardNumber(
|
|
5876
|
-
for (const [run] of
|
|
5850
|
+
function carriesCardNumber(text10) {
|
|
5851
|
+
for (const [run] of text10.matchAll(/[0-9]+(?:[ ._/,-][0-9]+)*/g)) {
|
|
5877
5852
|
const groups = run.split(/[ ._/,-]/);
|
|
5878
5853
|
for (let first = 0; first < groups.length; first += 1) {
|
|
5879
5854
|
let digits4 = "";
|
|
@@ -5886,17 +5861,17 @@ function carriesCardNumber(text9) {
|
|
|
5886
5861
|
}
|
|
5887
5862
|
return false;
|
|
5888
5863
|
}
|
|
5889
|
-
var wholeCardNumber = (
|
|
5864
|
+
var wholeCardNumber = (text10) => /^[2-6][0-9]{12,18}$/.test(text10) && luhn7(text10);
|
|
5890
5865
|
function membersRefusal(root) {
|
|
5891
5866
|
const pending = [[root, ""]];
|
|
5892
5867
|
while (pending.length > 0) {
|
|
5893
5868
|
const [node, path] = pending.pop();
|
|
5894
|
-
const
|
|
5869
|
+
const own13 = path === "" ? TRANSACTION_MEMBERS : owns7(RECORD_MEMBERS, path) ? RECORD_MEMBERS[path] : null;
|
|
5895
5870
|
for (const [key, child] of Object.entries(node)) {
|
|
5896
5871
|
const at = Array.isArray(node) ? path : path === "" ? key : `${path}.${key}`;
|
|
5897
5872
|
if (at === "checkoutCreditCard")
|
|
5898
5873
|
continue;
|
|
5899
|
-
if (
|
|
5874
|
+
if (own13 !== null && !own13.includes(key))
|
|
5900
5875
|
return true;
|
|
5901
5876
|
if (TEXT_RECORDS.includes(path) && child !== null && typeof child !== "string")
|
|
5902
5877
|
return true;
|
|
@@ -6003,6 +5978,119 @@ function payuLatamBodyVerdict(body, url) {
|
|
|
6003
5978
|
const { code } = judgeBody5(body, target);
|
|
6004
5979
|
return code === null ? CARD34 : refuse35(code);
|
|
6005
5980
|
}
|
|
5981
|
+
// src/pin-payments.js
|
|
5982
|
+
var PIN_PAYMENTS_PSP = "pin_payments";
|
|
5983
|
+
var PIN_PAYMENTS_CARD_HOSTS = /* @__PURE__ */ Object.freeze({ "api.pinpayments.com": "production", "test-api.pinpayments.com": "test" });
|
|
5984
|
+
var PIN_PAYMENTS_CARD_PATH = "/1/cards";
|
|
5985
|
+
var BODY_LIMIT34 = 4096;
|
|
5986
|
+
var CARD_KEYS15 = /* @__PURE__ */ Object.freeze(["name", "number", "cvc", "expiry_month", "expiry_year"]);
|
|
5987
|
+
var ADDRESS_KEYS6 = /* @__PURE__ */ Object.freeze([
|
|
5988
|
+
"address_line1",
|
|
5989
|
+
"address_line2",
|
|
5990
|
+
"address_city",
|
|
5991
|
+
"address_postcode",
|
|
5992
|
+
"address_state",
|
|
5993
|
+
"address_country"
|
|
5994
|
+
]);
|
|
5995
|
+
var KEY2 = "publishable_api_key";
|
|
5996
|
+
var METHOD = "_method";
|
|
5997
|
+
var DOCUMENTED = /* @__PURE__ */ new Set([KEY2, METHOD, ...CARD_KEYS15, ...ADDRESS_KEYS6]);
|
|
5998
|
+
var PUBLISHABLE_KEY2 = /^pk_[A-Za-z0-9_-]{8,64}$/;
|
|
5999
|
+
var CARD_NUMBER17 = /^[0-9]{12,19}$/;
|
|
6000
|
+
var CODE7 = /^[0-9]{3,4}$/;
|
|
6001
|
+
var MONTH18 = /^(?:0?[1-9]|1[0-2])$/;
|
|
6002
|
+
var YEAR19 = /^(?:[0-9]{2}|[0-9]{4})$/;
|
|
6003
|
+
var TEXT_LIMIT13 = 256;
|
|
6004
|
+
var record31 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6005
|
+
var own11 = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
6006
|
+
var refuse36 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
6007
|
+
var CARD35 = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
6008
|
+
function luhn8(digits4) {
|
|
6009
|
+
let sum = 0;
|
|
6010
|
+
for (let at = 0; at < digits4.length; at += 1) {
|
|
6011
|
+
let digit = Number(digits4[digits4.length - 1 - at]);
|
|
6012
|
+
if (at % 2 === 1) {
|
|
6013
|
+
digit *= 2;
|
|
6014
|
+
if (digit > 9)
|
|
6015
|
+
digit -= 9;
|
|
6016
|
+
}
|
|
6017
|
+
sum += digit;
|
|
6018
|
+
}
|
|
6019
|
+
return sum % 10 === 0;
|
|
6020
|
+
}
|
|
6021
|
+
function pinPaymentsCardUrl(url) {
|
|
6022
|
+
if (typeof url !== "string" || url.length > 256 || url.includes("?") || url.includes("#"))
|
|
6023
|
+
return null;
|
|
6024
|
+
let parsed;
|
|
6025
|
+
try {
|
|
6026
|
+
parsed = new URL(url);
|
|
6027
|
+
}
|
|
6028
|
+
catch {
|
|
6029
|
+
return null;
|
|
6030
|
+
}
|
|
6031
|
+
if (parsed.href !== url || parsed.protocol !== "https:" || parsed.port || parsed.username || parsed.password)
|
|
6032
|
+
return null;
|
|
6033
|
+
if (!own11(PIN_PAYMENTS_CARD_HOSTS, parsed.hostname) || parsed.pathname !== PIN_PAYMENTS_CARD_PATH)
|
|
6034
|
+
return null;
|
|
6035
|
+
return Object.freeze({ host: parsed.hostname, environment: PIN_PAYMENTS_CARD_HOSTS[parsed.hostname] });
|
|
6036
|
+
}
|
|
6037
|
+
function readBody20(body) {
|
|
6038
|
+
if (typeof body !== "string" || body === "" || body.length > BODY_LIMIT34)
|
|
6039
|
+
return null;
|
|
6040
|
+
let value;
|
|
6041
|
+
try {
|
|
6042
|
+
value = JSON.parse(body);
|
|
6043
|
+
if (!record31(value) || JSON.stringify(value) !== body)
|
|
6044
|
+
return null;
|
|
6045
|
+
}
|
|
6046
|
+
catch {
|
|
6047
|
+
return null;
|
|
6048
|
+
}
|
|
6049
|
+
return value;
|
|
6050
|
+
}
|
|
6051
|
+
var text8 = (value) => typeof value === "string" && value.length <= TEXT_LIMIT13;
|
|
6052
|
+
var dateValue = (value, shape) => typeof value === "string" && shape.test(value) || Number.isSafeInteger(value) && shape.test(String(value));
|
|
6053
|
+
function isCardBody(value) {
|
|
6054
|
+
if (!Object.keys(value).every((key) => DOCUMENTED.has(key)))
|
|
6055
|
+
return false;
|
|
6056
|
+
if (!CARD_KEYS15.every((key) => own11(value, key)) || !own11(value, KEY2))
|
|
6057
|
+
return false;
|
|
6058
|
+
if (typeof value[KEY2] !== "string" || !PUBLISHABLE_KEY2.test(value[KEY2]))
|
|
6059
|
+
return false;
|
|
6060
|
+
if (own11(value, METHOD) && value[METHOD] !== "POST")
|
|
6061
|
+
return false;
|
|
6062
|
+
if (!text8(value.name) || value.name.trim() === "")
|
|
6063
|
+
return false;
|
|
6064
|
+
if (typeof value.number !== "string" || !CARD_NUMBER17.test(value.number) || !luhn8(value.number))
|
|
6065
|
+
return false;
|
|
6066
|
+
if (typeof value.cvc !== "string" || !CODE7.test(value.cvc))
|
|
6067
|
+
return false;
|
|
6068
|
+
if (!dateValue(value.expiry_month, MONTH18) || !dateValue(value.expiry_year, YEAR19))
|
|
6069
|
+
return false;
|
|
6070
|
+
return ADDRESS_KEYS6.every((key) => !own11(value, key) || value[key] === null || text8(value[key]));
|
|
6071
|
+
}
|
|
6072
|
+
function pinPaymentsBodyVerdict(body, url) {
|
|
6073
|
+
if (url !== void 0 && pinPaymentsCardUrl(url) === null)
|
|
6074
|
+
return refuse36("pin_payments_url_refused");
|
|
6075
|
+
const value = readBody20(body);
|
|
6076
|
+
if (value === null || !isCardBody(value))
|
|
6077
|
+
return refuse36("pin_payments_body_unsupported");
|
|
6078
|
+
return CARD35;
|
|
6079
|
+
}
|
|
6080
|
+
var TOKEN_FACTS = /* @__PURE__ */ Object.freeze([
|
|
6081
|
+
"token",
|
|
6082
|
+
"scheme",
|
|
6083
|
+
"display_number",
|
|
6084
|
+
"issuing_country",
|
|
6085
|
+
"expiry_month",
|
|
6086
|
+
"expiry_year",
|
|
6087
|
+
"name",
|
|
6088
|
+
...ADDRESS_KEYS6,
|
|
6089
|
+
"network_type",
|
|
6090
|
+
"network_format",
|
|
6091
|
+
"customer_token",
|
|
6092
|
+
"primary"
|
|
6093
|
+
]);
|
|
6006
6094
|
// src/registration.js
|
|
6007
6095
|
var PARTS = { psp: "id", definitions: "list", refusedOperations: "list", settlementReadback: "any", exactUrl: "rule", bodyGate: "rule", amount: "rule" };
|
|
6008
6096
|
var PSP_ID = /^[a-z][a-z0-9_]*$/;
|
|
@@ -6051,14 +6139,14 @@ var MIDTRANS_OPERATION = "midtrans.card_request";
|
|
|
6051
6139
|
var MIDTRANS_TOKEN_URL = "https://api.midtrans.com/v2/token";
|
|
6052
6140
|
var MIDTRANS_SANDBOX_TOKEN_URL = "https://api.sandbox.midtrans.com/v2/token";
|
|
6053
6141
|
var MIDTRANS_TOKEN_KEYS = /* @__PURE__ */ Object.freeze(["card_cvv", "card_number", "card_exp_month", "card_exp_year", "installment_term"]);
|
|
6054
|
-
var
|
|
6055
|
-
var
|
|
6142
|
+
var BODY_LIMIT35 = 4096;
|
|
6143
|
+
var CARD_NUMBER18 = /^[0-9]{12,19}$/;
|
|
6056
6144
|
var SECURITY_CODE22 = /^[0-9]{3,4}$/;
|
|
6057
|
-
var
|
|
6058
|
-
var
|
|
6145
|
+
var MONTH19 = /^(?:0[1-9]|1[0-2])$/;
|
|
6146
|
+
var YEAR20 = /^20[0-9]{2}$/;
|
|
6059
6147
|
var TERM = /^[0-9]{1,3}$/;
|
|
6060
|
-
var
|
|
6061
|
-
var
|
|
6148
|
+
var record32 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6149
|
+
var own12 = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
6062
6150
|
var inOrder6 = (value, keys) => {
|
|
6063
6151
|
let at = 0;
|
|
6064
6152
|
for (const name of Object.keys(value)) {
|
|
@@ -6070,18 +6158,18 @@ var inOrder6 = (value, keys) => {
|
|
|
6070
6158
|
}
|
|
6071
6159
|
return true;
|
|
6072
6160
|
};
|
|
6073
|
-
var
|
|
6074
|
-
var
|
|
6161
|
+
var refuse37 = (code) => Object.freeze({ verdict: "refuse", code });
|
|
6162
|
+
var CARD36 = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
6075
6163
|
function isMidtransTokenUrl(url) {
|
|
6076
6164
|
return url === MIDTRANS_TOKEN_URL || url === MIDTRANS_SANDBOX_TOKEN_URL;
|
|
6077
6165
|
}
|
|
6078
|
-
function
|
|
6079
|
-
if (typeof body !== "string" || body === "" || body.length >
|
|
6166
|
+
function readBody21(body) {
|
|
6167
|
+
if (typeof body !== "string" || body === "" || body.length > BODY_LIMIT35)
|
|
6080
6168
|
return null;
|
|
6081
6169
|
let value;
|
|
6082
6170
|
try {
|
|
6083
6171
|
value = JSON.parse(body);
|
|
6084
|
-
if (!
|
|
6172
|
+
if (!record32(value) || JSON.stringify(value) !== body)
|
|
6085
6173
|
return null;
|
|
6086
6174
|
}
|
|
6087
6175
|
catch {
|
|
@@ -6090,20 +6178,20 @@ function readBody20(body) {
|
|
|
6090
6178
|
return value;
|
|
6091
6179
|
}
|
|
6092
6180
|
function midtransBodyVerdict(body) {
|
|
6093
|
-
const value =
|
|
6181
|
+
const value = readBody21(body);
|
|
6094
6182
|
if (value === null || !inOrder6(value, MIDTRANS_TOKEN_KEYS)) {
|
|
6095
|
-
if (
|
|
6096
|
-
return
|
|
6097
|
-
return
|
|
6183
|
+
if (record32(value) && (own12(value, "token_id") || own12(value, "two_click")) && !own12(value, "card_number"))
|
|
6184
|
+
return refuse37("midtrans_saved_card");
|
|
6185
|
+
return refuse37("midtrans_body_unsupported");
|
|
6098
6186
|
}
|
|
6099
|
-
if (!
|
|
6100
|
-
return
|
|
6187
|
+
if (!own12(value, "card_cvv") || !own12(value, "card_number") || !own12(value, "card_exp_month") || !own12(value, "card_exp_year")) {
|
|
6188
|
+
return refuse37("midtrans_body_unsupported");
|
|
6101
6189
|
}
|
|
6102
|
-
if (typeof value.card_cvv !== "string" || !SECURITY_CODE22.test(value.card_cvv) || typeof value.card_number !== "string" || !
|
|
6103
|
-
return
|
|
6104
|
-
if (
|
|
6105
|
-
return
|
|
6106
|
-
return
|
|
6190
|
+
if (typeof value.card_cvv !== "string" || !SECURITY_CODE22.test(value.card_cvv) || typeof value.card_number !== "string" || !CARD_NUMBER18.test(value.card_number) || typeof value.card_exp_month !== "string" || !MONTH19.test(value.card_exp_month) || typeof value.card_exp_year !== "string" || !YEAR20.test(value.card_exp_year))
|
|
6191
|
+
return refuse37("midtrans_body_unsupported");
|
|
6192
|
+
if (own12(value, "installment_term") && (typeof value.installment_term !== "string" || !TERM.test(value.installment_term)))
|
|
6193
|
+
return refuse37("midtrans_body_unsupported");
|
|
6194
|
+
return CARD36;
|
|
6107
6195
|
}
|
|
6108
6196
|
var midtrans_default = /* @__PURE__ */ registerProcessor({
|
|
6109
6197
|
psp: MIDTRANS_PSP,
|
|
@@ -6285,6 +6373,8 @@ function processorGate(recognizer, url, body) {
|
|
|
6285
6373
|
return { verdict: "refuse", code: "paymob_url_refused" };
|
|
6286
6374
|
return paymobBodyVerdict(body);
|
|
6287
6375
|
}
|
|
6376
|
+
if (recognizer && recognizer.psp === PIN_PAYMENTS_PSP)
|
|
6377
|
+
return pinPaymentsBodyVerdict(body, url);
|
|
6288
6378
|
if (recognizer && recognizer.psp === GRAVY_PSP)
|
|
6289
6379
|
return gravyBodyVerdict(body);
|
|
6290
6380
|
if (recognizer && recognizer.psp === MONERIS_PSP) {
|
|
@@ -6413,20 +6503,20 @@ var KEEP_ON_FILE_REFUSAL = "Refusing to pay: this Primer payment would keep the
|
|
|
6413
6503
|
var UNSUPPORTED_SDK_REFUSAL = "Refusing to pay: this checkout uses a Primer SDK Agentcard does not support yet. Nothing was sent.";
|
|
6414
6504
|
var NETWORK_MISMATCH_REFUSAL = "Refusing to pay: this Primer payment names a card network that is not your card's. Nothing was sent.";
|
|
6415
6505
|
var FILL_REFUSAL = "Could not fill the card fields for Primer. Nothing was sent.";
|
|
6416
|
-
var
|
|
6506
|
+
var BODY_LIMIT36 = 16384;
|
|
6417
6507
|
var RESPONSE_LIMIT = 32768;
|
|
6418
6508
|
var ROOT_KEYS10 = ["paymentInstrument", "userDescription", "tokenType", "paymentFlow"];
|
|
6419
6509
|
var INSTRUMENT_KEYS = ["number", "cvv", "expirationMonth", "expirationYear", "cardholderName", "preferredNetwork"];
|
|
6420
6510
|
var REQUIRED_INSTRUMENT_KEYS = ["number", "cvv", "expirationMonth", "expirationYear"];
|
|
6421
|
-
var
|
|
6511
|
+
var record33 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6422
6512
|
var owns8 = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
6423
6513
|
var exact4 = (pattern, value) => typeof value === "string" && pattern.exec(value)?.[0] === value;
|
|
6424
|
-
var
|
|
6514
|
+
var text9 = (value, max) => typeof value === "string" && value.length <= max && !/[\u0000-\u001f\u007f]/.test(value);
|
|
6425
6515
|
var digits3 = (value, min, max) => typeof value === "string" && value.length >= min && value.length <= max && !/[^0-9]/.test(value);
|
|
6426
6516
|
var panLike2 = (value) => /(?:[0-9][ _.:-]*){12,}/.test(value);
|
|
6427
|
-
var plain2 = (value, max) =>
|
|
6428
|
-
var
|
|
6429
|
-
var
|
|
6517
|
+
var plain2 = (value, max) => text9(value, max) && !panLike2(value);
|
|
6518
|
+
var MONTH20 = /^(?:0[1-9]|1[0-2])$/;
|
|
6519
|
+
var YEAR21 = /^20[0-9]{2}$/;
|
|
6430
6520
|
var NETWORK3 = /^[A-Z][A-Z_]{1,31}$/;
|
|
6431
6521
|
function isPrimerTokenizeUrl(url, method = "POST") {
|
|
6432
6522
|
if (method !== "POST" || typeof url !== "string" || url.length > 256 || url.includes("?") || url.includes("#"))
|
|
@@ -6441,7 +6531,7 @@ function isPrimerTokenizeUrl(url, method = "POST") {
|
|
|
6441
6531
|
return parsed.href === url && parsed.protocol === "https:" && !parsed.port && !parsed.username && !parsed.password && !parsed.search && !parsed.hash && PRIMER_PCI_HOSTS.includes(parsed.hostname) && parsed.pathname === PRIMER_TOKENIZE_PATH;
|
|
6442
6532
|
}
|
|
6443
6533
|
function judgeBody6(body) {
|
|
6444
|
-
if (typeof body !== "string" || body === "" || body.length >
|
|
6534
|
+
if (typeof body !== "string" || body === "" || body.length > BODY_LIMIT36)
|
|
6445
6535
|
return null;
|
|
6446
6536
|
let value;
|
|
6447
6537
|
try {
|
|
@@ -6450,14 +6540,14 @@ function judgeBody6(body) {
|
|
|
6450
6540
|
catch {
|
|
6451
6541
|
return null;
|
|
6452
6542
|
}
|
|
6453
|
-
if (!
|
|
6543
|
+
if (!record33(value) || !roundTrips(value, body))
|
|
6454
6544
|
return null;
|
|
6455
6545
|
if (!Object.keys(value).every((key) => ROOT_KEYS10.includes(key)) || !owns8(value, "paymentInstrument"))
|
|
6456
6546
|
return null;
|
|
6457
6547
|
const instrument = value.paymentInstrument;
|
|
6458
|
-
if (!
|
|
6548
|
+
if (!record33(instrument) || !Object.keys(instrument).every((key) => INSTRUMENT_KEYS.includes(key)) || !REQUIRED_INSTRUMENT_KEYS.every((key) => owns8(instrument, key)))
|
|
6459
6549
|
return null;
|
|
6460
|
-
if (!digits3(instrument.number, 12, 19) || !digits3(instrument.cvv, 3, 4) || !exact4(
|
|
6550
|
+
if (!digits3(instrument.number, 12, 19) || !digits3(instrument.cvv, 3, 4) || !exact4(MONTH20, instrument.expirationMonth) || !exact4(YEAR21, instrument.expirationYear))
|
|
6461
6551
|
return null;
|
|
6462
6552
|
if (owns8(instrument, "cardholderName") && instrument.cardholderName !== null && !plain2(instrument.cardholderName, 256) || owns8(instrument, "preferredNetwork") && instrument.preferredNetwork !== null && !exact4(NETWORK3, instrument.preferredNetwork) || owns8(value, "userDescription") && value.userDescription !== null && !plain2(value.userDescription, 256) || owns8(value, "tokenType") && value.tokenType !== "MULTI_USE" || owns8(value, "paymentFlow") && value.paymentFlow !== "VAULT")
|
|
6463
6553
|
return null;
|
|
@@ -6483,7 +6573,7 @@ var CLIENT_TOKEN = /^[A-Za-z0-9._~+/=-]{16,4096}$/;
|
|
|
6483
6573
|
var REQUEST_ID = /^[A-Za-z0-9-]{1,64}$/;
|
|
6484
6574
|
var API_VERSION = /^2\.[0-9]{1,2}$/;
|
|
6485
6575
|
function readHeaders(headers) {
|
|
6486
|
-
if (!
|
|
6576
|
+
if (!record33(headers))
|
|
6487
6577
|
return null;
|
|
6488
6578
|
const folded = /* @__PURE__ */ new Map();
|
|
6489
6579
|
for (const [name, value] of Object.entries(headers)) {
|
|
@@ -6530,7 +6620,7 @@ function onTokenizePath(url) {
|
|
|
6530
6620
|
}
|
|
6531
6621
|
}
|
|
6532
6622
|
function primerTokenizeRefusal(request) {
|
|
6533
|
-
if (!
|
|
6623
|
+
if (!record33(request) || request.method !== "POST" || !isPrimerTokenizeUrl(request.url))
|
|
6534
6624
|
return "unsupported";
|
|
6535
6625
|
return headersRefusal(request.headers) ?? primerBodyRefusal(request.body);
|
|
6536
6626
|
}
|
|
@@ -6545,7 +6635,7 @@ function primerCardOnFileRefusal(url, options, policy = PRIMER_SESSION_CARD_ON_F
|
|
|
6545
6635
|
return "unsupported";
|
|
6546
6636
|
if (new URL(url).hostname !== LIVE_PCI_HOST)
|
|
6547
6637
|
return null;
|
|
6548
|
-
return primerCardOnFileDisclosure(url, policy) &&
|
|
6638
|
+
return primerCardOnFileDisclosure(url, policy) && record33(options) && options.keepOnFile === true ? null : "keep_on_file";
|
|
6549
6639
|
}
|
|
6550
6640
|
function primerRefusalMessage(reason) {
|
|
6551
6641
|
if (reason === "keep_on_file")
|
|
@@ -6606,7 +6696,7 @@ function injectPrimerCard(body, card) {
|
|
|
6606
6696
|
}
|
|
6607
6697
|
var TOKEN4 = /^[A-Za-z0-9_-]{8,256}$/;
|
|
6608
6698
|
var ERROR_ID = /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/;
|
|
6609
|
-
var
|
|
6699
|
+
var CODE8 = /^[A-Z][A-Z0-9_]{0,63}$/;
|
|
6610
6700
|
var NETWORK_NAME = /^[A-Za-z][A-Za-z0-9 _-]{0,31}$/;
|
|
6611
6701
|
var RESPONSE_MONTH = /^(?:0?[1-9]|1[0-2])$/;
|
|
6612
6702
|
var RESPONSE_YEAR = /^(?:[0-9]{2}|20[0-9]{2})$/;
|
|
@@ -6629,7 +6719,7 @@ function readAnswer(body) {
|
|
|
6629
6719
|
return null;
|
|
6630
6720
|
try {
|
|
6631
6721
|
const value = JSON.parse(body);
|
|
6632
|
-
return
|
|
6722
|
+
return record33(value) ? value : null;
|
|
6633
6723
|
}
|
|
6634
6724
|
catch {
|
|
6635
6725
|
return null;
|
|
@@ -6638,16 +6728,16 @@ function readAnswer(body) {
|
|
|
6638
6728
|
var tokenValue = (value) => exact4(TOKEN4, value) && !panLike2(value);
|
|
6639
6729
|
var optional = (value, key, check) => !owns8(value, key) || value[key] === null || check(value[key]);
|
|
6640
6730
|
function cardDetails(data) {
|
|
6641
|
-
if (!
|
|
6731
|
+
if (!record33(data) || !exact4(/^[0-9]{4}$/, data.last4Digits))
|
|
6642
6732
|
return null;
|
|
6643
|
-
if (!optional(data, "first6Digits", (v) => exact4(/^[0-9]{6}$/, v)) || !optional(data, "expirationMonth", (v) => exact4(RESPONSE_MONTH, v)) || !optional(data, "expirationYear", (v) => exact4(RESPONSE_YEAR, v)) || !optional(data, "cardholderName", (v) => plain2(v, 256)) || !optional(data, "network", (v) => exact4(NETWORK_NAME, v)) || !optional(data, "isNetworkTokenized", (v) => typeof v === "boolean") || !optional(data, "binData",
|
|
6733
|
+
if (!optional(data, "first6Digits", (v) => exact4(/^[0-9]{6}$/, v)) || !optional(data, "expirationMonth", (v) => exact4(RESPONSE_MONTH, v)) || !optional(data, "expirationYear", (v) => exact4(RESPONSE_YEAR, v)) || !optional(data, "cardholderName", (v) => plain2(v, 256)) || !optional(data, "network", (v) => exact4(NETWORK_NAME, v)) || !optional(data, "isNetworkTokenized", (v) => typeof v === "boolean") || !optional(data, "binData", record33))
|
|
6644
6734
|
return null;
|
|
6645
6735
|
const safe = { last4Digits: data.last4Digits };
|
|
6646
6736
|
for (const key of ["first6Digits", "expirationMonth", "expirationYear", "cardholderName", "network", "isNetworkTokenized"]) {
|
|
6647
6737
|
if (owns8(data, key) && data[key] !== null)
|
|
6648
6738
|
safe[key] = data[key];
|
|
6649
6739
|
}
|
|
6650
|
-
if (
|
|
6740
|
+
if (record33(data.binData)) {
|
|
6651
6741
|
const bin = {};
|
|
6652
6742
|
for (const key of BIN_KEYS) {
|
|
6653
6743
|
if (!owns8(data.binData, key) || data.binData[key] === null)
|
|
@@ -6663,7 +6753,7 @@ function cardDetails(data) {
|
|
|
6663
6753
|
function threeDsSummary(value) {
|
|
6664
6754
|
if (value === void 0 || value === null)
|
|
6665
6755
|
return null;
|
|
6666
|
-
if (!
|
|
6756
|
+
if (!record33(value) || !exact4(CODE8, value.responseCode) || !optional(value, "reasonCode", (v) => exact4(CODE8, v)) || !optional(value, "reasonText", (v) => plain2(v, 256)) || !optional(value, "protocolVersion", (v) => v === "" || exact4(PROTOCOL2, v)) || !optional(value, "challengeIssued", (v) => typeof v === "boolean"))
|
|
6667
6757
|
return void 0;
|
|
6668
6758
|
const safe = { responseCode: value.responseCode };
|
|
6669
6759
|
for (const key of ["reasonCode", "reasonText", "protocolVersion", "challengeIssued"]) {
|
|
@@ -6691,7 +6781,7 @@ function rebuildToken(value) {
|
|
|
6691
6781
|
}
|
|
6692
6782
|
function primerErrorId(body) {
|
|
6693
6783
|
const value = readAnswer(body);
|
|
6694
|
-
const id = value &&
|
|
6784
|
+
const id = value && record33(value.error) ? value.error.errorId : null;
|
|
6695
6785
|
return exact4(ERROR_ID, id) && !panLike2(id) ? id : null;
|
|
6696
6786
|
}
|
|
6697
6787
|
function matchesCard(details, card) {
|