@agent-cards/sdk 0.23.23 → 0.23.25
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 +18 -0
- package/PREFLIGHT.md +2 -0
- package/README.md +13 -1
- package/dist/agent-amount.generated.js +1 -1
- package/dist/amadeus.d.ts +5 -2
- package/dist/amadeus.js +18 -3
- package/dist/amazon-payment-services.d.ts +25 -0
- package/dist/amazon-payment-services.generated.d.ts +76 -0
- package/dist/amazon-payment-services.generated.js +883 -0
- package/dist/amazon-payment-services.js +53 -0
- 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 +5 -4
- package/dist/cdp.js +70 -4
- package/dist/client.d.ts +55 -3
- package/dist/client.js +119 -12
- package/dist/hosted-entry.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/openpay.generated.d.ts +67 -0
- package/dist/openpay.generated.js +446 -0
- package/dist/paddle-checkout-watch.d.ts +70 -0
- package/dist/paddle-checkout-watch.js +239 -0
- package/dist/paddle-tokenex.generated.d.ts +29 -1
- package/dist/paddle-tokenex.generated.js +175 -26
- package/dist/pre-claim.d.ts +1 -0
- package/dist/pre-claim.js +18 -1
- package/dist/prepared-processor.d.ts +12 -4
- package/dist/prepared-processor.js +31 -5
- package/dist/primer.generated.js +5 -4
- package/dist/stripe-checkout.generated.js +5 -4
- package/dist/tap-payments.d.ts +43 -0
- package/dist/tap-payments.generated.d.ts +59 -0
- package/dist/tap-payments.generated.js +990 -0
- package/dist/tap-payments.js +72 -0
- package/dist/tokenex-iframe.generated.d.ts +18 -6
- package/dist/tokenex-iframe.generated.js +3 -3
- package/package.json +2 -2
package/dist/client.js
CHANGED
|
@@ -18,8 +18,10 @@ import { AMADEUS_CHECKOUT_PSP } from './amadeus-checkout.generated.js';
|
|
|
18
18
|
import { PADDLE_VGS_PSP, paddleVgsCardFactsOf } from './paddle-vgs.generated.js';
|
|
19
19
|
import { PAYGENT_PSP, paygentAnswerOutcome } from './paygent.generated.js';
|
|
20
20
|
import { PADDLE_TOKENEX_PSP, isPaddleTokenexServedFacts, isPaddleTokenexServedSubstitution } from './paddle-tokenex.js';
|
|
21
|
+
import { TAP_PAYMENTS_PSP, isTapPaymentsServedSubstitution } from './tap-payments.js';
|
|
21
22
|
import { WIX_PAYMENTS_PSP } from './wix-payments.generated.js';
|
|
22
23
|
import { HIPAY_PSP } from './hipay.generated.js';
|
|
24
|
+
import { OPENPAY_PSP, openpayAnswerOutcome } from './openpay.generated.js';
|
|
23
25
|
import { TOAST_PSP, isToastCiphertext } from './toast.generated.js';
|
|
24
26
|
import { classifyStripeCheckoutRequest, encodeStripeCheckoutContext, hasStripeCheckoutMarker, parseStripeCheckoutContext, parseStripeCheckoutResponse, STRIPE_CHECKOUT_CONTEXT_HEADER, } from './stripe-checkout.generated.js';
|
|
25
27
|
import { VoiceModule } from './voice.js';
|
|
@@ -38,6 +40,7 @@ import { JUSPAY_PSP, juspayPageAnswer } from './juspay-gate.js';
|
|
|
38
40
|
import { CARD_ENDPOINT_MODE, CARD_ENDPOINT_PSP, CardEndpointRefusedError, cardEndpointById, cardEndpointLive, cardEndpointSessionRefusal, } from './card-endpoint.js';
|
|
39
41
|
import { merchantCardEndpointFactsRefusal as sharedFactsRefusal, readMerchantCardEndpointFacts as sharedReadFacts, } from './merchant-card-endpoints.generated.js';
|
|
40
42
|
import { TOKENEX_IFRAME_PSP, tokenexIframePageAnswer, tokenexIframePlaceholderFits } from './tokenex-iframe.js';
|
|
43
|
+
import { APS_PSP, apsNavigationAnswer } from './amazon-payment-services.js';
|
|
41
44
|
import { PRIMER_PSP, primerTokenAnswer } from './primer.js';
|
|
42
45
|
import { isPayrailsPaymentUrl, payrailsAnswer } from './payrails.js';
|
|
43
46
|
import { EbanxFollowUpError } from './ebanx.js';
|
|
@@ -453,6 +456,49 @@ export const SUPPORTED_REGISTRY_FEATURES = ['card_fields', 'checkout_sessions'];
|
|
|
453
456
|
* Served on the same terms, and the API holds the lane to Agentcard's own company
|
|
454
457
|
* until a reviewed change binds the client key to the merchant.
|
|
455
458
|
*
|
|
459
|
+
* `tap_card_sdk_token`: the token request Tap Payments' card frame sends to sdk.tap.company, carrying
|
|
460
|
+
* the card only as one ciphertext the frame writes under the merchant's own RSA key. This build pauses
|
|
461
|
+
* it and writes over the placeholder's ciphertext the one the cardholder's device wrote under the key
|
|
462
|
+
* payment-core pins for the request's publishable key (tap-payments.ts), into that request alone; 3-D
|
|
463
|
+
* Secure and the merchant's charge then run in the agent's browser. Served on the same terms: only to
|
|
464
|
+
* a build that lists it, for a company Agentcard turned Tap on for.
|
|
465
|
+
*
|
|
466
|
+
* `fastspring_card_payment`: the card payment FastSpring's checkout posts, on every store's own
|
|
467
|
+
* host, to <store>.onfastspring.com[/popup-<name>]/session/<id>/payment under the session's
|
|
468
|
+
* X-Session-Token. This build pauses only the checkout's own card body at that exact URL (a card
|
|
469
|
+
* FastSpring saved, a renewal, a gift, a tax id's second card send and a CAPTCHA answer are refused
|
|
470
|
+
* at the pause, and another method's payment with no card continues); the cardholder's device writes
|
|
471
|
+
* the real card into the paused body and sends it through the checkout relay, and the checkout gets
|
|
472
|
+
* FastSpring's answer as payment-core's judge rebuilt it. The request names no amount, so the agent's
|
|
473
|
+
* pair, above zero, is the total the checkout shows. Served on the same terms:
|
|
474
|
+
* only to a build that lists it, for a company Agentcard turned FastSpring on for.
|
|
475
|
+
*
|
|
476
|
+
* `openpay_tokenizer`: the token create openpay.js sends from a merchant's own page to
|
|
477
|
+
* api.openpay.mx/v1/<merchant id>/tokens (api.openpay.co, api.openpay.pe; sandbox-api for a test
|
|
478
|
+
* row), only through a prepared checkout: openpay.js abandons the request 40 seconds after Pay, so
|
|
479
|
+
* the cardholder approves before Pay. The token URL names the merchant, so the claim binds the
|
|
480
|
+
* request by its host's environment and its shape, never by the prepared URL. The cardholder's
|
|
481
|
+
* device sends the card to Openpay itself and the page gets back Openpay's token alone, rebuilt by
|
|
482
|
+
* payment-core's judge. The request names no amount, so the agent's pair, above zero
|
|
483
|
+
* (agent-amount-processors.json), is the one the cardholder approves. Served on the same terms: only
|
|
484
|
+
* to a build that lists it, for a company Agentcard turned Openpay on for.
|
|
485
|
+
*
|
|
486
|
+
* `aps_custom_merchant_page`: Amazon Payment Services' custom merchant page, whose own card form
|
|
487
|
+
* posts top-level to /FortAPI/paymentPage on checkout.payfort.com (sbcheckout.payfort.com on APS's
|
|
488
|
+
* sandbox) with service_command=TOKENIZATION. This build pauses that navigation; the cardholder's
|
|
489
|
+
* phone sends the form with the real card through the checkout relay, and the paused navigation
|
|
490
|
+
* gets APS's own answer, its page or its redirect to the form's return page, only as payment-core's
|
|
491
|
+
* judge reads it for that form (amazon-payment-services.ts apsNavigationAnswer). The form names no
|
|
492
|
+
* amount, so the agent's pair, above zero, is the one the cardholder approves.
|
|
493
|
+
* Served on the same terms: only to a build that lists it, for a company Agentcard turned APS on for.
|
|
494
|
+
*
|
|
495
|
+
* `barion_hosted_payment_page`: Barion's Smart Gateway, whose card-free link
|
|
496
|
+
* (secure.barion.com/Pay?Id=<payment id>, a plain GET the merchant's redirect or script sends
|
|
497
|
+
* the buyer to) this build pauses for the cardholder's device by its exact link (hosted-entry.ts),
|
|
498
|
+
* and whose email check, card posts and 3-D Secure post this build never lets the agent's browser
|
|
499
|
+
* send (pre-claim.ts, barion.ts). Served on the same terms as Przelewy24's: only to a build that
|
|
500
|
+
* lists it, for a company Agentcard turned Barion on for.
|
|
501
|
+
*
|
|
456
502
|
* The list itself is capabilities.json, sorted, one per line (scripts/generate-capabilities.mjs).
|
|
457
503
|
*/
|
|
458
504
|
export const SUPPORTED_CAPABILITIES = DECLARED_CAPABILITIES;
|
|
@@ -843,7 +889,8 @@ export class AmountRequiredError extends Error {
|
|
|
843
889
|
const processor = PROCESSOR_NAMES[psp] ?? psp;
|
|
844
890
|
// A Payrexx card request names the frame's total, but the merchant's page charges its own total after the token.
|
|
845
891
|
const lacks = psp === REVOLUT_PSP ? 'names its amount but not its currency'
|
|
846
|
-
: psp === PAYREXX_PSP ? "only mints a token the merchant's page charges later"
|
|
892
|
+
: psp === PAYREXX_PSP ? "only mints a token the merchant's page charges later"
|
|
893
|
+
: psp === TAP_PAYMENTS_PSP ? 'does not decide the amount charged' : 'names no amount';
|
|
847
894
|
// "An Omise payment request", "A Clover payment request": the article follows the name's first letter.
|
|
848
895
|
const article = /^[AEIOU]/.test(processor) ? 'An' : 'A';
|
|
849
896
|
super(`${article} ${processor} payment request ${lacks}, so pass amount and currency: that is the amount the cardholder approves. Nothing was created and nothing was charged.`);
|
|
@@ -1844,19 +1891,33 @@ const PAYGENT_PREPARATION_REFUSALS = [
|
|
|
1844
1891
|
*/
|
|
1845
1892
|
const HIPAY_PREPARATION_REFUSALS = ['processor_unavailable', 'live_host_on_sandbox_row', 'sandbox_host_on_live_row', 'merchant_profile_mismatch',
|
|
1846
1893
|
'amount_required'];
|
|
1894
|
+
/**
|
|
1895
|
+
* The API's refusals of an Openpay preparation, before any preparation exists, that prepareCheckout passes on by
|
|
1896
|
+
* name: the company is not turned on for Openpay (`processor_unavailable`), the environment is not the caller's key
|
|
1897
|
+
* mode's (`live_host_on_sandbox_row`, `sandbox_host_on_live_row`), a live checkout's merchant is not the name the
|
|
1898
|
+
* reviewed pin for its origin carries (`merchant_profile_mismatch`), and the price is zero (`amount_required`), since
|
|
1899
|
+
* the token create names no amount. An origin no reviewed pin lists answers `unsupported_checkout`, which
|
|
1900
|
+
* PREPARATION_REFUSALS names for every checkout. The API holds the pins, not this build, so a merchant a later release
|
|
1901
|
+
* reviews needs no new SDK. Only for an Openpay checkout.
|
|
1902
|
+
*/
|
|
1903
|
+
const OPENPAY_PREPARATION_REFUSALS = ['processor_unavailable', 'live_host_on_sandbox_row', 'sandbox_host_on_live_row',
|
|
1904
|
+
'merchant_profile_mismatch', 'amount_required'];
|
|
1847
1905
|
/**
|
|
1848
1906
|
* The reason the cardholder's device declines a bound prepared row with, per processor, when its own
|
|
1849
1907
|
* send boundary passed before the card left it (the Vault's sendWindow, 12 seconds after it last saw
|
|
1850
1908
|
* the checkout unbound): a prepared Amadeus SDK add, a prepared Secure Acceptance token create and a
|
|
1851
1909
|
* prepared Wix tokenize request. It names the same known non-payment the adapters' own send window
|
|
1852
1910
|
* closes on (amadeus.ts), which can close later, so authorize() ends the attempt the way that window
|
|
1853
|
-
* does, as a CheckoutPreparationError with that reason, and never as the cardholder's "no".
|
|
1911
|
+
* does, as a CheckoutPreparationError with that reason, and never as the cardholder's "no". A prepared
|
|
1912
|
+
* HiPay token create too, and a prepared Openpay token create, whose device sends the card at most 25
|
|
1913
|
+
* seconds after it last saw the checkout unbound, inside the adapters' 30.
|
|
1854
1914
|
*/
|
|
1855
1915
|
const PREPARED_SEND_WINDOW_DECLINES = Object.freeze({
|
|
1856
1916
|
amadeus_checkout: 'amadeus_send_window_closed',
|
|
1857
1917
|
[SECURE_ACCEPTANCE_PSP]: 'secure_acceptance_send_window_closed',
|
|
1858
1918
|
[WIX_PAYMENTS_PSP]: 'wix_payments_send_window_closed',
|
|
1859
1919
|
[HIPAY_PSP]: 'hipay_send_window_closed',
|
|
1920
|
+
[OPENPAY_PSP]: 'openpay_send_window_closed',
|
|
1860
1921
|
});
|
|
1861
1922
|
/**
|
|
1862
1923
|
* Refusals a CyberSource Flex preparation that tokenizes before Pay answers (4xx) before any
|
|
@@ -2180,9 +2241,10 @@ export class VaultClient {
|
|
|
2180
2241
|
* capability (syncRegistry does), so before a sync, or against an API that
|
|
2181
2242
|
* withheld it, the adapters leave that processor's traffic exactly as they
|
|
2182
2243
|
* found it. prepare() asks this for ACI, whose card-number request names a
|
|
2183
|
-
* checkout id the merchant mints only at Pay time,
|
|
2184
|
-
*
|
|
2185
|
-
*
|
|
2244
|
+
* checkout id the merchant mints only at Pay time, for Openpay, whose token
|
|
2245
|
+
* URL names the merchant's own id, and for a processor whose card request is
|
|
2246
|
+
* a GET (Worldpay eProtect), since that request is recognized by a query the
|
|
2247
|
+
* page has not written yet.
|
|
2186
2248
|
*/
|
|
2187
2249
|
recognizesProcessor(psp) {
|
|
2188
2250
|
return this.registry.some((rec) => rec.psp === psp);
|
|
@@ -2425,7 +2487,8 @@ export class VaultClient {
|
|
|
2425
2487
|
const secureAcceptanceProfileId = secureAcceptance ? secureAcceptanceCheckoutProfile({ environment: input.environment,
|
|
2426
2488
|
profileId: input.secureAcceptanceProfileId, merchantOrigin: input.merchantOrigin }) : null;
|
|
2427
2489
|
// A live Paygent checkout's merchant is the API's to judge against the reviewed pins it holds, before anyone is
|
|
2428
|
-
// asked to approve (PAYGENT_PREPARATION_REFUSALS); test mode needs no pin.
|
|
2490
|
+
// asked to approve (PAYGENT_PREPARATION_REFUSALS); test mode needs no pin. So is a live Openpay checkout's
|
|
2491
|
+
// origin and merchant (OPENPAY_PREPARATION_REFUSALS); Openpay's sandbox needs no pin either.
|
|
2429
2492
|
const timeoutMs = input.timeoutMs ?? 15 * 60_000;
|
|
2430
2493
|
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 2_147_483_647)
|
|
2431
2494
|
throw fail('timeout_invalid');
|
|
@@ -2547,6 +2610,7 @@ export class VaultClient {
|
|
|
2547
2610
|
|| (input.psp === WIX_PAYMENTS_PSP && WIX_PAYMENTS_PREPARATION_REFUSALS.includes(error.code))
|
|
2548
2611
|
|| (input.psp === PAYGENT_PSP && PAYGENT_PREPARATION_REFUSALS.includes(error.code))
|
|
2549
2612
|
|| (input.psp === HIPAY_PSP && HIPAY_PREPARATION_REFUSALS.includes(error.code))
|
|
2613
|
+
|| (input.psp === OPENPAY_PSP && OPENPAY_PREPARATION_REFUSALS.includes(error.code))
|
|
2550
2614
|
|| (!!flexContext && CYBERSOURCE_FLEX_PREPARATION_REFUSALS.includes(error.code))))
|
|
2551
2615
|
|| (input.psp === 'fiserv' && error.status === 502 && error.code === 'cse_key_unavailable')))
|
|
2552
2616
|
throw fail(error.code);
|
|
@@ -2845,7 +2909,8 @@ export class VaultClient {
|
|
|
2845
2909
|
// like a missing one.
|
|
2846
2910
|
// A ComGate payment charges the total ComGate already holds for it, the same way, and a Webpay transaction the
|
|
2847
2911
|
// total the merchant's server bound to it, and a Payrexx page charges its own
|
|
2848
|
-
// total after the frame's token.
|
|
2912
|
+
// total after the frame's token. The charge that follows a Tap token charges the order the merchant's session
|
|
2913
|
+
// holds, the same way.
|
|
2849
2914
|
// A Moneris token is charged later for whatever the merchant's server decides, and a Payfast pay, a
|
|
2850
2915
|
// PayMongo attach or a MakeCommerce card post charges the total its payment, checkout session or
|
|
2851
2916
|
// transaction already holds, so a zero pair would show the cardholder no price at all: it is refused
|
|
@@ -2854,6 +2919,7 @@ export class VaultClient {
|
|
|
2854
2919
|
// A Toast payment method is charged by the page's own confirm for whatever its intent says, the same way.
|
|
2855
2920
|
// An Omise token is charged later for whatever the merchant's server decides, as a Clover one is.
|
|
2856
2921
|
// An SB Payment Service token is charged later the same way.
|
|
2922
|
+
// An Openpay token is charged later for whatever the merchant's server decides, as a HiPay one is.
|
|
2857
2923
|
if (hasAmount && rec && ABOVE_ZERO_PROCESSORS.includes(rec.psp) && Number(input.amount) <= 0)
|
|
2858
2924
|
throw new AmountRequiredError(rec.psp);
|
|
2859
2925
|
// Nor is the agent's pair tied to the page by anything but the total the
|
|
@@ -2920,6 +2986,12 @@ export class VaultClient {
|
|
|
2920
2986
|
// Only the profile's id: the API takes the leg, the key and its environment from the
|
|
2921
2987
|
// profile Agentcard reviewed, never from the caller.
|
|
2922
2988
|
...(verifoneProfile ? { verifone: { profile: verifoneProfile.id } } : {}),
|
|
2989
|
+
// Paddle TokenEx only: Paddle's checkout answers this browser recorded before the /pay paused, which the API
|
|
2990
|
+
// holds `amount` to (paddle-checkout-watch.ts). Any other processor's create would be refused with them.
|
|
2991
|
+
...(rec?.psp === PADDLE_TOKENEX_PSP && input.paddleCheckout?.answers.length ? { paddle_checkout: {
|
|
2992
|
+
paused_at: input.paddleCheckout.pausedAt,
|
|
2993
|
+
answers: input.paddleCheckout.answers.map((answer) => ({ method: answer.method, url: answer.url, status: answer.status, completed_at: answer.completedAt, body: answer.body })),
|
|
2994
|
+
} } : {}),
|
|
2923
2995
|
// A prepared checkout already carries the page origin as merchant_origin.
|
|
2924
2996
|
...(preparation
|
|
2925
2997
|
? { preparation_id: preparation.id, checkout_key: preparation.checkoutKey, merchant_origin: preparation.merchantOrigin, form_guidance: 'filled' }
|
|
@@ -3003,10 +3075,14 @@ export class VaultClient {
|
|
|
3003
3075
|
// A prepared HiPay token create too, for 20 seconds: HiPay's hosted fields give it 20 seconds from Pay, so
|
|
3004
3076
|
// an answer the cardholder's device records late in that span still reaches the frame before it gives up,
|
|
3005
3077
|
// and the API names 500 ms as such a row's poll interval.
|
|
3078
|
+
// A prepared Openpay token create too, for 40 seconds: openpay.js gives it 40 seconds from Pay, so the token
|
|
3079
|
+
// reaches the page within half a second of the device's answer, and the API names 500 ms as such a row's poll
|
|
3080
|
+
// interval.
|
|
3006
3081
|
const preparedFastPollUntil = preparation?.psp === 'mercado_pago' ? Date.now() + 10_000
|
|
3007
3082
|
: preparation?.psp === PADDLE_VGS_PSP || preparation?.psp === HIPAY_PSP ? Date.now() + 20_000
|
|
3008
|
-
: preparation?.psp ===
|
|
3009
|
-
: preparation?.psp ===
|
|
3083
|
+
: preparation?.psp === OPENPAY_PSP ? Date.now() + 40_000
|
|
3084
|
+
: preparation?.psp === EPROTECT_PSP ? Date.now() + 15_000
|
|
3085
|
+
: preparation?.psp === SECURE_ACCEPTANCE_PSP ? Date.now() + SECURE_ACCEPTANCE_FAST_POLL_MS : 0;
|
|
3010
3086
|
// A preparation that tokenized before Pay: the cardholder's device already holds CyberSource's
|
|
3011
3087
|
// token and approves as soon as this bind reaches it, while the page may give createToken only
|
|
3012
3088
|
// seconds (Alaska Airlines' flight checkout gives it three). Poll every 100 ms for 10 seconds,
|
|
@@ -3179,11 +3255,14 @@ export class VaultClient {
|
|
|
3179
3255
|
// Paddle TokenEx carries the two ciphertexts at tokenex_card and the five facts beside them in
|
|
3180
3256
|
// `paddle_tokenex_facts` (the expiry parts are numbers, so they cannot ride `fields`).
|
|
3181
3257
|
const paddleTokenex = rec?.psp === PADDLE_TOKENEX_PSP;
|
|
3258
|
+
// Tap carries its one ciphertext at the body root too (`at` is ''), and nothing to remove (tap-payments.ts).
|
|
3259
|
+
const tap = rec?.psp === TAP_PAYMENTS_PSP;
|
|
3182
3260
|
const fieldsOk = shiji ? isShijiStsServedSubstitution(sub) && isShijiStsServedCompanion(s.shiji_sts_companion)
|
|
3183
3261
|
: paddleTokenex ? isPaddleTokenexServedSubstitution(sub) && isPaddleTokenexServedFacts(s.paddle_tokenex_facts)
|
|
3184
|
-
:
|
|
3185
|
-
&& sub.
|
|
3186
|
-
|
|
3262
|
+
: tap ? isTapPaymentsServedSubstitution(sub)
|
|
3263
|
+
: sub && typeof sub === 'object' && sub.encoding === 'json' && typeof sub.at === 'string' && sub.at
|
|
3264
|
+
&& sub.fields && typeof sub.fields === 'object' && !Array.isArray(sub.fields)
|
|
3265
|
+
&& Object.values(sub.fields).every((v) => typeof v === 'string' && v.length > 0);
|
|
3187
3266
|
if (!fieldsOk)
|
|
3188
3267
|
throw new PaymentOutcomeUnknownError(authorizationId, 'cse_substitutions_malformed');
|
|
3189
3268
|
// A Fiserv approval carries exactly its envelope's four members at
|
|
@@ -3388,6 +3467,19 @@ export class VaultClient {
|
|
|
3388
3467
|
response.headers = { 'content-type': 'application/json' };
|
|
3389
3468
|
response.body = judged.body;
|
|
3390
3469
|
}
|
|
3470
|
+
if (rec?.psp === OPENPAY_PSP) {
|
|
3471
|
+
// Openpay's answer enters the page only as payment-core rebuilds an approved token from its id, masked number,
|
|
3472
|
+
// brand and points flag (openpay.js openpayAnswerOutcome: HTTP 200 or 201 and a token in shape), under its
|
|
3473
|
+
// approved status and a JSON content type. openpay.js hands any 2xx to the page's success callback, so
|
|
3474
|
+
// anything else, an error object Openpay answers inside a 2xx included, is never handed over as an approval;
|
|
3475
|
+
// the card may have left the device, so the outcome is unknown rather than declined.
|
|
3476
|
+
const judged = openpayAnswerOutcome(response.status, response.body, null);
|
|
3477
|
+
if (judged.outcome !== 'approved' || typeof judged.body !== 'string')
|
|
3478
|
+
throw new PaymentOutcomeUnknownError(authorizationId, 'openpay_token_unconfirmed');
|
|
3479
|
+
response.status = response.status === 201 ? 201 : 200;
|
|
3480
|
+
response.headers = { 'content-type': 'application/json' };
|
|
3481
|
+
response.body = judged.body;
|
|
3482
|
+
}
|
|
3391
3483
|
if (rec?.psp === PRIMER_PSP) {
|
|
3392
3484
|
// Primer's answer enters the page only as one single-use card token rebuilt from
|
|
3393
3485
|
// payment-core's allow-list, under a JSON content type (primer.ts primerTokenAnswer).
|
|
@@ -3412,6 +3504,21 @@ export class VaultClient {
|
|
|
3412
3504
|
response.headers = answer.headers;
|
|
3413
3505
|
response.body = answer.body;
|
|
3414
3506
|
}
|
|
3507
|
+
if (rec?.psp === APS_PSP) {
|
|
3508
|
+
// Amazon Payment Services: the paused top-level navigation is answered with APS's own page under its HTML
|
|
3509
|
+
// type, or with APS's redirect to the paused form's return page, and only with a token payment-core's judge
|
|
3510
|
+
// reads for that form (amazon-payment-services.ts apsNavigationAnswer). Anything else is not an answer to
|
|
3511
|
+
// hand the browser: the card has already reached APS. No autopilot run sends an APS form (payment-core, the
|
|
3512
|
+
// authority and the API refuse it), so an approval the API reports as unattended is not handed over either.
|
|
3513
|
+
if (execution.executionMode === 'autopilot')
|
|
3514
|
+
throw new PaymentOutcomeUnknownError(authorizationId, 'autopilot_submission_mode_invalid');
|
|
3515
|
+
const answer = apsNavigationAnswer(input.request, response);
|
|
3516
|
+
if (!answer)
|
|
3517
|
+
throw new PaymentOutcomeUnknownError(authorizationId, 'aps_answer_unconfirmed');
|
|
3518
|
+
response.status = answer.status;
|
|
3519
|
+
response.headers = answer.headers;
|
|
3520
|
+
response.body = answer.body;
|
|
3521
|
+
}
|
|
3415
3522
|
let processorContext;
|
|
3416
3523
|
if (mercadoContext) {
|
|
3417
3524
|
try {
|
package/dist/hosted-entry.js
CHANGED
|
@@ -17,10 +17,12 @@
|
|
|
17
17
|
import { PRZELEWY24_PSP, isPrzelewy24EntryUrl } from './przelewy24.js';
|
|
18
18
|
import { COMGATE_PSP, isComgateEntryUrl } from './comgate.js';
|
|
19
19
|
import { TRANSBANK_PSP, isTransbankEntryUrl } from './transbank.js';
|
|
20
|
+
import { BARION_PSP, isBarionEntryUrl } from './barion.js';
|
|
20
21
|
const HOSTED_GET_ENTRIES = new Map([
|
|
21
22
|
[PRZELEWY24_PSP, isPrzelewy24EntryUrl],
|
|
22
23
|
[COMGATE_PSP, isComgateEntryUrl],
|
|
23
24
|
[TRANSBANK_PSP, isTransbankEntryUrl],
|
|
25
|
+
[BARION_PSP, isBarionEntryUrl],
|
|
24
26
|
]);
|
|
25
27
|
/** Whether this processor's hosted page is entered with a GET this build reads exactly. */
|
|
26
28
|
export function hasHostedGetEntry(psp) {
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type { CardEndpointRefusal, CardEndpointSession, CardEndpointCookie } fro
|
|
|
25
25
|
export type { CdpLike, AttachOptions, CorsOutcome } from './cdp.js';
|
|
26
26
|
export type { StripeCheckoutOptions, StripeCheckoutBlockedDetail, StripeCheckoutBlockStage, StripeCheckoutBlockReason } from './stripe-checkout.js';
|
|
27
27
|
export { substituteEncryptedFields, SubstitutionError } from './substitute.js';
|
|
28
|
+
export { PaddleCheckoutWatch, type PaddleCheckoutAnswer, type PaddleCheckoutCapture } from './paddle-checkout-watch.js';
|
|
28
29
|
export type { Substitutions } from './substitute.js';
|
|
29
30
|
export { classifyDeclaredMerchantRequest, classifyMerchantRequest, substituteMerchantHostedBody } from './merchant-hosted.js';
|
|
30
31
|
export type { MerchantProfile, MerchantProfileStatus, MerchantRequestVerdict, MerchantHostedSubstitutions, MerchantHostedFact, JsonPathStep, SandboxMerchantDeclaration } from './merchant-hosted.js';
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { CardEndpointRefusedError, cardEndpointPatterns } from './card-endpoint.
|
|
|
12
12
|
// The merchant-session probe's capture (the deterministic merchant total, phase 0): no card, no Pay.
|
|
13
13
|
export { MerchantSessionRefusedError, captureMerchantSession, merchantSessionCapture, merchantSessionReadUrl } from './merchant-session-probe.js';
|
|
14
14
|
export { substituteEncryptedFields, SubstitutionError } from './substitute.js';
|
|
15
|
+
export { PaddleCheckoutWatch } from './paddle-checkout-watch.js';
|
|
15
16
|
export { classifyDeclaredMerchantRequest, classifyMerchantRequest, substituteMerchantHostedBody } from './merchant-hosted.js';
|
|
16
17
|
// The merchant's own total for a raw CDP runtime that intercepts on its own (merchant-total.ts).
|
|
17
18
|
export { MerchantExchangeLog, merchantAmountExchanges, merchantAmountFromResponses, merchantChargeReport, merchantProfilePricedBySource, merchantTotalAtRelease, MERCHANT_EXCHANGES_MAX, } from './merchant-total.js';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
declare var OPENPAY_PSP: string;
|
|
2
|
+
declare var OPENPAY_CAPABILITY: string;
|
|
3
|
+
declare var OPENPAY_OPERATION: string;
|
|
4
|
+
declare var OPENPAY_API_HOSTS: Readonly<{
|
|
5
|
+
"api.openpay.mx": "production";
|
|
6
|
+
"api.openpay.co": "production";
|
|
7
|
+
"api.openpay.pe": "production";
|
|
8
|
+
"sandbox-api.openpay.mx": "sandbox";
|
|
9
|
+
"sandbox-api.openpay.co": "sandbox";
|
|
10
|
+
"sandbox-api.openpay.pe": "sandbox";
|
|
11
|
+
}>;
|
|
12
|
+
declare var OPENPAY_CARD_KEYS: readonly string[];
|
|
13
|
+
declare var OPENPAY_ADDRESS_KEYS: readonly string[];
|
|
14
|
+
declare var OPENPAY_PREPARATION_URLS: Readonly<{
|
|
15
|
+
production: "https://api.openpay.mx/v1/prepared/tokens";
|
|
16
|
+
sandbox: "https://sandbox-api.openpay.mx/v1/prepared/tokens";
|
|
17
|
+
}>;
|
|
18
|
+
declare var OPENPAY_REFUSAL_CODES: readonly string[];
|
|
19
|
+
declare function openpayTokenTarget(url: any): Readonly<{
|
|
20
|
+
environment: any;
|
|
21
|
+
host: string;
|
|
22
|
+
merchantId: string;
|
|
23
|
+
}> | null;
|
|
24
|
+
declare function isOpenpayTokenUrl(url: any): boolean;
|
|
25
|
+
declare function openpayTokenEnvironment(url: any): any;
|
|
26
|
+
declare function openpayBodyVerdict(body: any, url: any): Readonly<{
|
|
27
|
+
verdict: "refuse";
|
|
28
|
+
code: any;
|
|
29
|
+
}> | Readonly<{
|
|
30
|
+
verdict: "card";
|
|
31
|
+
}>;
|
|
32
|
+
declare function openpayPublicKey(headers: any): string | null;
|
|
33
|
+
declare function openpayRequestRefusal(request: any): any;
|
|
34
|
+
declare function isPreparedOpenpayRequest(url: any, method: any, body: any, environment: any, headers: any): boolean;
|
|
35
|
+
declare function openpayRefusalMessage(code: any): any;
|
|
36
|
+
declare function openpayPinOriginUsable(origin: any): boolean;
|
|
37
|
+
declare var OPENPAY_MERCHANT_PINS: readonly any[];
|
|
38
|
+
declare function openpayOriginPin(merchantOrigin: any, pins?: readonly any[]): any;
|
|
39
|
+
declare function openpayPreparationRefusal(environment: any, merchantOrigin: any, pins?: readonly any[]): "unsupported_environment" | "openpay_merchant_unreviewed" | null;
|
|
40
|
+
declare function openpayMerchantPin(merchantOrigin: any, request: any, pins?: readonly any[]): any;
|
|
41
|
+
declare function openpayMerchantRefusal(merchantOrigin: any, request: any, pins?: readonly any[]): "openpay_url_refused" | "openpay_merchant_unreviewed" | "openpay_account_unreviewed" | null;
|
|
42
|
+
declare function openpayDeviceRefusal(request: any, options: any): any;
|
|
43
|
+
declare var OPENPAY_TEST_PANS: readonly string[];
|
|
44
|
+
declare function injectOpenpayCard(body: any, card: any): {
|
|
45
|
+
body: string;
|
|
46
|
+
where: string[];
|
|
47
|
+
};
|
|
48
|
+
declare function isOpenpayDeviceRequest(templateBody: any, deviceBody: any): boolean;
|
|
49
|
+
declare function isOpenpayRefusalCode(code: any): boolean;
|
|
50
|
+
declare function openpayAnswerOutcome(status: any, text: any, card: any): {
|
|
51
|
+
outcome: string;
|
|
52
|
+
reason: string | undefined;
|
|
53
|
+
code?: undefined;
|
|
54
|
+
body?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
outcome: string;
|
|
57
|
+
code: string | undefined;
|
|
58
|
+
reason?: undefined;
|
|
59
|
+
body?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
outcome: string;
|
|
62
|
+
body: string;
|
|
63
|
+
reason?: undefined;
|
|
64
|
+
code?: undefined;
|
|
65
|
+
};
|
|
66
|
+
declare function openpayRefusalCode(text: any, status: any): string | null | undefined;
|
|
67
|
+
export { OPENPAY_ADDRESS_KEYS, OPENPAY_API_HOSTS, OPENPAY_CAPABILITY, OPENPAY_CARD_KEYS, OPENPAY_MERCHANT_PINS, OPENPAY_OPERATION, OPENPAY_PREPARATION_URLS, OPENPAY_PSP, OPENPAY_REFUSAL_CODES, OPENPAY_TEST_PANS, injectOpenpayCard, isOpenpayDeviceRequest, isOpenpayRefusalCode, isOpenpayTokenUrl, isPreparedOpenpayRequest, openpayAnswerOutcome, openpayBodyVerdict, openpayDeviceRefusal, openpayMerchantPin, openpayMerchantRefusal, openpayOriginPin, openpayPinOriginUsable, openpayPreparationRefusal, openpayPublicKey, openpayRefusalCode, openpayRefusalMessage, openpayRequestRefusal, openpayTokenEnvironment, openpayTokenTarget };
|