@agent-cards/sdk 0.20.0 → 0.22.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.
- package/CHANGELOG.md +51 -0
- package/PREFLIGHT.md +34 -0
- package/README.md +1217 -15
- package/dist/aci.d.ts +173 -0
- package/dist/aci.generated.d.ts +87 -0
- package/dist/aci.generated.js +306 -0
- package/dist/aci.js +371 -0
- package/dist/adyen-merchant-hosted.generated.d.ts +3 -3
- package/dist/adyen-merchant-hosted.generated.js +283 -49
- package/dist/agentcard.d.ts +9 -2
- package/dist/agentcard.js +4 -2
- package/dist/amadeus-checkout.generated.d.ts +57 -0
- package/dist/amadeus-checkout.generated.js +549 -0
- package/dist/amadeus.d.ts +41 -0
- package/dist/amadeus.js +81 -0
- package/dist/builtin-registry.generated.js +1 -1
- package/dist/card-endpoint.d.ts +177 -0
- package/dist/card-endpoint.js +286 -0
- package/dist/card-fields.generated.d.ts +5 -3
- package/dist/card-fields.generated.js +284 -7
- package/dist/cdp.d.ts +6 -1
- package/dist/cdp.js +983 -147
- package/dist/client.d.ts +493 -13
- package/dist/client.js +1100 -82
- package/dist/creditguard.generated.d.ts +79 -0
- package/dist/creditguard.generated.js +662 -0
- package/dist/cse-body.js +11 -1
- package/dist/cybersource-flex.d.ts +183 -0
- package/dist/cybersource-flex.generated.d.ts +92 -0
- package/dist/cybersource-flex.generated.js +689 -0
- package/dist/cybersource-flex.js +275 -0
- package/dist/datatrans.d.ts +96 -0
- package/dist/datatrans.generated.d.ts +64 -0
- package/dist/datatrans.generated.js +426 -0
- package/dist/datatrans.js +178 -0
- package/dist/elavon-converge.d.ts +37 -0
- package/dist/elavon-converge.generated.d.ts +49 -0
- package/dist/elavon-converge.generated.js +439 -0
- package/dist/elavon-converge.js +84 -0
- package/dist/eprotect.d.ts +152 -0
- package/dist/eprotect.generated.d.ts +77 -0
- package/dist/eprotect.generated.js +498 -0
- package/dist/eprotect.js +222 -0
- package/dist/gmo.d.ts +63 -0
- package/dist/gmo.generated.d.ts +60 -0
- package/dist/gmo.generated.js +586 -0
- package/dist/gmo.js +119 -0
- package/dist/hosted-form.d.ts +3 -2
- package/dist/hosted-form.js +3 -2
- package/dist/index.d.ts +19 -3
- package/dist/index.js +6 -1
- package/dist/juspay-gate.d.ts +82 -0
- package/dist/juspay-gate.js +126 -0
- package/dist/juspay.generated.d.ts +89 -0
- package/dist/juspay.generated.js +705 -0
- package/dist/lifecycle.d.ts +62 -6
- package/dist/lifecycle.js +123 -8
- package/dist/merchant-card-endpoints.generated.d.ts +63 -0
- package/dist/merchant-card-endpoints.generated.js +1103 -0
- package/dist/merchant-hosted.d.ts +4 -1
- package/dist/merchant-hosted.js +5 -2
- package/dist/merchant-session-probe.d.ts +48 -0
- package/dist/merchant-session-probe.js +53 -0
- package/dist/merchant-session.generated.d.ts +69 -0
- package/dist/merchant-session.generated.js +919 -0
- package/dist/payrails.d.ts +133 -0
- package/dist/payrails.generated.d.ts +73 -0
- package/dist/payrails.generated.js +596 -0
- package/dist/payrails.js +305 -0
- package/dist/pelecard.d.ts +32 -0
- package/dist/pelecard.generated.d.ts +32 -0
- package/dist/pelecard.generated.js +283 -0
- package/dist/pelecard.js +42 -0
- package/dist/pre-claim.d.ts +84 -3
- package/dist/pre-claim.js +987 -9
- package/dist/preflight-catalog.json +2310 -263
- package/dist/preflight-schemas.json +187 -6
- package/dist/preflight.generated.d.ts +1 -1
- package/dist/preflight.generated.js +247 -4
- package/dist/preparation.d.ts +5 -2
- package/dist/preparation.js +36 -10
- package/dist/prepared-processor.d.ts +86 -5
- package/dist/prepared-processor.js +157 -6
- package/dist/primer.d.ts +53 -0
- package/dist/primer.generated.d.ts +38 -0
- package/dist/primer.generated.js +624 -0
- package/dist/primer.js +82 -0
- package/dist/registry.d.ts +114 -12
- package/dist/registry.js +85 -11
- package/dist/shiji-sts.d.ts +144 -0
- package/dist/shiji-sts.generated.d.ts +72 -0
- package/dist/shiji-sts.generated.js +913 -0
- package/dist/shiji-sts.js +222 -0
- package/dist/stripe-checkout.generated.d.ts +1 -1
- package/dist/stripe-checkout.generated.js +735 -10
- package/dist/stripe-setup.d.ts +16 -0
- package/dist/stripe-setup.js +61 -0
- package/dist/substitutions.generated.js +187 -29
- package/dist/verifone.d.ts +68 -0
- package/dist/verifone.generated.d.ts +51 -0
- package/dist/verifone.generated.js +1401 -0
- package/dist/verifone.js +119 -0
- package/dist/voice-types.d.ts +27 -0
- package/dist/voice.d.ts +6 -1
- package/dist/voice.js +6 -1
- package/dist/wspay.d.ts +41 -0
- package/dist/wspay.generated.d.ts +41 -0
- package/dist/wspay.generated.js +370 -0
- package/dist/wspay.js +65 -0
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +3 -3
package/dist/eprotect.js
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// Worldpay eProtect (Vantiv / Litle PayPage): the adapters' side of its card registration.
|
|
2
|
+
//
|
|
3
|
+
// The vendor's browser script (eProtect-api2/3, litle-api2/3, and the Worldpay iframe, which runs
|
|
4
|
+
// them in a Worldpay-origin frame) encrypts the card in the page and sends it as ONE JSONP
|
|
5
|
+
// <script> GET to /eProtect/paypage; the answer is `<callback>({...})`. The rules that judge that
|
|
6
|
+
// request (the query grammar, the pinned keys, the failover and give-up reports, the answer
|
|
7
|
+
// allowlist) live in payment-core and reach this SDK as eprotect.generated.ts. This module holds
|
|
8
|
+
// only what an attachment decides from them:
|
|
9
|
+
// - which request on eProtect's hosts is the registration to pause for the vault;
|
|
10
|
+
// - which is the vendor's failover re-send of a registration the page already sent (aborted
|
|
11
|
+
// quietly: it carries the placeholder's ciphertext and is never a destination);
|
|
12
|
+
// - which is the vendor's own report that it gave up (/eProtect/ppstats 900 or 901), which ends
|
|
13
|
+
// the approval running for that registration;
|
|
14
|
+
// - the script answer the paused registration gets once the cardholder's device registered the
|
|
15
|
+
// real card: the registration Agentcard stored, wrapped in the callback the paused URL named.
|
|
16
|
+
import { EPROTECT_HOSTS, EPROTECT_PATH, EPROTECT_SECONDARY_HOST, eprotectGiveUp, eprotectJsonp, eprotectMerchantPin, eprotectOutcome, eprotectRequestFacts, eprotectSecondaryAttempt, isEprotectRequest, } from './eprotect.generated.js';
|
|
17
|
+
/** The processor id, as the registry and the API name it. */
|
|
18
|
+
export const EPROTECT_PSP = 'worldpay_eprotect';
|
|
19
|
+
/** The dark-launch capability the API serves the eProtect recognizer behind (payment-core definitions.js). */
|
|
20
|
+
export const EPROTECT_CAPABILITY = 'worldpay_eprotect_jsonp';
|
|
21
|
+
/** What Worldpay answers a registration with on both of its card hosts, and what the paused script gets. */
|
|
22
|
+
export const EPROTECT_SCRIPT_CONTENT_TYPE = 'application/x-javascript;charset=UTF-8';
|
|
23
|
+
const EPROTECT_HOSTNAMES = [EPROTECT_HOSTS.production, EPROTECT_HOSTS.sandbox, EPROTECT_SECONDARY_HOST];
|
|
24
|
+
/**
|
|
25
|
+
* Why a Worldpay eProtect checkout may not be prepared under `merchant`, or null when it may. On the
|
|
26
|
+
* production host the API admits only a paypageId payment-core pins for the merchant origin, under
|
|
27
|
+
* that pin's merchant name, the one the approval shows, and refuses another name
|
|
28
|
+
* (merchant_profile_mismatch) before any preparation exists. When this build pins the paypageId
|
|
29
|
+
* too, it refuses another name first, before any network call, as a Fiserv checkout must name its
|
|
30
|
+
* key pin's merchant. A paypageId this build does not pin is the API's to judge (unsupported_checkout
|
|
31
|
+
* with no pin); none is pinned on either side yet. The pre-live host takes only the guide's test
|
|
32
|
+
* cards and needs no pin. `pins` is for tests.
|
|
33
|
+
*/
|
|
34
|
+
export function eprotectCheckoutRefusal(input, pins) {
|
|
35
|
+
if (input.environment !== 'production')
|
|
36
|
+
return null;
|
|
37
|
+
const pin = eprotectMerchantPin(input.paypageId, input.merchantOrigin, pins);
|
|
38
|
+
return pin && pin.merchant !== input.merchant ? 'merchant_profile_mismatch' : null;
|
|
39
|
+
}
|
|
40
|
+
/** Which eProtect request this is, or null for a URL that is not on one of Worldpay eProtect's hosts. */
|
|
41
|
+
export function classifyEprotectRequest(url, method) {
|
|
42
|
+
let parsed;
|
|
43
|
+
try {
|
|
44
|
+
parsed = new URL(url);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
if (parsed.protocol !== 'https:' || parsed.port || parsed.username || parsed.password
|
|
50
|
+
|| !EPROTECT_HOSTNAMES.includes(parsed.hostname))
|
|
51
|
+
return null;
|
|
52
|
+
const get = typeof method === 'string' && method.toUpperCase() === 'GET';
|
|
53
|
+
// Every spelling of the registration path belongs to the registration family: the exact path
|
|
54
|
+
// carries the card, and any neighbour of it is nothing this SDK completes.
|
|
55
|
+
if (parsed.pathname.toLowerCase().startsWith(EPROTECT_PATH.toLowerCase())) {
|
|
56
|
+
const facts = get ? eprotectRequestFacts(url) : null;
|
|
57
|
+
if (facts)
|
|
58
|
+
return { kind: 'registration', paypageId: facts.paypageId, id: facts.id };
|
|
59
|
+
const repeat = get ? eprotectSecondaryAttempt(url) : null;
|
|
60
|
+
if (repeat)
|
|
61
|
+
return { kind: 'failover', paypageId: repeat.paypageId, id: repeat.id };
|
|
62
|
+
return { kind: 'unsupported' };
|
|
63
|
+
}
|
|
64
|
+
const report = get ? eprotectGiveUp(url) : null;
|
|
65
|
+
if (report)
|
|
66
|
+
return { kind: 'give_up', code: report.code, paypageId: report.paypageId, id: report.txnId };
|
|
67
|
+
return { kind: 'sibling' };
|
|
68
|
+
}
|
|
69
|
+
/** The registration GET exactly as payment-core admits it: its URL alone, with no body. */
|
|
70
|
+
export function isEprotectRegistration(request) {
|
|
71
|
+
return (request.method ?? 'POST').toUpperCase() === 'GET'
|
|
72
|
+
&& isEprotectRequest({ url: request.url, method: 'GET', body: request.body ?? '' });
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The answer a paused registration script gets, or null when the stored answer is not one to hand
|
|
76
|
+
* the page: Worldpay's own shape, `<callback>(<registration>)` under its script type, with the
|
|
77
|
+
* callback the paused URL named. The registration must be one payment-core's judge accepts for that
|
|
78
|
+
* exact URL (response 870, the page's own id, only allowlisted fields), byte for byte what the API
|
|
79
|
+
* stored after running the same judge.
|
|
80
|
+
*/
|
|
81
|
+
export function eprotectScriptAnswer(templateUrl, response) {
|
|
82
|
+
const facts = eprotectRequestFacts(templateUrl);
|
|
83
|
+
if (!facts || response.status !== 200 || typeof response.body !== 'string')
|
|
84
|
+
return null;
|
|
85
|
+
let body;
|
|
86
|
+
try {
|
|
87
|
+
body = eprotectJsonp(facts.callback, response.body);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
const verdict = eprotectOutcome(200, body, templateUrl, undefined);
|
|
93
|
+
if (verdict.outcome !== 'registered' || verdict.sanitizedJson !== response.body)
|
|
94
|
+
return null;
|
|
95
|
+
return { status: 200, headers: { 'content-type': EPROTECT_SCRIPT_CONTENT_TYPE }, body };
|
|
96
|
+
}
|
|
97
|
+
const attemptKey = (attempt) => JSON.stringify([attempt.paypageId, attempt.id]);
|
|
98
|
+
/**
|
|
99
|
+
* How long a paused registration's re-send is still recognized as a known repeat. The vendor
|
|
100
|
+
* scripts re-send 5 seconds after an unanswered primary and give up at the merchant's own timeout
|
|
101
|
+
* (10 to 15 seconds at the merchants this SDK covers), so a minute leaves room for a timer a busy
|
|
102
|
+
* page delays. A re-send that comes later still is aborted all the same, as unsupported (pre-claim).
|
|
103
|
+
*/
|
|
104
|
+
export const EPROTECT_REPEAT_WINDOW_MS = 60_000;
|
|
105
|
+
/** At most this many paused registrations are remembered at once; the oldest is forgotten first. */
|
|
106
|
+
export const EPROTECT_REPEAT_LIMIT = 64;
|
|
107
|
+
/**
|
|
108
|
+
* One attachment's eProtect state. A failover re-send or a give-up report names a registration by
|
|
109
|
+
* paypageId and id; each is matched against what this attachment itself paused and answered, never
|
|
110
|
+
* taken on the page's word. Inert (classify returns null) until the registry serves eProtect, which
|
|
111
|
+
* a client reaches only by syncing with the capability for an org the API enabled, so a build, an
|
|
112
|
+
* org or an API that never served it leaves every eProtect request exactly as before.
|
|
113
|
+
*/
|
|
114
|
+
export class EprotectGate {
|
|
115
|
+
vault;
|
|
116
|
+
now;
|
|
117
|
+
/** Paused registrations, oldest first, each with the time its re-send window closes. */
|
|
118
|
+
seen = new Map();
|
|
119
|
+
running = null;
|
|
120
|
+
answered = null;
|
|
121
|
+
constructor(vault, now = Date.now) {
|
|
122
|
+
this.vault = vault;
|
|
123
|
+
this.now = now;
|
|
124
|
+
}
|
|
125
|
+
/** What this request is, when the registry serves eProtect and the URL is on its hosts; null leaves it to the other gates. */
|
|
126
|
+
classify(url, method) {
|
|
127
|
+
if (typeof this.vault?.recognizesProcessor !== 'function' || !this.vault.recognizesProcessor(EPROTECT_PSP))
|
|
128
|
+
return null;
|
|
129
|
+
return classifyEprotectRequest(url, method);
|
|
130
|
+
}
|
|
131
|
+
/** Playwright's route predicate sees only the URL: route the registration family and the give-up reports, never the scripts. */
|
|
132
|
+
matches(url) {
|
|
133
|
+
const request = this.classify(url, 'GET');
|
|
134
|
+
return request !== null && request.kind !== 'sibling';
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The page sent this registration and this attachment paused it: its re-send is then a known
|
|
138
|
+
* repeat for EPROTECT_REPEAT_WINDOW_MS. Seeing it again restarts that window. A long-lived
|
|
139
|
+
* attachment keeps at most EPROTECT_REPEAT_LIMIT of them, so repeated attempts never grow it.
|
|
140
|
+
*/
|
|
141
|
+
saw(attempt) {
|
|
142
|
+
const now = this.now();
|
|
143
|
+
this.forgetBefore(now);
|
|
144
|
+
const key = attemptKey(attempt);
|
|
145
|
+
this.seen.delete(key);
|
|
146
|
+
this.seen.set(key, now + EPROTECT_REPEAT_WINDOW_MS);
|
|
147
|
+
for (const oldest of this.seen.keys()) {
|
|
148
|
+
if (this.seen.size <= EPROTECT_REPEAT_LIMIT)
|
|
149
|
+
break;
|
|
150
|
+
this.seen.delete(oldest);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** Drops every registration whose re-send window closed: the map is in window order. */
|
|
154
|
+
forgetBefore(now) {
|
|
155
|
+
for (const [key, until] of this.seen) {
|
|
156
|
+
if (until > now)
|
|
157
|
+
break;
|
|
158
|
+
this.seen.delete(key);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A re-send of a registration this attachment paused, whether its approval is running, answered,
|
|
163
|
+
* or never started. The vendor script re-sends 5 seconds after an unanswered primary and has no
|
|
164
|
+
* error path, so a primary the adapters refused before any approval (no ready preparation, another
|
|
165
|
+
* paypageId, an approval already outstanding) or answered just as that timer fired is re-sent
|
|
166
|
+
* too. Such a re-send is aborted quietly, like one during the approval, and never replaces that
|
|
167
|
+
* refusal's own state with `unsupported`. A re-send of a registration this attachment never paused
|
|
168
|
+
* means the primary went somewhere it does not cover, and pre-claim aborts that one as unsupported.
|
|
169
|
+
* Both carry the placeholder's ciphertext, and both are aborted. A registration is remembered
|
|
170
|
+
* only for its re-send window (saw).
|
|
171
|
+
*/
|
|
172
|
+
repeats(attempt) {
|
|
173
|
+
this.forgetBefore(this.now());
|
|
174
|
+
return this.seen.has(attemptKey(attempt));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* An approval is running for this paused request, when it is a registration; `stop` ends it as the
|
|
178
|
+
* page abandoning its request. A new attempt also retires the last answered registration: a
|
|
179
|
+
* give-up report for it now belongs to a checkout the lifecycle has moved past, and must not end
|
|
180
|
+
* the attempt that just began (see gaveUp).
|
|
181
|
+
*/
|
|
182
|
+
begin(url, method, stop) {
|
|
183
|
+
const request = classifyEprotectRequest(url, method);
|
|
184
|
+
this.running = request?.kind === 'registration' ? { key: attemptKey(request), stop } : null;
|
|
185
|
+
this.answered = null;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The approval's answer reached this registration; `lost` reports that the page had already given
|
|
189
|
+
* up on it. Kept after the attempt ends, since the vendor's report can land just after the answer,
|
|
190
|
+
* and only until the next attempt begins.
|
|
191
|
+
*/
|
|
192
|
+
delivered(url, lost) {
|
|
193
|
+
const request = classifyEprotectRequest(url, 'GET');
|
|
194
|
+
if (request?.kind === 'registration')
|
|
195
|
+
this.answered = { key: attemptKey(request), lost };
|
|
196
|
+
}
|
|
197
|
+
/** The approval for the paused request ended, answered or not. */
|
|
198
|
+
end() { this.running = null; }
|
|
199
|
+
/**
|
|
200
|
+
* The vendor's give-up report: end the approval still running for that registration (the
|
|
201
|
+
* adapter cancels the authorization, which the API confirms only before the device registered
|
|
202
|
+
* the card, and aborts the paused script instead of answering it), or report that the answer
|
|
203
|
+
* already handed to it came too late. Returns which one, or null when the report names neither,
|
|
204
|
+
* including a registration answered before the current attempt began.
|
|
205
|
+
*/
|
|
206
|
+
gaveUp(attempt) {
|
|
207
|
+
const key = attemptKey(attempt);
|
|
208
|
+
if (this.running?.key === key) {
|
|
209
|
+
const { stop } = this.running;
|
|
210
|
+
this.running = null;
|
|
211
|
+
stop();
|
|
212
|
+
return 'running';
|
|
213
|
+
}
|
|
214
|
+
if (this.answered?.key === key) {
|
|
215
|
+
const { lost } = this.answered;
|
|
216
|
+
this.answered = null;
|
|
217
|
+
lost();
|
|
218
|
+
return 'answered';
|
|
219
|
+
}
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
}
|
package/dist/gmo.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { GMO_PSP, isGmoTokenHost } from './gmo.generated.js';
|
|
2
|
+
export { GMO_PSP, isGmoTokenHost };
|
|
3
|
+
/** The dark-launch capability a build declares when it pauses only what isGmoSharedPkRequest accepts. */
|
|
4
|
+
export declare const GMO_CAPABILITY = "gmo_shared_pk";
|
|
5
|
+
/**
|
|
6
|
+
* Why a GMO request was aborted as an unsupported checkout, reported as the `reason` of the
|
|
7
|
+
* `unsupported_checkout` event and of the attachment's `unsupported` state:
|
|
8
|
+
* unsupported_gmo_request a request to GMO's CreateToken.json that is not mp-token.js's SHARED_PK
|
|
9
|
+
* getToken for one token
|
|
10
|
+
* unsupported_gmo_token_v1 GMO token v1's JSONP GET to /ext/api/getToken
|
|
11
|
+
*/
|
|
12
|
+
export type GmoUnsupportedReason = 'unsupported_gmo_request' | 'unsupported_gmo_token_v1';
|
|
13
|
+
/**
|
|
14
|
+
* Fetch interception patterns for GMO token v1's JSONP GET, armed only for an org the API served GMO
|
|
15
|
+
* to. A CDP pattern matches the URL as written, path case included, while isGmoTokenV1Request
|
|
16
|
+
* accepts any path case, a trailing dot on the host and any port. So each v1 host is armed whole,
|
|
17
|
+
* in those four spellings, and the pre-claim gate classifies every paused request with
|
|
18
|
+
* isGmoTokenV1Request: the v1 GET is aborted, and anything else on the host continues untouched.
|
|
19
|
+
* Chrome writes the host in lower case, and it blocks a subresource URL that carries credentials.
|
|
20
|
+
*/
|
|
21
|
+
export declare const GMO_TOKEN_V1_PATTERNS: readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* Whether the vault's current registry recognizes GMO's card request: true only after
|
|
24
|
+
* syncRegistry() for an org the API serves the dark entry to.
|
|
25
|
+
*/
|
|
26
|
+
export declare function recognizesGmo(vault: {
|
|
27
|
+
isCardRequest?: (url: string, method?: string) => boolean;
|
|
28
|
+
} | null | undefined): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* GMO token v1's card request: a GET (or, with no method, a URL a route matcher is asked about)
|
|
31
|
+
* to /ext/api/getToken on either v1 host, in any case or with a trailing dot, since the servers
|
|
32
|
+
* behind it need not care.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isGmoTokenV1Request(rawUrl: string, method?: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether a POST the registry recognized on a GMO token host is anything but mp-token.js's
|
|
37
|
+
* SHARED_PK getToken for one token: null when the guard accepts it (it pauses for approval), else
|
|
38
|
+
* the reason it is aborted. A guard that throws refuses.
|
|
39
|
+
*/
|
|
40
|
+
export declare function gmoRequestRefusal(request: {
|
|
41
|
+
url: string;
|
|
42
|
+
method: string;
|
|
43
|
+
headers?: Record<string, string>;
|
|
44
|
+
body: string | null;
|
|
45
|
+
}): GmoUnsupportedReason | null;
|
|
46
|
+
/**
|
|
47
|
+
* The shop a GMO token request names (encryptionParameters.apiKey), as part of that request's
|
|
48
|
+
* identity. GMO mints a token for that one shop, so a retry that names another shop is a new
|
|
49
|
+
* question and never takes the first request's approval. Undefined when the URL is not a GMO token
|
|
50
|
+
* host; null when the body names no shop that can be read.
|
|
51
|
+
*/
|
|
52
|
+
export declare function gmoRequestShop(url: string, body: string): string | null | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* The only answer the page may receive for an approved GMO request: status 200, and GMO's body
|
|
55
|
+
* reduced to the five fields mp-token.js reads with exactly one 64-hex token
|
|
56
|
+
* (sanitizeGmoTokenResponse), under a JSON content type. Null for anything else, including
|
|
57
|
+
* several tokens, which one approval never pays for.
|
|
58
|
+
*/
|
|
59
|
+
export declare function gmoTokenAnswer(status: number, body: string): {
|
|
60
|
+
status: 200;
|
|
61
|
+
headers: Record<string, string>;
|
|
62
|
+
body: string;
|
|
63
|
+
} | null;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
declare var GMO_PSP: string;
|
|
2
|
+
declare var GMO_CLIENT_TYPE: string;
|
|
3
|
+
declare var GMO_CONTENT_TYPE: string;
|
|
4
|
+
declare var GMO_TOKEN_PATH: string;
|
|
5
|
+
declare var GMO_TOKEN_HOSTS: Readonly<{
|
|
6
|
+
production: "token.mul-pay.jp";
|
|
7
|
+
sandbox: "stg.token.mul-pay.jp";
|
|
8
|
+
}>;
|
|
9
|
+
declare var GMO_TOKEN_URLS: Readonly<{
|
|
10
|
+
production: `https://token.mul-pay.jp${string}`;
|
|
11
|
+
sandbox: `https://stg.token.mul-pay.jp${string}`;
|
|
12
|
+
}>;
|
|
13
|
+
declare var GMO_SHARED_KEYS: Readonly<{
|
|
14
|
+
"token.mul-pay.jp": Readonly<{
|
|
15
|
+
spki: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzJ6Ps4kEHAoUxWoTQM2YzvCnJrCpYo3kUKV6G8Pbl7NU1eAkF+rGKhGQVOqULbOa7bS+67txfK+p+WhYIVpxoCzkL9rFKKSb1qeW+phosmN3sXYo0IUa658adLvvpPzpwAqqTu+WNiANZrlstuCC2/dRBwGVl9i8W1pxJZbz2j2lPD7G/jxnqWgfDw+d/EXUAKazS/G6Dk+WoZkmTqkIzsJij5QX4xqmXbdyfsj6BXfmBS1RLAsngJ8bxtshRY9uQ6faSCuTaEF5l38Qh9HhXBoFB+MsOKQ4biUwgW/WaFc5KZ75VDFadrJtUn+5XOlY+iXIQhgdp/zewoZda0rGnQIDAQAB";
|
|
16
|
+
sha256: "c12555cbac901b38910f7f5034a97e353767e1ab6d7c8362c13d0b82f618e142";
|
|
17
|
+
}>;
|
|
18
|
+
"stg.token.mul-pay.jp": Readonly<{
|
|
19
|
+
spki: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoRuXDRz86jW+7es/BxzFJAmSxsjt69NvjrRCBsmBZb29luUsayl0Ge0pFDXYasVcv0V53S2AZXsikg+dxl3Ykxv0578LMNrKoMvuSDAOZP44/wIaEhN7375754kdubdvK+fHDdW48Q4t2GLrkzMcWjoYgflSW4ldIA/jvnIAine2fK+3ho2WRbIOLHSSwKmAOPI6CKs5v8yN9fg9MvX8IOi2rmFxu0NnYYv32w5qW5BHVzqD1w1ZKfrQHhhFk1Ngkle66NUoyCpVYCsXCJyLwfeN6M2vOIM/ob/K89XXUuAJzSSOgLBVUlSwOoxH35nr1TaKIu5VXp9irYBfiLmJewIDAQAB";
|
|
20
|
+
sha256: "0b065ee8e674fd50f01f9906c1e2393032dfe739eebc9d7b36ba7628312a63d8";
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
23
|
+
declare var GMO_REFUSAL_REASONS: readonly string[];
|
|
24
|
+
declare var GmoError: {
|
|
25
|
+
new (reason: any, message: any): {
|
|
26
|
+
name: string;
|
|
27
|
+
message: string;
|
|
28
|
+
stack?: string;
|
|
29
|
+
cause?: unknown;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
declare function gmoTokenEnvironment(rawUrl: any): "production" | "sandbox" | null;
|
|
33
|
+
declare function isGmoTokenHost(rawUrl: any): boolean;
|
|
34
|
+
declare function parseGmoSharedPkBody(body: any, environment: any): {
|
|
35
|
+
createCount: any;
|
|
36
|
+
apiKey: any;
|
|
37
|
+
} | {
|
|
38
|
+
apiKey: any;
|
|
39
|
+
createCount?: undefined;
|
|
40
|
+
} | null;
|
|
41
|
+
declare function isGmoSharedPkRequest(request: any): boolean;
|
|
42
|
+
declare function gmoShopId(request: any): any;
|
|
43
|
+
declare function buildGmoSharedPkBody(templateBody: any, card: any, { crypto, host }?: {}): Promise<string>;
|
|
44
|
+
declare function sanitizeGmoTokenResponse(text: any): string | null;
|
|
45
|
+
declare function gmoTokenMatchesCard(sanitized: any, card: any): boolean;
|
|
46
|
+
declare function gmoRefusalCode(text: any): any;
|
|
47
|
+
declare function gmoResponseFacts(status: any, text: any): {
|
|
48
|
+
outcome: string;
|
|
49
|
+
body: string;
|
|
50
|
+
code?: undefined;
|
|
51
|
+
} | {
|
|
52
|
+
outcome: string;
|
|
53
|
+
body?: undefined;
|
|
54
|
+
code?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
outcome: string;
|
|
57
|
+
code: any;
|
|
58
|
+
body?: undefined;
|
|
59
|
+
};
|
|
60
|
+
export { GMO_CLIENT_TYPE, GMO_CONTENT_TYPE, GMO_PSP, GMO_REFUSAL_REASONS, GMO_SHARED_KEYS, GMO_TOKEN_HOSTS, GMO_TOKEN_PATH, GMO_TOKEN_URLS, GmoError, buildGmoSharedPkBody, gmoRefusalCode, gmoResponseFacts, gmoShopId, gmoTokenEnvironment, gmoTokenMatchesCard, isGmoSharedPkRequest, isGmoTokenHost, parseGmoSharedPkBody, sanitizeGmoTokenResponse };
|