@agent-cards/sdk 0.23.12 → 0.23.14

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 (42) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/LICENSE +38 -0
  3. package/PREFLIGHT.md +1 -1
  4. package/README.md +53 -14
  5. package/dist/adyen-merchant-hosted.generated.js +2 -2
  6. package/dist/builtin-registry.generated.js +1 -1
  7. package/dist/card-fields.generated.js +843 -3
  8. package/dist/cdp.js +101 -13
  9. package/dist/client.d.ts +91 -2
  10. package/dist/client.js +205 -13
  11. package/dist/creditguard.generated.d.ts +100 -2
  12. package/dist/creditguard.generated.js +333 -3
  13. package/dist/datatrans.generated.d.ts +19 -4
  14. package/dist/datatrans.generated.js +15 -3
  15. package/dist/ebanx.d.ts +107 -0
  16. package/dist/ebanx.generated.d.ts +78 -0
  17. package/dist/ebanx.generated.js +577 -0
  18. package/dist/ebanx.js +159 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +2 -0
  21. package/dist/lifecycle.d.ts +35 -3
  22. package/dist/lifecycle.js +38 -3
  23. package/dist/paddle-tokenex.d.ts +56 -0
  24. package/dist/paddle-tokenex.generated.d.ts +67 -0
  25. package/dist/paddle-tokenex.generated.js +951 -0
  26. package/dist/paddle-tokenex.js +95 -0
  27. package/dist/paddle-vgs-pay.d.ts +55 -0
  28. package/dist/paddle-vgs-pay.js +115 -0
  29. package/dist/paddle-vgs.generated.d.ts +29 -1
  30. package/dist/paddle-vgs.generated.js +124 -5
  31. package/dist/paysafe.generated.d.ts +5 -7
  32. package/dist/paysafe.generated.js +50 -18
  33. package/dist/pre-claim.d.ts +46 -1
  34. package/dist/pre-claim.js +338 -17
  35. package/dist/preparation.d.ts +13 -0
  36. package/dist/preparation.js +22 -0
  37. package/dist/prepared-processor.js +6 -2
  38. package/dist/primer.generated.js +878 -38
  39. package/dist/redsys.d.ts +42 -0
  40. package/dist/redsys.js +68 -0
  41. package/dist/stripe-checkout.generated.js +479 -11
  42. package/package.json +9 -6
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Redsys's hosted payment page (the TPV Virtual redirect most Spanish banks give their merchants), as
3
+ * this SDK reads it.
4
+ *
5
+ * The merchant's page posts a signed entry form, top-level, to https://sis.redsys.es/sis/realizarPago
6
+ * (or /sis/realizarPago/utf-8), and Redsys answers with its own card page under a session of its own.
7
+ * That entry carries no card, and it is the one request this SDK pauses: the cardholder's device repeats
8
+ * it over the end-to-end TLS relay and fills the card into the page Redsys returns to it (payment-core
9
+ * processors/redsys.js). Everything else the agent's browser posts to Redsys carries a card the agent
10
+ * typed, or leads to a page that asks for one: the card page's own post (/sis/pagoTarjeta;jsessionid=...),
11
+ * the older page's 3-D Secure card lookup (/sis/services/rest/rest3DS/consultaTarjeta3DSPantalla), InSite's
12
+ * card post (/sis/services/rest/NC/generaIdOper). This SDK aborts every one of them, so a placeholder card
13
+ * never reaches Redsys.
14
+ *
15
+ * The entry host is payment-core's REDSYS_HOSTS; redsys.test.mjs pins the two lists together. The
16
+ * abort rule also covers Redsys's test platform, sis-t.redsys.es, on any port: it answers on 25443, which
17
+ * no recognizer takes, so Agentcard pays nothing there, and an entry posted to it opens a page that asks
18
+ * the agent for a card.
19
+ */
20
+ export declare const REDSYS_PSP = "redsys";
21
+ export declare const REDSYS_ENTRY_HOSTS: readonly string[];
22
+ export declare const REDSYS_HOSTS: readonly string[];
23
+ /** Whether this URL is on one of Redsys's hosts (https, no credentials, any port). */
24
+ export declare function isRedsysHost(url: string): boolean;
25
+ /**
26
+ * The only request on Redsys's hosts that is the merchant's entry: a POST to one of the two entry paths on
27
+ * the live host, written exactly as a form action writes it, with no port, query or fragment
28
+ * (payment-core isRedsysEntryUrl). The entry the SDK pauses; every other POST there is aborted.
29
+ */
30
+ export declare function isRedsysEntry(url: string, method: string): boolean;
31
+ /** The entry URL the registry recognizes when this build is armed for Redsys, for any URL on a Redsys host. */
32
+ export declare function redsysEntryUrl(url: string): string | null;
33
+ /**
34
+ * Whether an adapter must hand this request to the pre-claim gates: it is on one of Redsys's hosts and
35
+ * this build's registry serves Redsys's entry. The card page's post and the other card requests are not
36
+ * the entry, so the registry's card-request test does not name them; the CDP adapter still pauses them
37
+ * through the recognizer's host patterns, and attachToPlaywright's route predicate asks this, so both
38
+ * adapters show the gates every request to a Redsys host once Redsys is armed.
39
+ */
40
+ export declare function isArmedRedsysUrl(vault: {
41
+ isCardRequest(url: string, method?: string): boolean;
42
+ }, url: string): boolean;
package/dist/redsys.js ADDED
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Redsys's hosted payment page (the TPV Virtual redirect most Spanish banks give their merchants), as
3
+ * this SDK reads it.
4
+ *
5
+ * The merchant's page posts a signed entry form, top-level, to https://sis.redsys.es/sis/realizarPago
6
+ * (or /sis/realizarPago/utf-8), and Redsys answers with its own card page under a session of its own.
7
+ * That entry carries no card, and it is the one request this SDK pauses: the cardholder's device repeats
8
+ * it over the end-to-end TLS relay and fills the card into the page Redsys returns to it (payment-core
9
+ * processors/redsys.js). Everything else the agent's browser posts to Redsys carries a card the agent
10
+ * typed, or leads to a page that asks for one: the card page's own post (/sis/pagoTarjeta;jsessionid=...),
11
+ * the older page's 3-D Secure card lookup (/sis/services/rest/rest3DS/consultaTarjeta3DSPantalla), InSite's
12
+ * card post (/sis/services/rest/NC/generaIdOper). This SDK aborts every one of them, so a placeholder card
13
+ * never reaches Redsys.
14
+ *
15
+ * The entry host is payment-core's REDSYS_HOSTS; redsys.test.mjs pins the two lists together. The
16
+ * abort rule also covers Redsys's test platform, sis-t.redsys.es, on any port: it answers on 25443, which
17
+ * no recognizer takes, so Agentcard pays nothing there, and an entry posted to it opens a page that asks
18
+ * the agent for a card.
19
+ */
20
+ export const REDSYS_PSP = 'redsys';
21
+ export const REDSYS_ENTRY_HOSTS = Object.freeze(['sis.redsys.es']);
22
+ export const REDSYS_HOSTS = Object.freeze(['sis.redsys.es', 'sis-t.redsys.es']);
23
+ const REDSYS_ENTRY_PATHS = Object.freeze(['/sis/realizarPago', '/sis/realizarPago/utf-8']);
24
+ const REDSYS_ENTRY_URL = 'https://sis.redsys.es/sis/realizarPago';
25
+ /** Whether this URL is on one of Redsys's hosts (https, no credentials, any port). */
26
+ export function isRedsysHost(url) {
27
+ let parsed;
28
+ try {
29
+ parsed = new URL(url);
30
+ }
31
+ catch {
32
+ return false;
33
+ }
34
+ return parsed.protocol === 'https:' && !parsed.username && !parsed.password && REDSYS_HOSTS.includes(parsed.hostname.toLowerCase());
35
+ }
36
+ /**
37
+ * The only request on Redsys's hosts that is the merchant's entry: a POST to one of the two entry paths on
38
+ * the live host, written exactly as a form action writes it, with no port, query or fragment
39
+ * (payment-core isRedsysEntryUrl). The entry the SDK pauses; every other POST there is aborted.
40
+ */
41
+ export function isRedsysEntry(url, method) {
42
+ if (String(method).toUpperCase() !== 'POST' || typeof url !== 'string')
43
+ return false;
44
+ let parsed;
45
+ try {
46
+ parsed = new URL(url);
47
+ }
48
+ catch {
49
+ return false;
50
+ }
51
+ return parsed.protocol === 'https:' && REDSYS_ENTRY_HOSTS.includes(parsed.hostname) && REDSYS_ENTRY_PATHS.includes(parsed.pathname)
52
+ && !parsed.port && !parsed.username && !parsed.password && parsed.href === url && !/[?#]/.test(url);
53
+ }
54
+ /** The entry URL the registry recognizes when this build is armed for Redsys, for any URL on a Redsys host. */
55
+ export function redsysEntryUrl(url) {
56
+ return isRedsysHost(url) ? REDSYS_ENTRY_URL : null;
57
+ }
58
+ /**
59
+ * Whether an adapter must hand this request to the pre-claim gates: it is on one of Redsys's hosts and
60
+ * this build's registry serves Redsys's entry. The card page's post and the other card requests are not
61
+ * the entry, so the registry's card-request test does not name them; the CDP adapter still pauses them
62
+ * through the recognizer's host patterns, and attachToPlaywright's route predicate asks this, so both
63
+ * adapters show the gates every request to a Redsys host once Redsys is armed.
64
+ */
65
+ export function isArmedRedsysUrl(vault, url) {
66
+ const entry = redsysEntryUrl(url);
67
+ return entry !== null && vault.isCardRequest(entry, 'POST');
68
+ }