@agent-cards/sdk 0.23.19 → 0.23.21
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 +61 -2
- package/PREFLIGHT.md +4 -0
- package/README.md +175 -7
- package/dist/amadeus.d.ts +4 -2
- package/dist/amadeus.js +16 -3
- package/dist/buy.d.ts +84 -2
- package/dist/buy.js +16 -1
- package/dist/card-endpoint-facts.d.ts +2 -1
- package/dist/card-endpoint-facts.js +18 -9
- package/dist/card-endpoint.d.ts +20 -4
- package/dist/card-endpoint.js +38 -4
- package/dist/card-fields.generated.js +1444 -51
- package/dist/cdp.d.ts +29 -0
- package/dist/cdp.js +444 -24
- package/dist/client.d.ts +134 -7
- package/dist/client.js +350 -25
- package/dist/comgate.d.ts +50 -0
- package/dist/comgate.js +80 -0
- package/dist/cybersource-secure-acceptance.generated.d.ts +1 -1
- package/dist/eprotect.generated.d.ts +1 -1
- package/dist/gmo.generated.js +7 -3
- package/dist/hipay.generated.d.ts +56 -0
- package/dist/hipay.generated.js +392 -0
- package/dist/hold.d.ts +180 -0
- package/dist/hold.js +270 -0
- package/dist/hosted-entry.d.ts +4 -0
- package/dist/hosted-entry.js +32 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -0
- package/dist/lifecycle.d.ts +10 -0
- package/dist/lifecycle.js +21 -0
- package/dist/merchant-card-endpoints.generated.js +102 -11
- package/dist/paddle-tokenex.generated.js +7 -3
- package/dist/paddle-vgs.generated.d.ts +3 -2
- package/dist/paddle-vgs.generated.js +9 -5
- package/dist/payrails.generated.js +7 -3
- package/dist/pre-claim.d.ts +20 -0
- package/dist/pre-claim.js +202 -22
- package/dist/preflight-catalog.json +58 -0
- package/dist/preflight-schemas.json +4 -0
- package/dist/preflight.generated.js +26 -2
- package/dist/prepared-processor.d.ts +6 -2
- package/dist/prepared-processor.js +18 -2
- package/dist/primer.generated.js +1487 -94
- package/dist/przelewy24.d.ts +47 -0
- package/dist/przelewy24.js +88 -0
- package/dist/quickpay.d.ts +44 -0
- package/dist/quickpay.js +65 -0
- package/dist/registry.d.ts +6 -5
- package/dist/registry.js +27 -7
- package/dist/shiji-sts.generated.js +7 -3
- package/dist/stripe-checkout.generated.js +744 -13
- package/dist/tokenex-iframe.d.ts +93 -0
- package/dist/tokenex-iframe.generated.d.ts +81 -0
- package/dist/tokenex-iframe.generated.js +403 -0
- package/dist/tokenex-iframe.js +195 -0
- package/dist/transbank.d.ts +45 -0
- package/dist/transbank.js +73 -0
- package/dist/twoc2p.d.ts +54 -0
- package/dist/twoc2p.generated.d.ts +33 -0
- package/dist/twoc2p.generated.js +1149 -0
- package/dist/twoc2p.js +85 -0
- package/dist/voice.d.ts +16 -13
- package/dist/voice.js +13 -10
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +3 -3
package/dist/comgate.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ComGate's payment gateway (pay1 to pay4.comgate.cz, where most Czech and Slovak e-shops send the buyer), as this
|
|
3
|
+
* SDK reads it.
|
|
4
|
+
*
|
|
5
|
+
* The merchant's server creates the payment at ComGate and sends the buyer's browser to the gateway link ComGate
|
|
6
|
+
* answered with, https://payN.comgate.cz/init?id=<transaction id>, by a redirect or by setting the page's or a
|
|
7
|
+
* frame's location. That GET carries no card and nothing but the payment's id, and it is the one request a build
|
|
8
|
+
* that declares ComGate's capability pauses for ComGate (hosted-entry.ts): the cardholder's device then makes the
|
|
9
|
+
* gateway's own calls for that payment over the end-to-end TLS relay (payment-core processors/comgate.js). Only the
|
|
10
|
+
* link exactly as ComGate writes it is the entry; any other parameter would be handed on to the gateway's own
|
|
11
|
+
* route, which these rules never see.
|
|
12
|
+
*
|
|
13
|
+
* COMGATE_GATEWAY_HOSTS is payment-core's COMGATE_GATEWAY_HOSTS, and isComgateEntryUrl is payment-core's rule of
|
|
14
|
+
* the same name; hosted-entry.test.mjs pins both to payment-core on every case payment-core's own tests list.
|
|
15
|
+
*/
|
|
16
|
+
export const COMGATE_PSP = 'comgate';
|
|
17
|
+
/** The dark-launch capability the API serves ComGate's recognizer behind (payment-core definitions.js). */
|
|
18
|
+
export const COMGATE_CAPABILITY = 'comgate_hosted_payment_page';
|
|
19
|
+
/** The four gateway hosts ComGate's create answer names, each a host of its own entry. */
|
|
20
|
+
export const COMGATE_GATEWAY_HOSTS = Object.freeze(['pay1.comgate.cz', 'pay2.comgate.cz', 'pay3.comgate.cz', 'pay4.comgate.cz']);
|
|
21
|
+
const COMGATE_ENTRY_PATH = '/init';
|
|
22
|
+
// The id the gateway's router takes: three groups of four letters or digits.
|
|
23
|
+
const TRANS_ID = /^[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}$/;
|
|
24
|
+
/**
|
|
25
|
+
* The hosts that take a card, or part of one, for ComGate: the gateway's API (payments.comgate.cz behind pay1 and pay2,
|
|
26
|
+
* payments-gcp.comgate.cz behind pay3 and pay4), where the gateway posts the card (/client/instructions/card-process,
|
|
27
|
+
* check-card) and ComGate's Web Checkout SDK posts its own (/checkout/provider/*, /checkout/card/check-card), and the
|
|
28
|
+
* card frames' hosts (sec.comgate.cz, sec-gcp.comgate.cz), which post the card's first digits to their /bin-checker.
|
|
29
|
+
* The card is already encrypted in ComGate's frame by then, so no body rule could see it: once ComGate is served, this
|
|
30
|
+
* build fails every request to these hosts but a GET, so the card the agent typed never reaches ComGate.
|
|
31
|
+
*/
|
|
32
|
+
export const COMGATE_CARD_HOSTS = Object.freeze(['payments.comgate.cz', 'payments-gcp.comgate.cz', 'sec.comgate.cz', 'sec-gcp.comgate.cz']);
|
|
33
|
+
/** The Fetch.enable globs attachToCdp arms for the card hosts, only while ComGate is served (cdp.ts). */
|
|
34
|
+
export const COMGATE_CARD_PATTERNS = Object.freeze(COMGATE_CARD_HOSTS.map((host) => `*${host}*`));
|
|
35
|
+
// A gateway link, as ComGate writes one: the registry reads ComGate as served when it takes this as a GET entry.
|
|
36
|
+
const COMGATE_SAMPLE_ENTRY = 'https://pay1.comgate.cz/init?id=AAAA-BBBB-CCCC';
|
|
37
|
+
/** Whether this URL is on one of ComGate's card hosts (https, no credentials, any port, a trailing dot or not). */
|
|
38
|
+
export function isComgateCardHost(url) {
|
|
39
|
+
let parsed;
|
|
40
|
+
try {
|
|
41
|
+
parsed = new URL(url);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return parsed.protocol === 'https:' && !parsed.username && !parsed.password
|
|
47
|
+
&& COMGATE_CARD_HOSTS.includes(parsed.hostname.toLowerCase().replace(/\.$/, ''));
|
|
48
|
+
}
|
|
49
|
+
/** Whether this build's registry serves ComGate's entry: a company Agentcard turned ComGate on for, on a build that declares it. */
|
|
50
|
+
export function servesComgate(vault) {
|
|
51
|
+
return typeof vault?.isCardRequest === 'function' && vault.isCardRequest(COMGATE_SAMPLE_ENTRY, 'GET');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Whether an adapter must hand this request to the pre-claim gates: it is on one of ComGate's card hosts and this
|
|
55
|
+
* build's registry serves ComGate. attachToPlaywright's route predicate asks this, as attachToCdp arms the hosts.
|
|
56
|
+
*/
|
|
57
|
+
export function isArmedComgateUrl(vault, url) {
|
|
58
|
+
return isComgateCardHost(url) && servesComgate(vault);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Whether a URL is ComGate's gateway link exactly as ComGate's create answer writes it: https, one of the four
|
|
62
|
+
* gateway hosts in lowercase, the default port, no credentials or fragment, the path /init, and a query of the one
|
|
63
|
+
* `id` parameter holding a transaction id. A string that parses to another spelling is not it.
|
|
64
|
+
*/
|
|
65
|
+
export function isComgateEntryUrl(raw) {
|
|
66
|
+
if (typeof raw !== 'string' || raw.length > 256)
|
|
67
|
+
return false;
|
|
68
|
+
let url;
|
|
69
|
+
try {
|
|
70
|
+
url = new URL(raw);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (url.href !== raw || url.protocol !== 'https:' || url.port || url.username || url.password || url.hash)
|
|
76
|
+
return false;
|
|
77
|
+
if (!COMGATE_GATEWAY_HOSTS.includes(url.hostname) || url.pathname !== COMGATE_ENTRY_PATH)
|
|
78
|
+
return false;
|
|
79
|
+
return url.search.startsWith('?id=') && TRANS_ID.test(url.search.slice(4));
|
|
80
|
+
}
|
|
@@ -38,7 +38,7 @@ declare function isPreparedSecureAcceptanceRequest(url: any, method: any, body:
|
|
|
38
38
|
declare function secureAcceptanceMerchantEntry(profileId: any, merchantOrigin: any, entries?: any): any;
|
|
39
39
|
declare function secureAcceptanceMerchantRefusal(environment: any, profileId: any, merchantOrigin: any, accessKey: any, entries?: any): "unsupported_environment" | "invalid_profile_id" | "secure_acceptance_merchant_unreviewed" | "secure_acceptance_merchant_pending" | "secure_acceptance_access_key_unreviewed" | "secure_acceptance_merchant_observe" | null;
|
|
40
40
|
declare function secureAcceptanceCardType(number: any): "001" | "002" | "003" | "004" | null;
|
|
41
|
-
declare function secureAcceptanceCardRefusal(environment: any, card: any): "
|
|
41
|
+
declare function secureAcceptanceCardRefusal(environment: any, card: any): "invalid_card_number" | "unsupported_environment" | "sandbox_host_requires_documented_test_card" | "live_host_refuses_documented_test_card" | "card_network_unsupported" | "invalid_expiry" | "invalid_cvn" | null;
|
|
42
42
|
declare function isSecureAcceptanceDeviceRequest(templateBody: any, deviceBody: any, environment: any): boolean;
|
|
43
43
|
declare function secureAcceptanceDeviceRequest(request: any, card: any, options: any): {
|
|
44
44
|
url: any;
|
|
@@ -81,7 +81,7 @@ declare function eprotectMerchantPin(paypageId: any, merchantOrigin: any, pins?:
|
|
|
81
81
|
declare function eprotectMerchantRefusal(environment: any, paypageId: any, merchantOrigin: any, pins?: any): "invalid_paypage_id" | "unsupported_environment" | "eprotect_merchant_unreviewed" | null;
|
|
82
82
|
declare function defaultRandom(bytes: any): void;
|
|
83
83
|
declare function eprotectEncrypt(text: any, key: any, random?: typeof defaultRandom): string;
|
|
84
|
-
declare function eprotectCardRefusal(environment: any, cardNumber: any): "
|
|
84
|
+
declare function eprotectCardRefusal(environment: any, cardNumber: any): "invalid_card_number" | "unsupported_environment" | "sandbox_host_requires_documented_test_card" | "live_host_refuses_documented_test_card" | null;
|
|
85
85
|
declare function eprotectDeviceRequest(templateUrl: any, card: any, sessionKey: any, random?: typeof defaultRandom): {
|
|
86
86
|
url: string;
|
|
87
87
|
method: string;
|
package/dist/gmo.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: a65199bcbf0b67546130fb4f2c12ba72c8f51a2ff5b4e3054e2bfcc29b06f95d
|
|
4
4
|
// src/sha256.js
|
|
5
5
|
var K = /* @__PURE__ */ new Uint32Array([
|
|
6
6
|
1116352408,
|
|
@@ -153,6 +153,9 @@ var typedArrayName = Object.getOwnPropertyDescriptor(TYPED_ARRAY, Symbol.toStrin
|
|
|
153
153
|
function parseRsaPublicKey(key) {
|
|
154
154
|
const spki = key && typeof key === "object" ? key.spki : void 0;
|
|
155
155
|
const pin = key && typeof key === "object" ? key.sha256 : void 0;
|
|
156
|
+
const named = key && typeof key === "object" && Object.prototype.hasOwnProperty.call(key, "exponent") ? key.exponent : void 0;
|
|
157
|
+
if (named !== void 0 && named !== 17)
|
|
158
|
+
throw refuse("key");
|
|
156
159
|
if (typeof spki !== "string" || spki.length > 1024 || spki.length % 4 !== 0 || !BASE64.test(spki))
|
|
157
160
|
throw refuse("key");
|
|
158
161
|
if (typeof pin !== "string" || !SHA256_HEX.test(pin))
|
|
@@ -188,9 +191,10 @@ function parseRsaPublicKey(key) {
|
|
|
188
191
|
if (!MODULUS_BYTES.includes(n.length) || !(n[0] & 128) || !(n[n.length - 1] & 1))
|
|
189
192
|
throw refuse("key");
|
|
190
193
|
const e = exponent.bytes;
|
|
191
|
-
|
|
194
|
+
const expected = named === 17 ? [17] : [1, 0, 1];
|
|
195
|
+
if (e.length !== expected.length || !expected.every((byte, i) => e[i] === byte))
|
|
192
196
|
throw refuse("key");
|
|
193
|
-
return Object.freeze({ n: toBigInt(n), e: 65537n, size: n.length });
|
|
197
|
+
return Object.freeze({ n: toBigInt(n), e: named === 17 ? 17n : 65537n, size: n.length });
|
|
194
198
|
}
|
|
195
199
|
function rsaesPkcs1v15Encrypt(key, message, random) {
|
|
196
200
|
const { n, e, size } = parseRsaPublicKey(key);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
declare var HIPAY_PSP: string;
|
|
2
|
+
declare var HIPAY_CAPABILITY: string;
|
|
3
|
+
declare var HIPAY_OPERATION: string;
|
|
4
|
+
declare var HIPAY_VAULT_HOSTS: Readonly<{
|
|
5
|
+
"secure2-vault.hipay-tpp.com": "production";
|
|
6
|
+
"stage-secure2-vault.hipay-tpp.com": "sandbox";
|
|
7
|
+
}>;
|
|
8
|
+
declare var HIPAY_TOKEN_URLS: Readonly<{
|
|
9
|
+
production: "https://secure2-vault.hipay-tpp.com/rest/v2/token";
|
|
10
|
+
sandbox: "https://stage-secure2-vault.hipay-tpp.com/rest/v2/token";
|
|
11
|
+
}>;
|
|
12
|
+
declare var HIPAY_UPDATE_PATH: string;
|
|
13
|
+
declare var HIPAY_REFUSAL_CODES: readonly string[];
|
|
14
|
+
declare function hipayTokenEnvironment(url: any): "production" | "sandbox" | null;
|
|
15
|
+
declare function isHipayTokenUrl(url: any): boolean;
|
|
16
|
+
declare function hipayBodyVerdict(body: any): Readonly<{
|
|
17
|
+
verdict: "refuse";
|
|
18
|
+
code: any;
|
|
19
|
+
}> | Readonly<{
|
|
20
|
+
verdict: "card";
|
|
21
|
+
}>;
|
|
22
|
+
declare function hipayNumberOnlyRequest(url: any, method: any, body: any): boolean;
|
|
23
|
+
declare function hipayUsernameEnvironment(username: any): "production" | "sandbox" | null;
|
|
24
|
+
declare function hipayUsername(headers: any): string | null;
|
|
25
|
+
declare function hipayRequestRefusal(request: any): any;
|
|
26
|
+
declare function isPreparedHipayRequest(url: any, method: any, body: any, environment: any, headers: any): boolean;
|
|
27
|
+
declare function hipayPinOriginUsable(origin: any): boolean;
|
|
28
|
+
declare var HIPAY_MERCHANT_PINS: readonly any[];
|
|
29
|
+
declare function hipayOriginPin(merchantOrigin: any, pins?: readonly any[]): any;
|
|
30
|
+
declare function hipayPreparationRefusal(environment: any, merchantOrigin: any, pins?: readonly any[]): "unsupported_environment" | "hipay_merchant_unreviewed" | null;
|
|
31
|
+
declare function hipayMerchantPin(merchantOrigin: any, username: any, pins?: readonly any[]): any;
|
|
32
|
+
declare function hipayMerchantRefusal(environment: any, merchantOrigin: any, username: any, pins?: readonly any[]): "hipay_headers_refused" | "unsupported_environment" | "hipay_merchant_unreviewed" | null;
|
|
33
|
+
declare function hipayRefusalMessage(code: any): any;
|
|
34
|
+
declare function injectHipayCard(body: any, card: any): {
|
|
35
|
+
body: string;
|
|
36
|
+
where: string[];
|
|
37
|
+
};
|
|
38
|
+
declare function isHipayDeviceRequest(templateBody: any, deviceBody: any): boolean;
|
|
39
|
+
declare function hipayRefusalCode(text: any): string | null;
|
|
40
|
+
declare function hipayAnswerOutcome(status: any, text: any, card: any): {
|
|
41
|
+
outcome: string;
|
|
42
|
+
reason: string;
|
|
43
|
+
code?: undefined;
|
|
44
|
+
body?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
outcome: string;
|
|
47
|
+
code: string;
|
|
48
|
+
reason?: undefined;
|
|
49
|
+
body?: undefined;
|
|
50
|
+
} | {
|
|
51
|
+
outcome: string;
|
|
52
|
+
body: string;
|
|
53
|
+
reason?: undefined;
|
|
54
|
+
code?: undefined;
|
|
55
|
+
};
|
|
56
|
+
export { HIPAY_CAPABILITY, HIPAY_MERCHANT_PINS, HIPAY_OPERATION, HIPAY_PSP, HIPAY_REFUSAL_CODES, HIPAY_TOKEN_URLS, HIPAY_UPDATE_PATH, HIPAY_VAULT_HOSTS, hipayAnswerOutcome, hipayBodyVerdict, hipayMerchantPin, hipayMerchantRefusal, hipayNumberOnlyRequest, hipayOriginPin, hipayPinOriginUsable, hipayPreparationRefusal, hipayRefusalCode, hipayRefusalMessage, hipayRequestRefusal, hipayTokenEnvironment, hipayUsername, hipayUsernameEnvironment, injectHipayCard, isHipayDeviceRequest, isHipayTokenUrl, isPreparedHipayRequest };
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Generated from @agent-cards/payment-core. Do not edit.
|
|
3
|
+
// artifact-sha256: e8cb1ddfc6c8937f5126197b90d8261da8b07c9c68df1decb261052e8a2fabc1
|
|
4
|
+
// src/hipay.js
|
|
5
|
+
var HIPAY_PSP = "hipay";
|
|
6
|
+
var HIPAY_CAPABILITY = "hipay_vault_token";
|
|
7
|
+
var HIPAY_OPERATION = "hipay.card_request";
|
|
8
|
+
var HIPAY_VAULT_HOSTS = /* @__PURE__ */ Object.freeze({ "secure2-vault.hipay-tpp.com": "production", "stage-secure2-vault.hipay-tpp.com": "sandbox" });
|
|
9
|
+
var HIPAY_TOKEN_URLS = /* @__PURE__ */ Object.freeze({
|
|
10
|
+
production: "https://secure2-vault.hipay-tpp.com/rest/v2/token",
|
|
11
|
+
sandbox: "https://stage-secure2-vault.hipay-tpp.com/rest/v2/token"
|
|
12
|
+
});
|
|
13
|
+
var HIPAY_UPDATE_PATH = "/rest/v2/token/update";
|
|
14
|
+
var HIPAY_REFUSAL_CODES = /* @__PURE__ */ Object.freeze([
|
|
15
|
+
"hipay_url_refused",
|
|
16
|
+
"hipay_headers_refused",
|
|
17
|
+
"hipay_number_only",
|
|
18
|
+
"hipay_keeps_card",
|
|
19
|
+
"hipay_body_unsupported"
|
|
20
|
+
]);
|
|
21
|
+
var BODY_LIMIT = 2048;
|
|
22
|
+
var HOSTED_KEYS = /* @__PURE__ */ Object.freeze(["multi_use", "card_expiry_month", "card_expiry_year", "card_number", "card_holder", "cvc"]);
|
|
23
|
+
var HOSTED_KEYS_NO_HOLDER = /* @__PURE__ */ Object.freeze(["multi_use", "card_expiry_month", "card_expiry_year", "card_number", "cvc"]);
|
|
24
|
+
var DIRECT_KEYS = /* @__PURE__ */ Object.freeze(["card_expiry_month", "card_expiry_year", "card_number", "card_holder", "cvc", "multi_use"]);
|
|
25
|
+
var DIRECT_KEYS_NO_HOLDER = /* @__PURE__ */ Object.freeze(["card_expiry_month", "card_expiry_year", "card_number", "cvc", "multi_use"]);
|
|
26
|
+
var CARD_SHAPES = /* @__PURE__ */ Object.freeze([HOSTED_KEYS, HOSTED_KEYS_NO_HOLDER, DIRECT_KEYS, DIRECT_KEYS_NO_HOLDER]);
|
|
27
|
+
var NUMBER_ONLY_KEYS = /* @__PURE__ */ Object.freeze(["multi_use", "card_expiry_month", "card_expiry_year", "card_number"]);
|
|
28
|
+
var CARD_NUMBER = /^[0-9]{12,19}$/;
|
|
29
|
+
var SECURITY_CODE = /^[0-9]{3,4}$/;
|
|
30
|
+
var MONTH = /^(?:0[1-9]|1[0-2])$/;
|
|
31
|
+
var YEAR = /^20[0-9]{2}$/;
|
|
32
|
+
var TEXT_LIMIT = 256;
|
|
33
|
+
var CONTROL = /[\u0000-\u001f\u007f]/;
|
|
34
|
+
var JSON_TYPE = /^application\/json(?:\s*;\s*charset=utf-8)?$/i;
|
|
35
|
+
var BASIC = /^Basic ([A-Za-z0-9+/]{4,512}={0,2})$/;
|
|
36
|
+
var PRODUCTION_USERNAME = /^[0-9]{6,12}\.(?:secure-gateway|api)\.hipay-tpp\.com$/;
|
|
37
|
+
var SANDBOX_USERNAME = /^[0-9]{6,12}\.stage-secure-gateway\.hipay-tpp\.com$/;
|
|
38
|
+
var PASSWORD = /^[\x21-\x7e]{8,128}$/;
|
|
39
|
+
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
40
|
+
var sameKeys = (value, keys) => {
|
|
41
|
+
const own = Object.keys(value);
|
|
42
|
+
return own.length === keys.length && own.every((key, at) => key === keys[at]);
|
|
43
|
+
};
|
|
44
|
+
var plainText = (value) => typeof value === "string" && value.length <= TEXT_LIMIT && !CONTROL.test(value) && (value.match(/[0-9]/g) ?? []).length < 12;
|
|
45
|
+
var refuse = (code) => Object.freeze({ verdict: "refuse", code });
|
|
46
|
+
var CARD = /* @__PURE__ */ Object.freeze({ verdict: "card" });
|
|
47
|
+
function hipayTokenEnvironment(url) {
|
|
48
|
+
if (url === HIPAY_TOKEN_URLS.production)
|
|
49
|
+
return "production";
|
|
50
|
+
if (url === HIPAY_TOKEN_URLS.sandbox)
|
|
51
|
+
return "sandbox";
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function isHipayTokenUrl(url) {
|
|
55
|
+
return hipayTokenEnvironment(url) !== null;
|
|
56
|
+
}
|
|
57
|
+
function readBody(body) {
|
|
58
|
+
if (typeof body !== "string" || body === "" || body.length > BODY_LIMIT)
|
|
59
|
+
return null;
|
|
60
|
+
let value;
|
|
61
|
+
try {
|
|
62
|
+
value = JSON.parse(body);
|
|
63
|
+
if (!record(value) || JSON.stringify(value) !== body)
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
function hipayBodyVerdict(body) {
|
|
72
|
+
const value = readBody(body);
|
|
73
|
+
if (value === null)
|
|
74
|
+
return refuse("hipay_body_unsupported");
|
|
75
|
+
if (sameKeys(value, NUMBER_ONLY_KEYS))
|
|
76
|
+
return refuse("hipay_number_only");
|
|
77
|
+
if (!CARD_SHAPES.some((keys) => sameKeys(value, keys)))
|
|
78
|
+
return refuse("hipay_body_unsupported");
|
|
79
|
+
if (typeof value.card_number !== "string" || !CARD_NUMBER.test(value.card_number) || typeof value.cvc !== "string" || !SECURITY_CODE.test(value.cvc) || typeof value.card_expiry_month !== "string" || !MONTH.test(value.card_expiry_month) || typeof value.card_expiry_year !== "string" || !YEAR.test(value.card_expiry_year) || "card_holder" in value && !plainText(value.card_holder)) {
|
|
80
|
+
return refuse("hipay_body_unsupported");
|
|
81
|
+
}
|
|
82
|
+
if (value.multi_use === 1)
|
|
83
|
+
return refuse("hipay_keeps_card");
|
|
84
|
+
return value.multi_use === 0 ? CARD : refuse("hipay_body_unsupported");
|
|
85
|
+
}
|
|
86
|
+
function hipayNumberOnlyRequest(url, method, body) {
|
|
87
|
+
if (typeof method !== "string" || method.toUpperCase() !== "POST" || !isHipayTokenUrl(url))
|
|
88
|
+
return false;
|
|
89
|
+
if (typeof body !== "string" || body === "" || body.length > BODY_LIMIT)
|
|
90
|
+
return false;
|
|
91
|
+
let value;
|
|
92
|
+
try {
|
|
93
|
+
value = JSON.parse(body);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return record(value) && !(typeof value.cvc === "string" && SECURITY_CODE.test(value.cvc));
|
|
99
|
+
}
|
|
100
|
+
function headerValue(headers, name) {
|
|
101
|
+
const found = Object.keys(headers).filter((key) => key.toLowerCase() === name);
|
|
102
|
+
return found.length === 1 && typeof headers[found[0]] === "string" ? headers[found[0]] : null;
|
|
103
|
+
}
|
|
104
|
+
function base64Text(input) {
|
|
105
|
+
if (input.length % 4 !== 0)
|
|
106
|
+
return null;
|
|
107
|
+
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
108
|
+
const stripped = input.replace(/={1,2}$/, "");
|
|
109
|
+
if (stripped.includes("="))
|
|
110
|
+
return null;
|
|
111
|
+
let out = "";
|
|
112
|
+
let bits = 0;
|
|
113
|
+
let value = 0;
|
|
114
|
+
for (const character of stripped) {
|
|
115
|
+
const sextet = alphabet.indexOf(character);
|
|
116
|
+
if (sextet < 0)
|
|
117
|
+
return null;
|
|
118
|
+
value = value << 6 | sextet;
|
|
119
|
+
bits += 6;
|
|
120
|
+
if (bits >= 8) {
|
|
121
|
+
bits -= 8;
|
|
122
|
+
out += String.fromCharCode(value >> bits & 255);
|
|
123
|
+
value &= (1 << bits) - 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
function hipayUsernameEnvironment(username) {
|
|
129
|
+
if (typeof username !== "string")
|
|
130
|
+
return null;
|
|
131
|
+
if (PRODUCTION_USERNAME.test(username))
|
|
132
|
+
return "production";
|
|
133
|
+
return SANDBOX_USERNAME.test(username) ? "sandbox" : null;
|
|
134
|
+
}
|
|
135
|
+
function hipayUsername(headers) {
|
|
136
|
+
if (!record(headers))
|
|
137
|
+
return null;
|
|
138
|
+
const authorization = headerValue(headers, "authorization");
|
|
139
|
+
const basic = authorization === null ? null : BASIC.exec(authorization);
|
|
140
|
+
const text = basic ? base64Text(basic[1]) : null;
|
|
141
|
+
const colon = text === null ? -1 : text.indexOf(":");
|
|
142
|
+
if (colon <= 0)
|
|
143
|
+
return null;
|
|
144
|
+
const username = text.slice(0, colon);
|
|
145
|
+
return hipayUsernameEnvironment(username) !== null && PASSWORD.test(text.slice(colon + 1)) ? username : null;
|
|
146
|
+
}
|
|
147
|
+
function hipayRequestRefusal(request) {
|
|
148
|
+
if (!record(request) || typeof request.method !== "string" || request.method.toUpperCase() !== "POST")
|
|
149
|
+
return "hipay_url_refused";
|
|
150
|
+
const environment = hipayTokenEnvironment(request.url);
|
|
151
|
+
if (environment === null)
|
|
152
|
+
return "hipay_url_refused";
|
|
153
|
+
const headers = record(request.headers) ? request.headers : {};
|
|
154
|
+
const contentType = headerValue(headers, "content-type");
|
|
155
|
+
const username = hipayUsername(headers);
|
|
156
|
+
if (contentType === null || !JSON_TYPE.test(contentType.trim()) || username === null || hipayUsernameEnvironment(username) !== environment) {
|
|
157
|
+
return "hipay_headers_refused";
|
|
158
|
+
}
|
|
159
|
+
const verdict = hipayBodyVerdict(request.body);
|
|
160
|
+
return verdict.verdict === "card" ? null : verdict.code;
|
|
161
|
+
}
|
|
162
|
+
function isPreparedHipayRequest(url, method, body, environment, headers) {
|
|
163
|
+
return (environment === "production" || environment === "sandbox") && hipayTokenEnvironment(url) === environment && hipayRequestRefusal({ url, method, headers, body }) === null;
|
|
164
|
+
}
|
|
165
|
+
var PIN_ORIGIN = /^https:\/\/([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+)$/;
|
|
166
|
+
var HIPAY_DOMAIN = /(?:^|\.)(?:hipay\.com|hipay-tpp\.com|hipaywallet\.com|hipay-pos-platform\.com|hipaycomprafacil\.com)$/;
|
|
167
|
+
function hipayPinOriginUsable(origin) {
|
|
168
|
+
const host = typeof origin === "string" ? PIN_ORIGIN.exec(origin) : null;
|
|
169
|
+
return !!host && !HIPAY_DOMAIN.test(host[1]);
|
|
170
|
+
}
|
|
171
|
+
var pin = (fields) => Object.freeze({ ...fields, origins: Object.freeze([...fields.origins]), usernames: Object.freeze([...fields.usernames]) });
|
|
172
|
+
var HIPAY_MERCHANT_PINS = /* @__PURE__ */ Object.freeze([
|
|
173
|
+
pin({ id: "happybulle", merchant: "HappyBulle", origins: ["https://www.happybulle.com"], usernames: ["94683309.secure-gateway.hipay-tpp.com"] })
|
|
174
|
+
]);
|
|
175
|
+
var usablePin = (entry) => !!entry && Array.isArray(entry.origins) && Array.isArray(entry.usernames) && entry.origins.length > 0 && entry.usernames.length > 0 && entry.origins.every(hipayPinOriginUsable) && entry.usernames.every((name) => hipayUsernameEnvironment(name) === "production");
|
|
176
|
+
function hipayOriginPin(merchantOrigin, pins = HIPAY_MERCHANT_PINS) {
|
|
177
|
+
if (typeof merchantOrigin !== "string" || !Array.isArray(pins) || !hipayPinOriginUsable(merchantOrigin))
|
|
178
|
+
return null;
|
|
179
|
+
const found = pins.filter((entry) => usablePin(entry) && entry.origins.includes(merchantOrigin));
|
|
180
|
+
return found.length === 1 ? found[0] : null;
|
|
181
|
+
}
|
|
182
|
+
function hipayPreparationRefusal(environment, merchantOrigin, pins = HIPAY_MERCHANT_PINS) {
|
|
183
|
+
if (environment === "sandbox")
|
|
184
|
+
return null;
|
|
185
|
+
if (environment !== "production")
|
|
186
|
+
return "unsupported_environment";
|
|
187
|
+
return hipayOriginPin(merchantOrigin, pins) ? null : "hipay_merchant_unreviewed";
|
|
188
|
+
}
|
|
189
|
+
function hipayMerchantPin(merchantOrigin, username, pins = HIPAY_MERCHANT_PINS) {
|
|
190
|
+
if (typeof username !== "string" || hipayUsernameEnvironment(username) !== "production")
|
|
191
|
+
return null;
|
|
192
|
+
const found = hipayOriginPin(merchantOrigin, pins);
|
|
193
|
+
return found && found.usernames.includes(username) ? found : null;
|
|
194
|
+
}
|
|
195
|
+
function hipayMerchantRefusal(environment, merchantOrigin, username, pins = HIPAY_MERCHANT_PINS) {
|
|
196
|
+
if (environment !== "production" && environment !== "sandbox")
|
|
197
|
+
return "unsupported_environment";
|
|
198
|
+
if (hipayUsernameEnvironment(username) !== environment)
|
|
199
|
+
return "hipay_headers_refused";
|
|
200
|
+
if (environment === "sandbox")
|
|
201
|
+
return null;
|
|
202
|
+
return hipayMerchantPin(merchantOrigin, username, pins) ? null : "hipay_merchant_unreviewed";
|
|
203
|
+
}
|
|
204
|
+
var REFUSAL_MESSAGES = /* @__PURE__ */ Object.freeze({
|
|
205
|
+
hipay_url_refused: "Refusing to pay: this HiPay card request does not go to HiPay's card vault exactly as HiPay's card form sends it. Nothing was sent.",
|
|
206
|
+
hipay_headers_refused: "Refusing to pay: this HiPay card request does not carry the checkout's own headers. Nothing was sent.",
|
|
207
|
+
hipay_number_only: "Refusing to pay: this is not the card request of HiPay's card form. Nothing was sent.",
|
|
208
|
+
hipay_keeps_card: "This payment asks the payment processor to keep your card for later charges, and you cannot agree to that on this page yet.",
|
|
209
|
+
hipay_body_unsupported: "Refusing to pay: this is not the card request of HiPay's card form. Nothing was sent.",
|
|
210
|
+
hipay_merchant_unreviewed: "This payment goes to a merchant account Agentcard has not reviewed."
|
|
211
|
+
});
|
|
212
|
+
function hipayRefusalMessage(code) {
|
|
213
|
+
return Object.prototype.hasOwnProperty.call(REFUSAL_MESSAGES, code) ? REFUSAL_MESSAGES[code] : REFUSAL_MESSAGES.hipay_body_unsupported;
|
|
214
|
+
}
|
|
215
|
+
var WHERE = /* @__PURE__ */ Object.freeze(["card_number", "cvc", "card_expiry_month", "card_expiry_year"]);
|
|
216
|
+
function frameCard(card) {
|
|
217
|
+
if (!card)
|
|
218
|
+
return null;
|
|
219
|
+
const number = String(card.number).replace(/[ -]/g, "");
|
|
220
|
+
const cvc = String(card.cvc);
|
|
221
|
+
const month = Number(card.month);
|
|
222
|
+
const rawYear = Number(card.year);
|
|
223
|
+
const year = Number.isInteger(rawYear) && rawYear >= 0 && rawYear <= 99 ? 2e3 + rawYear : rawYear;
|
|
224
|
+
if (!CARD_NUMBER.test(number) || !SECURITY_CODE.test(cvc) || !Number.isInteger(month) || month < 1 || month > 12 || !Number.isInteger(year) || !YEAR.test(String(year)))
|
|
225
|
+
return null;
|
|
226
|
+
return { card_number: number, cvc, card_expiry_month: String(month).padStart(2, "0"), card_expiry_year: String(year) };
|
|
227
|
+
}
|
|
228
|
+
function written(body, values) {
|
|
229
|
+
const value = JSON.parse(body);
|
|
230
|
+
for (const key of WHERE)
|
|
231
|
+
value[key] = values[key];
|
|
232
|
+
return JSON.stringify(value);
|
|
233
|
+
}
|
|
234
|
+
function injectHipayCard(body, card) {
|
|
235
|
+
const verdict = hipayBodyVerdict(body);
|
|
236
|
+
if (verdict.verdict !== "card")
|
|
237
|
+
throw new Error(hipayRefusalMessage(verdict.code));
|
|
238
|
+
const values = frameCard(card);
|
|
239
|
+
if (!values)
|
|
240
|
+
throw new Error("Could not fill the card fields for HiPay. Nothing was sent.");
|
|
241
|
+
return { body: written(body, values), where: [...WHERE] };
|
|
242
|
+
}
|
|
243
|
+
function isHipayDeviceRequest(templateBody, deviceBody) {
|
|
244
|
+
if (hipayBodyVerdict(templateBody).verdict !== "card" || hipayBodyVerdict(deviceBody).verdict !== "card")
|
|
245
|
+
return false;
|
|
246
|
+
const device = JSON.parse(deviceBody);
|
|
247
|
+
return written(templateBody, device) === deviceBody && device.card_number !== JSON.parse(templateBody).card_number;
|
|
248
|
+
}
|
|
249
|
+
var ANSWER_LIMIT = 16384;
|
|
250
|
+
var TOKEN = /^[A-Za-z0-9_-]{16,128}$/;
|
|
251
|
+
var LONG_DIGIT_RUN = /[0-9]{13,}/;
|
|
252
|
+
var DIGEST_TOKEN = /^[0-9a-f]{64}$/;
|
|
253
|
+
var PAN = /^([0-9]{6})[xX*]{2,9}([0-9]{4})$/;
|
|
254
|
+
var REQUEST_ID = /^[0-9]{1,11}$/;
|
|
255
|
+
var REQUEST_ID_MAX = 99999999999;
|
|
256
|
+
var CARD_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
257
|
+
var WORD = /^[A-Za-z0-9][A-Za-z0-9 _.-]{0,31}$/;
|
|
258
|
+
var COUNTRY = /^[A-Z]{2}$/;
|
|
259
|
+
var VAULT_CODE = /^[0-9]{1,7}$/;
|
|
260
|
+
var ECHO_WINDOW = 7;
|
|
261
|
+
var HIDDEN_FLOOR = 5;
|
|
262
|
+
var SEPARATORS = /[ ._-]/g;
|
|
263
|
+
var WORD_DIGITS = 2;
|
|
264
|
+
var word = (value) => typeof value === "string" && WORD.test(value) && (value.match(/[0-9]/g) ?? []).length <= WORD_DIGITS;
|
|
265
|
+
var ANSWER_KEYS = /* @__PURE__ */ Object.freeze([
|
|
266
|
+
"token",
|
|
267
|
+
"request_id",
|
|
268
|
+
"card_id",
|
|
269
|
+
"multi_use",
|
|
270
|
+
"brand",
|
|
271
|
+
"pan",
|
|
272
|
+
"card_holder",
|
|
273
|
+
"card_expiry_month",
|
|
274
|
+
"card_expiry_year",
|
|
275
|
+
"issuer",
|
|
276
|
+
"country",
|
|
277
|
+
"domestic_network",
|
|
278
|
+
"card_type",
|
|
279
|
+
"card_category",
|
|
280
|
+
"forbidden_issuer_country"
|
|
281
|
+
]);
|
|
282
|
+
function readAnswer(text) {
|
|
283
|
+
if (typeof text !== "string" || text === "" || text.length > ANSWER_LIMIT)
|
|
284
|
+
return null;
|
|
285
|
+
try {
|
|
286
|
+
const value = JSON.parse(text);
|
|
287
|
+
return record(value) ? value : null;
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function vaultCode(answer) {
|
|
294
|
+
const code = answer ? answer.code : void 0;
|
|
295
|
+
const text = typeof code === "number" && Number.isInteger(code) && code >= 0 ? String(code) : typeof code === "string" ? code : null;
|
|
296
|
+
return text !== null && VAULT_CODE.test(text) ? text : null;
|
|
297
|
+
}
|
|
298
|
+
function hipayRefusalCode(text) {
|
|
299
|
+
const code = vaultCode(readAnswer(text));
|
|
300
|
+
return code === null ? null : `hipay_${code}`;
|
|
301
|
+
}
|
|
302
|
+
var KEPT = /* @__PURE__ */ Object.freeze({
|
|
303
|
+
token: (value) => typeof value === "string" && TOKEN.test(value) && (DIGEST_TOKEN.test(value) || !LONG_DIGIT_RUN.test(value)),
|
|
304
|
+
request_id: (value) => typeof value === "string" && REQUEST_ID.test(value) || Number.isInteger(value) && value >= 0 && value <= REQUEST_ID_MAX,
|
|
305
|
+
card_id: (value) => typeof value === "string" && CARD_ID.test(value) && !LONG_DIGIT_RUN.test(value),
|
|
306
|
+
multi_use: (value) => value === 0 || value === false,
|
|
307
|
+
brand: word,
|
|
308
|
+
pan: (value) => typeof value === "string" && PAN.test(value),
|
|
309
|
+
card_holder: plainText,
|
|
310
|
+
card_expiry_month: (value) => typeof value === "string" && MONTH.test(value),
|
|
311
|
+
card_expiry_year: (value) => typeof value === "string" && YEAR.test(value),
|
|
312
|
+
issuer: plainText,
|
|
313
|
+
country: (value) => typeof value === "string" && COUNTRY.test(value),
|
|
314
|
+
domestic_network: word,
|
|
315
|
+
card_type: word,
|
|
316
|
+
card_category: word,
|
|
317
|
+
forbidden_issuer_country: (value) => typeof value === "boolean"
|
|
318
|
+
});
|
|
319
|
+
function tokenAnswer(answer) {
|
|
320
|
+
if (!answer || typeof answer.token !== "string" || typeof answer.pan !== "string")
|
|
321
|
+
return null;
|
|
322
|
+
const out = {};
|
|
323
|
+
for (const key of ANSWER_KEYS) {
|
|
324
|
+
if (answer[key] === void 0 || answer[key] === null)
|
|
325
|
+
continue;
|
|
326
|
+
if (!KEPT[key](answer[key]))
|
|
327
|
+
return null;
|
|
328
|
+
out[key] = answer[key];
|
|
329
|
+
}
|
|
330
|
+
return out;
|
|
331
|
+
}
|
|
332
|
+
function hipayAnswerOutcome(status, text, card) {
|
|
333
|
+
if (!Number.isInteger(status))
|
|
334
|
+
return { outcome: "unknown", reason: "hipay_unconfirmed" };
|
|
335
|
+
if (status >= 500)
|
|
336
|
+
return { outcome: "unknown", reason: "server_error" };
|
|
337
|
+
if (status >= 400 && status < 500)
|
|
338
|
+
return { outcome: "refused", code: hipayRefusalCode(text) ?? `http_${status}` };
|
|
339
|
+
if (status !== 200 && status !== 201)
|
|
340
|
+
return { outcome: "unknown", reason: "hipay_unconfirmed" };
|
|
341
|
+
const answer = readAnswer(text);
|
|
342
|
+
if (answer && typeof answer.token !== "string" && vaultCode(answer) !== null)
|
|
343
|
+
return { outcome: "refused", code: `hipay_${vaultCode(answer)}` };
|
|
344
|
+
const token = tokenAnswer(answer);
|
|
345
|
+
if (token === null)
|
|
346
|
+
return { outcome: "unknown", reason: "hipay_unsafe_response" };
|
|
347
|
+
if (card) {
|
|
348
|
+
const sent = frameCard(card);
|
|
349
|
+
if (!sent)
|
|
350
|
+
return { outcome: "unknown", reason: "hipay_unsafe_response" };
|
|
351
|
+
const hidden = sent.card_number.slice(6, -4);
|
|
352
|
+
const holdsHidden = (key, value) => hidden.length >= HIDDEN_FLOOR && key !== "card_expiry_month" && key !== "card_expiry_year" && String(value).replace(SEPARATORS, "").includes(hidden);
|
|
353
|
+
if (ANSWER_KEYS.some((key) => key !== "pan" && token[key] !== void 0 && (echoesCard(token[key], sent.card_number) || holdsHidden(key, token[key])))) {
|
|
354
|
+
return { outcome: "unknown", reason: "hipay_unsafe_response" };
|
|
355
|
+
}
|
|
356
|
+
const pan = PAN.exec(token.pan);
|
|
357
|
+
const brand = brandNetwork(token.brand);
|
|
358
|
+
const network = cardNetwork(sent.card_number);
|
|
359
|
+
if (!pan || pan[1] !== sent.card_number.slice(0, 6) || pan[2] !== sent.card_number.slice(-4) || token.card_expiry_month !== void 0 && token.card_expiry_month !== sent.card_expiry_month || token.card_expiry_year !== void 0 && token.card_expiry_year !== sent.card_expiry_year || brand !== null && network !== null && brand !== network) {
|
|
360
|
+
return { outcome: "unknown", reason: "hipay_token_mismatch" };
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return { outcome: "approved", body: JSON.stringify(token) };
|
|
364
|
+
}
|
|
365
|
+
function echoesCard(value, number) {
|
|
366
|
+
const digits = String(value).replace(/[^0-9]/g, "");
|
|
367
|
+
if (digits.length < ECHO_WINDOW)
|
|
368
|
+
return false;
|
|
369
|
+
for (let at = 0; at + ECHO_WINDOW <= number.length; at += 1) {
|
|
370
|
+
if (digits.includes(number.slice(at, at + ECHO_WINDOW)))
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
function cardNetwork(number) {
|
|
376
|
+
const two = Number(number.slice(0, 2));
|
|
377
|
+
const four = Number(number.slice(0, 4));
|
|
378
|
+
if (number.startsWith("4"))
|
|
379
|
+
return "VISA";
|
|
380
|
+
if (two >= 51 && two <= 55 || four >= 2221 && four <= 2720)
|
|
381
|
+
return "MASTERCARD";
|
|
382
|
+
return two === 34 || two === 37 ? "AMEX" : null;
|
|
383
|
+
}
|
|
384
|
+
function brandNetwork(brand) {
|
|
385
|
+
const name = typeof brand === "string" ? brand.toUpperCase().replace(/[^A-Z]/g, "") : "";
|
|
386
|
+
if (name === "VISA")
|
|
387
|
+
return "VISA";
|
|
388
|
+
if (name === "MASTERCARD")
|
|
389
|
+
return "MASTERCARD";
|
|
390
|
+
return name === "AMERICANEXPRESS" || name === "AMEX" ? "AMEX" : null;
|
|
391
|
+
}
|
|
392
|
+
export { HIPAY_CAPABILITY, HIPAY_MERCHANT_PINS, HIPAY_OPERATION, HIPAY_PSP, HIPAY_REFUSAL_CODES, HIPAY_TOKEN_URLS, HIPAY_UPDATE_PATH, HIPAY_VAULT_HOSTS, hipayAnswerOutcome, hipayBodyVerdict, hipayMerchantPin, hipayMerchantRefusal, hipayNumberOnlyRequest, hipayOriginPin, hipayPinOriginUsable, hipayPreparationRefusal, hipayRefusalCode, hipayRefusalMessage, hipayRequestRefusal, hipayTokenEnvironment, hipayUsername, hipayUsernameEnvironment, injectHipayCard, isHipayDeviceRequest, isHipayTokenUrl, isPreparedHipayRequest };
|