@delopay/sdk 0.182.0 → 0.184.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 +26 -0
- package/dist/{chunk-3GSFUNXW.js → chunk-RH4CX4MU.js} +216 -2
- package/dist/chunk-RH4CX4MU.js.map +1 -0
- package/dist/index.cjs +216 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +575 -11
- package/dist/index.d.ts +575 -11
- package/dist/index.js +3 -1
- package/dist/internal.cjs +252 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +28 -3
- package/dist/internal.d.ts +28 -3
- package/dist/internal.js +39 -1
- package/dist/internal.js.map +1 -1
- package/package.json +17 -18
- package/dist/chunk-3GSFUNXW.js.map +0 -1
package/README.md
CHANGED
|
@@ -141,6 +141,32 @@ const payment = await delopay.payments.create({
|
|
|
141
141
|
});
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
+
### Sell from the catalog
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// A product belongs to a shop; every call names the shop last.
|
|
148
|
+
const product = await delopay.products.create(
|
|
149
|
+
{
|
|
150
|
+
name: 'Annual report',
|
|
151
|
+
kind: 'one_time',
|
|
152
|
+
prices: [{ amount: 2999, currency: 'EUR', is_default: true }],
|
|
153
|
+
},
|
|
154
|
+
'pro_abc123',
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
// Price a payment from the catalog: no amount, no currency — the server
|
|
158
|
+
// freezes the product's active default price (or a named `price_id`) onto it.
|
|
159
|
+
const payment = await delopay.payments.create({
|
|
160
|
+
product_id: product.id,
|
|
161
|
+
profile_id: 'pro_abc123',
|
|
162
|
+
payment_link: true,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// What the payment sold, as it was when it was created — unchanged by later
|
|
166
|
+
// catalog edits or deletion.
|
|
167
|
+
const sold = await delopay.payments.productLines(payment.payment_id);
|
|
168
|
+
```
|
|
169
|
+
|
|
144
170
|
### Handle disputes
|
|
145
171
|
|
|
146
172
|
```typescript
|
|
@@ -1948,7 +1948,8 @@ var Payments = class {
|
|
|
1948
1948
|
/**
|
|
1949
1949
|
* Create a new payment intent.
|
|
1950
1950
|
*
|
|
1951
|
-
* @param params -
|
|
1951
|
+
* @param params - An explicit amount and currency, or a DeloPay one-time
|
|
1952
|
+
* product whose active price supplies both on the server.
|
|
1952
1953
|
* @param options - Optional per-call extras: extra `headers` (e.g. an
|
|
1953
1954
|
* `Idempotency-Key` to make the create safe to retry), a `timeout` override,
|
|
1954
1955
|
* and an `AbortSignal`.
|
|
@@ -1962,6 +1963,16 @@ var Payments = class {
|
|
|
1962
1963
|
* );
|
|
1963
1964
|
* ```
|
|
1964
1965
|
*
|
|
1966
|
+
* @example Charge the active default price of a shop-owned product without
|
|
1967
|
+
* copying the product to the payment provider:
|
|
1968
|
+
* ```typescript
|
|
1969
|
+
* const payment = await delopay.payments.create({
|
|
1970
|
+
* product_id: 'prd_123',
|
|
1971
|
+
* profile_id: 'pro_123',
|
|
1972
|
+
* payment_link: true,
|
|
1973
|
+
* });
|
|
1974
|
+
* ```
|
|
1975
|
+
*
|
|
1965
1976
|
* @example Send `test_mode` to pick the environment per payment, so a staging
|
|
1966
1977
|
* deploy cannot charge real cards and a forgotten processor toggle cannot
|
|
1967
1978
|
* swallow production traffic:
|
|
@@ -2015,6 +2026,10 @@ var Payments = class {
|
|
|
2015
2026
|
if (Object.keys(query).length === 0) return this.request("GET", path);
|
|
2016
2027
|
return this.request("GET", path, { query });
|
|
2017
2028
|
}
|
|
2029
|
+
/** Product names and prices as frozen when the payment was created. */
|
|
2030
|
+
async productLines(paymentId) {
|
|
2031
|
+
return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/lines`);
|
|
2032
|
+
}
|
|
2018
2033
|
/**
|
|
2019
2034
|
* List every attempt made on a payment, each with its full failure detail
|
|
2020
2035
|
* (`error_code` / `error_message`, the Delopay-unified `unified_code` and
|
|
@@ -3969,6 +3984,14 @@ var Users = class {
|
|
|
3969
3984
|
async listUserRoles(params) {
|
|
3970
3985
|
return this.request("POST", "/user/employees", { body: params });
|
|
3971
3986
|
}
|
|
3987
|
+
/**
|
|
3988
|
+
* The current role's explicit payment-data policy, or `null` when the role
|
|
3989
|
+
* retains its pre-control access. A dashboard hint: every API response
|
|
3990
|
+
* enforces the same policy on its own. `GET /user/role/payment-visibility`
|
|
3991
|
+
*/
|
|
3992
|
+
async getRolePaymentVisibility() {
|
|
3993
|
+
return this.request("GET", "/user/role/payment-visibility");
|
|
3994
|
+
}
|
|
3972
3995
|
/**
|
|
3973
3996
|
* Change a team member's role. `POST /user/employees/update-role`
|
|
3974
3997
|
*
|
|
@@ -4899,6 +4922,16 @@ var Products = class {
|
|
|
4899
4922
|
scoped(profileId, options) {
|
|
4900
4923
|
return { ...options, headers: { "X-Profile-Id": profileId, ...options?.headers } };
|
|
4901
4924
|
}
|
|
4925
|
+
/** Upload a PNG, JPEG or WebP image to the merchant CDN. Save the returned
|
|
4926
|
+
* URL in a product create or update request; upload alone changes no product. */
|
|
4927
|
+
async uploadImage(file, profileId, options) {
|
|
4928
|
+
const form = new FormData();
|
|
4929
|
+
form.append("file", file);
|
|
4930
|
+
return this.request("POST", "/products/images", {
|
|
4931
|
+
body: form,
|
|
4932
|
+
...this.scoped(profileId, options)
|
|
4933
|
+
});
|
|
4934
|
+
}
|
|
4902
4935
|
/**
|
|
4903
4936
|
* Create a product together with its prices.
|
|
4904
4937
|
* `POST /products`
|
|
@@ -4967,6 +5000,13 @@ var Products = class {
|
|
|
4967
5000
|
...this.scoped(profileId, options)
|
|
4968
5001
|
});
|
|
4969
5002
|
}
|
|
5003
|
+
/** Mark an archived product deleted. Historical payment lines keep
|
|
5004
|
+
* their own immutable purchase snapshots, and the catalog row remains stored. */
|
|
5005
|
+
async delete(productId, profileId, options) {
|
|
5006
|
+
return this.request("DELETE", `/products/${encodeURIComponent(productId)}`, {
|
|
5007
|
+
...this.scoped(profileId, options)
|
|
5008
|
+
});
|
|
5009
|
+
}
|
|
4970
5010
|
/**
|
|
4971
5011
|
* Add a price to an existing product.
|
|
4972
5012
|
* `POST /products/{product_id}/prices`
|
|
@@ -5004,6 +5044,89 @@ var Products = class {
|
|
|
5004
5044
|
{ ...this.scoped(profileId, options) }
|
|
5005
5045
|
);
|
|
5006
5046
|
}
|
|
5047
|
+
// --- add-on selection groups ---------------------------------------
|
|
5048
|
+
/**
|
|
5049
|
+
* Add a group of optional extras to a one-time product, with how many of
|
|
5050
|
+
* them a buyer must and may choose. Each add-on is an active product of kind
|
|
5051
|
+
* `addon` in the same shop. Returns the whole product.
|
|
5052
|
+
* `POST /products/{product_id}/addon-groups`
|
|
5053
|
+
*/
|
|
5054
|
+
async createAddonGroup(productId, group, profileId, options) {
|
|
5055
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}/addon-groups`, {
|
|
5056
|
+
body: group,
|
|
5057
|
+
...this.scoped(profileId, options)
|
|
5058
|
+
});
|
|
5059
|
+
}
|
|
5060
|
+
/**
|
|
5061
|
+
* Change a group's name, bounds, or the add-ons it offers; a new list
|
|
5062
|
+
* replaces the old one whole.
|
|
5063
|
+
* `POST /products/{product_id}/addon-groups/{group_id}`
|
|
5064
|
+
*/
|
|
5065
|
+
async updateAddonGroup(productId, groupId, changes, profileId, options) {
|
|
5066
|
+
return this.request(
|
|
5067
|
+
"POST",
|
|
5068
|
+
`/products/${encodeURIComponent(productId)}/addon-groups/${encodeURIComponent(groupId)}`,
|
|
5069
|
+
{ body: changes, ...this.scoped(profileId, options) }
|
|
5070
|
+
);
|
|
5071
|
+
}
|
|
5072
|
+
/**
|
|
5073
|
+
* Remove a group and what it offered. The add-on products themselves stay.
|
|
5074
|
+
* `DELETE /products/{product_id}/addon-groups/{group_id}`
|
|
5075
|
+
*/
|
|
5076
|
+
async deleteAddonGroup(productId, groupId, profileId, options) {
|
|
5077
|
+
return this.request(
|
|
5078
|
+
"DELETE",
|
|
5079
|
+
`/products/${encodeURIComponent(productId)}/addon-groups/${encodeURIComponent(groupId)}`,
|
|
5080
|
+
{ ...this.scoped(profileId, options) }
|
|
5081
|
+
);
|
|
5082
|
+
}
|
|
5083
|
+
// --- bundles ---------------------------------------------------------
|
|
5084
|
+
/**
|
|
5085
|
+
* Replace what a bundle contains. Its pricing mode is fixed at creation;
|
|
5086
|
+
* past purchases keep their own frozen lines.
|
|
5087
|
+
* `POST /products/{product_id}/bundle`
|
|
5088
|
+
*/
|
|
5089
|
+
async replaceBundle(productId, bundle, profileId, options) {
|
|
5090
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}/bundle`, {
|
|
5091
|
+
body: bundle,
|
|
5092
|
+
...this.scoped(profileId, options)
|
|
5093
|
+
});
|
|
5094
|
+
}
|
|
5095
|
+
// --- provider import ---------------------------------------------
|
|
5096
|
+
/**
|
|
5097
|
+
* Read a connected billing account's products and say how each relates to
|
|
5098
|
+
* the catalog. Reads only: nothing is written to the provider or the catalog.
|
|
5099
|
+
* `POST /products/import/preview`
|
|
5100
|
+
*/
|
|
5101
|
+
async importPreview(request, profileId, options) {
|
|
5102
|
+
return this.request("POST", "/products/import/preview", {
|
|
5103
|
+
body: request,
|
|
5104
|
+
...this.scoped(profileId, options)
|
|
5105
|
+
});
|
|
5106
|
+
}
|
|
5107
|
+
/**
|
|
5108
|
+
* Create a product for every new item and add the new prices of every
|
|
5109
|
+
* changed one, tied to the provider's ids. Nothing is edited or removed, and
|
|
5110
|
+
* nothing is written to the provider. A failed item is reported with its
|
|
5111
|
+
* reason and can be retried by naming it in `connector_product_ids`.
|
|
5112
|
+
* `POST /products/import/apply`
|
|
5113
|
+
*/
|
|
5114
|
+
async importApply(request, profileId, options) {
|
|
5115
|
+
return this.request("POST", "/products/import/apply", {
|
|
5116
|
+
body: request,
|
|
5117
|
+
...this.scoped(profileId, options)
|
|
5118
|
+
});
|
|
5119
|
+
}
|
|
5120
|
+
/**
|
|
5121
|
+
* The shop's past imports from one connected account, newest first.
|
|
5122
|
+
* `GET /products/import/runs`
|
|
5123
|
+
*/
|
|
5124
|
+
async listImportRuns(merchantConnectorId, profileId, options) {
|
|
5125
|
+
return this.request("GET", "/products/import/runs", {
|
|
5126
|
+
query: { merchant_connector_id: merchantConnectorId },
|
|
5127
|
+
...this.scoped(profileId, options)
|
|
5128
|
+
});
|
|
5129
|
+
}
|
|
5007
5130
|
};
|
|
5008
5131
|
|
|
5009
5132
|
// src/resources/processorCosts.ts
|
|
@@ -5138,6 +5261,16 @@ var CheckoutMethods = class {
|
|
|
5138
5261
|
query: { merchant_id: merchantId }
|
|
5139
5262
|
});
|
|
5140
5263
|
}
|
|
5264
|
+
/**
|
|
5265
|
+
* The same document as {@link retrieve}, on the route that stays open to a
|
|
5266
|
+
* reader of the checkout's appearance while the role's payment-data
|
|
5267
|
+
* visibility is restricted. `GET /checkout-methods/{profile_id}/preview`
|
|
5268
|
+
*/
|
|
5269
|
+
async preview(merchantId, profileId) {
|
|
5270
|
+
return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}/preview`, {
|
|
5271
|
+
query: { merchant_id: merchantId }
|
|
5272
|
+
});
|
|
5273
|
+
}
|
|
5141
5274
|
/**
|
|
5142
5275
|
* Replace the shop's layout. The router refuses an express item that does
|
|
5143
5276
|
* not draw its own button, more than two rows of two in the express strip,
|
|
@@ -5953,6 +6086,85 @@ var OperationLimits = class {
|
|
|
5953
6086
|
}
|
|
5954
6087
|
};
|
|
5955
6088
|
|
|
6089
|
+
// src/resources/replayRetention.ts
|
|
6090
|
+
var ReplayRetention = class {
|
|
6091
|
+
constructor(request) {
|
|
6092
|
+
this.request = request;
|
|
6093
|
+
}
|
|
6094
|
+
/**
|
|
6095
|
+
* Every level that is set for the caller's merchant, plus the global level
|
|
6096
|
+
* when one is set.
|
|
6097
|
+
*
|
|
6098
|
+
* `GET /replay-retention`
|
|
6099
|
+
*/
|
|
6100
|
+
async list() {
|
|
6101
|
+
return this.request("GET", "/replay-retention");
|
|
6102
|
+
}
|
|
6103
|
+
/**
|
|
6104
|
+
* What applies to one shop's recordings, and which level decided.
|
|
6105
|
+
*
|
|
6106
|
+
* `GET /replay-retention/shops/{profileId}/effective`
|
|
6107
|
+
*/
|
|
6108
|
+
async effective(profileId) {
|
|
6109
|
+
return this.request(
|
|
6110
|
+
"GET",
|
|
6111
|
+
`/replay-retention/shops/${encodeURIComponent(profileId)}/effective`
|
|
6112
|
+
);
|
|
6113
|
+
}
|
|
6114
|
+
/**
|
|
6115
|
+
* Set the merchant-wide level.
|
|
6116
|
+
*
|
|
6117
|
+
* `PUT /replay-retention/merchant`
|
|
6118
|
+
*/
|
|
6119
|
+
async setMerchant(params) {
|
|
6120
|
+
return this.request("PUT", "/replay-retention/merchant", { body: params });
|
|
6121
|
+
}
|
|
6122
|
+
/**
|
|
6123
|
+
* Hand the merchant-wide level back to the global one.
|
|
6124
|
+
*
|
|
6125
|
+
* `DELETE /replay-retention/merchant`
|
|
6126
|
+
*/
|
|
6127
|
+
async clearMerchant() {
|
|
6128
|
+
await this.request("DELETE", "/replay-retention/merchant");
|
|
6129
|
+
}
|
|
6130
|
+
/**
|
|
6131
|
+
* Set one project's level.
|
|
6132
|
+
*
|
|
6133
|
+
* `PUT /replay-retention/projects/{projectId}`
|
|
6134
|
+
*/
|
|
6135
|
+
async setProject(projectId, params) {
|
|
6136
|
+
return this.request("PUT", `/replay-retention/projects/${encodeURIComponent(projectId)}`, {
|
|
6137
|
+
body: params
|
|
6138
|
+
});
|
|
6139
|
+
}
|
|
6140
|
+
/**
|
|
6141
|
+
* Hand one project's level back to the merchant's.
|
|
6142
|
+
*
|
|
6143
|
+
* `DELETE /replay-retention/projects/{projectId}`
|
|
6144
|
+
*/
|
|
6145
|
+
async clearProject(projectId) {
|
|
6146
|
+
await this.request("DELETE", `/replay-retention/projects/${encodeURIComponent(projectId)}`);
|
|
6147
|
+
}
|
|
6148
|
+
/**
|
|
6149
|
+
* Set one shop's level. A shop-scoped caller may set only its own shop.
|
|
6150
|
+
*
|
|
6151
|
+
* `PUT /replay-retention/shops/{profileId}`
|
|
6152
|
+
*/
|
|
6153
|
+
async setShop(profileId, params) {
|
|
6154
|
+
return this.request("PUT", `/replay-retention/shops/${encodeURIComponent(profileId)}`, {
|
|
6155
|
+
body: params
|
|
6156
|
+
});
|
|
6157
|
+
}
|
|
6158
|
+
/**
|
|
6159
|
+
* Hand one shop's level back to its project's (or the merchant's).
|
|
6160
|
+
*
|
|
6161
|
+
* `DELETE /replay-retention/shops/{profileId}`
|
|
6162
|
+
*/
|
|
6163
|
+
async clearShop(profileId) {
|
|
6164
|
+
await this.request("DELETE", `/replay-retention/shops/${encodeURIComponent(profileId)}`);
|
|
6165
|
+
}
|
|
6166
|
+
};
|
|
6167
|
+
|
|
5956
6168
|
// src/resources/risk.ts
|
|
5957
6169
|
var Risk = class {
|
|
5958
6170
|
constructor(request) {
|
|
@@ -6214,6 +6426,7 @@ var Delopay = class {
|
|
|
6214
6426
|
this.audit = new Audit(request);
|
|
6215
6427
|
this.settlement = new Settlement(request);
|
|
6216
6428
|
this.operationLimits = new OperationLimits(request);
|
|
6429
|
+
this.replayRetention = new ReplayRetention(request);
|
|
6217
6430
|
this.risk = new Risk(request);
|
|
6218
6431
|
this.subscriptions = new Subscriptions(request);
|
|
6219
6432
|
this.files = new Files(request);
|
|
@@ -10171,6 +10384,7 @@ export {
|
|
|
10171
10384
|
Audit,
|
|
10172
10385
|
Settlement,
|
|
10173
10386
|
OperationLimits,
|
|
10387
|
+
ReplayRetention,
|
|
10174
10388
|
Risk,
|
|
10175
10389
|
Delopay,
|
|
10176
10390
|
leaf,
|
|
@@ -10362,4 +10576,4 @@ export {
|
|
|
10362
10576
|
decodeNativePanes,
|
|
10363
10577
|
encodeNativePanes
|
|
10364
10578
|
};
|
|
10365
|
-
//# sourceMappingURL=chunk-
|
|
10579
|
+
//# sourceMappingURL=chunk-RH4CX4MU.js.map
|