@agent-cards/sdk 0.23.21 → 0.23.22

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.
@@ -0,0 +1,91 @@
1
+ export declare const PAYREXX_PSP: "payrexx";
2
+ /** The capability a build declares to be served Payrexx's recognizer (payment-core PAYREXX_CAPABILITY). */
3
+ export declare const PAYREXX_CAPABILITY: "payrexx_card_frame";
4
+ /** The reason a checkout reads when a 3-D Secure send of the placeholder card fails in the browser. */
5
+ export declare const PAYREXX_RESEND_REASON: "unsupported_payrexx_card_resend";
6
+ /** The 3-D Secure sends one approval covers, in the page's order (payment-core PAYREXX_FOLLOW_UP_KINDS). */
7
+ export type PayrexxFollowUpKind = 'authentication' | 'post_authentication';
8
+ /**
9
+ * Whether a request is a POST to Payrexx's card frame URL whose body sends the card again for a 3-D Secure step
10
+ * (payment-core payrexxBodyVerdict: payrexx_three_ds_resend). `readBody` is called only for a POST to the frame URL,
11
+ * and a reader that throws, or a body nobody could read, reads as no 3-D Secure send.
12
+ */
13
+ export declare function isPayrexxResend(url: string, method: string, readBody: () => string | null): boolean;
14
+ /**
15
+ * A 3-D Secure send the cardholder's device did not answer with Payrexx's own answer. `reason` is the API's word for
16
+ * it: `not_picked_up` (no device started it in time: the Vault page was closed or asleep), `not_sent` (the device
17
+ * refused it before the card left), `no_answer`, `answer_withheld` (Payrexx's answer carried the card),
18
+ * `answer_refused`, `answer_late`, `response_expired`, or the API's refusal code when it did not take the send at all
19
+ * (`follow_up_refused`, `follow_up_not_covered`, `follow_up_window_closed`). `cardSent` says whether the card may
20
+ * have reached Payrexx: false only when the API confirmed it never left the device. Nothing in it names the request,
21
+ * the card or Payrexx's answer.
22
+ */
23
+ export declare class PayrexxFollowUpError extends Error {
24
+ readonly reason: string;
25
+ readonly cardSent: boolean;
26
+ readonly authorizationId: string;
27
+ constructor(reason: string, cardSent: boolean, authorizationId: string);
28
+ }
29
+ /** A send this attachment claimed: the approval it goes under, its kind, the request to send, and how it ended. */
30
+ export interface PayrexxFollowUpClaim {
31
+ readonly authorizationId: string;
32
+ readonly kind: PayrexxFollowUpKind;
33
+ readonly until: number;
34
+ readonly request: {
35
+ url: string;
36
+ method: 'POST';
37
+ headers: Record<string, string>;
38
+ body: string;
39
+ };
40
+ /** Record the answer the page received, or null when the send failed. */
41
+ settle(answer: {
42
+ status: number;
43
+ text: string;
44
+ } | null): void;
45
+ }
46
+ /**
47
+ * What one attachment keeps of its approved Payrexx card request: the request and Payrexx's answer as the page received
48
+ * them, until when the API said the approval covers sends after it, and the sends it claimed since, in order. Only a
49
+ * card request whose answer started 3-D Secure (payment-core payrexxAnswerOutcome: pending three_ds) and whose read
50
+ * named that window (`followUpsUntil`) is kept. Any later Payrexx card request handed over replaces it, a send the
51
+ * window has passed is never claimed, and once a send is refused or fails the attachment stops (stop()): nothing after
52
+ * it is claimed, a later approval included.
53
+ */
54
+ export declare class PayrexxFollowUps {
55
+ private parent;
56
+ private sent;
57
+ private stopped;
58
+ /** After a refused or failed send: no later request on this attachment is claimed. */
59
+ stop(): void;
60
+ /**
61
+ * The approval the remembered card request went under, or null when none is remembered. The gate sends nothing
62
+ * unless the checkout's own state names this same approval.
63
+ */
64
+ get authorizationId(): string | null;
65
+ /**
66
+ * As the adapter hands an approved card request's answer to the page: before the answer lands, since the page may
67
+ * start 3-D Secure at once. Every Payrexx card request handed over clears what an earlier one left; only one whose
68
+ * answer started 3-D Secure, under a read that named the window, is kept.
69
+ */
70
+ remember(request: {
71
+ url: string;
72
+ body: string;
73
+ }, replay: {
74
+ mode?: string;
75
+ authorizationId: string;
76
+ status: number;
77
+ body: string;
78
+ followUpsUntil?: string;
79
+ }): void;
80
+ /**
81
+ * The claim for a paused 3-D Secure send the remembered approval covers, or null: no approval covers sends here, its
82
+ * window has passed, or payment-core's rule refuses the send against the sends already claimed. Synchronous, and it
83
+ * reserves the send, so two requests can never both be claimed as the next one.
84
+ */
85
+ claim(request: {
86
+ url: string;
87
+ method: string;
88
+ headers: Record<string, string>;
89
+ body: string | null;
90
+ }, now?: number): PayrexxFollowUpClaim | null;
91
+ }
@@ -0,0 +1,91 @@
1
+ declare var PAYREXX_PSP: string;
2
+ declare var PAYREXX_CAPABILITY: string;
3
+ declare var PAYREXX_OPERATION: string;
4
+ declare var PAYREXX_FRAME_HOST: string;
5
+ declare var PAYREXX_PAY_PSP_ID: string;
6
+ declare var PAYREXX_BODY_KEYS: readonly string[];
7
+ declare var PAYREXX_REFUSAL_CODES: readonly string[];
8
+ declare function payrexxFrameTarget(url: any): Readonly<{
9
+ pspId: string;
10
+ lang: string;
11
+ }> | null;
12
+ declare function isPayrexxFrameUrl(url: any): boolean;
13
+ declare function payrexxBodyVerdict(body: any): Readonly<{
14
+ verdict: "refuse";
15
+ code: any;
16
+ }> | Readonly<{
17
+ verdict: "continue";
18
+ }> | Readonly<{
19
+ verdict: "card";
20
+ }>;
21
+ declare function payrexxGateVerdict(url: any, body: any): Readonly<{
22
+ verdict: "refuse";
23
+ code: any;
24
+ }> | Readonly<{
25
+ verdict: "continue";
26
+ }> | Readonly<{
27
+ verdict: "card";
28
+ }>;
29
+ declare function payrexxRequestRefusal(request: any): any;
30
+ declare function isPayrexxDeviceRequest(template: any, body: any): boolean;
31
+ declare function payrexxInstance(body: any): any;
32
+ declare var PAYREXX_REVIEWED_INSTANCES: readonly string[];
33
+ declare function payrexxInstanceRefusal(instance: any, instances?: readonly string[]): "payrexx_instance_unreviewed" | null;
34
+ declare function payrexxRequestAmount(body: any): Readonly<{
35
+ amountCents: number;
36
+ currency: any;
37
+ }> | null;
38
+ declare function injectPayrexxCard(body: any, card: any): {
39
+ body: string;
40
+ where: any[];
41
+ };
42
+ declare function payrexxAnswerOutcome(status: any, text: any, card: any): {
43
+ outcome: string;
44
+ code: string;
45
+ reason?: undefined;
46
+ body?: undefined;
47
+ pending?: undefined;
48
+ } | {
49
+ outcome: string;
50
+ reason: string;
51
+ code?: undefined;
52
+ body?: undefined;
53
+ pending?: undefined;
54
+ } | {
55
+ outcome: string;
56
+ body: string;
57
+ code?: undefined;
58
+ reason?: undefined;
59
+ pending?: undefined;
60
+ } | {
61
+ outcome: string;
62
+ body: string;
63
+ pending: string;
64
+ code?: undefined;
65
+ reason?: undefined;
66
+ };
67
+ declare function payrexxRefusalCode(text: any): "payrexx_declined" | "payrexx_three_ds_error" | "payrexx_three_ds_declined" | null;
68
+ declare var PAYREXX_FOLLOW_UP_KINDS: readonly string[];
69
+ declare var PAYREXX_FOLLOW_UP_LIMITS: Readonly<{
70
+ authentication: 1;
71
+ post_authentication: 1;
72
+ }>;
73
+ declare var PAYREXX_FOLLOW_UP_MAX: number;
74
+ declare var PAYREXX_FOLLOW_UP_WINDOW_MS: number;
75
+ declare var PAYREXX_FOLLOW_UP_IDLE_MS: number;
76
+ declare var PAYREXX_FOLLOW_UP_CHALLENGE_MS: number;
77
+ declare var PAYREXX_FOLLOW_UP_BODY_LIMIT: number;
78
+ declare var PAYREXX_FOLLOW_UP_ANSWER_LIMIT: number;
79
+ declare var PAYREXX_FOLLOW_UP_REFUSALS: readonly string[];
80
+ declare function payrexxFollowUpVerdict(input: any): Readonly<{
81
+ ok: false;
82
+ refusal: any;
83
+ }> | Readonly<{
84
+ ok: true;
85
+ kind: string | undefined;
86
+ slot: 1;
87
+ }>;
88
+ declare function payrexxFollowUpIdleMs(kind: any, answerText: any): number;
89
+ declare function payrexxFollowUpAnswerRefusal(answerText: any): "answer_unreadable" | "card_in_answer" | null;
90
+ declare function payrexxRefusalMessage(code: any): any;
91
+ export { PAYREXX_BODY_KEYS, PAYREXX_CAPABILITY, PAYREXX_FOLLOW_UP_ANSWER_LIMIT, PAYREXX_FOLLOW_UP_BODY_LIMIT, PAYREXX_FOLLOW_UP_CHALLENGE_MS, PAYREXX_FOLLOW_UP_IDLE_MS, PAYREXX_FOLLOW_UP_KINDS, PAYREXX_FOLLOW_UP_LIMITS, PAYREXX_FOLLOW_UP_MAX, PAYREXX_FOLLOW_UP_REFUSALS, PAYREXX_FOLLOW_UP_WINDOW_MS, PAYREXX_FRAME_HOST, PAYREXX_OPERATION, PAYREXX_PAY_PSP_ID, PAYREXX_PSP, PAYREXX_REFUSAL_CODES, PAYREXX_REVIEWED_INSTANCES, injectPayrexxCard, isPayrexxDeviceRequest, isPayrexxFrameUrl, payrexxAnswerOutcome, payrexxBodyVerdict, payrexxFollowUpAnswerRefusal, payrexxFollowUpIdleMs, payrexxFollowUpVerdict, payrexxFrameTarget, payrexxGateVerdict, payrexxInstance, payrexxInstanceRefusal, payrexxRefusalCode, payrexxRefusalMessage, payrexxRequestAmount, payrexxRequestRefusal };