@delopay/sdk 0.183.0 → 0.185.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-HITQ3SXH.js → chunk-LA4KAVRD.js} +259 -2
- package/dist/chunk-LA4KAVRD.js.map +1 -0
- package/dist/index.cjs +258 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +683 -12
- package/dist/index.d.ts +683 -12
- package/dist/index.js +1 -1
- package/dist/internal.cjs +261 -2
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +28 -2
- package/dist/internal.d.ts +28 -2
- package/dist/internal.js +4 -2
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-HITQ3SXH.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
|
|
@@ -3984,6 +3984,14 @@ var Users = class {
|
|
|
3984
3984
|
async listUserRoles(params) {
|
|
3985
3985
|
return this.request("POST", "/user/employees", { body: params });
|
|
3986
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
|
+
}
|
|
3987
3995
|
/**
|
|
3988
3996
|
* Change a team member's role. `POST /user/employees/update-role`
|
|
3989
3997
|
*
|
|
@@ -4950,6 +4958,19 @@ var Products = class {
|
|
|
4950
4958
|
...this.scoped(profileId, options)
|
|
4951
4959
|
});
|
|
4952
4960
|
}
|
|
4961
|
+
/**
|
|
4962
|
+
* Find the product a name or a connector's id belongs to. Pass exactly one
|
|
4963
|
+
* of `alias`, `connector_product_id` and `connector_price_id`; the connector
|
|
4964
|
+
* ids need `connector` as well. Archived products resolve too, so a payment
|
|
4965
|
+
* that references one is still attributed. No match answers 404.
|
|
4966
|
+
* `GET /products/resolve`
|
|
4967
|
+
*/
|
|
4968
|
+
async resolve(query, profileId, options) {
|
|
4969
|
+
return this.request("GET", "/products/resolve", {
|
|
4970
|
+
query: { ...query },
|
|
4971
|
+
...this.scoped(profileId, options)
|
|
4972
|
+
});
|
|
4973
|
+
}
|
|
4953
4974
|
/**
|
|
4954
4975
|
* Retrieve one product with its prices.
|
|
4955
4976
|
* `GET /products/{product_id}`
|
|
@@ -4960,7 +4981,8 @@ var Products = class {
|
|
|
4960
4981
|
});
|
|
4961
4982
|
}
|
|
4962
4983
|
/**
|
|
4963
|
-
* Change a product's name, description or
|
|
4984
|
+
* Change a product's name, description, image, metadata or category
|
|
4985
|
+
* (`category_id: null` makes it uncategorized).
|
|
4964
4986
|
* `POST /products/{product_id}`
|
|
4965
4987
|
*
|
|
4966
4988
|
* Its kind and its prices are not editable here — see the class note.
|
|
@@ -5036,6 +5058,231 @@ var Products = class {
|
|
|
5036
5058
|
{ ...this.scoped(profileId, options) }
|
|
5037
5059
|
);
|
|
5038
5060
|
}
|
|
5061
|
+
// --- add-on selection groups ---------------------------------------
|
|
5062
|
+
/**
|
|
5063
|
+
* Add a group of optional extras to a one-time product, with how many of
|
|
5064
|
+
* them a buyer must and may choose. Each add-on is an active product of kind
|
|
5065
|
+
* `addon` in the same shop. Returns the whole product.
|
|
5066
|
+
* `POST /products/{product_id}/addon-groups`
|
|
5067
|
+
*/
|
|
5068
|
+
async createAddonGroup(productId, group, profileId, options) {
|
|
5069
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}/addon-groups`, {
|
|
5070
|
+
body: group,
|
|
5071
|
+
...this.scoped(profileId, options)
|
|
5072
|
+
});
|
|
5073
|
+
}
|
|
5074
|
+
/**
|
|
5075
|
+
* Change a group's name, bounds, or the add-ons it offers; a new list
|
|
5076
|
+
* replaces the old one whole.
|
|
5077
|
+
* `POST /products/{product_id}/addon-groups/{group_id}`
|
|
5078
|
+
*/
|
|
5079
|
+
async updateAddonGroup(productId, groupId, changes, profileId, options) {
|
|
5080
|
+
return this.request(
|
|
5081
|
+
"POST",
|
|
5082
|
+
`/products/${encodeURIComponent(productId)}/addon-groups/${encodeURIComponent(groupId)}`,
|
|
5083
|
+
{ body: changes, ...this.scoped(profileId, options) }
|
|
5084
|
+
);
|
|
5085
|
+
}
|
|
5086
|
+
/**
|
|
5087
|
+
* Remove a group and what it offered. The add-on products themselves stay.
|
|
5088
|
+
* `DELETE /products/{product_id}/addon-groups/{group_id}`
|
|
5089
|
+
*/
|
|
5090
|
+
async deleteAddonGroup(productId, groupId, profileId, options) {
|
|
5091
|
+
return this.request(
|
|
5092
|
+
"DELETE",
|
|
5093
|
+
`/products/${encodeURIComponent(productId)}/addon-groups/${encodeURIComponent(groupId)}`,
|
|
5094
|
+
{ ...this.scoped(profileId, options) }
|
|
5095
|
+
);
|
|
5096
|
+
}
|
|
5097
|
+
// --- bundles ---------------------------------------------------------
|
|
5098
|
+
/**
|
|
5099
|
+
* Replace what a bundle contains. Its pricing mode is fixed at creation;
|
|
5100
|
+
* past purchases keep their own frozen lines.
|
|
5101
|
+
* `POST /products/{product_id}/bundle`
|
|
5102
|
+
*/
|
|
5103
|
+
async replaceBundle(productId, bundle, profileId, options) {
|
|
5104
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}/bundle`, {
|
|
5105
|
+
body: bundle,
|
|
5106
|
+
...this.scoped(profileId, options)
|
|
5107
|
+
});
|
|
5108
|
+
}
|
|
5109
|
+
// --- identity: names and connector references ---------------------
|
|
5110
|
+
/**
|
|
5111
|
+
* Add a name the product goes by. A name it already goes by is returned
|
|
5112
|
+
* as it is; one another product of the shop goes by is refused.
|
|
5113
|
+
* `POST /products/{product_id}/aliases`
|
|
5114
|
+
*/
|
|
5115
|
+
async addAlias(productId, body, profileId, options) {
|
|
5116
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}/aliases`, {
|
|
5117
|
+
body,
|
|
5118
|
+
...this.scoped(profileId, options)
|
|
5119
|
+
});
|
|
5120
|
+
}
|
|
5121
|
+
/**
|
|
5122
|
+
* Remove a name the product goes by. Its current name stays.
|
|
5123
|
+
* `POST /products/{product_id}/aliases/{alias_id}/remove`
|
|
5124
|
+
*/
|
|
5125
|
+
async removeAlias(productId, aliasId, profileId, options) {
|
|
5126
|
+
return this.request(
|
|
5127
|
+
"POST",
|
|
5128
|
+
`/products/${encodeURIComponent(productId)}/aliases/${encodeURIComponent(aliasId)}/remove`,
|
|
5129
|
+
{ ...this.scoped(profileId, options) }
|
|
5130
|
+
);
|
|
5131
|
+
}
|
|
5132
|
+
/**
|
|
5133
|
+
* Tie a connected account's product, or one of its prices, to the product.
|
|
5134
|
+
* Recorded as `manual_id`: the ids are not checked against the account.
|
|
5135
|
+
* `POST /products/{product_id}/connector-references`
|
|
5136
|
+
*/
|
|
5137
|
+
async addConnectorReference(productId, body, profileId, options) {
|
|
5138
|
+
return this.request("POST", `/products/${encodeURIComponent(productId)}/connector-references`, {
|
|
5139
|
+
body,
|
|
5140
|
+
...this.scoped(profileId, options)
|
|
5141
|
+
});
|
|
5142
|
+
}
|
|
5143
|
+
/**
|
|
5144
|
+
* Remove a connected account's product or price from the product.
|
|
5145
|
+
* `POST /products/{product_id}/connector-references/{reference_id}/remove`
|
|
5146
|
+
*/
|
|
5147
|
+
async removeConnectorReference(productId, referenceId, profileId, options) {
|
|
5148
|
+
return this.request(
|
|
5149
|
+
"POST",
|
|
5150
|
+
`/products/${encodeURIComponent(productId)}/connector-references/${encodeURIComponent(referenceId)}/remove`,
|
|
5151
|
+
{ ...this.scoped(profileId, options) }
|
|
5152
|
+
);
|
|
5153
|
+
}
|
|
5154
|
+
/**
|
|
5155
|
+
* One bounded page of a connected billing account's products, to pick an
|
|
5156
|
+
* existing one to tie to a product. Reads only.
|
|
5157
|
+
* `GET /products/import-suggestions`
|
|
5158
|
+
*/
|
|
5159
|
+
async importSuggestions(query, profileId, options) {
|
|
5160
|
+
return this.request("GET", "/products/import-suggestions", {
|
|
5161
|
+
query: { ...query },
|
|
5162
|
+
...this.scoped(profileId, options)
|
|
5163
|
+
});
|
|
5164
|
+
}
|
|
5165
|
+
/**
|
|
5166
|
+
* Tie one of a connected account's existing products (or a price of it) to
|
|
5167
|
+
* the product, verified against a fresh read of the page it was suggested
|
|
5168
|
+
* on — pass the same `limit` and `offset`. Recorded as `map_existing`.
|
|
5169
|
+
* `POST /products/{product_id}/connector-references/import`
|
|
5170
|
+
*/
|
|
5171
|
+
async acceptImport(productId, body, profileId, options) {
|
|
5172
|
+
return this.request(
|
|
5173
|
+
"POST",
|
|
5174
|
+
`/products/${encodeURIComponent(productId)}/connector-references/import`,
|
|
5175
|
+
{ body, ...this.scoped(profileId, options) }
|
|
5176
|
+
);
|
|
5177
|
+
}
|
|
5178
|
+
// --- categories ------------------------------------------------------
|
|
5179
|
+
/**
|
|
5180
|
+
* Add a category to the shop, at the end of its order. File products under
|
|
5181
|
+
* it with `category_id` on `create` or `update`.
|
|
5182
|
+
* `POST /products/categories`
|
|
5183
|
+
*/
|
|
5184
|
+
async createCategory(body, profileId, options) {
|
|
5185
|
+
return this.request("POST", "/products/categories", {
|
|
5186
|
+
body,
|
|
5187
|
+
...this.scoped(profileId, options)
|
|
5188
|
+
});
|
|
5189
|
+
}
|
|
5190
|
+
/**
|
|
5191
|
+
* The shop's categories in order. Archived ones only with
|
|
5192
|
+
* `include_archived`; deleted ones never.
|
|
5193
|
+
* `GET /products/categories/list`
|
|
5194
|
+
*/
|
|
5195
|
+
async listCategories(query, profileId, options) {
|
|
5196
|
+
return this.request("GET", "/products/categories/list", {
|
|
5197
|
+
query: query === void 0 ? void 0 : { ...query },
|
|
5198
|
+
...this.scoped(profileId, options)
|
|
5199
|
+
});
|
|
5200
|
+
}
|
|
5201
|
+
/**
|
|
5202
|
+
* Put the shop's categories in a new order. Name every live category,
|
|
5203
|
+
* archived ones included, exactly once. Returns the categories in their new
|
|
5204
|
+
* order.
|
|
5205
|
+
* `POST /products/categories/reorder`
|
|
5206
|
+
*/
|
|
5207
|
+
async reorderCategories(body, profileId, options) {
|
|
5208
|
+
return this.request("POST", "/products/categories/reorder", {
|
|
5209
|
+
body,
|
|
5210
|
+
...this.scoped(profileId, options)
|
|
5211
|
+
});
|
|
5212
|
+
}
|
|
5213
|
+
/**
|
|
5214
|
+
* Rename a category.
|
|
5215
|
+
* `POST /products/categories/{category_id}`
|
|
5216
|
+
*/
|
|
5217
|
+
async updateCategory(categoryId, changes, profileId, options) {
|
|
5218
|
+
return this.request("POST", `/products/categories/${encodeURIComponent(categoryId)}`, {
|
|
5219
|
+
body: changes,
|
|
5220
|
+
...this.scoped(profileId, options)
|
|
5221
|
+
});
|
|
5222
|
+
}
|
|
5223
|
+
/**
|
|
5224
|
+
* Mark a category deleted. Its products become uncategorized and no payment
|
|
5225
|
+
* changes. Returns the deleted category.
|
|
5226
|
+
* `DELETE /products/categories/{category_id}`
|
|
5227
|
+
*/
|
|
5228
|
+
async deleteCategory(categoryId, profileId, options) {
|
|
5229
|
+
return this.request("DELETE", `/products/categories/${encodeURIComponent(categoryId)}`, {
|
|
5230
|
+
...this.scoped(profileId, options)
|
|
5231
|
+
});
|
|
5232
|
+
}
|
|
5233
|
+
/**
|
|
5234
|
+
* Keep a category with its products, but file no new product under it.
|
|
5235
|
+
* `POST /products/categories/{category_id}/archive`
|
|
5236
|
+
*/
|
|
5237
|
+
async archiveCategory(categoryId, profileId, options) {
|
|
5238
|
+
return this.request("POST", `/products/categories/${encodeURIComponent(categoryId)}/archive`, {
|
|
5239
|
+
...this.scoped(profileId, options)
|
|
5240
|
+
});
|
|
5241
|
+
}
|
|
5242
|
+
/**
|
|
5243
|
+
* Let an archived category take products again.
|
|
5244
|
+
* `POST /products/categories/{category_id}/restore`
|
|
5245
|
+
*/
|
|
5246
|
+
async restoreCategory(categoryId, profileId, options) {
|
|
5247
|
+
return this.request("POST", `/products/categories/${encodeURIComponent(categoryId)}/restore`, {
|
|
5248
|
+
...this.scoped(profileId, options)
|
|
5249
|
+
});
|
|
5250
|
+
}
|
|
5251
|
+
// --- provider import ---------------------------------------------
|
|
5252
|
+
/**
|
|
5253
|
+
* Read a connected billing account's products and say how each relates to
|
|
5254
|
+
* the catalog. Reads only: nothing is written to the provider or the catalog.
|
|
5255
|
+
* `POST /products/import/preview`
|
|
5256
|
+
*/
|
|
5257
|
+
async importPreview(request, profileId, options) {
|
|
5258
|
+
return this.request("POST", "/products/import/preview", {
|
|
5259
|
+
body: request,
|
|
5260
|
+
...this.scoped(profileId, options)
|
|
5261
|
+
});
|
|
5262
|
+
}
|
|
5263
|
+
/**
|
|
5264
|
+
* Create a product for every new item and add the new prices of every
|
|
5265
|
+
* changed one, tied to the provider's ids. Nothing is edited or removed, and
|
|
5266
|
+
* nothing is written to the provider. A failed item is reported with its
|
|
5267
|
+
* reason and can be retried by naming it in `connector_product_ids`.
|
|
5268
|
+
* `POST /products/import/apply`
|
|
5269
|
+
*/
|
|
5270
|
+
async importApply(request, profileId, options) {
|
|
5271
|
+
return this.request("POST", "/products/import/apply", {
|
|
5272
|
+
body: request,
|
|
5273
|
+
...this.scoped(profileId, options)
|
|
5274
|
+
});
|
|
5275
|
+
}
|
|
5276
|
+
/**
|
|
5277
|
+
* The shop's past imports from one connected account, newest first.
|
|
5278
|
+
* `GET /products/import/runs`
|
|
5279
|
+
*/
|
|
5280
|
+
async listImportRuns(merchantConnectorId, profileId, options) {
|
|
5281
|
+
return this.request("GET", "/products/import/runs", {
|
|
5282
|
+
query: { merchant_connector_id: merchantConnectorId },
|
|
5283
|
+
...this.scoped(profileId, options)
|
|
5284
|
+
});
|
|
5285
|
+
}
|
|
5039
5286
|
};
|
|
5040
5287
|
|
|
5041
5288
|
// src/resources/processorCosts.ts
|
|
@@ -5170,6 +5417,16 @@ var CheckoutMethods = class {
|
|
|
5170
5417
|
query: { merchant_id: merchantId }
|
|
5171
5418
|
});
|
|
5172
5419
|
}
|
|
5420
|
+
/**
|
|
5421
|
+
* The same document as {@link retrieve}, on the route that stays open to a
|
|
5422
|
+
* reader of the checkout's appearance while the role's payment-data
|
|
5423
|
+
* visibility is restricted. `GET /checkout-methods/{profile_id}/preview`
|
|
5424
|
+
*/
|
|
5425
|
+
async preview(merchantId, profileId) {
|
|
5426
|
+
return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}/preview`, {
|
|
5427
|
+
query: { merchant_id: merchantId }
|
|
5428
|
+
});
|
|
5429
|
+
}
|
|
5173
5430
|
/**
|
|
5174
5431
|
* Replace the shop's layout. The router refuses an express item that does
|
|
5175
5432
|
* not draw its own button, more than two rows of two in the express strip,
|
|
@@ -10475,4 +10732,4 @@ export {
|
|
|
10475
10732
|
decodeNativePanes,
|
|
10476
10733
|
encodeNativePanes
|
|
10477
10734
|
};
|
|
10478
|
-
//# sourceMappingURL=chunk-
|
|
10735
|
+
//# sourceMappingURL=chunk-LA4KAVRD.js.map
|