@agent-cards/sdk 0.23.27 → 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 (103) hide show
  1. package/CHANGELOG.md +66 -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/juspay-gate.js +2 -2
  37. package/dist/juspay.generated.d.ts +2 -2
  38. package/dist/juspay.generated.js +174 -4
  39. package/dist/lifecycle.d.ts +9 -61
  40. package/dist/lifecycle.js +24 -10
  41. package/dist/merchant-card-endpoints.generated.d.ts +6 -1
  42. package/dist/merchant-card-endpoints.generated.js +344 -19
  43. package/dist/merchant-hosted.d.ts +8 -1
  44. package/dist/nike-order.d.ts +51 -0
  45. package/dist/nike-order.js +81 -0
  46. package/dist/oceanpayment.d.ts +38 -0
  47. package/dist/oceanpayment.js +70 -0
  48. package/dist/paddle-tokenex.generated.js +105 -10
  49. package/dist/payplug.d.ts +41 -0
  50. package/dist/payplug.js +71 -0
  51. package/dist/payrails.generated.js +27 -7
  52. package/dist/payrexx.generated.js +176 -2
  53. package/dist/pre-claim.d.ts +9 -0
  54. package/dist/pre-claim.js +86 -7
  55. package/dist/preflight-capabilities.generated.d.ts +0 -4
  56. package/dist/preflight-capabilities.generated.js +0 -5
  57. package/dist/preflight-catalog.json +46 -5
  58. package/dist/preflight-playwright.d.ts +2 -2
  59. package/dist/preflight-playwright.js +63 -14
  60. package/dist/preflight-schemas.json +4 -0
  61. package/dist/preflight.generated.d.ts +0 -4
  62. package/dist/preflight.generated.js +24 -1
  63. package/dist/prepared-processor.d.ts +18 -5
  64. package/dist/prepared-processor.js +48 -8
  65. package/dist/primer.generated.js +1418 -120
  66. package/dist/processout.generated.d.ts +61 -0
  67. package/dist/processout.generated.js +577 -0
  68. package/dist/requests.js +1 -1
  69. package/dist/shiji-sts.generated.js +105 -10
  70. package/dist/stripe-checkout.generated.js +1405 -234
  71. package/dist/substitutions.generated.js +460 -26
  72. package/dist/tap-payments.generated.js +105 -10
  73. package/dist/twoc2p.generated.js +105 -10
  74. package/dist/url-masks/bluesnap.d.ts +2 -0
  75. package/dist/url-masks/bluesnap.js +15 -0
  76. package/dist/url-masks/oceanpayment.d.ts +2 -0
  77. package/dist/url-masks/oceanpayment.js +13 -0
  78. package/dist/url-masks/payplug.d.ts +2 -0
  79. package/dist/url-masks/payplug.js +13 -0
  80. package/dist/url-masks/vtex_payments.d.ts +2 -0
  81. package/dist/url-masks/vtex_payments.js +12 -0
  82. package/dist/url-masks.generated.d.ts +1 -1
  83. package/dist/url-masks.generated.js +6 -2
  84. package/dist/verifone.generated.js +42 -2
  85. package/dist/vtex-payments.generated.d.ts +127 -0
  86. package/dist/vtex-payments.generated.js +544 -0
  87. package/dist/webhooks.d.ts +2 -2
  88. package/dist/webhooks.js +2 -2
  89. package/dist/wspay.generated.d.ts +1 -1
  90. package/dist/wspay.generated.js +175 -3
  91. package/examples/preflight/kernel-native/inventory.json +1 -1
  92. package/package.json +6 -8
  93. package/dist/languages.d.ts +0 -23
  94. package/dist/languages.js +0 -76
  95. package/dist/voice-pkce.d.ts +0 -49
  96. package/dist/voice-pkce.js +0 -147
  97. package/dist/voice-stream.generated.d.ts +0 -118
  98. package/dist/voice-stream.generated.js +0 -170
  99. package/dist/voice-types.d.ts +0 -735
  100. package/dist/voice.d.ts +0 -373
  101. package/dist/voice.js +0 -815
  102. package/readme.test.mjs +0 -53
  103. /package/dist/{voice-retry.d.ts → api-retry.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  // Generated from @agent-cards/payment-core. Do not edit.
3
- // artifact-sha256: 06fe191e76a7d298c2cb35a4b370760894dc5a48bd8d1c920db8510b73f2e62b
3
+ // artifact-sha256: d5eb385431ea4768b88da6c9cdd3b17894a13c5247d3ef2e16b3beeda90ed617
4
4
  // src/sha256.js
5
5
  var K = /* @__PURE__ */ new Uint32Array([
6
6
  1116352408,
@@ -335,9 +335,64 @@ function isPlainObject(v) {
335
335
  return !!v && typeof v === "object" && !Array.isArray(v);
336
336
  }
337
337
  var MAX_PATH_STEPS = 16;
338
+ var MAX_TEXT_STEPS = 2;
339
+ function isTextStep(step) {
340
+ return isPlainObject(step) && Object.keys(step).length === 1 && step.text === "json";
341
+ }
342
+ function sameStep(a, b) {
343
+ return a === b || isTextStep(a) && isTextStep(b);
344
+ }
345
+ function spellJson(parsed, form) {
346
+ const text = JSON.stringify(parsed);
347
+ if (form !== "php")
348
+ return text;
349
+ return text.replace(/\//g, "\\/").replace(/[\u0080-\uffff]/g, (unit) => `\\u${unit.charCodeAt(0).toString(16).padStart(4, "0")}`);
350
+ }
351
+ function jsonTextForm(value) {
352
+ if (typeof value !== "string" || !/^[[{]/.test(value))
353
+ return void 0;
354
+ let parsed;
355
+ try {
356
+ parsed = JSON.parse(value);
357
+ }
358
+ catch {
359
+ return void 0;
360
+ }
361
+ if (parsed === null || typeof parsed !== "object")
362
+ return void 0;
363
+ for (const form of ["js", "php"]) {
364
+ try {
365
+ if (spellJson(parsed, form) === value)
366
+ return { parsed, form };
367
+ }
368
+ catch {
369
+ return void 0;
370
+ }
371
+ }
372
+ return void 0;
373
+ }
374
+ function jsonText(value) {
375
+ return jsonTextForm(value)?.parsed;
376
+ }
338
377
  function isJsonPath(path) {
339
378
  return Array.isArray(path) && path.length <= MAX_PATH_STEPS && path.every((step) => typeof step === "string" ? step.length > 0 && !FORBIDDEN_KEYS.has(step) : Number.isSafeInteger(step) && step >= 0);
340
379
  }
380
+ function isProfilePath(path) {
381
+ if (!Array.isArray(path) || path.length > MAX_PATH_STEPS)
382
+ return false;
383
+ let texts = 0;
384
+ for (const [i, step] of path.entries()) {
385
+ if (isTextStep(step)) {
386
+ texts += 1;
387
+ if (i === 0 || i === path.length - 1 || isTextStep(path[i - 1]) || texts > MAX_TEXT_STEPS)
388
+ return false;
389
+ }
390
+ else if (!isJsonPath([step])) {
391
+ return false;
392
+ }
393
+ }
394
+ return true;
395
+ }
341
396
  function jsonAt(root, path) {
342
397
  let node = root;
343
398
  for (const step of path) {
@@ -352,6 +407,42 @@ function jsonAt(root, path) {
352
407
  }
353
408
  return { found: true, value: node };
354
409
  }
410
+ function profileAt(root, path) {
411
+ if (!isProfilePath(path))
412
+ return { found: false };
413
+ let node = root;
414
+ for (const step of path) {
415
+ if (isTextStep(step)) {
416
+ const inner = jsonText(node);
417
+ if (inner === void 0)
418
+ return { found: false };
419
+ node = inner;
420
+ continue;
421
+ }
422
+ const at = jsonAt(node, [step]);
423
+ if (!at.found)
424
+ return { found: false };
425
+ node = at.value;
426
+ }
427
+ return { found: true, value: node };
428
+ }
429
+ function editAtProfilePath(root, path, edit) {
430
+ const at = profileAt(root, path);
431
+ if (!at.found || !isPlainObject(at.value))
432
+ return false;
433
+ const k = path.findIndex(isTextStep);
434
+ if (k === -1) {
435
+ edit(at.value);
436
+ return true;
437
+ }
438
+ const holder = jsonAt(root, path.slice(0, k - 1)).value;
439
+ const key = path[k - 1];
440
+ const text = jsonTextForm(holder[key]);
441
+ if (!text || !editAtProfilePath(text.parsed, path.slice(k + 1), edit))
442
+ return false;
443
+ holder[key] = spellJson(text.parsed, text.form);
444
+ return true;
445
+ }
355
446
  function roundTrips(parsed, body) {
356
447
  try {
357
448
  return JSON.stringify(parsed) === body;
@@ -361,17 +452,17 @@ function roundTrips(parsed, body) {
361
452
  }
362
453
  }
363
454
  function sameSteps(a, b) {
364
- return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((step, i) => step === b[i]);
455
+ return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((step, i) => sameStep(step, b[i]));
365
456
  }
366
457
  function pathsOverlap(a, b) {
367
458
  const n = Math.min(a.length, b.length);
368
459
  for (let i = 0; i < n; i += 1)
369
- if (a[i] !== b[i])
460
+ if (!sameStep(a[i], b[i]))
370
461
  return false;
371
462
  return true;
372
463
  }
373
464
  function describePath(path) {
374
- return path.length ? path.map((step) => typeof step === "number" ? `[${step}]` : `.${step}`).join("").replace(/^\./, "") : "(root)";
465
+ return path.length ? path.map((step) => typeof step === "number" ? `[${step}]` : isTextStep(step) ? "<json>" : `.${step}`).join("").replace(/^\./, "") : "(root)";
375
466
  }
376
467
  // src/substitution-primitives.js
377
468
  var SubstitutionError = class extends Error {
@@ -420,7 +511,7 @@ function swapMerchantHostedFields(body, spec, ciphertext = ADYEN_JWE) {
420
511
  const path = Array.isArray(spec.path) ? [...spec.path] : spec.path;
421
512
  const fields = isPlainObject(spec.fields) ? Object.fromEntries(Object.entries(spec.fields)) : null;
422
513
  const remove = Array.isArray(spec.remove) ? [...spec.remove] : spec.remove ?? [];
423
- if (!isJsonPath(path))
514
+ if (!isProfilePath(path))
424
515
  throw new SubstitutionError("refusing substitution path");
425
516
  if (!fields || Object.keys(fields).length === 0)
426
517
  throw new SubstitutionError("substitutions carry no fields");
@@ -454,7 +545,7 @@ function swapMerchantHostedFields(body, spec, ciphertext = ADYEN_JWE) {
454
545
  }
455
546
  if (!isPlainObject(parsed))
456
547
  throw new SubstitutionError("the paused body is not a JSON object");
457
- const holder = jsonAt(parsed, path);
548
+ const holder = profileAt(parsed, path);
458
549
  if (!holder.found || !isPlainObject(holder.value))
459
550
  throw new SubstitutionError(`the paused body has no object at ${describePath(path)}`);
460
551
  const swaps = /* @__PURE__ */ new Map();
@@ -506,15 +597,19 @@ function swapMerchantHostedFields(body, spec, ciphertext = ADYEN_JWE) {
506
597
  catch {
507
598
  throw new SubstitutionError("the substituted body is not JSON");
508
599
  }
509
- const written = jsonAt(out, path);
600
+ const written = profileAt(out, path);
510
601
  if (!written.found || !isPlainObject(written.value) || names.some((name) => written.value[name] !== fields[name]) || dummies.some((dummy) => swapped.includes(dummy))) {
511
602
  throw new SubstitutionError(`the substitution did not land at ${describePath(path)}`);
512
603
  }
513
604
  if (remove.length === 0 && set.length === 0)
514
605
  return swapped;
515
- for (const key of remove)
516
- if (Object.prototype.hasOwnProperty.call(written.value, key))
517
- delete written.value[key];
606
+ if (remove.length > 0 && !editAtProfilePath(out, path, (object) => {
607
+ for (const key of remove)
608
+ if (Object.prototype.hasOwnProperty.call(object, key))
609
+ delete object[key];
610
+ })) {
611
+ throw new SubstitutionError(`the substitution did not land at ${describePath(path)}`);
612
+ }
518
613
  for (const entry of set) {
519
614
  const parent = jsonAt(out, entry.path.slice(0, -1));
520
615
  if (!parent.found || !isPlainObject(parent.value))
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  // Generated from @agent-cards/payment-core. Do not edit.
3
- // artifact-sha256: 3c735198962459f0b06c7fbbdfa58de91ab1f76adeec6fa17b4e1a8d33e4b8c3
3
+ // artifact-sha256: c49f275728b59d60213cd4db98c8c96bb9fe3355a2a4f3688e39ce98205afddd
4
4
  // src/sha256.js
5
5
  var K = /* @__PURE__ */ new Uint32Array([
6
6
  1116352408,
@@ -684,9 +684,64 @@ function isPlainObject(v) {
684
684
  return !!v && typeof v === "object" && !Array.isArray(v);
685
685
  }
686
686
  var MAX_PATH_STEPS = 16;
687
+ var MAX_TEXT_STEPS = 2;
688
+ function isTextStep(step) {
689
+ return isPlainObject(step) && Object.keys(step).length === 1 && step.text === "json";
690
+ }
691
+ function sameStep(a, b) {
692
+ return a === b || isTextStep(a) && isTextStep(b);
693
+ }
694
+ function spellJson(parsed, form) {
695
+ const text2 = JSON.stringify(parsed);
696
+ if (form !== "php")
697
+ return text2;
698
+ return text2.replace(/\//g, "\\/").replace(/[\u0080-\uffff]/g, (unit) => `\\u${unit.charCodeAt(0).toString(16).padStart(4, "0")}`);
699
+ }
700
+ function jsonTextForm(value) {
701
+ if (typeof value !== "string" || !/^[[{]/.test(value))
702
+ return void 0;
703
+ let parsed;
704
+ try {
705
+ parsed = JSON.parse(value);
706
+ }
707
+ catch {
708
+ return void 0;
709
+ }
710
+ if (parsed === null || typeof parsed !== "object")
711
+ return void 0;
712
+ for (const form of ["js", "php"]) {
713
+ try {
714
+ if (spellJson(parsed, form) === value)
715
+ return { parsed, form };
716
+ }
717
+ catch {
718
+ return void 0;
719
+ }
720
+ }
721
+ return void 0;
722
+ }
723
+ function jsonText(value) {
724
+ return jsonTextForm(value)?.parsed;
725
+ }
687
726
  function isJsonPath(path) {
688
727
  return Array.isArray(path) && path.length <= MAX_PATH_STEPS && path.every((step) => typeof step === "string" ? step.length > 0 && !FORBIDDEN_KEYS.has(step) : Number.isSafeInteger(step) && step >= 0);
689
728
  }
729
+ function isProfilePath(path) {
730
+ if (!Array.isArray(path) || path.length > MAX_PATH_STEPS)
731
+ return false;
732
+ let texts = 0;
733
+ for (const [i, step] of path.entries()) {
734
+ if (isTextStep(step)) {
735
+ texts += 1;
736
+ if (i === 0 || i === path.length - 1 || isTextStep(path[i - 1]) || texts > MAX_TEXT_STEPS)
737
+ return false;
738
+ }
739
+ else if (!isJsonPath([step])) {
740
+ return false;
741
+ }
742
+ }
743
+ return true;
744
+ }
690
745
  function jsonAt(root, path) {
691
746
  let node = root;
692
747
  for (const step of path) {
@@ -701,6 +756,42 @@ function jsonAt(root, path) {
701
756
  }
702
757
  return { found: true, value: node };
703
758
  }
759
+ function profileAt(root, path) {
760
+ if (!isProfilePath(path))
761
+ return { found: false };
762
+ let node = root;
763
+ for (const step of path) {
764
+ if (isTextStep(step)) {
765
+ const inner = jsonText(node);
766
+ if (inner === void 0)
767
+ return { found: false };
768
+ node = inner;
769
+ continue;
770
+ }
771
+ const at = jsonAt(node, [step]);
772
+ if (!at.found)
773
+ return { found: false };
774
+ node = at.value;
775
+ }
776
+ return { found: true, value: node };
777
+ }
778
+ function editAtProfilePath(root, path, edit) {
779
+ const at = profileAt(root, path);
780
+ if (!at.found || !isPlainObject(at.value))
781
+ return false;
782
+ const k = path.findIndex(isTextStep);
783
+ if (k === -1) {
784
+ edit(at.value);
785
+ return true;
786
+ }
787
+ const holder = jsonAt(root, path.slice(0, k - 1)).value;
788
+ const key = path[k - 1];
789
+ const text2 = jsonTextForm(holder[key]);
790
+ if (!text2 || !editAtProfilePath(text2.parsed, path.slice(k + 1), edit))
791
+ return false;
792
+ holder[key] = spellJson(text2.parsed, text2.form);
793
+ return true;
794
+ }
704
795
  function roundTrips(parsed, body) {
705
796
  try {
706
797
  return JSON.stringify(parsed) === body;
@@ -710,17 +801,17 @@ function roundTrips(parsed, body) {
710
801
  }
711
802
  }
712
803
  function sameSteps(a, b) {
713
- return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((step, i) => step === b[i]);
804
+ return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((step, i) => sameStep(step, b[i]));
714
805
  }
715
806
  function pathsOverlap(a, b) {
716
807
  const n = Math.min(a.length, b.length);
717
808
  for (let i = 0; i < n; i += 1)
718
- if (a[i] !== b[i])
809
+ if (!sameStep(a[i], b[i]))
719
810
  return false;
720
811
  return true;
721
812
  }
722
813
  function describePath(path) {
723
- return path.length ? path.map((step) => typeof step === "number" ? `[${step}]` : `.${step}`).join("").replace(/^\./, "") : "(root)";
814
+ return path.length ? path.map((step) => typeof step === "number" ? `[${step}]` : isTextStep(step) ? "<json>" : `.${step}`).join("").replace(/^\./, "") : "(root)";
724
815
  }
725
816
  // src/substitution-primitives.js
726
817
  var SubstitutionError = class extends Error {
@@ -769,7 +860,7 @@ function swapMerchantHostedFields(body, spec, ciphertext = ADYEN_JWE) {
769
860
  const path = Array.isArray(spec.path) ? [...spec.path] : spec.path;
770
861
  const fields = isPlainObject(spec.fields) ? Object.fromEntries(Object.entries(spec.fields)) : null;
771
862
  const remove = Array.isArray(spec.remove) ? [...spec.remove] : spec.remove ?? [];
772
- if (!isJsonPath(path))
863
+ if (!isProfilePath(path))
773
864
  throw new SubstitutionError("refusing substitution path");
774
865
  if (!fields || Object.keys(fields).length === 0)
775
866
  throw new SubstitutionError("substitutions carry no fields");
@@ -803,7 +894,7 @@ function swapMerchantHostedFields(body, spec, ciphertext = ADYEN_JWE) {
803
894
  }
804
895
  if (!isPlainObject(parsed))
805
896
  throw new SubstitutionError("the paused body is not a JSON object");
806
- const holder = jsonAt(parsed, path);
897
+ const holder = profileAt(parsed, path);
807
898
  if (!holder.found || !isPlainObject(holder.value))
808
899
  throw new SubstitutionError(`the paused body has no object at ${describePath(path)}`);
809
900
  const swaps = /* @__PURE__ */ new Map();
@@ -855,15 +946,19 @@ function swapMerchantHostedFields(body, spec, ciphertext = ADYEN_JWE) {
855
946
  catch {
856
947
  throw new SubstitutionError("the substituted body is not JSON");
857
948
  }
858
- const written = jsonAt(out, path);
949
+ const written = profileAt(out, path);
859
950
  if (!written.found || !isPlainObject(written.value) || names.some((name) => written.value[name] !== fields[name]) || dummies.some((dummy) => swapped.includes(dummy))) {
860
951
  throw new SubstitutionError(`the substitution did not land at ${describePath(path)}`);
861
952
  }
862
953
  if (remove.length === 0 && set.length === 0)
863
954
  return swapped;
864
- for (const key of remove)
865
- if (Object.prototype.hasOwnProperty.call(written.value, key))
866
- delete written.value[key];
955
+ if (remove.length > 0 && !editAtProfilePath(out, path, (object) => {
956
+ for (const key of remove)
957
+ if (Object.prototype.hasOwnProperty.call(object, key))
958
+ delete object[key];
959
+ })) {
960
+ throw new SubstitutionError(`the substitution did not land at ${describePath(path)}`);
961
+ }
867
962
  for (const entry of set) {
868
963
  const parent = jsonAt(out, entry.path.slice(0, -1));
869
964
  if (!parent.found || !isPlainObject(parent.value))
@@ -0,0 +1,2 @@
1
+ import { type UrlMask } from '../url-mask-parts.js';
2
+ export declare const mask: UrlMask;
@@ -0,0 +1,15 @@
1
+ import { SLASH } from '../url-mask-parts.js';
2
+ /**
3
+ * BlueSnap's payment-fields token is the card requests' only credential: whoever holds it binds a card to the
4
+ * merchant's token for the token's 60 minutes (payment-core processors/bluesnap.js). On BlueSnap's hosts the segment
5
+ * after /payment-fields-tokens/ reads {token}, and so does any run of 64 hex digits with its suffix, in any case:
6
+ * https://ws1.bluesnap.com/services/2/payment-fields-tokens/{token}.
7
+ */
8
+ const HOST = /^(?:ws1|ws2|sandpay)\.bluesnap\.com\.?$/i;
9
+ const TOKEN_PATH = new RegExp(`(${SLASH}payment-fields-tokens${SLASH}+)[^/]*`, 'gi');
10
+ const TOKEN = /[0-9a-f]{64}_[12]?/gi;
11
+ export const mask = {
12
+ host: HOST,
13
+ named: /bluesnap\.com/i,
14
+ mask: (path) => path.replace(TOKEN_PATH, '$1{token}').replace(TOKEN, '{token}'),
15
+ };
@@ -0,0 +1,2 @@
1
+ import type { UrlMask } from '../url-mask-parts.js';
2
+ export declare const mask: UrlMask;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Oceanpayment's hosted payment page posts the card to /gateway/sendPay;jsessionid=<session>, and the session in the path
3
+ * names the payment the page holds (payment-core processors/oceanpayment.js); the page itself and its other calls carry
4
+ * the same session the same way. On Oceanpayment's hosts the session after `;jsessionid=`, with the `;` or the `=`
5
+ * escaped once or more, reads {session}: https://secure.oceanpayment.com/gateway/sendPay;jsessionid={session}.
6
+ */
7
+ const OCEANPAYMENT_HOST = /(?:^|\.)oceanpayment\.com\.?$/i;
8
+ const OCEANPAYMENT_SESSION = /((?:;|%(?:25)*3b)jsessionid(?:=|%(?:25)*3d))[^/?#;]*/gi;
9
+ export const mask = {
10
+ host: OCEANPAYMENT_HOST,
11
+ named: /oceanpayment\.com/i,
12
+ mask: (path) => path.replace(OCEANPAYMENT_SESSION, '$1{session}'),
13
+ };
@@ -0,0 +1,2 @@
1
+ import { type UrlMask } from '../url-mask-parts.js';
2
+ export declare const mask: UrlMask;
@@ -0,0 +1,13 @@
1
+ import { SLASH } from '../url-mask-parts.js';
2
+ /**
3
+ * PayPlug's payment page (payment-core processors/payplug.js): https://secure.payplug.com/pay/<payment id>, or
4
+ * /pay/test/<payment id> for a test payment. The id alone opens that payment's page, with its merchant and its total,
5
+ * and pays it, so on PayPlug's page host the id after /pay/ or /pay/test/ reads {payment}, in either case and behind
6
+ * any slash SLASH reads: https://secure.payplug.com/pay/{payment}.
7
+ */
8
+ const PAYPLUG_PAYMENT = new RegExp(`(${SLASH}pay${SLASH}+(?:test${SLASH}+)?)[A-Za-z0-9]+`, 'gi');
9
+ export const mask = {
10
+ host: /(?:^|\.)secure\.payplug\.com\.?$/i,
11
+ named: /secure\.payplug\.com/i,
12
+ mask: (path) => path.replace(PAYPLUG_PAYMENT, '$1{payment}'),
13
+ };
@@ -0,0 +1,2 @@
1
+ import type { UrlMask } from '../url-mask-parts.js';
2
+ export declare const mask: UrlMask;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * On a VTEX account's vault host (<account>.vtexvault.com, and api.vtexvault.com, Ollie's fallback) the transaction id
3
+ * after /transactions/ is all VTEX asks of a card post to that payment: its payments endpoint takes no authentication
4
+ * (payment-core processors/vtex_payments.js). So a run of 32 hex digits or more there reads {transaction}, in any case.
5
+ * The pattern reads a percent escape as one unit and keeps it, so the hex digits of an escaped slash before the id
6
+ * (%2F, %252F) never start a match and leave the id's last digits showing.
7
+ */
8
+ const HEX_OR_ESCAPE = /%(?:25)*[0-9a-f]{2}|[0-9a-f]{32,}/gi;
9
+ function maskVtexTransaction(path) {
10
+ return path.replace(HEX_OR_ESCAPE, (token) => (token.startsWith('%') ? token : '{transaction}'));
11
+ }
12
+ export const mask = { host: /^[a-z0-9-]{1,63}\.vtexvault\.com\.?$/i, named: /vtexvault\.com/i, mask: maskVtexTransaction };
@@ -1,3 +1,3 @@
1
1
  import type { UrlMask } from './url-mask-parts.js';
2
- /** The masks of the processors registered in src/url-masks/: none yet. */
2
+ /** The masks of the processors registered in src/url-masks/: bluesnap, oceanpayment, payplug, vtex_payments. */
3
3
  export declare const URL_MASKS: readonly UrlMask[];
@@ -1,2 +1,6 @@
1
- /** The masks of the processors registered in src/url-masks/: none yet. */
2
- export const URL_MASKS = [];
1
+ import { mask as mask0 } from './url-masks/bluesnap.js';
2
+ import { mask as mask1 } from './url-masks/oceanpayment.js';
3
+ import { mask as mask2 } from './url-masks/payplug.js';
4
+ import { mask as mask3 } from './url-masks/vtex_payments.js';
5
+ /** The masks of the processors registered in src/url-masks/: bluesnap, oceanpayment, payplug, vtex_payments. */
6
+ export const URL_MASKS = [mask0, mask1, mask2, mask3];
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  // Generated from @agent-cards/payment-core. Do not edit.
3
- // artifact-sha256: db732bdbb517b37ea27d05debafb7659bb456f686edd0c90d78b2fbdb993d68d
3
+ // artifact-sha256: c5965a6e2cafc3d6c3a01bc6bd55e1deb8e64fe64fd9a556f80b73f5189d4cef
4
4
  // src/deep-freeze.js
5
5
  function deepFreeze(value) {
6
6
  if (value && typeof value === "object" && !Object.isFrozen(value)) {
@@ -16,6 +16,41 @@ function isPlainObject(v) {
16
16
  return !!v && typeof v === "object" && !Array.isArray(v);
17
17
  }
18
18
  var MAX_PATH_STEPS = 16;
19
+ function isTextStep(step) {
20
+ return isPlainObject(step) && Object.keys(step).length === 1 && step.text === "json";
21
+ }
22
+ function spellJson(parsed, form) {
23
+ const text = JSON.stringify(parsed);
24
+ if (form !== "php")
25
+ return text;
26
+ return text.replace(/\//g, "\\/").replace(/[\u0080-\uffff]/g, (unit) => `\\u${unit.charCodeAt(0).toString(16).padStart(4, "0")}`);
27
+ }
28
+ function jsonTextForm(value) {
29
+ if (typeof value !== "string" || !/^[[{]/.test(value))
30
+ return void 0;
31
+ let parsed;
32
+ try {
33
+ parsed = JSON.parse(value);
34
+ }
35
+ catch {
36
+ return void 0;
37
+ }
38
+ if (parsed === null || typeof parsed !== "object")
39
+ return void 0;
40
+ for (const form of ["js", "php"]) {
41
+ try {
42
+ if (spellJson(parsed, form) === value)
43
+ return { parsed, form };
44
+ }
45
+ catch {
46
+ return void 0;
47
+ }
48
+ }
49
+ return void 0;
50
+ }
51
+ function jsonText(value) {
52
+ return jsonTextForm(value)?.parsed;
53
+ }
19
54
  function isJsonPath(path) {
20
55
  return Array.isArray(path) && path.length <= MAX_PATH_STEPS && path.every((step) => typeof step === "string" ? step.length > 0 && !FORBIDDEN_KEYS.has(step) : Number.isSafeInteger(step) && step >= 0);
21
56
  }
@@ -49,7 +84,12 @@ function valuesIgnoringCase(root, path) {
49
84
  for (const step of path) {
50
85
  const next = [];
51
86
  for (const node of nodes) {
52
- if (typeof step === "number") {
87
+ if (isTextStep(step)) {
88
+ const inner = jsonText(node);
89
+ if (inner !== void 0)
90
+ next.push(inner);
91
+ }
92
+ else if (typeof step === "number") {
53
93
  if (Array.isArray(node) && Number.isSafeInteger(step) && step >= 0 && step < node.length)
54
94
  next.push(node[step]);
55
95
  }
@@ -0,0 +1,127 @@
1
+ declare var VTEX_PAYMENTS_PSP: string;
2
+ declare var VTEX_PAYMENTS_CAPABILITY: string;
3
+ declare var VTEX_PAYMENTS_OPERATION: string;
4
+ declare var VTEX_PAYMENTS_FALLBACK_HOST: string;
5
+ declare var VTEX_PAYMENTS_PREPARATION_URL: string;
6
+ declare var VTEX_PAYMENTS_REFUSAL_CODES: readonly string[];
7
+ declare var VTEX_PAYMENTS_LINE_KEYS: readonly string[];
8
+ declare var VTEX_PAYMENTS_FIELD_KEYS: readonly string[];
9
+ declare var VTEX_PAYMENTS_ADDRESS_KEYS: readonly string[];
10
+ declare var VTEX_PAYMENTS_NETWORKS: Readonly<{
11
+ 1: "amex";
12
+ 2: "visa";
13
+ 4: "mastercard";
14
+ 5: "discover";
15
+ }>;
16
+ declare var VTEX_PAYMENTS_MERCHANT_PINS: readonly (Readonly<{
17
+ account: "alssports";
18
+ origin: "https://www.als.com";
19
+ merchant: "Al's Sporting Goods";
20
+ currency: "USD";
21
+ }> | Readonly<{
22
+ account: "roadrunnersports";
23
+ origin: "https://www.roadrunnersports.com";
24
+ merchant: "Road Runner Sports";
25
+ currency: "USD";
26
+ }>)[];
27
+ declare function vtexPaymentsCardTarget(url: any): Readonly<{
28
+ account: string | null;
29
+ transactionId: string;
30
+ orderId: string | null;
31
+ fallback: boolean;
32
+ }> | null;
33
+ declare function isVtexPaymentsCardUrl(url: any): boolean;
34
+ declare function vtexPaymentsBodyVerdict(body: any, target: any): Readonly<{
35
+ verdict: "refuse";
36
+ code: any;
37
+ }> | Readonly<{
38
+ verdict: "card";
39
+ }>;
40
+ declare function vtexPaymentsRequestRefusal(request: any): any;
41
+ declare function isPreparedVtexPaymentsRequest(url: any, method: any, body: any, environment: any, headers: any): boolean;
42
+ declare function vtexPaymentsOriginPin(merchantOrigin: any, pins?: readonly (Readonly<{
43
+ account: "alssports";
44
+ origin: "https://www.als.com";
45
+ merchant: "Al's Sporting Goods";
46
+ currency: "USD";
47
+ }> | Readonly<{
48
+ account: "roadrunnersports";
49
+ origin: "https://www.roadrunnersports.com";
50
+ merchant: "Road Runner Sports";
51
+ currency: "USD";
52
+ }>)[]): Readonly<{
53
+ account: "alssports";
54
+ origin: "https://www.als.com";
55
+ merchant: "Al's Sporting Goods";
56
+ currency: "USD";
57
+ }> | Readonly<{
58
+ account: "roadrunnersports";
59
+ origin: "https://www.roadrunnersports.com";
60
+ merchant: "Road Runner Sports";
61
+ currency: "USD";
62
+ }> | null;
63
+ declare function vtexPaymentsAccountPin(account: any, pins?: readonly (Readonly<{
64
+ account: "alssports";
65
+ origin: "https://www.als.com";
66
+ merchant: "Al's Sporting Goods";
67
+ currency: "USD";
68
+ }> | Readonly<{
69
+ account: "roadrunnersports";
70
+ origin: "https://www.roadrunnersports.com";
71
+ merchant: "Road Runner Sports";
72
+ currency: "USD";
73
+ }>)[]): Readonly<{
74
+ account: "alssports";
75
+ origin: "https://www.als.com";
76
+ merchant: "Al's Sporting Goods";
77
+ currency: "USD";
78
+ }> | Readonly<{
79
+ account: "roadrunnersports";
80
+ origin: "https://www.roadrunnersports.com";
81
+ merchant: "Road Runner Sports";
82
+ currency: "USD";
83
+ }> | null;
84
+ declare function vtexPaymentsMerchantRefusal(merchantOrigin: any, request: any, pins?: readonly (Readonly<{
85
+ account: "alssports";
86
+ origin: "https://www.als.com";
87
+ merchant: "Al's Sporting Goods";
88
+ currency: "USD";
89
+ }> | Readonly<{
90
+ account: "roadrunnersports";
91
+ origin: "https://www.roadrunnersports.com";
92
+ merchant: "Road Runner Sports";
93
+ currency: "USD";
94
+ }>)[]): "vtex_payments_merchant_unreviewed" | null;
95
+ declare function vtexPaymentsAmount(body: any): {
96
+ amountCents: any;
97
+ currency: any;
98
+ } | null;
99
+ declare function vtexPaymentsRefusalMessage(code: any): any;
100
+ declare function vtexPaymentsDeviceRefusal(request: any): any;
101
+ declare function injectVtexPaymentsCard(body: any, card: any): {
102
+ body: string;
103
+ where: string[];
104
+ };
105
+ declare function vtexPaymentsRefusalCode(text: any): string | null;
106
+ declare function vtexPaymentsAnswerOutcome(status: any, text: any): {
107
+ outcome: string;
108
+ reason: string;
109
+ code?: undefined;
110
+ body?: undefined;
111
+ pending?: undefined;
112
+ } | {
113
+ outcome: string;
114
+ code: string;
115
+ reason?: undefined;
116
+ body?: undefined;
117
+ pending?: undefined;
118
+ } | {
119
+ outcome: string;
120
+ body: string;
121
+ pending: string;
122
+ reason?: undefined;
123
+ code?: undefined;
124
+ };
125
+ declare var vtex_payments_default: any;
126
+ declare var device: any;
127
+ export { VTEX_PAYMENTS_ADDRESS_KEYS, VTEX_PAYMENTS_CAPABILITY, VTEX_PAYMENTS_FALLBACK_HOST, VTEX_PAYMENTS_FIELD_KEYS, VTEX_PAYMENTS_LINE_KEYS, VTEX_PAYMENTS_MERCHANT_PINS, VTEX_PAYMENTS_NETWORKS, VTEX_PAYMENTS_OPERATION, VTEX_PAYMENTS_PREPARATION_URL, VTEX_PAYMENTS_PSP, VTEX_PAYMENTS_REFUSAL_CODES, vtex_payments_default as default, device, injectVtexPaymentsCard, isPreparedVtexPaymentsRequest, isVtexPaymentsCardUrl, vtexPaymentsAccountPin, vtexPaymentsAmount, vtexPaymentsAnswerOutcome, vtexPaymentsBodyVerdict, vtexPaymentsCardTarget, vtexPaymentsDeviceRefusal, vtexPaymentsMerchantRefusal, vtexPaymentsOriginPin, vtexPaymentsRefusalCode, vtexPaymentsRefusalMessage, vtexPaymentsRequestRefusal };