@agent-cards/sdk 0.23.18 → 0.23.20
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 +30 -0
- package/PREFLIGHT.md +2 -0
- package/README.md +46 -7
- package/dist/aci.d.ts +0 -7
- package/dist/aci.js +0 -19
- package/dist/amadeus.d.ts +4 -2
- package/dist/amadeus.js +16 -3
- package/dist/buy.d.ts +84 -2
- package/dist/buy.js +16 -1
- package/dist/card-endpoint-facts.d.ts +2 -1
- package/dist/card-endpoint-facts.js +18 -9
- package/dist/card-endpoint.d.ts +20 -4
- package/dist/card-endpoint.js +38 -4
- package/dist/card-fields.generated.js +974 -45
- package/dist/cdp.d.ts +29 -0
- package/dist/cdp.js +302 -18
- package/dist/client.d.ts +43 -5
- package/dist/client.js +237 -43
- package/dist/datatrans.d.ts +2 -2
- package/dist/datatrans.generated.js +16 -11
- package/dist/datatrans.js +2 -2
- package/dist/hipay.generated.d.ts +56 -0
- package/dist/hipay.generated.js +389 -0
- package/dist/hold.d.ts +180 -0
- package/dist/hold.js +264 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/lifecycle.d.ts +10 -0
- package/dist/lifecycle.js +21 -0
- package/dist/merchant-card-endpoints.generated.js +102 -11
- package/dist/paddle-vgs.generated.d.ts +3 -2
- package/dist/paddle-vgs.generated.js +9 -5
- package/dist/pelecard.generated.d.ts +2 -1
- package/dist/pelecard.generated.js +14 -5
- package/dist/pre-claim.d.ts +14 -0
- package/dist/pre-claim.js +76 -3
- package/dist/prepared-processor.d.ts +6 -2
- package/dist/prepared-processor.js +18 -2
- package/dist/primer.generated.js +998 -69
- package/dist/quickpay.d.ts +44 -0
- package/dist/quickpay.js +65 -0
- package/dist/stripe-checkout.generated.js +320 -2
- package/dist/twoc2p.d.ts +54 -0
- package/dist/twoc2p.generated.d.ts +33 -0
- package/dist/twoc2p.generated.js +1145 -0
- package/dist/twoc2p.js +85 -0
- package/dist/voice.d.ts +16 -13
- package/dist/voice.js +13 -10
- package/package.json +3 -3
package/dist/card-endpoint.d.ts
CHANGED
|
@@ -49,6 +49,11 @@ export interface CardEndpointProfile {
|
|
|
49
49
|
*/
|
|
50
50
|
readonly facts?: {
|
|
51
51
|
readonly reader: string;
|
|
52
|
+
/**
|
|
53
|
+
* Null when the record's answers come from the endpoint origin; else the origin they come from, another host of
|
|
54
|
+
* the endpoint's site (D-EDGE's payment hub, beside the card frame that posts the card).
|
|
55
|
+
*/
|
|
56
|
+
readonly origin: string | null;
|
|
52
57
|
readonly responses: readonly {
|
|
53
58
|
readonly method: string;
|
|
54
59
|
readonly path: string;
|
|
@@ -101,9 +106,11 @@ export declare const CARD_ENDPOINT_MODE: "card_endpoint";
|
|
|
101
106
|
* (`detail` says what, naming fields, never values).
|
|
102
107
|
* - `facts_unavailable`: the merchant keeps its own record of the order (profile.facts),
|
|
103
108
|
* and this runtime read none for this checkout, or one it cannot place.
|
|
104
|
-
* - `facts_refused`: the merchant's own record says the order renews on a schedule,
|
|
105
|
-
*
|
|
106
|
-
*
|
|
109
|
+
* - `facts_refused`: the merchant's own record says the order renews on a schedule, that
|
|
110
|
+
* the merchant charges the card later (a hotel rate that only guarantees the booking, a
|
|
111
|
+
* charge on a later date, part of the room left for the stay), or that its checkout is
|
|
112
|
+
* in test mode. A total or currency that differs from the agent's is an
|
|
113
|
+
* AmountMismatchError instead.
|
|
107
114
|
*
|
|
108
115
|
* `not_enabled`, `amount_required`, `approval_required` and `preparation_unsupported`
|
|
109
116
|
* answer the same way for every request on the attachment, so the adapters stop asking;
|
|
@@ -138,7 +145,10 @@ export declare function cardEndpointResendFor(url: string, method: string): Card
|
|
|
138
145
|
* CORS preflight to the same URL defers), so routing a URL is never a decision to pause it.
|
|
139
146
|
*/
|
|
140
147
|
export declare function cardEndpointRouted(url: string): boolean;
|
|
141
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* The origins the record of each profile whose merchant keeps one comes from (its facts.origin, else its
|
|
150
|
+
* endpoint): the only responses card-endpoint-facts.ts records.
|
|
151
|
+
*/
|
|
142
152
|
export declare function cardEndpointFactsOrigins(): readonly string[];
|
|
143
153
|
/**
|
|
144
154
|
* The checkout session a request on the endpoint of a profile with facts belongs to: the
|
|
@@ -148,6 +158,12 @@ export declare function cardEndpointFactsOrigins(): readonly string[];
|
|
|
148
158
|
* request. card-endpoint-facts.ts counts what it keeps, and what a checkout lost, by it.
|
|
149
159
|
* When the paths of two profiles on one origin both fit, the shorter session is the one:
|
|
150
160
|
* every request on a card request's session then gets the card request's own.
|
|
161
|
+
*
|
|
162
|
+
* For a profile whose record comes from its own origin (D-EDGE's payment hub beside the card
|
|
163
|
+
* frame), a request on that origin belongs to the session its last path segment names, the
|
|
164
|
+
* session id every hub URL ends in, and the profile's card request to the session its bind
|
|
165
|
+
* value names, both written on that origin ('https://pay.secure-hotel-booking.com/<id>'): the
|
|
166
|
+
* card post and the hub's own calls are one checkout, as payment-core's role rules read them.
|
|
151
167
|
*/
|
|
152
168
|
export declare function cardEndpointFactsSession(url: string): string | null;
|
|
153
169
|
/** Whether this build's copy of the profile takes payments (enabled, nothing pending, a reviewed HAR, not recurring). */
|
package/dist/card-endpoint.js
CHANGED
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
// that sends the typed card again outside the card request is aborted in every status
|
|
47
47
|
// (cardEndpointResendFor). And the merchant's own record of the order, which its page
|
|
48
48
|
// reads from the endpoint origin, is recorded read-only (card-endpoint-facts.ts) and sent
|
|
49
|
-
// with the create, so the agent's amount is held to the merchant's total.
|
|
49
|
+
// with the create, so the agent's amount is held to the merchant's total. D-EDGE's card
|
|
50
|
+
// frame is read the same way from the payment hub around it, whose booking record says
|
|
51
|
+
// what the card pays now and whether the hotel charges it later.
|
|
50
52
|
//
|
|
51
53
|
// The endpoint URL (it carries cart, booking and instance ids), the paused body, the
|
|
52
54
|
// session and the answer are cardholder data even with no real card in them: no
|
|
@@ -121,9 +123,23 @@ const ROUTED_METHODS = [...new Set(PROFILES.flatMap((profile) => [profile.method
|
|
|
121
123
|
export function cardEndpointRouted(url) {
|
|
122
124
|
return ROUTED_METHODS.some((method) => cardEndpointFor(url, method) !== null || cardEndpointResendFor(url, method) !== null);
|
|
123
125
|
}
|
|
124
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* The origins the record of each profile whose merchant keeps one comes from (its facts.origin, else its
|
|
128
|
+
* endpoint): the only responses card-endpoint-facts.ts records.
|
|
129
|
+
*/
|
|
125
130
|
export function cardEndpointFactsOrigins() {
|
|
126
|
-
return [...new Set(PROFILES.filter((profile) => profile.facts).map((profile) => profile.endpoint))];
|
|
131
|
+
return [...new Set(PROFILES.filter((profile) => profile.facts).map((profile) => profile.facts.origin ?? profile.endpoint))];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The `:name` segment of a card path template a URL path gives, when the path has the template's
|
|
135
|
+
* shape (as many segments, every literal one equal); else null.
|
|
136
|
+
*/
|
|
137
|
+
function boundSegment(template, segments, name) {
|
|
138
|
+
const want = template.split('/');
|
|
139
|
+
if (want.length !== segments.length || !want.every((part, i) => (part.startsWith(':') ? segments[i] !== '' : part === segments[i])))
|
|
140
|
+
return null;
|
|
141
|
+
const at = want.indexOf(`:${name}`);
|
|
142
|
+
return at < 1 ? null : segments[at];
|
|
127
143
|
}
|
|
128
144
|
/**
|
|
129
145
|
* The checkout session a request on the endpoint of a profile with facts belongs to: the
|
|
@@ -133,6 +149,12 @@ export function cardEndpointFactsOrigins() {
|
|
|
133
149
|
* request. card-endpoint-facts.ts counts what it keeps, and what a checkout lost, by it.
|
|
134
150
|
* When the paths of two profiles on one origin both fit, the shorter session is the one:
|
|
135
151
|
* every request on a card request's session then gets the card request's own.
|
|
152
|
+
*
|
|
153
|
+
* For a profile whose record comes from its own origin (D-EDGE's payment hub beside the card
|
|
154
|
+
* frame), a request on that origin belongs to the session its last path segment names, the
|
|
155
|
+
* session id every hub URL ends in, and the profile's card request to the session its bind
|
|
156
|
+
* value names, both written on that origin ('https://pay.secure-hotel-booking.com/<id>'): the
|
|
157
|
+
* card post and the hub's own calls are one checkout, as payment-core's role rules read them.
|
|
136
158
|
*/
|
|
137
159
|
export function cardEndpointFactsSession(url) {
|
|
138
160
|
let parsed;
|
|
@@ -143,9 +165,21 @@ export function cardEndpointFactsSession(url) {
|
|
|
143
165
|
return null;
|
|
144
166
|
}
|
|
145
167
|
const segments = parsed.pathname.split('/');
|
|
168
|
+
for (const profile of PROFILES) {
|
|
169
|
+
const origin = profile.facts?.origin;
|
|
170
|
+
if (!origin)
|
|
171
|
+
continue;
|
|
172
|
+
if (parsed.origin === origin) {
|
|
173
|
+
const last = segments[segments.length - 1];
|
|
174
|
+
return last ? `${origin}/${last}` : null;
|
|
175
|
+
}
|
|
176
|
+
const bound = parsed.origin === profile.endpoint ? boundSegment(profile.path, segments, profile.facts.bind) : null;
|
|
177
|
+
if (bound)
|
|
178
|
+
return `${origin}/${bound}`;
|
|
179
|
+
}
|
|
146
180
|
let shortest = null;
|
|
147
181
|
for (const profile of PROFILES) {
|
|
148
|
-
if (!profile.facts || profile.endpoint !== parsed.origin)
|
|
182
|
+
if (!profile.facts || profile.facts.origin || profile.endpoint !== parsed.origin)
|
|
149
183
|
continue;
|
|
150
184
|
const template = profile.path.split('/');
|
|
151
185
|
const at = template.indexOf(`:${profile.facts.bind}`);
|