@delopay/sdk 0.183.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 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
  *
@@ -5036,6 +5044,89 @@ var Products = class {
5036
5044
  { ...this.scoped(profileId, options) }
5037
5045
  );
5038
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
+ }
5039
5130
  };
5040
5131
 
5041
5132
  // src/resources/processorCosts.ts
@@ -5170,6 +5261,16 @@ var CheckoutMethods = class {
5170
5261
  query: { merchant_id: merchantId }
5171
5262
  });
5172
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
+ }
5173
5274
  /**
5174
5275
  * Replace the shop's layout. The router refuses an express item that does
5175
5276
  * not draw its own button, more than two rows of two in the express strip,
@@ -10475,4 +10576,4 @@ export {
10475
10576
  decodeNativePanes,
10476
10577
  encodeNativePanes
10477
10578
  };
10478
- //# sourceMappingURL=chunk-HITQ3SXH.js.map
10579
+ //# sourceMappingURL=chunk-RH4CX4MU.js.map