@delopay/sdk 0.87.0 → 0.91.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/dist/{chunk-DQ36QCU7.js → chunk-BWTQ34HP.js} +115 -1
- package/dist/{chunk-DQ36QCU7.js.map → chunk-BWTQ34HP.js.map} +1 -1
- package/dist/index.cjs +114 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +143 -3
- package/dist/index.d.ts +143 -3
- package/dist/index.js +1 -1
- package/dist/internal.cjs +114 -0
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
|
@@ -5264,6 +5264,14 @@ function withoutCredentialHeaders(extra) {
|
|
|
5264
5264
|
}
|
|
5265
5265
|
return out;
|
|
5266
5266
|
}
|
|
5267
|
+
function withoutHeader(headers, name) {
|
|
5268
|
+
const out = {};
|
|
5269
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
5270
|
+
if (key.toLowerCase() === name) continue;
|
|
5271
|
+
out[key] = value;
|
|
5272
|
+
}
|
|
5273
|
+
return out;
|
|
5274
|
+
}
|
|
5267
5275
|
var CheckoutSession = class {
|
|
5268
5276
|
constructor(options) {
|
|
5269
5277
|
this.merchantId = options.merchantId;
|
|
@@ -5310,6 +5318,112 @@ var CheckoutSession = class {
|
|
|
5310
5318
|
}
|
|
5311
5319
|
return this.clientSecret;
|
|
5312
5320
|
}
|
|
5321
|
+
/**
|
|
5322
|
+
* The hosted checkout's bootstrap payload for a one-time payment —
|
|
5323
|
+
* `CheckoutDetails` while payable, a status view once settled.
|
|
5324
|
+
*
|
|
5325
|
+
* Deliberately unauthenticated: a `pay_` link bootstraps before any
|
|
5326
|
+
* credential exists, so no credential header is ever attached (caller
|
|
5327
|
+
* extras are still stripped of credentials). The response is a large
|
|
5328
|
+
* discriminated union owned by the consuming checkout, which keeps its
|
|
5329
|
+
* own types and runtime gates — hence the loose return type.
|
|
5330
|
+
*
|
|
5331
|
+
* `theme` is the route's one declared query parameter (a named checkout
|
|
5332
|
+
* variant, backend#793). `locale` travels as `Accept-Language` — the only
|
|
5333
|
+
* channel the backend's locale resolution reads; a `?locale=` query is
|
|
5334
|
+
* silently ignored by this route.
|
|
5335
|
+
*
|
|
5336
|
+
* `GET /payment-link/data/{merchantId}/{paymentId}`
|
|
5337
|
+
*/
|
|
5338
|
+
async fetchCheckoutData(params, options) {
|
|
5339
|
+
return this.client.request(
|
|
5340
|
+
"GET",
|
|
5341
|
+
`/payment-link/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
5342
|
+
{
|
|
5343
|
+
query: { theme: params?.theme },
|
|
5344
|
+
...options,
|
|
5345
|
+
headers: {
|
|
5346
|
+
...params?.locale ? {
|
|
5347
|
+
...withoutHeader(withoutCredentialHeaders(options?.headers), "accept-language"),
|
|
5348
|
+
"Accept-Language": params.locale
|
|
5349
|
+
} : withoutCredentialHeaders(options?.headers)
|
|
5350
|
+
}
|
|
5351
|
+
}
|
|
5352
|
+
);
|
|
5353
|
+
}
|
|
5354
|
+
/**
|
|
5355
|
+
* The subscription twin of {@link CheckoutSession.fetchCheckoutData}: the
|
|
5356
|
+
* bootstrap payload for a `sub_` checkout. Authenticated with the
|
|
5357
|
+
* subscription's client secret (construct the session with the `sub_…` id
|
|
5358
|
+
* in the `paymentId` slot). `locale` travels as `Accept-Language`, same
|
|
5359
|
+
* as {@link CheckoutSession.fetchCheckoutData}.
|
|
5360
|
+
*
|
|
5361
|
+
* `GET /subscriptions/data/{merchantId}/{subscriptionId}`
|
|
5362
|
+
*/
|
|
5363
|
+
async fetchSubscriptionData(params, options) {
|
|
5364
|
+
return this.client.request(
|
|
5365
|
+
"GET",
|
|
5366
|
+
`/subscriptions/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
5367
|
+
{
|
|
5368
|
+
...options,
|
|
5369
|
+
headers: {
|
|
5370
|
+
...params?.locale ? {
|
|
5371
|
+
...withoutHeader(this.bearerHeaders(options?.headers), "accept-language"),
|
|
5372
|
+
"Accept-Language": params.locale
|
|
5373
|
+
} : this.bearerHeaders(options?.headers)
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
);
|
|
5377
|
+
}
|
|
5378
|
+
/**
|
|
5379
|
+
* Report buyer/device signals for rails that never reach
|
|
5380
|
+
* `/payments/{id}/confirm` (the Stripe SAQ-A rail: raw cards, Apple Pay,
|
|
5381
|
+
* Google Pay). Same telemetry contract as
|
|
5382
|
+
* {@link CheckoutSession.recordEvent}: sent with `keepalive: true`, and
|
|
5383
|
+
* failures resolve instead of rejecting — signals must never block or
|
|
5384
|
+
* break a checkout. Unauthenticated by design.
|
|
5385
|
+
*
|
|
5386
|
+
* `POST /payment-link/client-signals/{merchantId}/{paymentId}`
|
|
5387
|
+
*/
|
|
5388
|
+
async reportClientSignals(params, options) {
|
|
5389
|
+
try {
|
|
5390
|
+
await this.client.request(
|
|
5391
|
+
"POST",
|
|
5392
|
+
`/payment-link/client-signals/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
5393
|
+
{
|
|
5394
|
+
body: params,
|
|
5395
|
+
keepalive: true,
|
|
5396
|
+
...options,
|
|
5397
|
+
headers: withoutCredentialHeaders(options?.headers)
|
|
5398
|
+
}
|
|
5399
|
+
);
|
|
5400
|
+
} catch {
|
|
5401
|
+
}
|
|
5402
|
+
}
|
|
5403
|
+
/**
|
|
5404
|
+
* Confirm a subscription (PayPal approval rail). The client secret is
|
|
5405
|
+
* attached automatically; the shop's profile id travels as the
|
|
5406
|
+
* `X-Profile-Id` header the subscription routes require.
|
|
5407
|
+
*
|
|
5408
|
+
* `POST /subscriptions/{subscriptionId}/confirm` (publishable key)
|
|
5409
|
+
*/
|
|
5410
|
+
async confirmSubscription(subscriptionId, profileId, params, options) {
|
|
5411
|
+
return this.client.request(
|
|
5412
|
+
"POST",
|
|
5413
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}/confirm`,
|
|
5414
|
+
{
|
|
5415
|
+
body: { ...params, client_secret: this.requireClientSecret() },
|
|
5416
|
+
...options,
|
|
5417
|
+
// Strip any caller-supplied x-profile-id first (case-insensitively):
|
|
5418
|
+
// Fetch folds duplicate headers into `caller, pro_x`, and the
|
|
5419
|
+
// subscription routes must see exactly one profile scope.
|
|
5420
|
+
headers: {
|
|
5421
|
+
...withoutHeader(this.pkHeaders(options?.headers), "x-profile-id"),
|
|
5422
|
+
"X-Profile-Id": profileId
|
|
5423
|
+
}
|
|
5424
|
+
}
|
|
5425
|
+
);
|
|
5426
|
+
}
|
|
5313
5427
|
/**
|
|
5314
5428
|
* The Paysepro rail catalog for the buyer's country.
|
|
5315
5429
|
*
|
|
@@ -5772,4 +5886,4 @@ export {
|
|
|
5772
5886
|
focusedCheckoutUrl,
|
|
5773
5887
|
CHECKOUT_EVENT_KINDS
|
|
5774
5888
|
};
|
|
5775
|
-
//# sourceMappingURL=chunk-
|
|
5889
|
+
//# sourceMappingURL=chunk-BWTQ34HP.js.map
|