@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/dist/index.cjs CHANGED
@@ -102,6 +102,7 @@ __export(index_exports, {
102
102
  Products: () => Products,
103
103
  RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
104
104
  Regions: () => Regions,
105
+ ReplayRetention: () => ReplayRetention,
105
106
  Risk: () => Risk,
106
107
  SECTION_ALIASES: () => SECTION_ALIASES,
107
108
  STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
@@ -2189,7 +2190,8 @@ var Payments = class {
2189
2190
  /**
2190
2191
  * Create a new payment intent.
2191
2192
  *
2192
- * @param params - Payment creation parameters including amount and currency.
2193
+ * @param params - An explicit amount and currency, or a DeloPay one-time
2194
+ * product whose active price supplies both on the server.
2193
2195
  * @param options - Optional per-call extras: extra `headers` (e.g. an
2194
2196
  * `Idempotency-Key` to make the create safe to retry), a `timeout` override,
2195
2197
  * and an `AbortSignal`.
@@ -2203,6 +2205,16 @@ var Payments = class {
2203
2205
  * );
2204
2206
  * ```
2205
2207
  *
2208
+ * @example Charge the active default price of a shop-owned product without
2209
+ * copying the product to the payment provider:
2210
+ * ```typescript
2211
+ * const payment = await delopay.payments.create({
2212
+ * product_id: 'prd_123',
2213
+ * profile_id: 'pro_123',
2214
+ * payment_link: true,
2215
+ * });
2216
+ * ```
2217
+ *
2206
2218
  * @example Send `test_mode` to pick the environment per payment, so a staging
2207
2219
  * deploy cannot charge real cards and a forgotten processor toggle cannot
2208
2220
  * swallow production traffic:
@@ -2256,6 +2268,10 @@ var Payments = class {
2256
2268
  if (Object.keys(query).length === 0) return this.request("GET", path);
2257
2269
  return this.request("GET", path, { query });
2258
2270
  }
2271
+ /** Product names and prices as frozen when the payment was created. */
2272
+ async productLines(paymentId) {
2273
+ return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/lines`);
2274
+ }
2259
2275
  /**
2260
2276
  * List every attempt made on a payment, each with its full failure detail
2261
2277
  * (`error_code` / `error_message`, the Delopay-unified `unified_code` and
@@ -4210,6 +4226,14 @@ var Users = class {
4210
4226
  async listUserRoles(params) {
4211
4227
  return this.request("POST", "/user/employees", { body: params });
4212
4228
  }
4229
+ /**
4230
+ * The current role's explicit payment-data policy, or `null` when the role
4231
+ * retains its pre-control access. A dashboard hint: every API response
4232
+ * enforces the same policy on its own. `GET /user/role/payment-visibility`
4233
+ */
4234
+ async getRolePaymentVisibility() {
4235
+ return this.request("GET", "/user/role/payment-visibility");
4236
+ }
4213
4237
  /**
4214
4238
  * Change a team member's role. `POST /user/employees/update-role`
4215
4239
  *
@@ -5140,6 +5164,16 @@ var Products = class {
5140
5164
  scoped(profileId, options) {
5141
5165
  return { ...options, headers: { "X-Profile-Id": profileId, ...options?.headers } };
5142
5166
  }
5167
+ /** Upload a PNG, JPEG or WebP image to the merchant CDN. Save the returned
5168
+ * URL in a product create or update request; upload alone changes no product. */
5169
+ async uploadImage(file, profileId, options) {
5170
+ const form = new FormData();
5171
+ form.append("file", file);
5172
+ return this.request("POST", "/products/images", {
5173
+ body: form,
5174
+ ...this.scoped(profileId, options)
5175
+ });
5176
+ }
5143
5177
  /**
5144
5178
  * Create a product together with its prices.
5145
5179
  * `POST /products`
@@ -5208,6 +5242,13 @@ var Products = class {
5208
5242
  ...this.scoped(profileId, options)
5209
5243
  });
5210
5244
  }
5245
+ /** Mark an archived product deleted. Historical payment lines keep
5246
+ * their own immutable purchase snapshots, and the catalog row remains stored. */
5247
+ async delete(productId, profileId, options) {
5248
+ return this.request("DELETE", `/products/${encodeURIComponent(productId)}`, {
5249
+ ...this.scoped(profileId, options)
5250
+ });
5251
+ }
5211
5252
  /**
5212
5253
  * Add a price to an existing product.
5213
5254
  * `POST /products/{product_id}/prices`
@@ -5245,6 +5286,89 @@ var Products = class {
5245
5286
  { ...this.scoped(profileId, options) }
5246
5287
  );
5247
5288
  }
5289
+ // --- add-on selection groups ---------------------------------------
5290
+ /**
5291
+ * Add a group of optional extras to a one-time product, with how many of
5292
+ * them a buyer must and may choose. Each add-on is an active product of kind
5293
+ * `addon` in the same shop. Returns the whole product.
5294
+ * `POST /products/{product_id}/addon-groups`
5295
+ */
5296
+ async createAddonGroup(productId, group, profileId, options) {
5297
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/addon-groups`, {
5298
+ body: group,
5299
+ ...this.scoped(profileId, options)
5300
+ });
5301
+ }
5302
+ /**
5303
+ * Change a group's name, bounds, or the add-ons it offers; a new list
5304
+ * replaces the old one whole.
5305
+ * `POST /products/{product_id}/addon-groups/{group_id}`
5306
+ */
5307
+ async updateAddonGroup(productId, groupId, changes, profileId, options) {
5308
+ return this.request(
5309
+ "POST",
5310
+ `/products/${encodeURIComponent(productId)}/addon-groups/${encodeURIComponent(groupId)}`,
5311
+ { body: changes, ...this.scoped(profileId, options) }
5312
+ );
5313
+ }
5314
+ /**
5315
+ * Remove a group and what it offered. The add-on products themselves stay.
5316
+ * `DELETE /products/{product_id}/addon-groups/{group_id}`
5317
+ */
5318
+ async deleteAddonGroup(productId, groupId, profileId, options) {
5319
+ return this.request(
5320
+ "DELETE",
5321
+ `/products/${encodeURIComponent(productId)}/addon-groups/${encodeURIComponent(groupId)}`,
5322
+ { ...this.scoped(profileId, options) }
5323
+ );
5324
+ }
5325
+ // --- bundles ---------------------------------------------------------
5326
+ /**
5327
+ * Replace what a bundle contains. Its pricing mode is fixed at creation;
5328
+ * past purchases keep their own frozen lines.
5329
+ * `POST /products/{product_id}/bundle`
5330
+ */
5331
+ async replaceBundle(productId, bundle, profileId, options) {
5332
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/bundle`, {
5333
+ body: bundle,
5334
+ ...this.scoped(profileId, options)
5335
+ });
5336
+ }
5337
+ // --- provider import ---------------------------------------------
5338
+ /**
5339
+ * Read a connected billing account's products and say how each relates to
5340
+ * the catalog. Reads only: nothing is written to the provider or the catalog.
5341
+ * `POST /products/import/preview`
5342
+ */
5343
+ async importPreview(request, profileId, options) {
5344
+ return this.request("POST", "/products/import/preview", {
5345
+ body: request,
5346
+ ...this.scoped(profileId, options)
5347
+ });
5348
+ }
5349
+ /**
5350
+ * Create a product for every new item and add the new prices of every
5351
+ * changed one, tied to the provider's ids. Nothing is edited or removed, and
5352
+ * nothing is written to the provider. A failed item is reported with its
5353
+ * reason and can be retried by naming it in `connector_product_ids`.
5354
+ * `POST /products/import/apply`
5355
+ */
5356
+ async importApply(request, profileId, options) {
5357
+ return this.request("POST", "/products/import/apply", {
5358
+ body: request,
5359
+ ...this.scoped(profileId, options)
5360
+ });
5361
+ }
5362
+ /**
5363
+ * The shop's past imports from one connected account, newest first.
5364
+ * `GET /products/import/runs`
5365
+ */
5366
+ async listImportRuns(merchantConnectorId, profileId, options) {
5367
+ return this.request("GET", "/products/import/runs", {
5368
+ query: { merchant_connector_id: merchantConnectorId },
5369
+ ...this.scoped(profileId, options)
5370
+ });
5371
+ }
5248
5372
  };
5249
5373
 
5250
5374
  // src/resources/processorCosts.ts
@@ -5379,6 +5503,16 @@ var CheckoutMethods = class {
5379
5503
  query: { merchant_id: merchantId }
5380
5504
  });
5381
5505
  }
5506
+ /**
5507
+ * The same document as {@link retrieve}, on the route that stays open to a
5508
+ * reader of the checkout's appearance while the role's payment-data
5509
+ * visibility is restricted. `GET /checkout-methods/{profile_id}/preview`
5510
+ */
5511
+ async preview(merchantId, profileId) {
5512
+ return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}/preview`, {
5513
+ query: { merchant_id: merchantId }
5514
+ });
5515
+ }
5382
5516
  /**
5383
5517
  * Replace the shop's layout. The router refuses an express item that does
5384
5518
  * not draw its own button, more than two rows of two in the express strip,
@@ -6194,6 +6328,85 @@ var OperationLimits = class {
6194
6328
  }
6195
6329
  };
6196
6330
 
6331
+ // src/resources/replayRetention.ts
6332
+ var ReplayRetention = class {
6333
+ constructor(request) {
6334
+ this.request = request;
6335
+ }
6336
+ /**
6337
+ * Every level that is set for the caller's merchant, plus the global level
6338
+ * when one is set.
6339
+ *
6340
+ * `GET /replay-retention`
6341
+ */
6342
+ async list() {
6343
+ return this.request("GET", "/replay-retention");
6344
+ }
6345
+ /**
6346
+ * What applies to one shop's recordings, and which level decided.
6347
+ *
6348
+ * `GET /replay-retention/shops/{profileId}/effective`
6349
+ */
6350
+ async effective(profileId) {
6351
+ return this.request(
6352
+ "GET",
6353
+ `/replay-retention/shops/${encodeURIComponent(profileId)}/effective`
6354
+ );
6355
+ }
6356
+ /**
6357
+ * Set the merchant-wide level.
6358
+ *
6359
+ * `PUT /replay-retention/merchant`
6360
+ */
6361
+ async setMerchant(params) {
6362
+ return this.request("PUT", "/replay-retention/merchant", { body: params });
6363
+ }
6364
+ /**
6365
+ * Hand the merchant-wide level back to the global one.
6366
+ *
6367
+ * `DELETE /replay-retention/merchant`
6368
+ */
6369
+ async clearMerchant() {
6370
+ await this.request("DELETE", "/replay-retention/merchant");
6371
+ }
6372
+ /**
6373
+ * Set one project's level.
6374
+ *
6375
+ * `PUT /replay-retention/projects/{projectId}`
6376
+ */
6377
+ async setProject(projectId, params) {
6378
+ return this.request("PUT", `/replay-retention/projects/${encodeURIComponent(projectId)}`, {
6379
+ body: params
6380
+ });
6381
+ }
6382
+ /**
6383
+ * Hand one project's level back to the merchant's.
6384
+ *
6385
+ * `DELETE /replay-retention/projects/{projectId}`
6386
+ */
6387
+ async clearProject(projectId) {
6388
+ await this.request("DELETE", `/replay-retention/projects/${encodeURIComponent(projectId)}`);
6389
+ }
6390
+ /**
6391
+ * Set one shop's level. A shop-scoped caller may set only its own shop.
6392
+ *
6393
+ * `PUT /replay-retention/shops/{profileId}`
6394
+ */
6395
+ async setShop(profileId, params) {
6396
+ return this.request("PUT", `/replay-retention/shops/${encodeURIComponent(profileId)}`, {
6397
+ body: params
6398
+ });
6399
+ }
6400
+ /**
6401
+ * Hand one shop's level back to its project's (or the merchant's).
6402
+ *
6403
+ * `DELETE /replay-retention/shops/{profileId}`
6404
+ */
6405
+ async clearShop(profileId) {
6406
+ await this.request("DELETE", `/replay-retention/shops/${encodeURIComponent(profileId)}`);
6407
+ }
6408
+ };
6409
+
6197
6410
  // src/resources/risk.ts
6198
6411
  var Risk = class {
6199
6412
  constructor(request) {
@@ -6455,6 +6668,7 @@ var Delopay = class {
6455
6668
  this.audit = new Audit(request);
6456
6669
  this.settlement = new Settlement(request);
6457
6670
  this.operationLimits = new OperationLimits(request);
6671
+ this.replayRetention = new ReplayRetention(request);
6458
6672
  this.risk = new Risk(request);
6459
6673
  this.subscriptions = new Subscriptions(request);
6460
6674
  this.files = new Files(request);
@@ -10467,6 +10681,7 @@ var encodeNativePanes = encodePanes;
10467
10681
  Products,
10468
10682
  RTL_CHECKOUT_LOCALES,
10469
10683
  Regions,
10684
+ ReplayRetention,
10470
10685
  Risk,
10471
10686
  SECTION_ALIASES,
10472
10687
  STRIPE_FALLBACK_PANE_CATALOG,