@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/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
@@ -5140,6 +5156,16 @@ var Products = class {
5140
5156
  scoped(profileId, options) {
5141
5157
  return { ...options, headers: { "X-Profile-Id": profileId, ...options?.headers } };
5142
5158
  }
5159
+ /** Upload a PNG, JPEG or WebP image to the merchant CDN. Save the returned
5160
+ * URL in a product create or update request; upload alone changes no product. */
5161
+ async uploadImage(file, profileId, options) {
5162
+ const form = new FormData();
5163
+ form.append("file", file);
5164
+ return this.request("POST", "/products/images", {
5165
+ body: form,
5166
+ ...this.scoped(profileId, options)
5167
+ });
5168
+ }
5143
5169
  /**
5144
5170
  * Create a product together with its prices.
5145
5171
  * `POST /products`
@@ -5208,6 +5234,13 @@ var Products = class {
5208
5234
  ...this.scoped(profileId, options)
5209
5235
  });
5210
5236
  }
5237
+ /** Mark an archived product deleted. Historical payment lines keep
5238
+ * their own immutable purchase snapshots, and the catalog row remains stored. */
5239
+ async delete(productId, profileId, options) {
5240
+ return this.request("DELETE", `/products/${encodeURIComponent(productId)}`, {
5241
+ ...this.scoped(profileId, options)
5242
+ });
5243
+ }
5211
5244
  /**
5212
5245
  * Add a price to an existing product.
5213
5246
  * `POST /products/{product_id}/prices`
@@ -6194,6 +6227,85 @@ var OperationLimits = class {
6194
6227
  }
6195
6228
  };
6196
6229
 
6230
+ // src/resources/replayRetention.ts
6231
+ var ReplayRetention = class {
6232
+ constructor(request) {
6233
+ this.request = request;
6234
+ }
6235
+ /**
6236
+ * Every level that is set for the caller's merchant, plus the global level
6237
+ * when one is set.
6238
+ *
6239
+ * `GET /replay-retention`
6240
+ */
6241
+ async list() {
6242
+ return this.request("GET", "/replay-retention");
6243
+ }
6244
+ /**
6245
+ * What applies to one shop's recordings, and which level decided.
6246
+ *
6247
+ * `GET /replay-retention/shops/{profileId}/effective`
6248
+ */
6249
+ async effective(profileId) {
6250
+ return this.request(
6251
+ "GET",
6252
+ `/replay-retention/shops/${encodeURIComponent(profileId)}/effective`
6253
+ );
6254
+ }
6255
+ /**
6256
+ * Set the merchant-wide level.
6257
+ *
6258
+ * `PUT /replay-retention/merchant`
6259
+ */
6260
+ async setMerchant(params) {
6261
+ return this.request("PUT", "/replay-retention/merchant", { body: params });
6262
+ }
6263
+ /**
6264
+ * Hand the merchant-wide level back to the global one.
6265
+ *
6266
+ * `DELETE /replay-retention/merchant`
6267
+ */
6268
+ async clearMerchant() {
6269
+ await this.request("DELETE", "/replay-retention/merchant");
6270
+ }
6271
+ /**
6272
+ * Set one project's level.
6273
+ *
6274
+ * `PUT /replay-retention/projects/{projectId}`
6275
+ */
6276
+ async setProject(projectId, params) {
6277
+ return this.request("PUT", `/replay-retention/projects/${encodeURIComponent(projectId)}`, {
6278
+ body: params
6279
+ });
6280
+ }
6281
+ /**
6282
+ * Hand one project's level back to the merchant's.
6283
+ *
6284
+ * `DELETE /replay-retention/projects/{projectId}`
6285
+ */
6286
+ async clearProject(projectId) {
6287
+ await this.request("DELETE", `/replay-retention/projects/${encodeURIComponent(projectId)}`);
6288
+ }
6289
+ /**
6290
+ * Set one shop's level. A shop-scoped caller may set only its own shop.
6291
+ *
6292
+ * `PUT /replay-retention/shops/{profileId}`
6293
+ */
6294
+ async setShop(profileId, params) {
6295
+ return this.request("PUT", `/replay-retention/shops/${encodeURIComponent(profileId)}`, {
6296
+ body: params
6297
+ });
6298
+ }
6299
+ /**
6300
+ * Hand one shop's level back to its project's (or the merchant's).
6301
+ *
6302
+ * `DELETE /replay-retention/shops/{profileId}`
6303
+ */
6304
+ async clearShop(profileId) {
6305
+ await this.request("DELETE", `/replay-retention/shops/${encodeURIComponent(profileId)}`);
6306
+ }
6307
+ };
6308
+
6197
6309
  // src/resources/risk.ts
6198
6310
  var Risk = class {
6199
6311
  constructor(request) {
@@ -6455,6 +6567,7 @@ var Delopay = class {
6455
6567
  this.audit = new Audit(request);
6456
6568
  this.settlement = new Settlement(request);
6457
6569
  this.operationLimits = new OperationLimits(request);
6570
+ this.replayRetention = new ReplayRetention(request);
6458
6571
  this.risk = new Risk(request);
6459
6572
  this.subscriptions = new Subscriptions(request);
6460
6573
  this.files = new Files(request);
@@ -10467,6 +10580,7 @@ var encodeNativePanes = encodePanes;
10467
10580
  Products,
10468
10581
  RTL_CHECKOUT_LOCALES,
10469
10582
  Regions,
10583
+ ReplayRetention,
10470
10584
  Risk,
10471
10585
  SECTION_ALIASES,
10472
10586
  STRIPE_FALLBACK_PANE_CATALOG,