@agent-cards/sdk 0.23.2 → 0.23.4
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 +16 -0
- package/PREFLIGHT.md +2 -0
- package/README.md +17 -12
- package/dist/adyen-merchant-hosted.generated.js +134 -127
- package/dist/card-endpoint.d.ts +9 -1
- package/dist/card-endpoint.js +15 -2
- package/dist/cdp.js +19 -13
- package/dist/client.js +11 -8
- package/dist/lifecycle.d.ts +5 -3
- package/dist/lifecycle.js +4 -2
- package/dist/merchant-card-endpoints.generated.js +238 -136
- package/dist/merchant-hosted.js +2 -1
- package/dist/merchant-total.js +4 -1
- package/dist/paypal-hosted-fields.d.ts +52 -0
- package/dist/paypal-hosted-fields.js +80 -0
- package/dist/pre-claim.d.ts +1 -0
- package/dist/pre-claim.js +59 -6
- package/dist/preflight-catalog.json +37 -2
- package/dist/preflight-schemas.json +2 -0
- package/dist/preflight.generated.js +26 -4
- package/dist/substitutions.generated.js +134 -127
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +3 -3
package/dist/client.js
CHANGED
|
@@ -1787,9 +1787,10 @@ export class VaultClient {
|
|
|
1787
1787
|
// with that method, so a caller handing in another one would get it
|
|
1788
1788
|
// silently rewritten and the cardholder's device would replay something the
|
|
1789
1789
|
// caller never asked for. A direct caller deserves to be told, not surprised.
|
|
1790
|
-
|
|
1791
|
-
//
|
|
1792
|
-
const
|
|
1790
|
+
// A card endpoint has no recognizer: its card request is its profile's own method (a POST, or
|
|
1791
|
+
// Target Optical's PUT), which admitCardEndpoint already held the request to.
|
|
1792
|
+
const method = (input.request.method ?? cardEndpoint?.method ?? 'POST').toUpperCase();
|
|
1793
|
+
const cardMethod = rec ? recognizerRequestMethod(rec) : cardEndpoint ? cardEndpoint.method : 'POST';
|
|
1793
1794
|
if (method !== cardMethod) {
|
|
1794
1795
|
throw new Error(cardMethod === 'GET'
|
|
1795
1796
|
? `a ${rec?.psp} card registration is a GET; got ${method} for ${redactUrl(input.request.url)}.`
|
|
@@ -1854,7 +1855,7 @@ export class VaultClient {
|
|
|
1854
1855
|
...(input.cardId ? { cardId: input.cardId } : {}),
|
|
1855
1856
|
execution_mode: 'user_approval',
|
|
1856
1857
|
checkout_origin: cardEndpoint.session.page_origin,
|
|
1857
|
-
request: { url: cardEndpoint.session.url, method:
|
|
1858
|
+
request: { url: cardEndpoint.session.url, method: cardEndpoint.method, headers: {}, body: '' },
|
|
1858
1859
|
merchant_card_endpoint: { profile: cardEndpoint.profile, session: cardEndpoint.session, ...(cardEndpoint.facts ? { facts: cardEndpoint.facts } : {}) },
|
|
1859
1860
|
} : {
|
|
1860
1861
|
user: input.user,
|
|
@@ -2707,8 +2708,10 @@ export class VaultClient {
|
|
|
2707
2708
|
/**
|
|
2708
2709
|
* A card endpoint request, checked whole before any network call: a profile in this
|
|
2709
2710
|
* build's table; no other checkout context, Autopilot or preparation (the cardholder
|
|
2710
|
-
* approves every such payment); the agent's amount, the only authority here;
|
|
2711
|
-
* session
|
|
2711
|
+
* approves every such payment); the agent's amount, the only authority here; the
|
|
2712
|
+
* session's own URL with the profile's own method (a request that names none takes
|
|
2713
|
+
* the profile's, a POST or Target Optical's PUT); a session the API and the device
|
|
2714
|
+
* would take (payment-core
|
|
2712
2715
|
* merchantCardEndpointSessionRefusal: the profile's URL, headers, cookies, Referer and
|
|
2713
2716
|
* body, paused on its checkout page); for a merchant that keeps its own record of the
|
|
2714
2717
|
* order, that record, held to the agent's amount and currency, and refused for an order
|
|
@@ -2731,7 +2734,7 @@ function admitCardEndpoint(input) {
|
|
|
2731
2734
|
if (input.amount == null || typeof input.currency !== 'string' || !input.currency)
|
|
2732
2735
|
throw new CardEndpointRefusedError(profile.id, 'amount_required');
|
|
2733
2736
|
const session = named.session;
|
|
2734
|
-
if (!isRecord(session) || (input.request.method ??
|
|
2737
|
+
if (!isRecord(session) || (input.request.method ?? profile.method).toUpperCase() !== profile.method || input.request.url !== session.url) {
|
|
2735
2738
|
throw new CardEndpointRefusedError(profile.id, 'request_unsupported', 'the request is not the session\'s card request');
|
|
2736
2739
|
}
|
|
2737
2740
|
const refusal = cardEndpointSessionRefusal(profile, session);
|
|
@@ -2740,7 +2743,7 @@ function admitCardEndpoint(input) {
|
|
|
2740
2743
|
const facts = admitCardEndpointFacts(profile, session, named.facts, input);
|
|
2741
2744
|
if (!cardEndpointLive(profile))
|
|
2742
2745
|
throw new CardEndpointRefusedError(profile.id, 'not_enabled');
|
|
2743
|
-
return { profile: profile.id, session, ...(facts ? { facts } : {}) };
|
|
2746
|
+
return { profile: profile.id, method: profile.method, session, ...(facts ? { facts } : {}) };
|
|
2744
2747
|
}
|
|
2745
2748
|
/**
|
|
2746
2749
|
* The merchant's own record of the order, for a profile whose merchant keeps one
|
package/dist/lifecycle.d.ts
CHANGED
|
@@ -225,10 +225,12 @@ export declare class CheckoutLifecycle implements CheckoutController {
|
|
|
225
225
|
* unsupported_primer_request), a Payrails request its gate refuses
|
|
226
226
|
* (`unsupported_payrails_card_payment` and the card-save refusal codes), a
|
|
227
227
|
* Shiji STS request its gate refuses (shiji_sts_keep_on_file and the other
|
|
228
|
-
* shiji-sts.ts reasons),
|
|
229
|
-
* the cardholder's device can fill (processor_card_page: NMI's)
|
|
228
|
+
* shiji-sts.ts reasons), a post to a processor's own card page that only
|
|
229
|
+
* the cardholder's device can fill (processor_card_page: NMI's), or a card
|
|
230
|
+
* sent to PayPal's legacy Hosted Fields confirm, which no Vault mode takes
|
|
231
|
+
* over (unsupported_paypal_hosted_fields, paypal-hosted-fields.ts).
|
|
230
232
|
*/
|
|
231
|
-
unsupported(reason?: 'unrecognized_payment_endpoint' | 'merchant_profile_observe' | 'merchant_request_unsupported' | GmoUnsupportedReason | 'microform_unsupported' | 'juspay_request_unsupported' | 'merchant_card_endpoint_not_enabled' | 'merchant_card_endpoint_resend_refused' | 'creditguard_three_d_secure' | 'unsupported_primer_sdk' | 'unsupported_primer_request' | PayrailsUnsupportedReason | ShijiStsUnsupportedReason | 'processor_card_page'): void;
|
|
233
|
+
unsupported(reason?: 'unrecognized_payment_endpoint' | 'merchant_profile_observe' | 'merchant_request_unsupported' | GmoUnsupportedReason | 'microform_unsupported' | 'juspay_request_unsupported' | 'merchant_card_endpoint_not_enabled' | 'merchant_card_endpoint_resend_refused' | 'creditguard_three_d_secure' | 'unsupported_primer_sdk' | 'unsupported_primer_request' | PayrailsUnsupportedReason | ShijiStsUnsupportedReason | 'processor_card_page' | 'unsupported_paypal_hosted_fields'): void;
|
|
232
234
|
/**
|
|
233
235
|
* A card request that only a prepared checkout pays (an Adyen merchant
|
|
234
236
|
* profile's, or a Fiserv card capture) arrived with no preparation on this
|
package/dist/lifecycle.js
CHANGED
|
@@ -201,8 +201,10 @@ export class CheckoutLifecycle {
|
|
|
201
201
|
* unsupported_primer_request), a Payrails request its gate refuses
|
|
202
202
|
* (`unsupported_payrails_card_payment` and the card-save refusal codes), a
|
|
203
203
|
* Shiji STS request its gate refuses (shiji_sts_keep_on_file and the other
|
|
204
|
-
* shiji-sts.ts reasons),
|
|
205
|
-
* the cardholder's device can fill (processor_card_page: NMI's)
|
|
204
|
+
* shiji-sts.ts reasons), a post to a processor's own card page that only
|
|
205
|
+
* the cardholder's device can fill (processor_card_page: NMI's), or a card
|
|
206
|
+
* sent to PayPal's legacy Hosted Fields confirm, which no Vault mode takes
|
|
207
|
+
* over (unsupported_paypal_hosted_fields, paypal-hosted-fields.ts).
|
|
206
208
|
*/
|
|
207
209
|
unsupported(reason = 'unrecognized_payment_endpoint') {
|
|
208
210
|
this.held = true;
|