@delopay/sdk 0.334.0 → 0.337.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/README.md +2 -2
- package/dist/{chunk-GHDAF4L4.js → chunk-EPN4ZOGA.js} +70 -11
- package/dist/chunk-EPN4ZOGA.js.map +1 -0
- package/dist/{index-BsFcLSe4.d.cts → index-DkTsbc0F.d.cts} +245 -52
- package/dist/{index-BsFcLSe4.d.ts → index-DkTsbc0F.d.ts} +245 -52
- package/dist/index.cjs +69 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal.cjs +85 -10
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +51 -20
- package/dist/internal.d.ts +51 -20
- package/dist/internal.js +17 -1
- package/dist/internal.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-GHDAF4L4.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1021,7 +1021,7 @@ var Connectors = class {
|
|
|
1021
1021
|
);
|
|
1022
1022
|
}
|
|
1023
1023
|
/**
|
|
1024
|
-
* Share a connector with more shops of the same merchant
|
|
1024
|
+
* Share a connector with more shops of the same merchant.
|
|
1025
1025
|
* `POST /account/{accountId}/connectors/{connectorId}/shops`
|
|
1026
1026
|
*
|
|
1027
1027
|
* Nothing is copied: every shop sends payments to the same account, on the
|
|
@@ -1035,7 +1035,7 @@ var Connectors = class {
|
|
|
1035
1035
|
);
|
|
1036
1036
|
}
|
|
1037
1037
|
/**
|
|
1038
|
-
* Fold copies of the same provider account into this connector
|
|
1038
|
+
* Fold copies of the same provider account into this connector.
|
|
1039
1039
|
* `POST /account/{accountId}/connectors/{connectorId}/consolidate`
|
|
1040
1040
|
*
|
|
1041
1041
|
* The copies' shops move to the connector with their on/off state, routing,
|
|
@@ -1063,7 +1063,7 @@ var Connectors = class {
|
|
|
1063
1063
|
);
|
|
1064
1064
|
}
|
|
1065
1065
|
/**
|
|
1066
|
-
* Stop a connector serving one shop
|
|
1066
|
+
* Stop a connector serving one shop. Any shop may leave, the
|
|
1067
1067
|
* one the connector was created in included, while another one stays: the
|
|
1068
1068
|
* last shop is refused, and the connector is deleted instead. The account,
|
|
1069
1069
|
* its limits and every other shop on it are unaffected.
|
|
@@ -1078,7 +1078,7 @@ var Connectors = class {
|
|
|
1078
1078
|
/**
|
|
1079
1079
|
* Read the transaction currencies a connector may process: its own list,
|
|
1080
1080
|
* what the provider is known to accept with its methods, and the effective
|
|
1081
|
-
* currencies in each shop it serves
|
|
1081
|
+
* currencies in each shop it serves.
|
|
1082
1082
|
* `GET /account/{accountId}/connectors/{connectorId}/currencies`
|
|
1083
1083
|
*/
|
|
1084
1084
|
async getCurrencies(accountId, connectorId) {
|
|
@@ -6758,7 +6758,7 @@ var SellToRestrictions = class {
|
|
|
6758
6758
|
);
|
|
6759
6759
|
}
|
|
6760
6760
|
/**
|
|
6761
|
-
* One payment connector account's own policy
|
|
6761
|
+
* One payment connector account's own policy, and which buyer
|
|
6762
6762
|
* signals its payments can be judged on. Needs the merchant-level `Read`
|
|
6763
6763
|
* rung; a shop-scoped role is refused.
|
|
6764
6764
|
* `GET /sell-to-restrictions/connectors/{merchant_connector_id}`
|
|
@@ -10866,6 +10866,9 @@ var Delopay = class {
|
|
|
10866
10866
|
this.maxRetries = options?.maxRetries ?? 2;
|
|
10867
10867
|
this.debug = options?.debug ?? false;
|
|
10868
10868
|
if (options?.logger !== void 0) this.logger = options.logger;
|
|
10869
|
+
if (options?.profileId !== void 0 && options.profileId !== "") {
|
|
10870
|
+
this.profileId = options.profileId;
|
|
10871
|
+
}
|
|
10869
10872
|
if (options?.baseUrl !== void 0) {
|
|
10870
10873
|
this.baseUrl = options.baseUrl;
|
|
10871
10874
|
} else if (options?.sandbox) {
|
|
@@ -11014,6 +11017,17 @@ var Delopay = class {
|
|
|
11014
11017
|
return url;
|
|
11015
11018
|
}
|
|
11016
11019
|
/** The credential header: the JWT when one is set, else the API key. */
|
|
11020
|
+
/**
|
|
11021
|
+
* The client's `X-Profile-Id`, unless the call names one itself (in any
|
|
11022
|
+
* letter case: two spellings would be sent as one joined value).
|
|
11023
|
+
*/
|
|
11024
|
+
profileHeaders(callHeaders) {
|
|
11025
|
+
if (this.profileId === void 0) return {};
|
|
11026
|
+
const named = Object.keys(callHeaders ?? {}).some(
|
|
11027
|
+
(name) => name.toLowerCase() === "x-profile-id"
|
|
11028
|
+
);
|
|
11029
|
+
return named ? {} : { "X-Profile-Id": this.profileId };
|
|
11030
|
+
}
|
|
11017
11031
|
authHeaders() {
|
|
11018
11032
|
if (this.jwtToken) return { Authorization: `Bearer ${this.jwtToken}` };
|
|
11019
11033
|
if (this.apiKey) return { "api-key": this.apiKey };
|
|
@@ -11057,6 +11071,7 @@ var Delopay = class {
|
|
|
11057
11071
|
const lastEventId = options.lastEventId ?? "";
|
|
11058
11072
|
const headers = {
|
|
11059
11073
|
...this.authHeaders(),
|
|
11074
|
+
...this.profileHeaders(options.headers),
|
|
11060
11075
|
Accept: "text/event-stream",
|
|
11061
11076
|
...lastEventId ? { "Last-Event-ID": lastEventId } : {},
|
|
11062
11077
|
...options.headers
|
|
@@ -11194,6 +11209,7 @@ var Delopay = class {
|
|
|
11194
11209
|
const url = this.buildUrl(path, options?.query);
|
|
11195
11210
|
let headers = {
|
|
11196
11211
|
...this.authHeaders(),
|
|
11212
|
+
...this.profileHeaders(options?.headers),
|
|
11197
11213
|
...options?.headers
|
|
11198
11214
|
};
|
|
11199
11215
|
const isRawBody = options?.body !== void 0 && options?.body !== null && (options.body instanceof FormData || options.body instanceof Blob || options.body instanceof ArrayBuffer || options.body instanceof URLSearchParams);
|
|
@@ -13783,7 +13799,7 @@ function decodeBranding(source) {
|
|
|
13783
13799
|
DEFAULT_BRANDING.whopSelection
|
|
13784
13800
|
),
|
|
13785
13801
|
paypalValidTint: parseBool(extras["paypalValidTint"], DEFAULT_BRANDING.paypalValidTint),
|
|
13786
|
-
// A look stored before
|
|
13802
|
+
// A look stored before e-Payouts had its own keys has none: the form keeps
|
|
13787
13803
|
// the PayPal values it was drawn with until then.
|
|
13788
13804
|
epayoutsCardLayout: pickEnum(
|
|
13789
13805
|
extras["epayoutsCardLayout"],
|
|
@@ -14472,7 +14488,7 @@ function parseImportedBranding(raw) {
|
|
|
14472
14488
|
dflt.whopSelection
|
|
14473
14489
|
),
|
|
14474
14490
|
paypalValidTint: parseBool(root["paypalValidTint"], dflt.paypalValidTint),
|
|
14475
|
-
// A look stored before
|
|
14491
|
+
// A look stored before e-Payouts had its own keys has none: the form keeps
|
|
14476
14492
|
// the PayPal values it was drawn with until then.
|
|
14477
14493
|
epayoutsCardLayout: pickEnum(
|
|
14478
14494
|
root["epayoutsCardLayout"],
|
|
@@ -14932,6 +14948,47 @@ var CheckoutSession = class {
|
|
|
14932
14948
|
}
|
|
14933
14949
|
);
|
|
14934
14950
|
}
|
|
14951
|
+
/**
|
|
14952
|
+
* The methods the buyer may pick for a subscription that waits for the
|
|
14953
|
+
* choice (`method_choice_pending`), judged for the buyer. Call it from the
|
|
14954
|
+
* buyer's browser: the sell-to country is read from this request's own
|
|
14955
|
+
* connection. Authenticated with the subscription's client secret.
|
|
14956
|
+
*
|
|
14957
|
+
* `GET /subscriptions/method-options/{merchantId}/{subscriptionId}`
|
|
14958
|
+
*/
|
|
14959
|
+
async subscriptionMethodOptions(options) {
|
|
14960
|
+
return this.client.request(
|
|
14961
|
+
"GET",
|
|
14962
|
+
`/subscriptions/method-options/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
14963
|
+
{
|
|
14964
|
+
...options,
|
|
14965
|
+
headers: this.bearerHeaders(options?.headers)
|
|
14966
|
+
}
|
|
14967
|
+
);
|
|
14968
|
+
}
|
|
14969
|
+
/**
|
|
14970
|
+
* Bind a waiting subscription to the method the buyer picked and open its
|
|
14971
|
+
* first cycle on that method's billing account. The methods are judged
|
|
14972
|
+
* again from this request; afterwards
|
|
14973
|
+
* {@link CheckoutSession.fetchSubscriptionData} describes the bound
|
|
14974
|
+
* subscription (Stripe's Payment Element for `card`, `confirmSubscription`
|
|
14975
|
+
* for the others). A subscription that no longer waits answers 409
|
|
14976
|
+
* (`DE_20`). Authenticated with the subscription's client secret.
|
|
14977
|
+
*
|
|
14978
|
+
* `POST /subscriptions/select-method/{merchantId}/{subscriptionId}`
|
|
14979
|
+
*/
|
|
14980
|
+
async selectSubscriptionMethod(method, options) {
|
|
14981
|
+
const body = { method };
|
|
14982
|
+
return this.client.request(
|
|
14983
|
+
"POST",
|
|
14984
|
+
`/subscriptions/select-method/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
14985
|
+
{
|
|
14986
|
+
body,
|
|
14987
|
+
...options,
|
|
14988
|
+
headers: this.bearerHeaders(options?.headers)
|
|
14989
|
+
}
|
|
14990
|
+
);
|
|
14991
|
+
}
|
|
14935
14992
|
/**
|
|
14936
14993
|
* Confirm a subscription (PayPal approval rail). The client secret is
|
|
14937
14994
|
* attached automatically; the shop's profile id travels as the
|
|
@@ -15205,7 +15262,8 @@ var CheckoutSession = class {
|
|
|
15205
15262
|
* Only `authorized: true` permits the form to contact its processor. A
|
|
15206
15263
|
* competing flow receives `false` and must reload; an unresolved provider
|
|
15207
15264
|
* outcome stays reserved, regardless of elapsed time. A buyer-blocklist
|
|
15208
|
-
* refusal throws a `DelopayError` with code `DE_14
|
|
15265
|
+
* refusal throws a `DelopayError` with code `DE_14`; a shop whose payments
|
|
15266
|
+
* DeloPay stopped is refused with `DE_22`.
|
|
15209
15267
|
*
|
|
15210
15268
|
* `POST /payment-link/{merchantId}/{paymentId}/browser-card-claim`
|
|
15211
15269
|
*/
|
|
@@ -15231,7 +15289,8 @@ var CheckoutSession = class {
|
|
|
15231
15289
|
* against the shop's sell-to restrictions before Stripe authorises, and a
|
|
15232
15290
|
* refusal throws a `DelopayError` with code `DE_10`. A buyer on the
|
|
15233
15291
|
* merchant's buyer blocklist is refused before any Stripe call with code
|
|
15234
|
-
* `DE_14` (`buyer_blocked`, 422), which names no entry
|
|
15292
|
+
* `DE_14` (`buyer_blocked`, 422), which names no entry, and a shop whose
|
|
15293
|
+
* payments DeloPay stopped with `DE_22`. When the answer's
|
|
15235
15294
|
* `status` is `requires_action`, run `stripe.handleNextAction` with its
|
|
15236
15295
|
* `client_secret` — safe, because the intent is `confirmation_method=manual`
|
|
15237
15296
|
* and that secret confirms nothing without the secret key — then call this
|
|
@@ -15462,7 +15521,7 @@ var CheckoutSession = class {
|
|
|
15462
15521
|
/**
|
|
15463
15522
|
* Reopen a provider session the buyer switched away from, when they pick the
|
|
15464
15523
|
* same method again, instead of opening a second session at the provider
|
|
15465
|
-
|
|
15524
|
+
*. Pass an `attempt_id` from the checkout's
|
|
15466
15525
|
* `reopenable_attempts`; the attempt becomes the payment's active one again
|
|
15467
15526
|
* and `redirect_url` sends the buyer back to it. Refused (`IR_16`) when the
|
|
15468
15527
|
* payment no longer awaits a method, a payment is under way on the checkout,
|