@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.js CHANGED
@@ -81,6 +81,7 @@ import {
81
81
  Products,
82
82
  RTL_CHECKOUT_LOCALES,
83
83
  Regions,
84
+ ReplayRetention,
84
85
  Risk,
85
86
  SECTION_ALIASES,
86
87
  STRIPE_FALLBACK_PANE_CATALOG,
@@ -215,7 +216,7 @@ import {
215
216
  validatePanes,
216
217
  verticalGapValue,
217
218
  visibleCustomFields
218
- } from "./chunk-3GSFUNXW.js";
219
+ } from "./chunk-RH4CX4MU.js";
219
220
  export {
220
221
  AIRWALLEX_AUTOFILL_TREATMENTS,
221
222
  AIRWALLEX_CARD_LAYOUTS,
@@ -299,6 +300,7 @@ export {
299
300
  Products,
300
301
  RTL_CHECKOUT_LOCALES,
301
302
  Regions,
303
+ ReplayRetention,
302
304
  Risk,
303
305
  SECTION_ALIASES,
304
306
  STRIPE_FALLBACK_PANE_CATALOG,
package/dist/internal.cjs CHANGED
@@ -115,6 +115,7 @@ __export(internal_exports, {
115
115
  Products: () => Products,
116
116
  RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
117
117
  Regions: () => Regions,
118
+ ReplayRetention: () => ReplayRetention,
118
119
  Risk: () => Risk,
119
120
  SECTION_ALIASES: () => SECTION_ALIASES,
120
121
  STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
@@ -2202,7 +2203,8 @@ var Payments = class {
2202
2203
  /**
2203
2204
  * Create a new payment intent.
2204
2205
  *
2205
- * @param params - Payment creation parameters including amount and currency.
2206
+ * @param params - An explicit amount and currency, or a DeloPay one-time
2207
+ * product whose active price supplies both on the server.
2206
2208
  * @param options - Optional per-call extras: extra `headers` (e.g. an
2207
2209
  * `Idempotency-Key` to make the create safe to retry), a `timeout` override,
2208
2210
  * and an `AbortSignal`.
@@ -2216,6 +2218,16 @@ var Payments = class {
2216
2218
  * );
2217
2219
  * ```
2218
2220
  *
2221
+ * @example Charge the active default price of a shop-owned product without
2222
+ * copying the product to the payment provider:
2223
+ * ```typescript
2224
+ * const payment = await delopay.payments.create({
2225
+ * product_id: 'prd_123',
2226
+ * profile_id: 'pro_123',
2227
+ * payment_link: true,
2228
+ * });
2229
+ * ```
2230
+ *
2219
2231
  * @example Send `test_mode` to pick the environment per payment, so a staging
2220
2232
  * deploy cannot charge real cards and a forgotten processor toggle cannot
2221
2233
  * swallow production traffic:
@@ -2269,6 +2281,10 @@ var Payments = class {
2269
2281
  if (Object.keys(query).length === 0) return this.request("GET", path);
2270
2282
  return this.request("GET", path, { query });
2271
2283
  }
2284
+ /** Product names and prices as frozen when the payment was created. */
2285
+ async productLines(paymentId) {
2286
+ return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/lines`);
2287
+ }
2272
2288
  /**
2273
2289
  * List every attempt made on a payment, each with its full failure detail
2274
2290
  * (`error_code` / `error_message`, the Delopay-unified `unified_code` and
@@ -4223,6 +4239,14 @@ var Users = class {
4223
4239
  async listUserRoles(params) {
4224
4240
  return this.request("POST", "/user/employees", { body: params });
4225
4241
  }
4242
+ /**
4243
+ * The current role's explicit payment-data policy, or `null` when the role
4244
+ * retains its pre-control access. A dashboard hint: every API response
4245
+ * enforces the same policy on its own. `GET /user/role/payment-visibility`
4246
+ */
4247
+ async getRolePaymentVisibility() {
4248
+ return this.request("GET", "/user/role/payment-visibility");
4249
+ }
4226
4250
  /**
4227
4251
  * Change a team member's role. `POST /user/employees/update-role`
4228
4252
  *
@@ -5153,6 +5177,16 @@ var Products = class {
5153
5177
  scoped(profileId, options) {
5154
5178
  return { ...options, headers: { "X-Profile-Id": profileId, ...options?.headers } };
5155
5179
  }
5180
+ /** Upload a PNG, JPEG or WebP image to the merchant CDN. Save the returned
5181
+ * URL in a product create or update request; upload alone changes no product. */
5182
+ async uploadImage(file, profileId, options) {
5183
+ const form = new FormData();
5184
+ form.append("file", file);
5185
+ return this.request("POST", "/products/images", {
5186
+ body: form,
5187
+ ...this.scoped(profileId, options)
5188
+ });
5189
+ }
5156
5190
  /**
5157
5191
  * Create a product together with its prices.
5158
5192
  * `POST /products`
@@ -5221,6 +5255,13 @@ var Products = class {
5221
5255
  ...this.scoped(profileId, options)
5222
5256
  });
5223
5257
  }
5258
+ /** Mark an archived product deleted. Historical payment lines keep
5259
+ * their own immutable purchase snapshots, and the catalog row remains stored. */
5260
+ async delete(productId, profileId, options) {
5261
+ return this.request("DELETE", `/products/${encodeURIComponent(productId)}`, {
5262
+ ...this.scoped(profileId, options)
5263
+ });
5264
+ }
5224
5265
  /**
5225
5266
  * Add a price to an existing product.
5226
5267
  * `POST /products/{product_id}/prices`
@@ -5258,6 +5299,89 @@ var Products = class {
5258
5299
  { ...this.scoped(profileId, options) }
5259
5300
  );
5260
5301
  }
5302
+ // --- add-on selection groups ---------------------------------------
5303
+ /**
5304
+ * Add a group of optional extras to a one-time product, with how many of
5305
+ * them a buyer must and may choose. Each add-on is an active product of kind
5306
+ * `addon` in the same shop. Returns the whole product.
5307
+ * `POST /products/{product_id}/addon-groups`
5308
+ */
5309
+ async createAddonGroup(productId, group, profileId, options) {
5310
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/addon-groups`, {
5311
+ body: group,
5312
+ ...this.scoped(profileId, options)
5313
+ });
5314
+ }
5315
+ /**
5316
+ * Change a group's name, bounds, or the add-ons it offers; a new list
5317
+ * replaces the old one whole.
5318
+ * `POST /products/{product_id}/addon-groups/{group_id}`
5319
+ */
5320
+ async updateAddonGroup(productId, groupId, changes, profileId, options) {
5321
+ return this.request(
5322
+ "POST",
5323
+ `/products/${encodeURIComponent(productId)}/addon-groups/${encodeURIComponent(groupId)}`,
5324
+ { body: changes, ...this.scoped(profileId, options) }
5325
+ );
5326
+ }
5327
+ /**
5328
+ * Remove a group and what it offered. The add-on products themselves stay.
5329
+ * `DELETE /products/{product_id}/addon-groups/{group_id}`
5330
+ */
5331
+ async deleteAddonGroup(productId, groupId, profileId, options) {
5332
+ return this.request(
5333
+ "DELETE",
5334
+ `/products/${encodeURIComponent(productId)}/addon-groups/${encodeURIComponent(groupId)}`,
5335
+ { ...this.scoped(profileId, options) }
5336
+ );
5337
+ }
5338
+ // --- bundles ---------------------------------------------------------
5339
+ /**
5340
+ * Replace what a bundle contains. Its pricing mode is fixed at creation;
5341
+ * past purchases keep their own frozen lines.
5342
+ * `POST /products/{product_id}/bundle`
5343
+ */
5344
+ async replaceBundle(productId, bundle, profileId, options) {
5345
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/bundle`, {
5346
+ body: bundle,
5347
+ ...this.scoped(profileId, options)
5348
+ });
5349
+ }
5350
+ // --- provider import ---------------------------------------------
5351
+ /**
5352
+ * Read a connected billing account's products and say how each relates to
5353
+ * the catalog. Reads only: nothing is written to the provider or the catalog.
5354
+ * `POST /products/import/preview`
5355
+ */
5356
+ async importPreview(request, profileId, options) {
5357
+ return this.request("POST", "/products/import/preview", {
5358
+ body: request,
5359
+ ...this.scoped(profileId, options)
5360
+ });
5361
+ }
5362
+ /**
5363
+ * Create a product for every new item and add the new prices of every
5364
+ * changed one, tied to the provider's ids. Nothing is edited or removed, and
5365
+ * nothing is written to the provider. A failed item is reported with its
5366
+ * reason and can be retried by naming it in `connector_product_ids`.
5367
+ * `POST /products/import/apply`
5368
+ */
5369
+ async importApply(request, profileId, options) {
5370
+ return this.request("POST", "/products/import/apply", {
5371
+ body: request,
5372
+ ...this.scoped(profileId, options)
5373
+ });
5374
+ }
5375
+ /**
5376
+ * The shop's past imports from one connected account, newest first.
5377
+ * `GET /products/import/runs`
5378
+ */
5379
+ async listImportRuns(merchantConnectorId, profileId, options) {
5380
+ return this.request("GET", "/products/import/runs", {
5381
+ query: { merchant_connector_id: merchantConnectorId },
5382
+ ...this.scoped(profileId, options)
5383
+ });
5384
+ }
5261
5385
  };
5262
5386
 
5263
5387
  // src/resources/processorCosts.ts
@@ -5392,6 +5516,16 @@ var CheckoutMethods = class {
5392
5516
  query: { merchant_id: merchantId }
5393
5517
  });
5394
5518
  }
5519
+ /**
5520
+ * The same document as {@link retrieve}, on the route that stays open to a
5521
+ * reader of the checkout's appearance while the role's payment-data
5522
+ * visibility is restricted. `GET /checkout-methods/{profile_id}/preview`
5523
+ */
5524
+ async preview(merchantId, profileId) {
5525
+ return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}/preview`, {
5526
+ query: { merchant_id: merchantId }
5527
+ });
5528
+ }
5395
5529
  /**
5396
5530
  * Replace the shop's layout. The router refuses an express item that does
5397
5531
  * not draw its own button, more than two rows of two in the express strip,
@@ -6207,6 +6341,85 @@ var OperationLimits = class {
6207
6341
  }
6208
6342
  };
6209
6343
 
6344
+ // src/resources/replayRetention.ts
6345
+ var ReplayRetention = class {
6346
+ constructor(request) {
6347
+ this.request = request;
6348
+ }
6349
+ /**
6350
+ * Every level that is set for the caller's merchant, plus the global level
6351
+ * when one is set.
6352
+ *
6353
+ * `GET /replay-retention`
6354
+ */
6355
+ async list() {
6356
+ return this.request("GET", "/replay-retention");
6357
+ }
6358
+ /**
6359
+ * What applies to one shop's recordings, and which level decided.
6360
+ *
6361
+ * `GET /replay-retention/shops/{profileId}/effective`
6362
+ */
6363
+ async effective(profileId) {
6364
+ return this.request(
6365
+ "GET",
6366
+ `/replay-retention/shops/${encodeURIComponent(profileId)}/effective`
6367
+ );
6368
+ }
6369
+ /**
6370
+ * Set the merchant-wide level.
6371
+ *
6372
+ * `PUT /replay-retention/merchant`
6373
+ */
6374
+ async setMerchant(params) {
6375
+ return this.request("PUT", "/replay-retention/merchant", { body: params });
6376
+ }
6377
+ /**
6378
+ * Hand the merchant-wide level back to the global one.
6379
+ *
6380
+ * `DELETE /replay-retention/merchant`
6381
+ */
6382
+ async clearMerchant() {
6383
+ await this.request("DELETE", "/replay-retention/merchant");
6384
+ }
6385
+ /**
6386
+ * Set one project's level.
6387
+ *
6388
+ * `PUT /replay-retention/projects/{projectId}`
6389
+ */
6390
+ async setProject(projectId, params) {
6391
+ return this.request("PUT", `/replay-retention/projects/${encodeURIComponent(projectId)}`, {
6392
+ body: params
6393
+ });
6394
+ }
6395
+ /**
6396
+ * Hand one project's level back to the merchant's.
6397
+ *
6398
+ * `DELETE /replay-retention/projects/{projectId}`
6399
+ */
6400
+ async clearProject(projectId) {
6401
+ await this.request("DELETE", `/replay-retention/projects/${encodeURIComponent(projectId)}`);
6402
+ }
6403
+ /**
6404
+ * Set one shop's level. A shop-scoped caller may set only its own shop.
6405
+ *
6406
+ * `PUT /replay-retention/shops/{profileId}`
6407
+ */
6408
+ async setShop(profileId, params) {
6409
+ return this.request("PUT", `/replay-retention/shops/${encodeURIComponent(profileId)}`, {
6410
+ body: params
6411
+ });
6412
+ }
6413
+ /**
6414
+ * Hand one shop's level back to its project's (or the merchant's).
6415
+ *
6416
+ * `DELETE /replay-retention/shops/{profileId}`
6417
+ */
6418
+ async clearShop(profileId) {
6419
+ await this.request("DELETE", `/replay-retention/shops/${encodeURIComponent(profileId)}`);
6420
+ }
6421
+ };
6422
+
6210
6423
  // src/resources/risk.ts
6211
6424
  var Risk = class {
6212
6425
  constructor(request) {
@@ -6468,6 +6681,7 @@ var Delopay = class {
6468
6681
  this.audit = new Audit(request);
6469
6682
  this.settlement = new Settlement(request);
6470
6683
  this.operationLimits = new OperationLimits(request);
6684
+ this.replayRetention = new ReplayRetention(request);
6471
6685
  this.risk = new Risk(request);
6472
6686
  this.subscriptions = new Subscriptions(request);
6473
6687
  this.files = new Files(request);
@@ -10475,6 +10689,13 @@ var AdminPortal = class {
10475
10689
  async getTransaction(paymentId) {
10476
10690
  return this.request("GET", `/admin-portal/transactions/${encodeURIComponent(paymentId)}`);
10477
10691
  }
10692
+ /** The same frozen purchase lines available on the merchant payment read. */
10693
+ async getTransactionProductLines(paymentId) {
10694
+ return this.request(
10695
+ "GET",
10696
+ `/admin-portal/transactions/${encodeURIComponent(paymentId)}/product-lines`
10697
+ );
10698
+ }
10478
10699
  /**
10479
10700
  * Per-attempt history (retries across connectors, decline reasons) for a
10480
10701
  * single transaction of ANY merchant.
@@ -10862,6 +11083,35 @@ var AdminPortal = class {
10862
11083
  { body: params }
10863
11084
  );
10864
11085
  }
11086
+ /**
11087
+ * The deployment's checkout-recording retention level — the outermost of
11088
+ * the four. A list of zero or one: empty means the global level is unset,
11089
+ * and a merchant that sets nothing of its own keeps recordings forever.
11090
+ *
11091
+ * `GET /admin-portal/replay-retention`
11092
+ */
11093
+ async getReplayRetention() {
11094
+ return this.request("GET", "/admin-portal/replay-retention");
11095
+ }
11096
+ /**
11097
+ * Set the deployment's checkout-recording retention level.
11098
+ * `retention_days: null` stores an explicit *keep forever*, which a
11099
+ * merchant, project or shop level can still override.
11100
+ *
11101
+ * `PUT /admin-portal/replay-retention`
11102
+ */
11103
+ async setReplayRetention(params) {
11104
+ return this.request("PUT", "/admin-portal/replay-retention", { body: params });
11105
+ }
11106
+ /**
11107
+ * Unset the deployment's retention level. Merchants that set nothing of
11108
+ * their own are back to recordings being kept forever.
11109
+ *
11110
+ * `DELETE /admin-portal/replay-retention`
11111
+ */
11112
+ async clearReplayRetention() {
11113
+ await this.request("DELETE", "/admin-portal/replay-retention");
11114
+ }
10865
11115
  /**
10866
11116
  * Soft-delete a transaction of ANY merchant. Only payments whose status
10867
11117
  * is in the admin delete policy can be deleted; the action is audited.
@@ -11963,6 +12213,7 @@ var DelopayInternal = class extends Delopay {
11963
12213
  Products,
11964
12214
  RTL_CHECKOUT_LOCALES,
11965
12215
  Regions,
12216
+ ReplayRetention,
11966
12217
  Risk,
11967
12218
  SECTION_ALIASES,
11968
12219
  STRIPE_FALLBACK_PANE_CATALOG,