@agent-cards/sdk 0.23.21 → 0.23.23
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 +36 -0
- package/PREFLIGHT.md +4 -0
- package/README.md +53 -4
- package/dist/aci.generated.js +3 -3
- package/dist/agent-amount.generated.d.ts +7 -0
- package/dist/agent-amount.generated.js +3 -0
- package/dist/amadeus-checkout.generated.d.ts +6 -1
- package/dist/amadeus-checkout.generated.js +26 -2
- package/dist/capabilities.generated.d.ts +2 -0
- package/dist/capabilities.generated.js +3 -0
- package/dist/card-fields.generated.js +2574 -186
- package/dist/cdp.js +103 -29
- package/dist/client.d.ts +130 -9
- package/dist/client.js +304 -115
- package/dist/creditguard.generated.js +4 -2
- package/dist/cse-body.js +11 -0
- package/dist/ebanx.d.ts +1 -1
- package/dist/ebanx.js +1 -1
- package/dist/eximbay.d.ts +46 -0
- package/dist/eximbay.js +69 -0
- package/dist/hosted-entry.js +2 -1
- package/dist/hosted-form.d.ts +5 -0
- package/dist/hosted-form.js +5 -0
- package/dist/lifecycle.d.ts +9 -4
- package/dist/lifecycle.js +16 -4
- package/dist/paygent.generated.d.ts +60 -0
- package/dist/paygent.generated.js +425 -0
- package/dist/payrexx.d.ts +91 -0
- package/dist/payrexx.generated.d.ts +91 -0
- package/dist/payrexx.generated.js +536 -0
- package/dist/payrexx.js +141 -0
- package/dist/paytrail.d.ts +58 -0
- package/dist/paytrail.js +98 -0
- package/dist/pre-claim.d.ts +27 -0
- package/dist/pre-claim.js +175 -20
- package/dist/prepared-processor.d.ts +7 -2
- package/dist/prepared-processor.js +16 -2
- package/dist/primer.generated.js +2709 -321
- package/dist/registry.d.ts +4 -3
- package/dist/registry.js +12 -4
- package/dist/sbps.d.ts +57 -0
- package/dist/sbps.generated.d.ts +96 -0
- package/dist/sbps.generated.js +427 -0
- package/dist/sbps.js +90 -0
- package/dist/stripe-checkout.generated.js +744 -27
- package/dist/toast-seal.generated.d.ts +37 -0
- package/dist/toast-seal.generated.js +625 -0
- package/dist/toast.generated.d.ts +41 -0
- package/dist/toast.generated.js +113 -0
- package/dist/transbank.d.ts +33 -0
- package/dist/transbank.js +62 -0
- package/dist/url-mask-parts.d.ts +24 -0
- package/dist/url-mask-parts.js +22 -0
- package/dist/url-masks.generated.d.ts +3 -0
- package/dist/url-masks.generated.js +2 -0
- package/package.json +4 -4
package/dist/payrexx.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payrexx Pay's card frame after its card request (payment-core payrexx.js holds the rules; this SDK vendors them as
|
|
3
|
+
* payrexx.generated.ts).
|
|
4
|
+
*
|
|
5
|
+
* The frame, https://checkout.payrexx.com/?pspId=44&lang=<xx>, posts the card to its own URL. When Payrexx answers that
|
|
6
|
+
* card request by starting 3-D Secure (no token, a threeDSServerTransID), the merchant's page runs 3-D Secure and the
|
|
7
|
+
* frame posts the whole card again to the same URL for each step, with the step's own keys after the card request's
|
|
8
|
+
* fifteen:
|
|
9
|
+
* - the authentication, after the ACS method: threeDSServerTransID, threeDSVersion when the first answer named one,
|
|
10
|
+
* and ten authData values the page reads from the agent's browser;
|
|
11
|
+
* - the post-authentication, after the bank's challenge: threeDSServerTransID and postAuth=true.
|
|
12
|
+
* On a page this SDK is attached to, that card is the agent's placeholder. One approval covers at most one of each, in
|
|
13
|
+
* that order, for the 3-D Secure run its own answer opened (payment-core payrexxFollowUpVerdict), so a run sends the
|
|
14
|
+
* card at most three times. What this module keeps of the approved card request (PayrexxFollowUps) is what the
|
|
15
|
+
* pre-claim gate reads to decide whether the cardholder's device sends a step, or the step fails in the browser.
|
|
16
|
+
* The card request itself, and a body with no card value at all (a wallet's own encryptedCard), are not 3-D Secure
|
|
17
|
+
* sends: the card-request arbiter pauses the one and continues the other (card-fields.js).
|
|
18
|
+
*/
|
|
19
|
+
import { PAYREXX_FOLLOW_UP_KINDS, isPayrexxFrameUrl, payrexxAnswerOutcome, payrexxBodyVerdict, payrexxFollowUpVerdict, payrexxGateVerdict, } from './payrexx.generated.js';
|
|
20
|
+
export const PAYREXX_PSP = 'payrexx';
|
|
21
|
+
/** The capability a build declares to be served Payrexx's recognizer (payment-core PAYREXX_CAPABILITY). */
|
|
22
|
+
export const PAYREXX_CAPABILITY = 'payrexx_card_frame';
|
|
23
|
+
/** The reason a checkout reads when a 3-D Secure send of the placeholder card fails in the browser. */
|
|
24
|
+
export const PAYREXX_RESEND_REASON = 'unsupported_payrexx_card_resend';
|
|
25
|
+
/**
|
|
26
|
+
* Whether a request is a POST to Payrexx's card frame URL whose body sends the card again for a 3-D Secure step
|
|
27
|
+
* (payment-core payrexxBodyVerdict: payrexx_three_ds_resend). `readBody` is called only for a POST to the frame URL,
|
|
28
|
+
* and a reader that throws, or a body nobody could read, reads as no 3-D Secure send.
|
|
29
|
+
*/
|
|
30
|
+
export function isPayrexxResend(url, method, readBody) {
|
|
31
|
+
if (String(method).toUpperCase() !== 'POST' || !isPayrexxFrameUrl(url))
|
|
32
|
+
return false;
|
|
33
|
+
let body;
|
|
34
|
+
try {
|
|
35
|
+
body = readBody();
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
body = null;
|
|
39
|
+
}
|
|
40
|
+
if (typeof body !== 'string')
|
|
41
|
+
return false;
|
|
42
|
+
const verdict = payrexxBodyVerdict(body);
|
|
43
|
+
return verdict.verdict === 'refuse' && verdict.code === 'payrexx_three_ds_resend';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A 3-D Secure send the cardholder's device did not answer with Payrexx's own answer. `reason` is the API's word for
|
|
47
|
+
* it: `not_picked_up` (no device started it in time: the Vault page was closed or asleep), `not_sent` (the device
|
|
48
|
+
* refused it before the card left), `no_answer`, `answer_withheld` (Payrexx's answer carried the card),
|
|
49
|
+
* `answer_refused`, `answer_late`, `response_expired`, or the API's refusal code when it did not take the send at all
|
|
50
|
+
* (`follow_up_refused`, `follow_up_not_covered`, `follow_up_window_closed`). `cardSent` says whether the card may
|
|
51
|
+
* have reached Payrexx: false only when the API confirmed it never left the device. Nothing in it names the request,
|
|
52
|
+
* the card or Payrexx's answer.
|
|
53
|
+
*/
|
|
54
|
+
export class PayrexxFollowUpError extends Error {
|
|
55
|
+
reason;
|
|
56
|
+
cardSent;
|
|
57
|
+
authorizationId;
|
|
58
|
+
constructor(reason, cardSent, authorizationId) {
|
|
59
|
+
super(cardSent
|
|
60
|
+
? `This Payrexx 3-D Secure request under ${authorizationId} has no answer, and the cardholder's device may have sent it: ${reason}.`
|
|
61
|
+
: `The cardholder's device did not send this Payrexx 3-D Secure request under ${authorizationId}: ${reason}.`);
|
|
62
|
+
this.reason = reason;
|
|
63
|
+
this.cardSent = cardSent;
|
|
64
|
+
this.authorizationId = authorizationId;
|
|
65
|
+
this.name = 'PayrexxFollowUpError';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* What one attachment keeps of its approved Payrexx card request: the request and Payrexx's answer as the page received
|
|
70
|
+
* them, until when the API said the approval covers sends after it, and the sends it claimed since, in order. Only a
|
|
71
|
+
* card request whose answer started 3-D Secure (payment-core payrexxAnswerOutcome: pending three_ds) and whose read
|
|
72
|
+
* named that window (`followUpsUntil`) is kept. Any later Payrexx card request handed over replaces it, a send the
|
|
73
|
+
* window has passed is never claimed, and once a send is refused or fails the attachment stops (stop()): nothing after
|
|
74
|
+
* it is claimed, a later approval included.
|
|
75
|
+
*/
|
|
76
|
+
export class PayrexxFollowUps {
|
|
77
|
+
parent = null;
|
|
78
|
+
sent = [];
|
|
79
|
+
stopped = false;
|
|
80
|
+
/** After a refused or failed send: no later request on this attachment is claimed. */
|
|
81
|
+
stop() { this.stopped = true; }
|
|
82
|
+
/**
|
|
83
|
+
* The approval the remembered card request went under, or null when none is remembered. The gate sends nothing
|
|
84
|
+
* unless the checkout's own state names this same approval.
|
|
85
|
+
*/
|
|
86
|
+
get authorizationId() { return this.parent?.authorizationId ?? null; }
|
|
87
|
+
/**
|
|
88
|
+
* As the adapter hands an approved card request's answer to the page: before the answer lands, since the page may
|
|
89
|
+
* start 3-D Secure at once. Every Payrexx card request handed over clears what an earlier one left; only one whose
|
|
90
|
+
* answer started 3-D Secure, under a read that named the window, is kept.
|
|
91
|
+
*/
|
|
92
|
+
remember(request, replay) {
|
|
93
|
+
if (payrexxGateVerdict(request.url, request.body).verdict !== 'card')
|
|
94
|
+
return;
|
|
95
|
+
this.parent = null;
|
|
96
|
+
this.sent = [];
|
|
97
|
+
const until = typeof replay.followUpsUntil === 'string' ? Date.parse(replay.followUpsUntil) : NaN;
|
|
98
|
+
if ((replay.mode ?? 'token') !== 'token' || !Number.isFinite(until))
|
|
99
|
+
return;
|
|
100
|
+
// No card: this browser only ever held the placeholder.
|
|
101
|
+
const outcome = payrexxAnswerOutcome(replay.status, replay.body, null);
|
|
102
|
+
if (outcome.outcome !== 'approved' || outcome.pending !== 'three_ds')
|
|
103
|
+
return;
|
|
104
|
+
this.parent = { authorizationId: replay.authorizationId, url: request.url, body: request.body, answer: { status: replay.status, text: replay.body }, until };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The claim for a paused 3-D Secure send the remembered approval covers, or null: no approval covers sends here, its
|
|
108
|
+
* window has passed, or payment-core's rule refuses the send against the sends already claimed. Synchronous, and it
|
|
109
|
+
* reserves the send, so two requests can never both be claimed as the next one.
|
|
110
|
+
*/
|
|
111
|
+
claim(request, now = Date.now()) {
|
|
112
|
+
const parent = this.parent;
|
|
113
|
+
if (this.stopped || !parent || now >= parent.until || typeof request.body !== 'string')
|
|
114
|
+
return null;
|
|
115
|
+
const verdict = payrexxFollowUpVerdict({
|
|
116
|
+
parent: { url: parent.url, body: parent.body, answer: parent.answer }, sent: this.sent,
|
|
117
|
+
request: { url: request.url, method: request.method, body: request.body },
|
|
118
|
+
});
|
|
119
|
+
if (!verdict.ok || !PAYREXX_FOLLOW_UP_KINDS.includes(verdict.kind))
|
|
120
|
+
return null;
|
|
121
|
+
const entry = { kind: verdict.kind, state: 'pending' };
|
|
122
|
+
this.sent.push(entry);
|
|
123
|
+
const contentType = Object.entries(request.headers ?? {}).find(([name]) => /^content-type$/i.test(name))?.[1];
|
|
124
|
+
return {
|
|
125
|
+
authorizationId: parent.authorizationId, kind: verdict.kind, until: parent.until,
|
|
126
|
+
request: { url: request.url, method: 'POST', headers: { 'content-type': typeof contentType === 'string' ? contentType : 'application/x-www-form-urlencoded; charset=UTF-8' },
|
|
127
|
+
body: request.body },
|
|
128
|
+
settle(answer) {
|
|
129
|
+
if (entry.state !== 'pending')
|
|
130
|
+
return;
|
|
131
|
+
// A copy of the answer as it was settled: a caller that changes its own object later changes no claim.
|
|
132
|
+
if (answer) {
|
|
133
|
+
entry.state = 'answered';
|
|
134
|
+
entry.answer = { status: answer.status, text: answer.text };
|
|
135
|
+
}
|
|
136
|
+
else
|
|
137
|
+
entry.state = 'failed';
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paytrail's card method (the Visa and Mastercard method on the payment wall most Finnish webshops send the buyer
|
|
3
|
+
* to), as this SDK reads it.
|
|
4
|
+
*
|
|
5
|
+
* The merchant's page, or Paytrail's own wall, posts a card-free entry top-level to
|
|
6
|
+
* https://services.paytrail.com/payments/<transaction>/click-to-pay/loading-and-redirect: seven fields Paytrail signed
|
|
7
|
+
* for the merchant, and no card and no amount. Paytrail answers with a loading page whose one form posts the same
|
|
8
|
+
* fields to .../click-to-pay/initialize-payment, which sends the browser to Payment Highway's card page
|
|
9
|
+
* (v1.api.paymenthighway.io, Paytrail's card platform) under a session of its own. The entry is the one request this
|
|
10
|
+
* SDK pauses: the cardholder's device repeats it over the end-to-end TLS relay and follows it to the card page
|
|
11
|
+
* (payment-core processors/paytrail.js). Everything after it in the agent's browser leads to the card the agent
|
|
12
|
+
* typed: the loading page's own post opens the card page, and on Payment Highway's host the card post (/card), the
|
|
13
|
+
* Click to Pay posts (/visa, /mastercard), the 3-D Secure step (/continue), the older card form's post and the card
|
|
14
|
+
* page's lookup of the typed card's first digits (GET .../acquirerData?bin=...). This SDK aborts every one of them,
|
|
15
|
+
* so a placeholder card never reaches Payment Highway.
|
|
16
|
+
*
|
|
17
|
+
* The hosts are payment-core's PAYTRAIL_HOSTS and PAYMENT_HIGHWAY_HOSTS; paytrail.test.mjs pins the lists together.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PAYTRAIL_PSP = "paytrail";
|
|
20
|
+
export declare const PAYTRAIL_HOSTS: readonly string[];
|
|
21
|
+
export declare const PAYMENT_HIGHWAY_HOSTS: readonly string[];
|
|
22
|
+
/** Whether this URL is on Paytrail's entry host (https, no credentials, any port, a trailing dot or not). */
|
|
23
|
+
export declare function isPaytrailHost(url: string): boolean;
|
|
24
|
+
/** Whether this URL is on Payment Highway's card page host (https, no credentials, any port, a trailing dot or not). */
|
|
25
|
+
export declare function isPaymentHighwayHost(url: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The only request that is the merchant's entry: a POST to the card method's loading-and-redirect route for one
|
|
28
|
+
* transaction, written exactly as the method's form action writes it, with the transaction in lowercase and no port,
|
|
29
|
+
* query, fragment or credentials (payment-core isPaytrailEntryUrl). The entry the SDK pauses; the gate aborts every
|
|
30
|
+
* other post of the card method.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isPaytrailEntry(url: string, method: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether a request on Paytrail's host belongs to the card method (a /click-to-pay/ route of a payment, in any letter
|
|
35
|
+
* case): the entry, the loading page's post to initialize-payment, which opens Payment Highway's card page for the
|
|
36
|
+
* transaction, and any other spelling of either. Another method's form (a bank's) is not.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isPaytrailCardMethodUrl(url: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The card page's card lookup: a GET on Payment Highway's host to .../acquirerData, which names the first digits of
|
|
41
|
+
* the card typed so far in its `bin` query. Any other GET there (the card page itself, its scripts and images) is not
|
|
42
|
+
* a card request.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isPaymentHighwayCardLookup(url: string, method: string): boolean;
|
|
45
|
+
/** Whether this build's registry serves Paytrail's entry, asked with an entry on a transaction no payment holds. */
|
|
46
|
+
export declare function isPaytrailServed(vault: {
|
|
47
|
+
isCardRequest(url: string, method?: string): boolean;
|
|
48
|
+
}): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether an adapter must hand this request to the pre-claim gates: it is on Paytrail's host or Payment Highway's, and
|
|
51
|
+
* this build's registry serves Paytrail's entry. The loading page's post and Payment Highway's card requests are not
|
|
52
|
+
* the entry, so the registry's card-request test does not name them; the CDP adapter still pauses them through the
|
|
53
|
+
* recognizer's host and its abort host, and attachToPlaywright's route predicate asks this, so both adapters show the
|
|
54
|
+
* gates every request to either host once Paytrail is armed.
|
|
55
|
+
*/
|
|
56
|
+
export declare function isArmedPaytrailUrl(vault: {
|
|
57
|
+
isCardRequest(url: string, method?: string): boolean;
|
|
58
|
+
}, url: string): boolean;
|
package/dist/paytrail.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paytrail's card method (the Visa and Mastercard method on the payment wall most Finnish webshops send the buyer
|
|
3
|
+
* to), as this SDK reads it.
|
|
4
|
+
*
|
|
5
|
+
* The merchant's page, or Paytrail's own wall, posts a card-free entry top-level to
|
|
6
|
+
* https://services.paytrail.com/payments/<transaction>/click-to-pay/loading-and-redirect: seven fields Paytrail signed
|
|
7
|
+
* for the merchant, and no card and no amount. Paytrail answers with a loading page whose one form posts the same
|
|
8
|
+
* fields to .../click-to-pay/initialize-payment, which sends the browser to Payment Highway's card page
|
|
9
|
+
* (v1.api.paymenthighway.io, Paytrail's card platform) under a session of its own. The entry is the one request this
|
|
10
|
+
* SDK pauses: the cardholder's device repeats it over the end-to-end TLS relay and follows it to the card page
|
|
11
|
+
* (payment-core processors/paytrail.js). Everything after it in the agent's browser leads to the card the agent
|
|
12
|
+
* typed: the loading page's own post opens the card page, and on Payment Highway's host the card post (/card), the
|
|
13
|
+
* Click to Pay posts (/visa, /mastercard), the 3-D Secure step (/continue), the older card form's post and the card
|
|
14
|
+
* page's lookup of the typed card's first digits (GET .../acquirerData?bin=...). This SDK aborts every one of them,
|
|
15
|
+
* so a placeholder card never reaches Payment Highway.
|
|
16
|
+
*
|
|
17
|
+
* The hosts are payment-core's PAYTRAIL_HOSTS and PAYMENT_HIGHWAY_HOSTS; paytrail.test.mjs pins the lists together.
|
|
18
|
+
*/
|
|
19
|
+
export const PAYTRAIL_PSP = 'paytrail';
|
|
20
|
+
export const PAYTRAIL_HOSTS = Object.freeze(['services.paytrail.com']);
|
|
21
|
+
export const PAYMENT_HIGHWAY_HOSTS = Object.freeze(['v1.api.paymenthighway.io']);
|
|
22
|
+
const UUID = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}';
|
|
23
|
+
const ENTRY_PATH = new RegExp(`^/payments/${UUID}/click-to-pay/loading-and-redirect$`);
|
|
24
|
+
// The card method's entry on a transaction no payment holds: the URL this build asks its registry about to learn
|
|
25
|
+
// whether the API serves Paytrail's recognizer, which takes any transaction (payment-core isPaytrailEntryUrl).
|
|
26
|
+
const ENTRY_PROBE = 'https://services.paytrail.com/payments/00000000-0000-4000-8000-000000000000/click-to-pay/loading-and-redirect';
|
|
27
|
+
function onHosts(url, hosts) {
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = new URL(url);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return parsed.protocol === 'https:' && !parsed.username && !parsed.password
|
|
36
|
+
&& hosts.includes(parsed.hostname.toLowerCase().replace(/\.$/, '')) ? parsed : null;
|
|
37
|
+
}
|
|
38
|
+
/** Whether this URL is on Paytrail's entry host (https, no credentials, any port, a trailing dot or not). */
|
|
39
|
+
export function isPaytrailHost(url) {
|
|
40
|
+
return onHosts(url, PAYTRAIL_HOSTS) !== null;
|
|
41
|
+
}
|
|
42
|
+
/** Whether this URL is on Payment Highway's card page host (https, no credentials, any port, a trailing dot or not). */
|
|
43
|
+
export function isPaymentHighwayHost(url) {
|
|
44
|
+
return onHosts(url, PAYMENT_HIGHWAY_HOSTS) !== null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The only request that is the merchant's entry: a POST to the card method's loading-and-redirect route for one
|
|
48
|
+
* transaction, written exactly as the method's form action writes it, with the transaction in lowercase and no port,
|
|
49
|
+
* query, fragment or credentials (payment-core isPaytrailEntryUrl). The entry the SDK pauses; the gate aborts every
|
|
50
|
+
* other post of the card method.
|
|
51
|
+
*/
|
|
52
|
+
export function isPaytrailEntry(url, method) {
|
|
53
|
+
if (String(method).toUpperCase() !== 'POST' || typeof url !== 'string')
|
|
54
|
+
return false;
|
|
55
|
+
let parsed;
|
|
56
|
+
try {
|
|
57
|
+
parsed = new URL(url);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return parsed.protocol === 'https:' && PAYTRAIL_HOSTS.includes(parsed.hostname) && ENTRY_PATH.test(parsed.pathname)
|
|
63
|
+
&& !parsed.port && !parsed.username && !parsed.password && parsed.href === url && !/[?#]/.test(url);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Whether a request on Paytrail's host belongs to the card method (a /click-to-pay/ route of a payment, in any letter
|
|
67
|
+
* case): the entry, the loading page's post to initialize-payment, which opens Payment Highway's card page for the
|
|
68
|
+
* transaction, and any other spelling of either. Another method's form (a bank's) is not.
|
|
69
|
+
*/
|
|
70
|
+
export function isPaytrailCardMethodUrl(url) {
|
|
71
|
+
const parsed = onHosts(url, PAYTRAIL_HOSTS);
|
|
72
|
+
return parsed !== null && /^\/payments\/[^/]+\/click-to-pay(?:\/|$)/i.test(parsed.pathname);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The card page's card lookup: a GET on Payment Highway's host to .../acquirerData, which names the first digits of
|
|
76
|
+
* the card typed so far in its `bin` query. Any other GET there (the card page itself, its scripts and images) is not
|
|
77
|
+
* a card request.
|
|
78
|
+
*/
|
|
79
|
+
export function isPaymentHighwayCardLookup(url, method) {
|
|
80
|
+
if (String(method).toUpperCase() !== 'GET')
|
|
81
|
+
return false;
|
|
82
|
+
const parsed = onHosts(url, PAYMENT_HIGHWAY_HOSTS);
|
|
83
|
+
return parsed !== null && (/\/acquirerData\/?$/i.test(parsed.pathname) || parsed.searchParams.has('bin'));
|
|
84
|
+
}
|
|
85
|
+
/** Whether this build's registry serves Paytrail's entry, asked with an entry on a transaction no payment holds. */
|
|
86
|
+
export function isPaytrailServed(vault) {
|
|
87
|
+
return vault.isCardRequest(ENTRY_PROBE, 'POST');
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Whether an adapter must hand this request to the pre-claim gates: it is on Paytrail's host or Payment Highway's, and
|
|
91
|
+
* this build's registry serves Paytrail's entry. The loading page's post and Payment Highway's card requests are not
|
|
92
|
+
* the entry, so the registry's card-request test does not name them; the CDP adapter still pauses them through the
|
|
93
|
+
* recognizer's host and its abort host, and attachToPlaywright's route predicate asks this, so both adapters show the
|
|
94
|
+
* gates every request to either host once Paytrail is armed.
|
|
95
|
+
*/
|
|
96
|
+
export function isArmedPaytrailUrl(vault, url) {
|
|
97
|
+
return (isPaytrailHost(url) || isPaymentHighwayHost(url)) && isPaytrailServed(vault);
|
|
98
|
+
}
|
package/dist/pre-claim.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { DatatransRepeats } from './datatrans.js';
|
|
|
5
5
|
import { TokenexIframeRepeats } from './tokenex-iframe.js';
|
|
6
6
|
import { type AciGate } from './aci.js';
|
|
7
7
|
import type { EprotectGate } from './eprotect.js';
|
|
8
|
+
import type { SbpsGate } from './sbps.js';
|
|
8
9
|
import { type ShijiStsCompanions } from './shiji-sts.js';
|
|
9
10
|
import type { CheckoutLifecycle } from './lifecycle.js';
|
|
10
11
|
import { type MerchantProfile } from './merchant-hosted.js';
|
|
@@ -16,6 +17,7 @@ import { type VerifoneProfile } from './verifone.js';
|
|
|
16
17
|
import { type WorldlineMyCheckoutProducts } from './worldline-mycheckout.js';
|
|
17
18
|
import { type PaddleVgsPayGate } from './paddle-vgs-pay.js';
|
|
18
19
|
import { type EbanxFollowUps } from './ebanx.js';
|
|
20
|
+
import { type PayrexxFollowUps } from './payrexx.js';
|
|
19
21
|
/** The native Stripe step the gate claimed, or null when none was: exactly what StripeCheckoutGate.claim returns. */
|
|
20
22
|
type StripeStep = ReturnType<StripeCheckoutGate['claim']>;
|
|
21
23
|
/** A synthetic response a gate fulfills locally. The effect applies CORS and encoding. */
|
|
@@ -116,6 +118,20 @@ export interface PreClaimContext {
|
|
|
116
118
|
headers: Record<string, string>;
|
|
117
119
|
body: string;
|
|
118
120
|
}>;
|
|
121
|
+
/** VaultClient.sendPayrexxFollowUp: a 3-D Secure send an approved Payrexx card request covers, from the cardholder's device. */
|
|
122
|
+
sendPayrexxFollowUp?(authorizationId: string, request: {
|
|
123
|
+
url: string;
|
|
124
|
+
method: 'POST';
|
|
125
|
+
headers: Record<string, string>;
|
|
126
|
+
body: string;
|
|
127
|
+
}, options?: {
|
|
128
|
+
signal?: AbortSignal;
|
|
129
|
+
until?: number;
|
|
130
|
+
}): Promise<{
|
|
131
|
+
status: number;
|
|
132
|
+
headers: Record<string, string>;
|
|
133
|
+
body: string;
|
|
134
|
+
}>;
|
|
119
135
|
};
|
|
120
136
|
guards: {
|
|
121
137
|
matches(url: string, method?: string): boolean;
|
|
@@ -133,6 +149,8 @@ export interface PreClaimContext {
|
|
|
133
149
|
replacesNavigationBody?: () => Promise<boolean>;
|
|
134
150
|
/** Worldpay eProtect's hosts; absent or inert until the registry serves eProtect. */
|
|
135
151
|
eprotect?: EprotectGate;
|
|
152
|
+
/** SB Payment Service's token hosts; absent or inert until the registry serves SBPS. */
|
|
153
|
+
sbps?: SbpsGate;
|
|
136
154
|
readDocumentUrl: () => Promise<string>;
|
|
137
155
|
lifecycle: CheckoutLifecycle;
|
|
138
156
|
/**
|
|
@@ -226,6 +244,12 @@ export interface PreClaimContext {
|
|
|
226
244
|
* is refused, as before the approval covered them.
|
|
227
245
|
*/
|
|
228
246
|
ebanx?: EbanxFollowUps;
|
|
247
|
+
/**
|
|
248
|
+
* The attachment's approved Payrexx card request and the 3-D Secure sends claimed under it (payrexx.ts
|
|
249
|
+
* PayrexxFollowUps). Absent, or holding no approval whose answer started 3-D Secure, and every 3-D Secure send of the
|
|
250
|
+
* card frame is refused.
|
|
251
|
+
*/
|
|
252
|
+
payrexx?: PayrexxFollowUps;
|
|
229
253
|
}
|
|
230
254
|
/**
|
|
231
255
|
* The URL an event may name for a request. For an armed merchant profile's
|
|
@@ -257,9 +281,11 @@ export declare function isArmedCreditguardCall(vault: {
|
|
|
257
281
|
export declare const przelewy24PreClaim: PreClaimGate;
|
|
258
282
|
export declare const ekashuPreClaim: PreClaimGate;
|
|
259
283
|
export declare const transbankPreClaim: PreClaimGate;
|
|
284
|
+
export declare const paytrailPreClaim: PreClaimGate;
|
|
260
285
|
export declare const redsysPreClaim: PreClaimGate;
|
|
261
286
|
export declare const quickpayPreClaim: PreClaimGate;
|
|
262
287
|
export declare const comgatePreClaim: PreClaimGate;
|
|
288
|
+
export declare const eximbayPreClaim: PreClaimGate;
|
|
263
289
|
export declare const paypalHostedFieldsPreClaim: PreClaimGate;
|
|
264
290
|
export declare const paypalCardFormsPreClaim: PreClaimGate;
|
|
265
291
|
export declare const cybersourceSecureAcceptancePreClaim: PreClaimGate;
|
|
@@ -277,6 +303,7 @@ export declare function routesHipayVault(vault: {
|
|
|
277
303
|
recognizesProcessor?: (psp: string) => boolean;
|
|
278
304
|
} | null | undefined, url: string): boolean;
|
|
279
305
|
export declare const ebanxPreClaim: PreClaimGate;
|
|
306
|
+
export declare const payrexxPreClaim: PreClaimGate;
|
|
280
307
|
/** The processor gates, in order. A new family adds one entry here; the terminal
|
|
281
308
|
* arbiter runs after all of them and is not part of this list. A gate appended
|
|
282
309
|
* after Stripe is never offered a step Stripe claimed: Stripe answers, aborts or
|