@delopay/sdk 0.189.0 → 0.192.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 +61 -0
- package/dist/{chunk-7M6HDH2Q.js → chunk-BIAYMQN7.js} +162 -2
- package/dist/chunk-BIAYMQN7.js.map +1 -0
- package/dist/index.cjs +161 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +690 -16
- package/dist/index.d.ts +690 -16
- package/dist/index.js +1 -1
- package/dist/internal.cjs +161 -1
- 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
- package/dist/chunk-7M6HDH2Q.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -3328,6 +3328,12 @@ var Routing = class {
|
|
|
3328
3328
|
* Every account named must belong to this shop; one that does not is refused.
|
|
3329
3329
|
* So is an amount cap without a `currency`, and a payment cap with one.
|
|
3330
3330
|
*
|
|
3331
|
+
* An account may appear twice — a payment count and a budget — and never
|
|
3332
|
+
* twice in one `unit`. Re-send a range with its `limit_max`, or it is stored
|
|
3333
|
+
* as its bottom. Never re-send `current_limit` as `set_current_limit`: the
|
|
3334
|
+
* value read belongs to the window it was read in, and pinning it into a
|
|
3335
|
+
* window that has since reset is a limit nobody chose.
|
|
3336
|
+
*
|
|
3331
3337
|
* `PUT /routing/connector-caps/{profileId}`
|
|
3332
3338
|
*/
|
|
3333
3339
|
async setConnectorCaps(profileId, params) {
|
|
@@ -4289,6 +4295,33 @@ var Users = class {
|
|
|
4289
4295
|
async changeMemberScope(params) {
|
|
4290
4296
|
return this.request("POST", "/user/employees/change-scope", { body: params });
|
|
4291
4297
|
}
|
|
4298
|
+
/**
|
|
4299
|
+
* One member of your merchant, with the person fields the member list
|
|
4300
|
+
* omits. `GET /user/employees/{user_id}/details`
|
|
4301
|
+
*
|
|
4302
|
+
* Answers only for a member `listUsersInLineage` shows you. Any other id,
|
|
4303
|
+
* unknown or not yours, is a 404 `UR_68` with `data.reason:
|
|
4304
|
+
* 'member_not_found'`.
|
|
4305
|
+
*/
|
|
4306
|
+
async getTeamMemberDetails(userId) {
|
|
4307
|
+
return this.request("GET", `/user/employees/${encodeURIComponent(userId)}/details`);
|
|
4308
|
+
}
|
|
4309
|
+
/**
|
|
4310
|
+
* Replace a team member's password with a temporary one, returned once.
|
|
4311
|
+
* `POST /user/employees/{user_id}/reset-password`
|
|
4312
|
+
*
|
|
4313
|
+
* Needs the *Users* write permission and the *Impersonation* permission,
|
|
4314
|
+
* and the member must be one you could sign in as with
|
|
4315
|
+
* `impersonateEmployee`. The member's sessions end, and their next sign-in
|
|
4316
|
+
* asks them to choose a new password. Two-factor authentication is left as
|
|
4317
|
+
* it is. `TeamMemberDetails.can_reset_password` answers the same rule. A
|
|
4318
|
+
* refusal is a `UR_68` error whose `data` is a {@link TeamMemberRefusal}.
|
|
4319
|
+
*/
|
|
4320
|
+
async resetTeamMemberPassword(userId, params) {
|
|
4321
|
+
return this.request("POST", `/user/employees/${encodeURIComponent(userId)}/reset-password`, {
|
|
4322
|
+
body: params
|
|
4323
|
+
});
|
|
4324
|
+
}
|
|
4292
4325
|
/** Sign in via OIDC. `POST /user/oidc` */
|
|
4293
4326
|
async signInOidc(params) {
|
|
4294
4327
|
return this.request("POST", "/user/oidc", { body: params });
|
|
@@ -5291,6 +5324,25 @@ var Products = class {
|
|
|
5291
5324
|
query: { ...query }
|
|
5292
5325
|
});
|
|
5293
5326
|
}
|
|
5327
|
+
/**
|
|
5328
|
+
* Which active prices of the named recurring products can start a
|
|
5329
|
+
* subscription on the shop's billing processor account, in the environment
|
|
5330
|
+
* the account is in now. `GET /products/billing-readiness`
|
|
5331
|
+
*
|
|
5332
|
+
* Reads only; subscribing still checks the processor's price before
|
|
5333
|
+
* anything is billed. Unknown ids, one-time products and archived prices
|
|
5334
|
+
* are left out of the answer.
|
|
5335
|
+
*
|
|
5336
|
+
* @param productIds - 1 to 100 product ids.
|
|
5337
|
+
* @param profileId - The shop the products belong to.
|
|
5338
|
+
*/
|
|
5339
|
+
async billingReadiness(productIds, profileId, options) {
|
|
5340
|
+
return this.request("GET", "/products/billing-readiness", {
|
|
5341
|
+
...this.scoped(profileId, options),
|
|
5342
|
+
// One comma-separated value, as the route reads it — not repeated keys.
|
|
5343
|
+
query: { product_ids: productIds.join(",") }
|
|
5344
|
+
});
|
|
5345
|
+
}
|
|
5294
5346
|
/**
|
|
5295
5347
|
* Change a product's name, description, image, metadata or category
|
|
5296
5348
|
* (`category_id: null` makes it uncategorized).
|
|
@@ -5940,6 +5992,31 @@ var Subscriptions = class {
|
|
|
5940
5992
|
...options
|
|
5941
5993
|
});
|
|
5942
5994
|
}
|
|
5995
|
+
/**
|
|
5996
|
+
* {@link getItems}, with whether the list is only the first part of what the
|
|
5997
|
+
* processor holds. `GET /subscriptions/items`
|
|
5998
|
+
*
|
|
5999
|
+
* The backend states that in the `X-Delopay-Items-Truncated` response
|
|
6000
|
+
* header (Stripe Billing lists its first 100 products), which the plain
|
|
6001
|
+
* {@link getItems} cannot return. Without `limit` and `offset` every item
|
|
6002
|
+
* the billing account offers is listed, up to 500.
|
|
6003
|
+
*/
|
|
6004
|
+
async getItemsPage(params, options) {
|
|
6005
|
+
let truncated = false;
|
|
6006
|
+
const items = await this.request(
|
|
6007
|
+
"GET",
|
|
6008
|
+
"/subscriptions/items",
|
|
6009
|
+
{
|
|
6010
|
+
query: params,
|
|
6011
|
+
...options,
|
|
6012
|
+
onDownloadProgress: (event) => {
|
|
6013
|
+
truncated = event.headers.get("x-delopay-items-truncated")?.toLowerCase() === "true";
|
|
6014
|
+
options?.onDownloadProgress?.(event);
|
|
6015
|
+
}
|
|
6016
|
+
}
|
|
6017
|
+
);
|
|
6018
|
+
return { items, truncated };
|
|
6019
|
+
}
|
|
5943
6020
|
/**
|
|
5944
6021
|
* Pause a subscription. `POST /subscriptions/{subscriptionId}/pause`
|
|
5945
6022
|
*
|
|
@@ -5960,13 +6037,64 @@ var Subscriptions = class {
|
|
|
5960
6037
|
...options
|
|
5961
6038
|
});
|
|
5962
6039
|
}
|
|
5963
|
-
/**
|
|
6040
|
+
/**
|
|
6041
|
+
* Cancel a subscription. `POST /subscriptions/{subscriptionId}/cancel`
|
|
6042
|
+
*
|
|
6043
|
+
* A subscription in a state it cannot be cancelled from is refused with
|
|
6044
|
+
* `DE_11`; `error.data.reason` then names why (`SubscriptionActionRefusal`).
|
|
6045
|
+
*/
|
|
5964
6046
|
async cancel(subscriptionId, params, options) {
|
|
5965
6047
|
return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {
|
|
5966
6048
|
body: params ?? {},
|
|
5967
6049
|
...options
|
|
5968
6050
|
});
|
|
5969
6051
|
}
|
|
6052
|
+
/**
|
|
6053
|
+
* Read 1 to 50 subscriptions back from their billing processor and mirror
|
|
6054
|
+
* what it reports. `POST /subscriptions/sync`
|
|
6055
|
+
*
|
|
6056
|
+
* Nothing is written at the processor. A status is mirrored only with the
|
|
6057
|
+
* time the processor stamped it with, and never over a newer event already
|
|
6058
|
+
* recorded; a plan only with its own stamp. One result per id, in request
|
|
6059
|
+
* order; one that fails does not stop the others.
|
|
6060
|
+
*/
|
|
6061
|
+
async sync(params, options) {
|
|
6062
|
+
return this.request("POST", "/subscriptions/sync", { body: params, ...options });
|
|
6063
|
+
}
|
|
6064
|
+
/**
|
|
6065
|
+
* Read one subscription back from its billing processor and mirror what it
|
|
6066
|
+
* reports, as {@link sync} does, with what the processor reported beside
|
|
6067
|
+
* what the mirror now holds. `POST /subscriptions/{subscriptionId}/sync`
|
|
6068
|
+
*/
|
|
6069
|
+
async syncOne(subscriptionId, options) {
|
|
6070
|
+
return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/sync`, {
|
|
6071
|
+
...options
|
|
6072
|
+
});
|
|
6073
|
+
}
|
|
6074
|
+
/**
|
|
6075
|
+
* List the subscriptions a billing account holds at its processor, and how
|
|
6076
|
+
* each relates to DeloPay's: already held, new (its buyer is a DeloPay
|
|
6077
|
+
* customer), needing a customer, ended, or not adoptable here.
|
|
6078
|
+
* `POST /subscriptions/import/preview`
|
|
6079
|
+
*
|
|
6080
|
+
* Reads only; nothing is written here or at the processor. Creem and
|
|
6081
|
+
* Stripe Billing can be listed; PayPal cannot, which `capabilities` states
|
|
6082
|
+
* (`reason_code: 'listing_unsupported'`).
|
|
6083
|
+
*/
|
|
6084
|
+
async importPreview(params, options) {
|
|
6085
|
+
return this.request("POST", "/subscriptions/import/preview", { body: params, ...options });
|
|
6086
|
+
}
|
|
6087
|
+
/**
|
|
6088
|
+
* Take 1 to 25 processor subscriptions over, each through {@link adopt}
|
|
6089
|
+
* with every one of its checks, one after another.
|
|
6090
|
+
* `POST /subscriptions/import/apply`
|
|
6091
|
+
*
|
|
6092
|
+
* One result per selection, in request order; one refused does not stop
|
|
6093
|
+
* the others.
|
|
6094
|
+
*/
|
|
6095
|
+
async importApply(params, options) {
|
|
6096
|
+
return this.request("POST", "/subscriptions/import/apply", { body: params, ...options });
|
|
6097
|
+
}
|
|
5970
6098
|
/**
|
|
5971
6099
|
* Resolve which of the given payments were raised by a subscription.
|
|
5972
6100
|
* `POST /subscriptions/payments/lookup`
|
|
@@ -10226,6 +10354,38 @@ var CheckoutSession = class {
|
|
|
10226
10354
|
}
|
|
10227
10355
|
);
|
|
10228
10356
|
}
|
|
10357
|
+
/**
|
|
10358
|
+
* The status a buyer coming back from the processor's checkout may read:
|
|
10359
|
+
* the subscription's status, and whether the processor has reported it yet
|
|
10360
|
+
* (`awaiting_processor`). Construct the session with the `sub_…` id in the
|
|
10361
|
+
* `paymentId` slot.
|
|
10362
|
+
*
|
|
10363
|
+
* Authenticated with the return token (`rt`) the return URL carried, sent as
|
|
10364
|
+
* `Authorization: Bearer <rt>`. That token reads only this, for a day; it is
|
|
10365
|
+
* never the client secret, which this call does not send.
|
|
10366
|
+
*
|
|
10367
|
+
* `GET /subscriptions/return-status/{merchantId}/{subscriptionId}`
|
|
10368
|
+
*/
|
|
10369
|
+
async subscriptionReturnStatus(returnToken, options) {
|
|
10370
|
+
if (!returnToken) {
|
|
10371
|
+
throw new DelopayError("This call requires the return token (rt) from the return URL", {
|
|
10372
|
+
status: 0,
|
|
10373
|
+
code: "MISSING_CREDENTIAL",
|
|
10374
|
+
type: "invalid_request"
|
|
10375
|
+
});
|
|
10376
|
+
}
|
|
10377
|
+
return this.client.request(
|
|
10378
|
+
"GET",
|
|
10379
|
+
`/subscriptions/return-status/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
10380
|
+
{
|
|
10381
|
+
...options,
|
|
10382
|
+
headers: {
|
|
10383
|
+
...withoutCredentialHeaders(options?.headers),
|
|
10384
|
+
Authorization: `Bearer ${returnToken}`
|
|
10385
|
+
}
|
|
10386
|
+
}
|
|
10387
|
+
);
|
|
10388
|
+
}
|
|
10229
10389
|
/**
|
|
10230
10390
|
* Confirm a subscription (PayPal approval rail). The client secret is
|
|
10231
10391
|
* attached automatically; the shop's profile id travels as the
|