@delopay/sdk 0.182.0 → 0.183.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/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
@@ -5153,6 +5169,16 @@ var Products = class {
5153
5169
  scoped(profileId, options) {
5154
5170
  return { ...options, headers: { "X-Profile-Id": profileId, ...options?.headers } };
5155
5171
  }
5172
+ /** Upload a PNG, JPEG or WebP image to the merchant CDN. Save the returned
5173
+ * URL in a product create or update request; upload alone changes no product. */
5174
+ async uploadImage(file, profileId, options) {
5175
+ const form = new FormData();
5176
+ form.append("file", file);
5177
+ return this.request("POST", "/products/images", {
5178
+ body: form,
5179
+ ...this.scoped(profileId, options)
5180
+ });
5181
+ }
5156
5182
  /**
5157
5183
  * Create a product together with its prices.
5158
5184
  * `POST /products`
@@ -5221,6 +5247,13 @@ var Products = class {
5221
5247
  ...this.scoped(profileId, options)
5222
5248
  });
5223
5249
  }
5250
+ /** Mark an archived product deleted. Historical payment lines keep
5251
+ * their own immutable purchase snapshots, and the catalog row remains stored. */
5252
+ async delete(productId, profileId, options) {
5253
+ return this.request("DELETE", `/products/${encodeURIComponent(productId)}`, {
5254
+ ...this.scoped(profileId, options)
5255
+ });
5256
+ }
5224
5257
  /**
5225
5258
  * Add a price to an existing product.
5226
5259
  * `POST /products/{product_id}/prices`
@@ -6207,6 +6240,85 @@ var OperationLimits = class {
6207
6240
  }
6208
6241
  };
6209
6242
 
6243
+ // src/resources/replayRetention.ts
6244
+ var ReplayRetention = class {
6245
+ constructor(request) {
6246
+ this.request = request;
6247
+ }
6248
+ /**
6249
+ * Every level that is set for the caller's merchant, plus the global level
6250
+ * when one is set.
6251
+ *
6252
+ * `GET /replay-retention`
6253
+ */
6254
+ async list() {
6255
+ return this.request("GET", "/replay-retention");
6256
+ }
6257
+ /**
6258
+ * What applies to one shop's recordings, and which level decided.
6259
+ *
6260
+ * `GET /replay-retention/shops/{profileId}/effective`
6261
+ */
6262
+ async effective(profileId) {
6263
+ return this.request(
6264
+ "GET",
6265
+ `/replay-retention/shops/${encodeURIComponent(profileId)}/effective`
6266
+ );
6267
+ }
6268
+ /**
6269
+ * Set the merchant-wide level.
6270
+ *
6271
+ * `PUT /replay-retention/merchant`
6272
+ */
6273
+ async setMerchant(params) {
6274
+ return this.request("PUT", "/replay-retention/merchant", { body: params });
6275
+ }
6276
+ /**
6277
+ * Hand the merchant-wide level back to the global one.
6278
+ *
6279
+ * `DELETE /replay-retention/merchant`
6280
+ */
6281
+ async clearMerchant() {
6282
+ await this.request("DELETE", "/replay-retention/merchant");
6283
+ }
6284
+ /**
6285
+ * Set one project's level.
6286
+ *
6287
+ * `PUT /replay-retention/projects/{projectId}`
6288
+ */
6289
+ async setProject(projectId, params) {
6290
+ return this.request("PUT", `/replay-retention/projects/${encodeURIComponent(projectId)}`, {
6291
+ body: params
6292
+ });
6293
+ }
6294
+ /**
6295
+ * Hand one project's level back to the merchant's.
6296
+ *
6297
+ * `DELETE /replay-retention/projects/{projectId}`
6298
+ */
6299
+ async clearProject(projectId) {
6300
+ await this.request("DELETE", `/replay-retention/projects/${encodeURIComponent(projectId)}`);
6301
+ }
6302
+ /**
6303
+ * Set one shop's level. A shop-scoped caller may set only its own shop.
6304
+ *
6305
+ * `PUT /replay-retention/shops/{profileId}`
6306
+ */
6307
+ async setShop(profileId, params) {
6308
+ return this.request("PUT", `/replay-retention/shops/${encodeURIComponent(profileId)}`, {
6309
+ body: params
6310
+ });
6311
+ }
6312
+ /**
6313
+ * Hand one shop's level back to its project's (or the merchant's).
6314
+ *
6315
+ * `DELETE /replay-retention/shops/{profileId}`
6316
+ */
6317
+ async clearShop(profileId) {
6318
+ await this.request("DELETE", `/replay-retention/shops/${encodeURIComponent(profileId)}`);
6319
+ }
6320
+ };
6321
+
6210
6322
  // src/resources/risk.ts
6211
6323
  var Risk = class {
6212
6324
  constructor(request) {
@@ -6468,6 +6580,7 @@ var Delopay = class {
6468
6580
  this.audit = new Audit(request);
6469
6581
  this.settlement = new Settlement(request);
6470
6582
  this.operationLimits = new OperationLimits(request);
6583
+ this.replayRetention = new ReplayRetention(request);
6471
6584
  this.risk = new Risk(request);
6472
6585
  this.subscriptions = new Subscriptions(request);
6473
6586
  this.files = new Files(request);
@@ -10475,6 +10588,13 @@ var AdminPortal = class {
10475
10588
  async getTransaction(paymentId) {
10476
10589
  return this.request("GET", `/admin-portal/transactions/${encodeURIComponent(paymentId)}`);
10477
10590
  }
10591
+ /** The same frozen purchase lines available on the merchant payment read. */
10592
+ async getTransactionProductLines(paymentId) {
10593
+ return this.request(
10594
+ "GET",
10595
+ `/admin-portal/transactions/${encodeURIComponent(paymentId)}/product-lines`
10596
+ );
10597
+ }
10478
10598
  /**
10479
10599
  * Per-attempt history (retries across connectors, decline reasons) for a
10480
10600
  * single transaction of ANY merchant.
@@ -10862,6 +10982,35 @@ var AdminPortal = class {
10862
10982
  { body: params }
10863
10983
  );
10864
10984
  }
10985
+ /**
10986
+ * The deployment's checkout-recording retention level — the outermost of
10987
+ * the four. A list of zero or one: empty means the global level is unset,
10988
+ * and a merchant that sets nothing of its own keeps recordings forever.
10989
+ *
10990
+ * `GET /admin-portal/replay-retention`
10991
+ */
10992
+ async getReplayRetention() {
10993
+ return this.request("GET", "/admin-portal/replay-retention");
10994
+ }
10995
+ /**
10996
+ * Set the deployment's checkout-recording retention level.
10997
+ * `retention_days: null` stores an explicit *keep forever*, which a
10998
+ * merchant, project or shop level can still override.
10999
+ *
11000
+ * `PUT /admin-portal/replay-retention`
11001
+ */
11002
+ async setReplayRetention(params) {
11003
+ return this.request("PUT", "/admin-portal/replay-retention", { body: params });
11004
+ }
11005
+ /**
11006
+ * Unset the deployment's retention level. Merchants that set nothing of
11007
+ * their own are back to recordings being kept forever.
11008
+ *
11009
+ * `DELETE /admin-portal/replay-retention`
11010
+ */
11011
+ async clearReplayRetention() {
11012
+ await this.request("DELETE", "/admin-portal/replay-retention");
11013
+ }
10865
11014
  /**
10866
11015
  * Soft-delete a transaction of ANY merchant. Only payments whose status
10867
11016
  * is in the admin delete policy can be deleted; the action is audited.
@@ -11963,6 +12112,7 @@ var DelopayInternal = class extends Delopay {
11963
12112
  Products,
11964
12113
  RTL_CHECKOUT_LOCALES,
11965
12114
  Regions,
12115
+ ReplayRetention,
11966
12116
  Risk,
11967
12117
  SECTION_ALIASES,
11968
12118
  STRIPE_FALLBACK_PANE_CATALOG,