@agent-cards/sdk 0.23.28 → 0.24.0

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.
Files changed (97) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/PREFLIGHT.md +7 -1
  3. package/README.md +137 -99
  4. package/dist/aci.d.ts +52 -22
  5. package/dist/aci.js +79 -15
  6. package/dist/adyen-merchant-hosted.generated.d.ts +1 -1
  7. package/dist/adyen-merchant-hosted.generated.js +459 -21
  8. package/dist/agent-amount.generated.js +1 -1
  9. package/dist/agentcard.d.ts +4 -5
  10. package/dist/agentcard.js +4 -5
  11. package/dist/amadeus.d.ts +9 -3
  12. package/dist/amadeus.js +33 -4
  13. package/dist/api-module.d.ts +1 -7
  14. package/dist/api-module.js +3 -5
  15. package/dist/{voice-retry.js → api-retry.js} +1 -1
  16. package/dist/api-types.d.ts +53 -0
  17. package/dist/{voice-types.js → api-types.js} +7 -2
  18. package/dist/approvals.d.ts +166 -0
  19. package/dist/approvals.js +213 -0
  20. package/dist/buy.d.ts +20 -101
  21. package/dist/buy.js +19 -74
  22. package/dist/capabilities.generated.js +1 -1
  23. package/dist/card-fields.generated.js +1398 -106
  24. package/dist/cdp.d.ts +3 -13
  25. package/dist/cdp.js +231 -175
  26. package/dist/client.d.ts +104 -22
  27. package/dist/client.js +215 -40
  28. package/dist/creditguard.generated.d.ts +4 -4
  29. package/dist/datatrans.generated.js +22 -1
  30. package/dist/elavon-converge.generated.js +5 -3
  31. package/dist/hold.d.ts +8 -0
  32. package/dist/hold.js +43 -2
  33. package/dist/hosted-entry.js +2 -0
  34. package/dist/index.d.ts +9 -15
  35. package/dist/index.js +6 -10
  36. package/dist/lifecycle.d.ts +9 -61
  37. package/dist/lifecycle.js +24 -10
  38. package/dist/merchant-card-endpoints.generated.d.ts +6 -1
  39. package/dist/merchant-card-endpoints.generated.js +344 -19
  40. package/dist/merchant-hosted.d.ts +8 -1
  41. package/dist/nike-order.d.ts +51 -0
  42. package/dist/nike-order.js +81 -0
  43. package/dist/oceanpayment.d.ts +38 -0
  44. package/dist/oceanpayment.js +70 -0
  45. package/dist/paddle-tokenex.generated.js +105 -10
  46. package/dist/payplug.d.ts +41 -0
  47. package/dist/payplug.js +71 -0
  48. package/dist/payrails.generated.js +27 -7
  49. package/dist/pre-claim.d.ts +9 -0
  50. package/dist/pre-claim.js +86 -7
  51. package/dist/preflight-capabilities.generated.d.ts +0 -4
  52. package/dist/preflight-capabilities.generated.js +0 -5
  53. package/dist/preflight-catalog.json +46 -5
  54. package/dist/preflight-playwright.d.ts +2 -2
  55. package/dist/preflight-playwright.js +63 -14
  56. package/dist/preflight-schemas.json +4 -0
  57. package/dist/preflight.generated.d.ts +0 -4
  58. package/dist/preflight.generated.js +24 -1
  59. package/dist/prepared-processor.d.ts +18 -5
  60. package/dist/prepared-processor.js +48 -8
  61. package/dist/primer.generated.js +1418 -120
  62. package/dist/processout.generated.d.ts +61 -0
  63. package/dist/processout.generated.js +577 -0
  64. package/dist/requests.js +1 -1
  65. package/dist/shiji-sts.generated.js +105 -10
  66. package/dist/stripe-checkout.generated.js +1405 -234
  67. package/dist/substitutions.generated.js +460 -26
  68. package/dist/tap-payments.generated.js +105 -10
  69. package/dist/twoc2p.generated.js +105 -10
  70. package/dist/url-masks/bluesnap.d.ts +2 -0
  71. package/dist/url-masks/bluesnap.js +15 -0
  72. package/dist/url-masks/oceanpayment.d.ts +2 -0
  73. package/dist/url-masks/oceanpayment.js +13 -0
  74. package/dist/url-masks/payplug.d.ts +2 -0
  75. package/dist/url-masks/payplug.js +13 -0
  76. package/dist/url-masks/vtex_payments.d.ts +2 -0
  77. package/dist/url-masks/vtex_payments.js +12 -0
  78. package/dist/url-masks.generated.d.ts +1 -1
  79. package/dist/url-masks.generated.js +6 -2
  80. package/dist/verifone.generated.js +42 -2
  81. package/dist/vtex-payments.generated.d.ts +127 -0
  82. package/dist/vtex-payments.generated.js +544 -0
  83. package/dist/webhooks.d.ts +2 -2
  84. package/dist/webhooks.js +2 -2
  85. package/examples/preflight/kernel-native/inventory.json +1 -1
  86. package/package.json +6 -8
  87. package/dist/languages.d.ts +0 -23
  88. package/dist/languages.js +0 -76
  89. package/dist/voice-pkce.d.ts +0 -49
  90. package/dist/voice-pkce.js +0 -147
  91. package/dist/voice-stream.generated.d.ts +0 -118
  92. package/dist/voice-stream.generated.js +0 -170
  93. package/dist/voice-types.d.ts +0 -735
  94. package/dist/voice.d.ts +0 -373
  95. package/dist/voice.js +0 -815
  96. package/readme.test.mjs +0 -53
  97. /package/dist/{voice-retry.d.ts → api-retry.d.ts} +0 -0
@@ -18,6 +18,8 @@ import { WIX_PAYMENTS_TOKENIZE_URL, isPreparedWixPaymentsRequest } from './wix-p
18
18
  import { paygentEnvironment, paygentPreparationUrl, paygentRequestRefusal } from './paygent.generated.js';
19
19
  import { HIPAY_TOKEN_URLS, hipayRequestRefusal, hipayTokenEnvironment, isPreparedHipayRequest } from './hipay.generated.js';
20
20
  import { OPENPAY_PREPARATION_URLS, isPreparedOpenpayRequest, openpayRequestRefusal, openpayTokenEnvironment } from './openpay.generated.js';
21
+ import { VTEX_PAYMENTS_PREPARATION_URL, isPreparedVtexPaymentsRequest, vtexPaymentsCardTarget, vtexPaymentsRequestRefusal } from './vtex-payments.generated.js';
22
+ import { PROCESSOUT_PREPARATION_URLS, isPreparedProcessoutRequest, processoutEnvironment, processoutRequestRefusal } from './processout.generated.js';
21
23
  export function preparationMode(psp) {
22
24
  return psp === 'adyen' || psp === 'fiserv' || psp === 'verifone' ? 'cse' : 'token';
23
25
  }
@@ -54,16 +56,17 @@ export function preparedApprovalAnswersRetry(psp) {
54
56
  * live, testsecureacceptance is test. So are Paddle VGS's two card URLs: vault is live,
55
57
  * sandbox-vault is test. So are Paygent's two token hosts: token is live, sandbox is test. So are
56
58
  * HiPay's two vault hosts: secure2-vault is live, stage-secure2-vault is test. So are Openpay's API
57
- * hosts: api.openpay.<mx|co|pe> is live, sandbox-api.openpay.<mx|co|pe> is test.
59
+ * hosts: api.openpay.<mx|co|pe> is live, sandbox-api.openpay.<mx|co|pe> is test. ProcessOut's share
60
+ * one host, and the card URL's project id attests them: proj_ is live, test-proj_ is test.
58
61
  */
59
62
  export function validPreparationEnvironment(psp, environment) {
60
63
  if (psp === 'bambora' || psp === 'mercado_pago' || psp === 'recurly' || psp === 'spreedly')
61
64
  return environment === 'shared';
62
- // Wix Payments has production alone: its tokenizer has no test host.
63
- if (psp === 'wix_payments')
65
+ // Wix Payments has production alone: its tokenizer has no test host. VTEX Payments too: every store's vault is live.
66
+ if (psp === 'wix_payments' || psp === 'vtex_payments')
64
67
  return environment === 'production';
65
68
  return ['square', 'braintree', 'worldpay', 'adyen', 'checkout_com', 'paysafe', 'fiserv', 'cybersource_flex', 'aci', 'creditguard', 'worldpay_eprotect', 'amadeus_checkout', 'verifone',
66
- 'cybersource_secure_acceptance', 'paddle_vgs', 'paygent', 'hipay', 'openpay_bbva'].includes(psp) && ['production', 'sandbox'].includes(environment);
69
+ 'cybersource_secure_acceptance', 'paddle_vgs', 'paygent', 'hipay', 'openpay_bbva', 'processout'].includes(psp) && ['production', 'sandbox'].includes(environment);
67
70
  }
68
71
  /**
69
72
  * ACI's prepared endpoint, the literal the API names (backend checkout-prepared-processor.ts): its
@@ -77,12 +80,12 @@ export function aciPreparationUrl(environment) {
77
80
  /**
78
81
  * A processor whose card request names an id the merchant mints only at Pay time (ACI's checkout
79
82
  * id), or the merchant's own id (Openpay's token URL carries the merchant id in its path and the
80
- * country in its host), so no URL can be prepared in advance: whether the adapters can intercept it
81
- * is asked of the registry (VaultClient.recognizesProcessor), not of the prepared endpoint, which
82
- * only names the preparation.
83
+ * country in its host, ProcessOut's card URL the project id in its query), so no URL can be prepared
84
+ * in advance: whether the adapters can intercept it is asked of the registry
85
+ * (VaultClient.recognizesProcessor), not of the prepared endpoint, which only names the preparation.
83
86
  */
84
87
  export function preparationBindsByShape(psp) {
85
- return psp === 'aci' || psp === 'openpay_bbva';
88
+ return psp === 'aci' || psp === 'openpay_bbva' || psp === 'vtex_payments' || psp === 'processout';
86
89
  }
87
90
  /**
88
91
  * The endpoint a CreditGuard preparation stands for, per environment, as the API advertises it: the
@@ -124,6 +127,15 @@ export function preparationEndpoint(psp, environment) {
124
127
  // and the claim binds the real token URL by environment and shape (matchesPreparedRequest), as ACI's.
125
128
  if (psp === 'openpay_bbva')
126
129
  return OPENPAY_PREPARATION_URLS[environment];
130
+ // VTEX Payments: the literal that only names the preparation. Its "prepared" is no transaction id, so no card request
131
+ // is ever sent to it, and the claim binds the store's own card post by its shape (matchesPreparedRequest).
132
+ if (psp === 'vtex_payments')
133
+ return VTEX_PAYMENTS_PREPARATION_URL;
134
+ // ProcessOut: the literal the API names (backend checkout-prepared-processor.ts). It only names the preparation and its
135
+ // environment: its "prepared" is shorter than any project id, so no card request is ever sent to it, and the claim binds
136
+ // the real card URL by its project's environment and its shape (matchesPreparedRequest), as Openpay's.
137
+ if (psp === 'processout')
138
+ return PROCESSOUT_PREPARATION_URLS[environment];
127
139
  // A Verifone endpoint is its reviewed profile's leg, never one per environment (verifone.ts).
128
140
  if (psp === 'verifone')
129
141
  throw new Error('unsupported_preparation_processor');
@@ -304,6 +316,19 @@ export function matchesPreparedRequest(psp, environment, requestUrl, method, bod
304
316
  // merchant a later release reviews needs no new build of this library.
305
317
  if (psp === 'openpay_bbva')
306
318
  return isPreparedOpenpayRequest(requestUrl, method, body ?? null, environment, headers ?? {});
319
+ // VTEX Payments: a post to a store's own vault and payment-core's whole request rule (Ollie's JSON content type and
320
+ // one credit card line for the URL's transaction), the rule the API and the Vault bind with too. Ollie's resend to
321
+ // api.vtexvault.com never binds. Which store a request may reach is the API's to judge at the bind and the Vault's
322
+ // before it writes the card, against the reviewed pins each holds, so a store a later release reviews needs no new SDK.
323
+ if (psp === 'vtex_payments')
324
+ return isPreparedVtexPaymentsRequest(requestUrl, method, body ?? null, environment, headers ?? {});
325
+ // ProcessOut: a card URL whose project names the environment and payment-core's whole request rule (the JSON content
326
+ // type, the API version, the URL's own project credential and tokenizeCard's body), the rule the API and the Vault bind
327
+ // with too. Which project a live request may name is the API's to judge at the bind and the Vault's before it writes
328
+ // the card, against the reviewed pin each of them holds for the approved checkout origin, so a store a later release
329
+ // reviews needs no new build of this library.
330
+ if (psp === 'processout')
331
+ return isPreparedProcessoutRequest(requestUrl, method, body ?? null, environment, headers ?? {});
307
332
  if (psp === 'creditguard')
308
333
  return matchesPreparedCreditguard(environment, requestUrl, body, headers, binding);
309
334
  // A Verifone request is judged only through the profile its preparation names (matchesPreparation).
@@ -479,6 +504,21 @@ export function preparedRequestRefusal(psp, environment, requestUrl, body, heade
479
504
  return 'checkout_changed';
480
505
  return openpayRequestRefusal({ url: requestUrl, method: 'POST', headers, body: body ?? null }) ?? 'checkout_changed';
481
506
  }
507
+ // A VTEX post on a vault host names what payment-core's request rule refused (vtex_payments_fallback_refused for
508
+ // Ollie's resend to api.vtexvault.com, vtex_payments_installments, ...); any other request is `checkout_changed`.
509
+ if (psp === 'vtex_payments') {
510
+ if (environment !== 'production' || vtexPaymentsCardTarget(requestUrl) === null)
511
+ return 'checkout_changed';
512
+ return vtexPaymentsRequestRefusal({ url: requestUrl, method: 'POST', headers, body: body ?? null }) ?? 'checkout_changed';
513
+ }
514
+ // A ProcessOut card request whose project names the prepared environment names what payment-core's request rule
515
+ // refused (processout_headers_refused, processout_body_unsupported); the other environment's project, another query
516
+ // or path, or any other request is `checkout_changed`.
517
+ if (psp === 'processout') {
518
+ if (processoutEnvironment(requestUrl) !== environment)
519
+ return 'checkout_changed';
520
+ return processoutRequestRefusal({ url: requestUrl, method: 'POST', headers, body: body ?? null }) ?? 'checkout_changed';
521
+ }
482
522
  if (psp !== 'amadeus_checkout' || amadeusEnvironment(requestUrl) !== environment)
483
523
  return 'checkout_changed';
484
524
  const merchantHost = merchantHostOf(merchantOrigin);