@agent-cards/sdk 0.23.19 → 0.23.20
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 +20 -0
- package/PREFLIGHT.md +2 -0
- package/README.md +34 -4
- 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 +483 -17
- package/dist/cdp.d.ts +29 -0
- package/dist/cdp.js +302 -18
- package/dist/client.d.ts +30 -4
- package/dist/client.js +128 -13
- package/dist/hipay.generated.d.ts +56 -0
- package/dist/hipay.generated.js +389 -0
- package/dist/hold.d.ts +180 -0
- package/dist/hold.js +264 -0
- package/dist/index.d.ts +3 -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-vgs.generated.d.ts +3 -2
- package/dist/paddle-vgs.generated.js +9 -5
- package/dist/pre-claim.d.ts +14 -0
- package/dist/pre-claim.js +76 -3
- package/dist/prepared-processor.d.ts +6 -2
- package/dist/prepared-processor.js +18 -2
- package/dist/primer.generated.js +510 -44
- package/dist/quickpay.d.ts +44 -0
- package/dist/quickpay.js +65 -0
- package/dist/stripe-checkout.generated.js +124 -2
- package/dist/twoc2p.d.ts +54 -0
- package/dist/twoc2p.generated.d.ts +33 -0
- package/dist/twoc2p.generated.js +1145 -0
- package/dist/twoc2p.js +85 -0
- package/dist/voice.d.ts +16 -13
- package/dist/voice.js +13 -10
- package/package.json +3 -3
package/dist/client.d.ts
CHANGED
|
@@ -257,6 +257,28 @@ export declare const SUPPORTED_REGISTRY_FEATURES: readonly string[];
|
|
|
257
257
|
* that the page then runs in the agent's browser. The cardholder's device sends the card through
|
|
258
258
|
* the checkout relay. Served on the same terms: only to a build that lists it, for a company
|
|
259
259
|
* Agentcard turned PayMongo on for.
|
|
260
|
+
*
|
|
261
|
+
* `hipay_vault_token`: the token create HiPay's hosted fields send to HiPay's Secure Vault
|
|
262
|
+
* (secure2-vault.hipay-tpp.com, stage-secure2-vault for a test row), only through a prepared
|
|
263
|
+
* checkout: the merchant's page gives the frame 20 seconds after Pay. The cardholder's device
|
|
264
|
+
* sends the card to HiPay directly and the frame gets back HiPay's token. The number-only post
|
|
265
|
+
* the frame sends while the number is typed, and its /update once it holds a token, fail in the
|
|
266
|
+
* browser (pre-claim.ts hipayPreClaim). Served on the same terms: only to a build that lists it,
|
|
267
|
+
* for a company Agentcard turned HiPay on for.
|
|
268
|
+
*
|
|
269
|
+
* `twoc2p_secure_pay`: the Payment 2C2P's hosted payment page posts to its payment API
|
|
270
|
+
* (pgwv4.2c2p.com), carrying the card only as one field the page encrypts under 2C2P's static
|
|
271
|
+
* key. This build pauses it and writes over the placeholder's field the one the cardholder's
|
|
272
|
+
* device wrote under the key payment-core pins (twoc2p.ts), into that Payment alone; 3-D Secure
|
|
273
|
+
* then runs in the agent's browser. Served only to a build that lists it, and only for Agentcard's
|
|
274
|
+
* proof company, whatever the API's processor lists name: the field is the card under 2C2P's one
|
|
275
|
+
* static key, which any 2C2P merchant could charge.
|
|
276
|
+
*
|
|
277
|
+
* `quickpay_hosted_payment_page`: QuickPay's hosted payment window, whose card-free signed entry
|
|
278
|
+
* this build pauses for the cardholder's device and whose card post, fee lookup, wallet post, 3-D
|
|
279
|
+
* Secure step and card lookup this build never lets the agent's browser send (pre-claim.ts,
|
|
280
|
+
* quickpay.ts). Served on the same terms as NMI's and Redsys's: only to a build that lists it, for a
|
|
281
|
+
* company Agentcard turned QuickPay on for.
|
|
260
282
|
*/
|
|
261
283
|
export declare const SUPPORTED_CAPABILITIES: readonly string[];
|
|
262
284
|
/**
|
|
@@ -1193,6 +1215,10 @@ export declare class CheckoutAuthError extends Error {
|
|
|
1193
1215
|
* On Paytrail's hosts a payment's id reads `{transaction}`:
|
|
1194
1216
|
* https://services.paytrail.com/payments/{transaction}/click-to-pay/loading-and-redirect, and on Payment
|
|
1195
1217
|
* Highway's a card page's session reads `{session}`.
|
|
1218
|
+
* On 2C2P's page hosts everything after the build's folder reads `{token}`:
|
|
1219
|
+
* https://pgw-ui.2c2p.com/payment/4.1/{token}.
|
|
1220
|
+
* On QuickPay's host the window's session reads `{session}`:
|
|
1221
|
+
* https://payment.quickpay.net/{session}/3ds_auth.
|
|
1196
1222
|
* A string that is not a URL keeps the part before any `?` or `#`, with the
|
|
1197
1223
|
* same segments masked for every processor whose host it names.
|
|
1198
1224
|
* A URL is read by its host only when the parser finds one. Text before a URL
|
|
@@ -1243,8 +1269,8 @@ export interface VaultClientOptions {
|
|
|
1243
1269
|
/**
|
|
1244
1270
|
* The voice module: how this product approves purchases by voice, named
|
|
1245
1271
|
* once per business, with the Vault return link and the verifier address
|
|
1246
|
-
* beside it. Leave it out
|
|
1247
|
-
* `
|
|
1272
|
+
* beside it. Leave it out and the client approves on Agentcard's page
|
|
1273
|
+
* (`approval: 'sheet'`). See `VoiceOptions`.
|
|
1248
1274
|
*/
|
|
1249
1275
|
voice?: VoiceOptions;
|
|
1250
1276
|
/**
|
|
@@ -1309,8 +1335,8 @@ export declare class VaultClient {
|
|
|
1309
1335
|
/**
|
|
1310
1336
|
* Approve purchases by voice inside your own product: connect a person once,
|
|
1311
1337
|
* create the purchase, ask for the key word, read the result. Same
|
|
1312
|
-
* credentials, same token as the checkout calls.
|
|
1313
|
-
*
|
|
1338
|
+
* credentials, same token as the checkout calls. Approves on Agentcard's
|
|
1339
|
+
* page unless `voice: { approval: 'in_app' }` was named at construction.
|
|
1314
1340
|
*/
|
|
1315
1341
|
readonly voice: VoiceModule;
|
|
1316
1342
|
/**
|
package/dist/client.js
CHANGED
|
@@ -16,7 +16,9 @@ import { SHIJI_STS_CAPABILITY, SHIJI_STS_PSP, isShijiStsServedCompanion, isShiji
|
|
|
16
16
|
import { AMADEUS_CHECKOUT_CAPABILITY, AMADEUS_CHECKOUT_PSP } from './amadeus-checkout.generated.js';
|
|
17
17
|
import { PADDLE_VGS_CAPABILITY, PADDLE_VGS_PSP, paddleVgsCardFactsOf } from './paddle-vgs.generated.js';
|
|
18
18
|
import { PADDLE_TOKENEX_CAPABILITY, PADDLE_TOKENEX_PSP, isPaddleTokenexServedFacts, isPaddleTokenexServedSubstitution } from './paddle-tokenex.js';
|
|
19
|
+
import { TWOC2P_CAPABILITY, TWOC2P_PSP } from './twoc2p.js';
|
|
19
20
|
import { WIX_PAYMENTS_CAPABILITY, WIX_PAYMENTS_PSP } from './wix-payments.generated.js';
|
|
21
|
+
import { HIPAY_CAPABILITY, HIPAY_PSP } from './hipay.generated.js';
|
|
20
22
|
import { classifyStripeCheckoutRequest, encodeStripeCheckoutContext, hasStripeCheckoutMarker, parseStripeCheckoutContext, parseStripeCheckoutResponse, STRIPE_CHECKOUT_CONTEXT_HEADER, } from './stripe-checkout.generated.js';
|
|
21
23
|
import { VoiceModule } from './voice.js';
|
|
22
24
|
import { BuyModule } from './buy.js';
|
|
@@ -241,9 +243,31 @@ export const SUPPORTED_REGISTRY_FEATURES = ['card_fields', 'checkout_sessions'];
|
|
|
241
243
|
* that the page then runs in the agent's browser. The cardholder's device sends the card through
|
|
242
244
|
* the checkout relay. Served on the same terms: only to a build that lists it, for a company
|
|
243
245
|
* Agentcard turned PayMongo on for.
|
|
246
|
+
*
|
|
247
|
+
* `hipay_vault_token`: the token create HiPay's hosted fields send to HiPay's Secure Vault
|
|
248
|
+
* (secure2-vault.hipay-tpp.com, stage-secure2-vault for a test row), only through a prepared
|
|
249
|
+
* checkout: the merchant's page gives the frame 20 seconds after Pay. The cardholder's device
|
|
250
|
+
* sends the card to HiPay directly and the frame gets back HiPay's token. The number-only post
|
|
251
|
+
* the frame sends while the number is typed, and its /update once it holds a token, fail in the
|
|
252
|
+
* browser (pre-claim.ts hipayPreClaim). Served on the same terms: only to a build that lists it,
|
|
253
|
+
* for a company Agentcard turned HiPay on for.
|
|
254
|
+
*
|
|
255
|
+
* `twoc2p_secure_pay`: the Payment 2C2P's hosted payment page posts to its payment API
|
|
256
|
+
* (pgwv4.2c2p.com), carrying the card only as one field the page encrypts under 2C2P's static
|
|
257
|
+
* key. This build pauses it and writes over the placeholder's field the one the cardholder's
|
|
258
|
+
* device wrote under the key payment-core pins (twoc2p.ts), into that Payment alone; 3-D Secure
|
|
259
|
+
* then runs in the agent's browser. Served only to a build that lists it, and only for Agentcard's
|
|
260
|
+
* proof company, whatever the API's processor lists name: the field is the card under 2C2P's one
|
|
261
|
+
* static key, which any 2C2P merchant could charge.
|
|
262
|
+
*
|
|
263
|
+
* `quickpay_hosted_payment_page`: QuickPay's hosted payment window, whose card-free signed entry
|
|
264
|
+
* this build pauses for the cardholder's device and whose card post, fee lookup, wallet post, 3-D
|
|
265
|
+
* Secure step and card lookup this build never lets the agent's browser send (pre-claim.ts,
|
|
266
|
+
* quickpay.ts). Served on the same terms as NMI's and Redsys's: only to a build that lists it, for a
|
|
267
|
+
* company Agentcard turned QuickPay on for.
|
|
244
268
|
*/
|
|
245
269
|
export const SUPPORTED_CAPABILITIES = ['fiserv_card_capture', GMO_CAPABILITY, CYBERSOURCE_FLEX_CAPABILITY, JUSPAY_CAPABILITY, DATATRANS_CAPABILITY, 'authorize_net_dpm_form', PELECARD_CAPABILITY, ACI_CAPABILITY, 'creditguard_pps_process', PRIMER_CAPABILITY, PAYRAILS_CAPABILITY, CONVERGE_CAPABILITY, EPROTECT_CAPABILITY, WSPAY_CAPABILITY, SHIJI_STS_CAPABILITY, AMADEUS_CHECKOUT_CAPABILITY, 'worldline_mycheckout_form', 'verifone_card_capture', 'ekashu_hosted_payment_page', SECURE_ACCEPTANCE_CAPABILITY, 'gravy_session_fields_put', 'moneris_hosted_tokenization', PADDLE_VGS_CAPABILITY, PADDLE_TOKENEX_CAPABILITY,
|
|
246
|
-
'redsys_hosted_payment_page', 'lyra_krypton_payment', 'payfast_card_pay', WIX_PAYMENTS_CAPABILITY, 'paymongo_checkout_pay'];
|
|
270
|
+
'redsys_hosted_payment_page', 'lyra_krypton_payment', 'payfast_card_pay', WIX_PAYMENTS_CAPABILITY, 'paymongo_checkout_pay', HIPAY_CAPABILITY, TWOC2P_CAPABILITY, 'quickpay_hosted_payment_page'];
|
|
247
271
|
/**
|
|
248
272
|
* Processors whose paused request names no amount at all, so the pair the
|
|
249
273
|
* agent passes is the amount the cardholder approves: authorize() refuses one
|
|
@@ -275,15 +299,20 @@ export const SUPPORTED_CAPABILITIES = ['fiserv_card_capture', GMO_CAPABILITY, CY
|
|
|
275
299
|
* PayMongo's card attach carries none either: the merchant bound the total, always in
|
|
276
300
|
* Philippine pesos, to the checkout session when it created it, so the agent sends that
|
|
277
301
|
* total, above zero (PAYMONGO_PSP below), and the API holds it to the session PayMongo's
|
|
278
|
-
* own page shows.
|
|
302
|
+
* own page shows. 2C2P's Payment carries none either: the merchant bound the total to the
|
|
303
|
+
* payment token when it created it, so the agent sends the total 2C2P's page shows, above
|
|
304
|
+
* zero (TWOC2P_PSP), and the API holds it to the amount 2C2P's own PaymentOption answer names.
|
|
305
|
+
* HiPay's token create carries none either: the merchant's server charges
|
|
306
|
+
* HiPay's token for its own order, so the agent's pair, which the prepared checkout carries,
|
|
307
|
+
* is the total the cardholder approves, above zero as Moneris's is.
|
|
279
308
|
*/
|
|
280
309
|
const MONERIS_PSP = 'moneris';
|
|
281
310
|
const PAYFAST_PSP = 'payfast';
|
|
282
311
|
const PAYMONGO_PSP = 'paymongo';
|
|
283
|
-
const AGENT_AMOUNT_PROCESSORS = [GMO_PSP, PELECARD_PSP, WSPAY_PSP, SECURE_ACCEPTANCE_PSP, MONERIS_PSP, PADDLE_VGS_PSP, PAYFAST_PSP, WIX_PAYMENTS_PSP, PAYMONGO_PSP];
|
|
312
|
+
const AGENT_AMOUNT_PROCESSORS = [GMO_PSP, PELECARD_PSP, WSPAY_PSP, SECURE_ACCEPTANCE_PSP, MONERIS_PSP, PADDLE_VGS_PSP, PAYFAST_PSP, WIX_PAYMENTS_PSP, PAYMONGO_PSP, HIPAY_PSP, TWOC2P_PSP];
|
|
284
313
|
/** How AmountRequiredError names a processor. */
|
|
285
314
|
const PROCESSOR_NAMES = { [GMO_PSP]: 'GMO', [PELECARD_PSP]: 'Pelecard', [WSPAY_PSP]: 'WSPay',
|
|
286
|
-
[SECURE_ACCEPTANCE_PSP]: 'CyberSource Secure Acceptance', [MONERIS_PSP]: 'Moneris', [PADDLE_VGS_PSP]: 'Paddle', [PAYFAST_PSP]: 'Payfast', [WIX_PAYMENTS_PSP]: 'Wix', [PAYMONGO_PSP]: 'PayMongo' };
|
|
315
|
+
[SECURE_ACCEPTANCE_PSP]: 'CyberSource Secure Acceptance', [MONERIS_PSP]: 'Moneris', [PADDLE_VGS_PSP]: 'Paddle', [PAYFAST_PSP]: 'Payfast', [WIX_PAYMENTS_PSP]: 'Wix', [PAYMONGO_PSP]: 'PayMongo', [HIPAY_PSP]: 'HiPay', [TWOC2P_PSP]: '2C2P' };
|
|
287
316
|
/**
|
|
288
317
|
* Processors whose request and answer name no amount at all, so the total the
|
|
289
318
|
* payment page shows (`pageAmount`) is the one figure that ties the agent's pair
|
|
@@ -1268,6 +1297,68 @@ function maskPaytrailTransaction(path) {
|
|
|
1268
1297
|
function maskPaymentHighwaySession(path) {
|
|
1269
1298
|
return maskPaytrailId(path, '{session}');
|
|
1270
1299
|
}
|
|
1300
|
+
/**
|
|
1301
|
+
* 2C2P's hosted payment page names its payment token in its hash routes (pgw-ui.2c2p.com/payment/<build>/#/token/
|
|
1302
|
+
* <token>, #/info/<token>, #/mobile/process/<token>), and the token is all a browser needs to open that payment's page
|
|
1303
|
+
* (payment-core twoc2p.js). redactUrl drops a fragment, but a URL whose `#` was escaped carries the route in its path,
|
|
1304
|
+
* and then in any spelling: escaped or doubled separators, escaped letters, parameters. Nothing past the build's folder
|
|
1305
|
+
* on 2C2P's page hosts is worth a log line, so everything after `/payment/<build>/`, its separators in any spelling
|
|
1306
|
+
* SLASH reads, reads {token}, and on any other path everything after its first separator. A string that is not a URL
|
|
1307
|
+
* is cut the same way after a whole page-host authority it names (at the start, or after a space, a quote, a bracket,
|
|
1308
|
+
* a colon such as a `see:` before it, a comma, a semicolon, an equals sign or `//`, and followed by a path, a port or
|
|
1309
|
+
* the end), and only up to the end of that URL, so the message's own words,
|
|
1310
|
+
* another site's path naming the host and a lookalike host stay; a text naming several such URLs has each one cut.
|
|
1311
|
+
* Anchored matches and cuts in one pass: no input makes it backtrack.
|
|
1312
|
+
*/
|
|
1313
|
+
const TWOC2P_PAGE_HOST = /^(?:sandbox-)?pgw-ui\.2c2p\.com\.?$/i;
|
|
1314
|
+
const TWOC2P_PAGE_FOLDER = new RegExp(`^${SLASH}payment${SLASH}4\\.[0-9]{1,2}${SLASH}`, 'i');
|
|
1315
|
+
const TWOC2P_FIRST_SEPARATOR = new RegExp(`^${SLASH}`, 'i');
|
|
1316
|
+
const TWOC2P_PAGE_AUTHORITY = `(?:^|[\\s"'(<\\[:,;=]|//)(?:sandbox-)?pgw-ui\\.2c2p\\.com\\.?(?::[0-9]{1,5})?(?=${SLASH}|$)`;
|
|
1317
|
+
/** One page path, from its first separator: the build's folder stays and the rest reads {token}. */
|
|
1318
|
+
function maskTwoC2pPath(path) {
|
|
1319
|
+
const kept = TWOC2P_PAGE_FOLDER.exec(path) ?? TWOC2P_FIRST_SEPARATOR.exec(path);
|
|
1320
|
+
const end = kept ? kept[0].length : 0;
|
|
1321
|
+
return path.length > end ? `${path.slice(0, end)}{token}` : path;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Text that is not a URL: every whole page-host authority it names, each URL cut only to its own end (the first
|
|
1325
|
+
* space, quote or bracket), so the words between and after them stay. A text that starts with a slash is read the
|
|
1326
|
+
* same way, so another site's protocol-relative URL that names the host keeps its own host and path.
|
|
1327
|
+
*/
|
|
1328
|
+
function maskTwoC2pToken(path) {
|
|
1329
|
+
const authority = new RegExp(TWOC2P_PAGE_AUTHORITY, 'gi');
|
|
1330
|
+
// A closing bracket or parenthesis ends the URL only when no path or token character follows it, so a URL
|
|
1331
|
+
// a message wraps in [] or () keeps the words after it, and a bracket inside the path still cannot end the cut early.
|
|
1332
|
+
const urlEnd = /[\s"'<>]|[\])](?![A-Za-z0-9+/=%\\])/g;
|
|
1333
|
+
let out = '';
|
|
1334
|
+
let done = 0;
|
|
1335
|
+
for (let host = authority.exec(path); host !== null; host = authority.exec(path)) {
|
|
1336
|
+
const start = host.index + host[0].length;
|
|
1337
|
+
urlEnd.lastIndex = start;
|
|
1338
|
+
const stop = urlEnd.exec(path);
|
|
1339
|
+
const end = stop ? stop.index : path.length;
|
|
1340
|
+
out += path.slice(done, start) + maskTwoC2pPath(path.slice(start, end));
|
|
1341
|
+
done = end;
|
|
1342
|
+
authority.lastIndex = end;
|
|
1343
|
+
}
|
|
1344
|
+
return out + path.slice(done);
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* QuickPay's window names its session as the first segment of its own path (/<32 hex>, then /3ds_auth or
|
|
1348
|
+
* /poll-response), and that id is what carries a card post into the payment the merchant's signed entry
|
|
1349
|
+
* opened; a payment link's id (/payments/<64 hex>) opens one the same way. On QuickPay's host a run of 32 hex
|
|
1350
|
+
* digits or more after a slash, in any case or escaped, reads {session} whatever follows it: a URL parser drops a
|
|
1351
|
+
* newline after the URL, so words after it can run on into the id. The entry, the host's root, carries none.
|
|
1352
|
+
*/
|
|
1353
|
+
const QUICKPAY_HOST = /^payment\.quickpay\.net\.?$/i;
|
|
1354
|
+
const QUICKPAY_SESSION = /(\/|%2f)[0-9a-f]{32,}/gi;
|
|
1355
|
+
function maskQuickpaySession(path) {
|
|
1356
|
+
return path.replace(QUICKPAY_SESSION, '$1{session}');
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* `mask` reads a text that names the processor's host; `pathMask`, where a processor has one, reads the path of a
|
|
1360
|
+
* URL already parsed on that host, which `mask` reads otherwise.
|
|
1361
|
+
*/
|
|
1271
1362
|
const PATH_CREDENTIALS = [
|
|
1272
1363
|
{ host: PATH_SECRET_HOST, named: /(?:wspay\.biz|monri\.com)/i, mask: maskPathSecret },
|
|
1273
1364
|
{ host: CREDITGUARD_HOST, named: /creditguard\.co\.il/i, mask: maskCreditguardTxId },
|
|
@@ -1288,6 +1379,8 @@ const PATH_CREDENTIALS = [
|
|
|
1288
1379
|
{ host: SUMUP_API_HOST, named: /api\.sumup\.com/i, mask: maskSumupCheckout },
|
|
1289
1380
|
{ host: PAYTRAIL_HOST, named: /paytrail\.com/i, mask: maskPaytrailTransaction },
|
|
1290
1381
|
{ host: PAYMENT_HIGHWAY_HOST, named: /(?:paymenthighway\.io|sph-test-solinor\.com)/i, mask: maskPaymentHighwaySession },
|
|
1382
|
+
{ host: TWOC2P_PAGE_HOST, named: /pgw-ui\.2c2p\.com/i, mask: maskTwoC2pToken, pathMask: maskTwoC2pPath },
|
|
1383
|
+
{ host: QUICKPAY_HOST, named: /quickpay\.net/i, mask: maskQuickpaySession },
|
|
1291
1384
|
];
|
|
1292
1385
|
/**
|
|
1293
1386
|
* A URL as it may appear in an error message: origin + path only. A paused
|
|
@@ -1321,6 +1414,10 @@ const PATH_CREDENTIALS = [
|
|
|
1321
1414
|
* On Paytrail's hosts a payment's id reads `{transaction}`:
|
|
1322
1415
|
* https://services.paytrail.com/payments/{transaction}/click-to-pay/loading-and-redirect, and on Payment
|
|
1323
1416
|
* Highway's a card page's session reads `{session}`.
|
|
1417
|
+
* On 2C2P's page hosts everything after the build's folder reads `{token}`:
|
|
1418
|
+
* https://pgw-ui.2c2p.com/payment/4.1/{token}.
|
|
1419
|
+
* On QuickPay's host the window's session reads `{session}`:
|
|
1420
|
+
* https://payment.quickpay.net/{session}/3ds_auth.
|
|
1324
1421
|
* A string that is not a URL keeps the part before any `?` or `#`, with the
|
|
1325
1422
|
* same segments masked for every processor whose host it names.
|
|
1326
1423
|
* A URL is read by its host only when the parser finds one. Text before a URL
|
|
@@ -1345,7 +1442,7 @@ export function redactUrl(raw) {
|
|
|
1345
1442
|
let path = url.pathname;
|
|
1346
1443
|
for (const rule of PATH_CREDENTIALS)
|
|
1347
1444
|
if (rule.host.test(url.hostname))
|
|
1348
|
-
path = rule.mask(path);
|
|
1445
|
+
path = (rule.pathMask ?? rule.mask)(path);
|
|
1349
1446
|
return maskNamed(`${url.origin}${path}`, url.pathname);
|
|
1350
1447
|
}
|
|
1351
1448
|
/**
|
|
@@ -1429,6 +1526,16 @@ const PADDLE_VGS_PREPARATION_REFUSALS = [
|
|
|
1429
1526
|
* `unsupported_checkout`, which PREPARATION_REFUSALS names for every checkout. Only for a Wix checkout.
|
|
1430
1527
|
*/
|
|
1431
1528
|
const WIX_PAYMENTS_PREPARATION_REFUSALS = ['processor_unavailable', 'live_host_on_sandbox_row', 'merchant_profile_mismatch'];
|
|
1529
|
+
/**
|
|
1530
|
+
* The API's refusals of a HiPay preparation, before any preparation exists, that prepareCheckout surfaces by name:
|
|
1531
|
+
* the company is not turned on for HiPay (`processor_unavailable`), the environment is not the caller's key mode's
|
|
1532
|
+
* (`live_host_on_sandbox_row`, `sandbox_host_on_live_row`), a checkout's merchant is not the name the reviewed pin
|
|
1533
|
+
* carries (`merchant_profile_mismatch`), and the price is zero (`amount_required`), since every create after it would be
|
|
1534
|
+
* refused. An unreviewed origin answers `unsupported_checkout`, which PREPARATION_REFUSALS names for every checkout.
|
|
1535
|
+
* Only for a HiPay checkout.
|
|
1536
|
+
*/
|
|
1537
|
+
const HIPAY_PREPARATION_REFUSALS = ['processor_unavailable', 'live_host_on_sandbox_row', 'sandbox_host_on_live_row', 'merchant_profile_mismatch',
|
|
1538
|
+
'amount_required'];
|
|
1432
1539
|
/**
|
|
1433
1540
|
* The reason the cardholder's device declines a bound prepared row with, per processor, when its own
|
|
1434
1541
|
* send boundary passed before the card left it (the Vault's sendWindow, 12 seconds after it last saw
|
|
@@ -1441,6 +1548,7 @@ const PREPARED_SEND_WINDOW_DECLINES = Object.freeze({
|
|
|
1441
1548
|
amadeus_checkout: 'amadeus_send_window_closed',
|
|
1442
1549
|
[SECURE_ACCEPTANCE_PSP]: 'secure_acceptance_send_window_closed',
|
|
1443
1550
|
[WIX_PAYMENTS_PSP]: 'wix_payments_send_window_closed',
|
|
1551
|
+
[HIPAY_PSP]: 'hipay_send_window_closed',
|
|
1444
1552
|
});
|
|
1445
1553
|
/**
|
|
1446
1554
|
* Refusals a CyberSource Flex preparation that tokenizes before Pay answers (4xx) before any
|
|
@@ -1529,8 +1637,8 @@ export class VaultClient {
|
|
|
1529
1637
|
/**
|
|
1530
1638
|
* Approve purchases by voice inside your own product: connect a person once,
|
|
1531
1639
|
* create the purchase, ask for the key word, read the result. Same
|
|
1532
|
-
* credentials, same token as the checkout calls.
|
|
1533
|
-
*
|
|
1640
|
+
* credentials, same token as the checkout calls. Approves on Agentcard's
|
|
1641
|
+
* page unless `voice: { approval: 'in_app' }` was named at construction.
|
|
1534
1642
|
*/
|
|
1535
1643
|
voice;
|
|
1536
1644
|
/**
|
|
@@ -1644,7 +1752,9 @@ export class VaultClient {
|
|
|
1644
1752
|
// wspay_confirm, shiji_sts_pinned_key, amadeus_checkout_actions.v1,
|
|
1645
1753
|
// worldline_mycheckout_form, verifone_card_capture, ekashu_hosted_payment_page,
|
|
1646
1754
|
// cybersource_sa_token_create, gravy_session_fields_put,
|
|
1647
|
-
// moneris_hosted_tokenization, paddle_vgs_cards,
|
|
1755
|
+
// moneris_hosted_tokenization, paddle_vgs_cards, paddle_tokenex_pay,
|
|
1756
|
+
// redsys_hosted_payment_page, lyra_krypton_payment, payfast_card_pay,
|
|
1757
|
+
// quickpay_hosted_payment_page) and
|
|
1648
1758
|
// the caller's company is one Agentcard turned that processor on for, so this
|
|
1649
1759
|
// build arms Fiserv's card capture, GMO's getToken, CyberSource Flex's card
|
|
1650
1760
|
// fields, Juspay's card flow, Datatrans's Secure Fields card post, the
|
|
@@ -2123,6 +2233,7 @@ export class VaultClient {
|
|
|
2123
2233
|
|| (input.psp === EPROTECT_PSP && EPROTECT_PREPARATION_REFUSALS.includes(error.code))
|
|
2124
2234
|
|| (input.psp === PADDLE_VGS_PSP && PADDLE_VGS_PREPARATION_REFUSALS.includes(error.code))
|
|
2125
2235
|
|| (input.psp === WIX_PAYMENTS_PSP && WIX_PAYMENTS_PREPARATION_REFUSALS.includes(error.code))
|
|
2236
|
+
|| (input.psp === HIPAY_PSP && HIPAY_PREPARATION_REFUSALS.includes(error.code))
|
|
2126
2237
|
|| (!!flexContext && CYBERSOURCE_FLEX_PREPARATION_REFUSALS.includes(error.code))))
|
|
2127
2238
|
|| (input.psp === 'fiserv' && error.status === 502 && error.code === 'cse_key_unavailable')))
|
|
2128
2239
|
throw fail(error.code);
|
|
@@ -2406,10 +2517,11 @@ export class VaultClient {
|
|
|
2406
2517
|
// amount_required.
|
|
2407
2518
|
if (!hasAmount && rec && AGENT_AMOUNT_PROCESSORS.includes(rec.psp))
|
|
2408
2519
|
throw new AmountRequiredError(rec.psp);
|
|
2409
|
-
// A Moneris token is charged later for whatever the merchant's server decides, and a Payfast pay
|
|
2410
|
-
// PayMongo attach charges the total its payment
|
|
2411
|
-
// would show the cardholder no price at all: it is refused like a missing one.
|
|
2412
|
-
if (hasAmount && rec && (rec.psp === MONERIS_PSP || rec.psp === PAYFAST_PSP || rec.psp === PAYMONGO_PSP
|
|
2520
|
+
// A Moneris or a HiPay token is charged later for whatever the merchant's server decides, and a Payfast pay, a
|
|
2521
|
+
// PayMongo attach or a 2C2P Payment charges the total its payment, checkout session or payment token
|
|
2522
|
+
// already holds, so a zero pair would show the cardholder no price at all: it is refused like a missing one.
|
|
2523
|
+
if (hasAmount && rec && (rec.psp === MONERIS_PSP || rec.psp === PAYFAST_PSP || rec.psp === PAYMONGO_PSP || rec.psp === HIPAY_PSP || rec.psp === TWOC2P_PSP)
|
|
2524
|
+
&& Number(input.amount) <= 0)
|
|
2413
2525
|
throw new AmountRequiredError(rec.psp);
|
|
2414
2526
|
// Nor is the agent's pair tied to the page by anything but the total the
|
|
2415
2527
|
// page shows: without it the cardholder could approve one figure while the
|
|
@@ -2555,8 +2667,11 @@ export class VaultClient {
|
|
|
2555
2667
|
// and the API names 500 ms as such a row's poll interval.
|
|
2556
2668
|
// A prepared Paddle VGS card request too, for 20 seconds: Paddle's frame aborts it 10 seconds after
|
|
2557
2669
|
// Pay and sends it once more, and the API names 500 ms as such a row's poll interval.
|
|
2670
|
+
// A prepared HiPay token create too, for 20 seconds: HiPay's hosted fields give it 20 seconds from Pay, so
|
|
2671
|
+
// an answer the cardholder's device records late in that span still reaches the frame before it gives up,
|
|
2672
|
+
// and the API names 500 ms as such a row's poll interval.
|
|
2558
2673
|
const preparedFastPollUntil = preparation?.psp === 'mercado_pago' ? Date.now() + 10_000
|
|
2559
|
-
: preparation?.psp === PADDLE_VGS_PSP ? Date.now() + 20_000
|
|
2674
|
+
: preparation?.psp === PADDLE_VGS_PSP || preparation?.psp === HIPAY_PSP ? Date.now() + 20_000
|
|
2560
2675
|
: preparation?.psp === EPROTECT_PSP ? Date.now() + 15_000
|
|
2561
2676
|
: preparation?.psp === SECURE_ACCEPTANCE_PSP ? Date.now() + SECURE_ACCEPTANCE_FAST_POLL_MS : 0;
|
|
2562
2677
|
// A preparation that tokenized before Pay: the cardholder's device already holds CyberSource's
|
|
@@ -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 never[];
|
|
29
|
+
declare function hipayOriginPin(merchantOrigin: any, pins?: readonly never[]): null;
|
|
30
|
+
declare function hipayPreparationRefusal(environment: any, merchantOrigin: any, pins?: readonly never[]): "unsupported_environment" | "hipay_merchant_unreviewed" | null;
|
|
31
|
+
declare function hipayMerchantPin(merchantOrigin: any, username: any, pins?: readonly never[]): null;
|
|
32
|
+
declare function hipayMerchantRefusal(environment: any, merchantOrigin: any, username: any, pins?: readonly never[]): "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 };
|