@delopay/sdk 0.312.0 → 0.318.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
@@ -807,9 +807,10 @@ var Billing = class {
807
807
  * @param params - Auto-recharge settings to update.
808
808
  * @returns The updated billing profile.
809
809
  */
810
- async updateAutoRecharge(merchantId, params) {
810
+ async updateAutoRecharge(merchantId, params, options) {
811
811
  return this.request("PATCH", `/billing/${encodeURIComponent(merchantId)}/auto-recharge`, {
812
- body: params
812
+ body: params,
813
+ ...options
813
814
  });
814
815
  }
815
816
  };
@@ -993,12 +994,13 @@ var Connectors = class {
993
994
  *
994
995
  * `POST /account/{accountId}/connectors/{connectorId}`
995
996
  */
996
- async update(accountId, connectorId, params) {
997
+ async update(accountId, connectorId, params, options) {
997
998
  return this.request(
998
999
  "POST",
999
1000
  `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}`,
1000
1001
  {
1001
- body: params
1002
+ body: params,
1003
+ ...options
1002
1004
  }
1003
1005
  );
1004
1006
  }
@@ -1562,8 +1564,11 @@ var Customers = class {
1562
1564
  * @param params - Fields to update (name, email, address, metadata, etc.).
1563
1565
  * @returns The updated customer.
1564
1566
  */
1565
- async update(customerId, params) {
1566
- return this.request("POST", `/customers/${encodeURIComponent(customerId)}`, { body: params });
1567
+ async update(customerId, params, options) {
1568
+ return this.request("POST", `/customers/${encodeURIComponent(customerId)}`, {
1569
+ body: params,
1570
+ ...options
1571
+ });
1567
1572
  }
1568
1573
  /**
1569
1574
  * Delete a customer and all their saved payment methods.
@@ -2419,8 +2424,11 @@ var Fees = class {
2419
2424
  * @param feeId - The fee schedule ID.
2420
2425
  * @param params - Fields to update.
2421
2426
  */
2422
- async update(feeId, params) {
2423
- return this.request("PUT", `/merchant-fees/${encodeURIComponent(feeId)}`, { body: params });
2427
+ async update(feeId, params, options) {
2428
+ return this.request("PUT", `/merchant-fees/${encodeURIComponent(feeId)}`, {
2429
+ body: params,
2430
+ ...options
2431
+ });
2424
2432
  }
2425
2433
  /**
2426
2434
  * Delete a merchant-scoped fee schedule.
@@ -2538,8 +2546,11 @@ var MerchantAccounts = class {
2538
2546
  async retrieve(accountId) {
2539
2547
  return this.request("GET", `/accounts/${encodeURIComponent(accountId)}`);
2540
2548
  }
2541
- async update(accountId, params) {
2542
- return this.request("POST", `/accounts/${encodeURIComponent(accountId)}`, { body: params });
2549
+ async update(accountId, params, options) {
2550
+ return this.request("POST", `/accounts/${encodeURIComponent(accountId)}`, {
2551
+ body: params,
2552
+ ...options
2553
+ });
2543
2554
  }
2544
2555
  async delete(accountId) {
2545
2556
  return this.request("DELETE", `/accounts/${encodeURIComponent(accountId)}`);
@@ -3649,12 +3660,13 @@ var Profiles = class {
3649
3660
  async listByProfile(accountId) {
3650
3661
  return this.request("GET", `/account/${encodeURIComponent(accountId)}/profile`);
3651
3662
  }
3652
- async update(accountId, profileId, params) {
3663
+ async update(accountId, profileId, params, options) {
3653
3664
  return this.request(
3654
3665
  "POST",
3655
3666
  `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}`,
3656
3667
  {
3657
- body: params
3668
+ body: params,
3669
+ ...options
3658
3670
  }
3659
3671
  );
3660
3672
  }
@@ -3759,10 +3771,14 @@ var Projects = class {
3759
3771
  * @param merchantId - Optional merchant scope. See {@link Projects.retrieve}.
3760
3772
  * @returns The updated project.
3761
3773
  */
3762
- async update(projectId, params, merchantId) {
3774
+ async update(projectId, params, merchantId, options) {
3763
3775
  const path = `/projects/${encodeURIComponent(projectId)}`;
3764
- if (merchantId === void 0) return this.request("PUT", path, { body: params });
3765
- return this.request("PUT", path, { body: params, query: { merchant_id: merchantId } });
3776
+ if (merchantId === void 0) return this.request("PUT", path, { body: params, ...options });
3777
+ return this.request("PUT", path, {
3778
+ body: params,
3779
+ query: { merchant_id: merchantId },
3780
+ ...options
3781
+ });
3766
3782
  }
3767
3783
  /**
3768
3784
  * Delete a project.
@@ -3905,8 +3921,11 @@ var Refunds = class {
3905
3921
  * @param params - Fields to update (reason, metadata).
3906
3922
  * @returns The updated refund.
3907
3923
  */
3908
- async update(refundId, params) {
3909
- return this.request("POST", `/refunds/${encodeURIComponent(refundId)}`, { body: params });
3924
+ async update(refundId, params, options) {
3925
+ return this.request("POST", `/refunds/${encodeURIComponent(refundId)}`, {
3926
+ body: params,
3927
+ ...options
3928
+ });
3910
3929
  }
3911
3930
  /**
3912
3931
  * List refunds, optionally filtered by payment, status, or date range.
@@ -4109,8 +4128,11 @@ var Routing = class {
4109
4128
  * @param params - The fields to change (at least one required).
4110
4129
  * @returns The updated routing configuration including the algorithm body.
4111
4130
  */
4112
- async update(algorithmId, params) {
4113
- return this.request("PUT", `/routing/${encodeURIComponent(algorithmId)}`, { body: params });
4131
+ async update(algorithmId, params, options) {
4132
+ return this.request("PUT", `/routing/${encodeURIComponent(algorithmId)}`, {
4133
+ body: params,
4134
+ ...options
4135
+ });
4114
4136
  }
4115
4137
  /**
4116
4138
  * Delete a static routing configuration.
@@ -4287,9 +4309,10 @@ var Routing = class {
4287
4309
  return this.request("GET", `/routing/default/profile/${encodeURIComponent(profileId)}`);
4288
4310
  }
4289
4311
  /** Update default config for a profile. `POST /routing/default/profile/{profileId}` */
4290
- async updateDefaultProfile(profileId, params) {
4312
+ async updateDefaultProfile(profileId, params, options) {
4291
4313
  return this.request("POST", `/routing/default/profile/${encodeURIComponent(profileId)}`, {
4292
- body: params
4314
+ body: params,
4315
+ ...options
4293
4316
  });
4294
4317
  }
4295
4318
  /** List routing configs for profile. `GET /routing/list/profile` */
@@ -4318,28 +4341,28 @@ var RoutingDecisionManager = class {
4318
4341
  this.request = request;
4319
4342
  }
4320
4343
  /** Upsert decision manager config. `PUT /routing/decision` */
4321
- async upsert(params) {
4322
- return this.request("PUT", "/routing/decision", { body: params });
4344
+ async upsert(params, options) {
4345
+ return this.request("PUT", "/routing/decision", { body: params, ...options });
4323
4346
  }
4324
4347
  /** Retrieve decision manager config. `GET /routing/decision` */
4325
4348
  async retrieve() {
4326
4349
  return this.request("GET", "/routing/decision");
4327
4350
  }
4328
4351
  /** Delete decision manager config. `DELETE /routing/decision` */
4329
- async delete() {
4330
- return this.request("DELETE", "/routing/decision");
4352
+ async delete(options) {
4353
+ return this.request("DELETE", "/routing/decision", options);
4331
4354
  }
4332
4355
  /** Upsert surcharge decision config. `PUT /routing/decision/surcharge` */
4333
- async upsertSurcharge(params) {
4334
- return this.request("PUT", "/routing/decision/surcharge", { body: params });
4356
+ async upsertSurcharge(params, options) {
4357
+ return this.request("PUT", "/routing/decision/surcharge", { body: params, ...options });
4335
4358
  }
4336
4359
  /** Retrieve surcharge decision config. `GET /routing/decision/surcharge` */
4337
4360
  async retrieveSurcharge() {
4338
4361
  return this.request("GET", "/routing/decision/surcharge");
4339
4362
  }
4340
4363
  /** Delete surcharge decision config. `DELETE /routing/decision/surcharge` */
4341
- async deleteSurcharge() {
4342
- return this.request("DELETE", "/routing/decision/surcharge");
4364
+ async deleteSurcharge(options) {
4365
+ return this.request("DELETE", "/routing/decision/surcharge", options);
4343
4366
  }
4344
4367
  };
4345
4368
  var SurchargeRules = class {
@@ -4361,8 +4384,8 @@ var SurchargeRules = class {
4361
4384
  * });
4362
4385
  * ```
4363
4386
  */
4364
- async upsert(params) {
4365
- return this.request("PUT", "/routing/surcharge/rules", { body: params });
4387
+ async upsert(params, options) {
4388
+ return this.request("PUT", "/routing/surcharge/rules", { body: params, ...options });
4366
4389
  }
4367
4390
  /**
4368
4391
  * Retrieve the active surcharge program for a scope, or `null` when none is set.
@@ -4383,9 +4406,10 @@ var SurchargeRules = class {
4383
4406
  *
4384
4407
  * @param profileId - Shop scope. Omit for the merchant-wide rule.
4385
4408
  */
4386
- async delete(profileId) {
4409
+ async delete(profileId, options) {
4387
4410
  return this.request("DELETE", "/routing/surcharge/rules", {
4388
- query: { profile_id: profileId }
4411
+ query: { profile_id: profileId },
4412
+ ...options
4389
4413
  });
4390
4414
  }
4391
4415
  };
@@ -4766,6 +4790,34 @@ var Shops = class {
4766
4790
  options
4767
4791
  );
4768
4792
  }
4793
+ /**
4794
+ * Read the Test checkout's appearance, used by payments created with
4795
+ * `test_mode: true`. Until its first save, Test follows Live:
4796
+ * `follows_live` is `true` and `payment_link_config` is Live's.
4797
+ *
4798
+ * `GET /shops/{merchantId}/{shopId}/checkout-branding/test`
4799
+ */
4800
+ async retrieveTestCheckoutBranding(merchantId, shopId, options) {
4801
+ return this.request(
4802
+ "GET",
4803
+ `/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/checkout-branding/test`,
4804
+ options
4805
+ );
4806
+ }
4807
+ /**
4808
+ * Replace the Test checkout's appearance, exactly as
4809
+ * {@link updateCheckoutBranding} replaces Live's. Live is not touched; a
4810
+ * shop whose Test followed Live has its own Test settings from this save on.
4811
+ *
4812
+ * `POST /shops/{merchantId}/{shopId}/checkout-branding/test`
4813
+ */
4814
+ async updateTestCheckoutBranding(merchantId, shopId, params, options) {
4815
+ return this.request(
4816
+ "POST",
4817
+ `/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/checkout-branding/test`,
4818
+ { body: params, ...options }
4819
+ );
4820
+ }
4769
4821
  };
4770
4822
 
4771
4823
  // src/resources/stripeConnect.ts
@@ -4921,8 +4973,8 @@ var Users = class {
4921
4973
  async getDetails() {
4922
4974
  return this.request("GET", "/user");
4923
4975
  }
4924
- async update(params) {
4925
- return this.request("POST", "/user/update", { body: params });
4976
+ async update(params, options) {
4977
+ return this.request("POST", "/user/update", { body: params, ...options });
4926
4978
  }
4927
4979
  /**
4928
4980
  * Read a preference owned by the logged-in user. Missing keys return value null.
@@ -5640,8 +5692,11 @@ var Users = class {
5640
5692
  return this.request("GET", `/user/role/${encodeURIComponent(roleId)}`);
5641
5693
  }
5642
5694
  /** Update role by ID. `PUT /user/role/{roleId}` */
5643
- async updateRole(roleId, params) {
5644
- return this.request("PUT", `/user/role/${encodeURIComponent(roleId)}`, { body: params });
5695
+ async updateRole(roleId, params, options) {
5696
+ return this.request("PUT", `/user/role/${encodeURIComponent(roleId)}`, {
5697
+ body: params,
5698
+ ...options
5699
+ });
5645
5700
  }
5646
5701
  /**
5647
5702
  * Delete a custom role. Predefined roles and roles still assigned to
@@ -6218,8 +6273,11 @@ var Analytics = class {
6218
6273
  * clear, and the full `surfaces` list you mean to keep.
6219
6274
  * `PUT /analytics/exclusions/{id}`
6220
6275
  */
6221
- async updateExclusion(id, rule) {
6222
- return this.request("PUT", `/analytics/exclusions/${encodeURIComponent(id)}`, { body: rule });
6276
+ async updateExclusion(id, rule, options) {
6277
+ return this.request("PUT", `/analytics/exclusions/${encodeURIComponent(id)}`, {
6278
+ body: rule,
6279
+ ...options
6280
+ });
6223
6281
  }
6224
6282
  /**
6225
6283
  * Delete a stored exclusion. Returns the rule as it was, so a caller can
@@ -6254,7 +6312,16 @@ var Analytics = class {
6254
6312
  async connectorEventLogs(params) {
6255
6313
  return this.request("GET", "/analytics/connector-event-logs", { query: params });
6256
6314
  }
6257
- /** Get routing event logs. `GET /analytics/routing-event-logs` */
6315
+ /**
6316
+ * Get routing event logs. `GET /analytics/routing-event-logs`
6317
+ *
6318
+ * @deprecated The service answers this only from a ClickHouse analytics
6319
+ * store; with SQL analytics, the default configuration, it answers an
6320
+ * error. To learn why a payment used a connector, read
6321
+ * `payments.routingDecisions(paymentId)`,
6322
+ * the routing decision recorded behind each attempt. This method stays for
6323
+ * compatibility and still sends the same request.
6324
+ */
6258
6325
  async routingEventLogs(params) {
6259
6326
  return this.request("GET", "/analytics/routing-event-logs", { query: params });
6260
6327
  }
@@ -6552,17 +6619,18 @@ var SellToRestrictions = class {
6552
6619
  * The change is recorded in the audit log before it is made.
6553
6620
  * `PUT /sell-to-restrictions/merchant`
6554
6621
  */
6555
- async updateMerchantPolicy(params) {
6556
- return this.request("PUT", "/sell-to-restrictions/merchant", { body: params });
6622
+ async updateMerchantPolicy(params, options) {
6623
+ return this.request("PUT", "/sell-to-restrictions/merchant", { body: params, ...options });
6557
6624
  }
6558
6625
  /**
6559
6626
  * Give one shop its own policy, replacing the merchant-wide policy for that
6560
6627
  * shop. An empty `blocked_countries` lifts every restriction for it.
6561
6628
  * `PUT /sell-to-restrictions/shops/{profile_id}`
6562
6629
  */
6563
- async updateShopOverride(profileId, params) {
6630
+ async updateShopOverride(profileId, params, options) {
6564
6631
  return this.request("PUT", `/sell-to-restrictions/shops/${encodeURIComponent(profileId)}`, {
6565
- body: params
6632
+ body: params,
6633
+ ...options
6566
6634
  });
6567
6635
  }
6568
6636
  /**
@@ -6570,8 +6638,12 @@ var SellToRestrictions = class {
6570
6638
  * Removing an override the shop does not have changes nothing.
6571
6639
  * `DELETE /sell-to-restrictions/shops/{profile_id}`
6572
6640
  */
6573
- async deleteShopOverride(profileId) {
6574
- return this.request("DELETE", `/sell-to-restrictions/shops/${encodeURIComponent(profileId)}`);
6641
+ async deleteShopOverride(profileId, options) {
6642
+ return this.request(
6643
+ "DELETE",
6644
+ `/sell-to-restrictions/shops/${encodeURIComponent(profileId)}`,
6645
+ options
6646
+ );
6575
6647
  }
6576
6648
  /**
6577
6649
  * Which checks each payment path performs, and how this deployment resolves
@@ -8137,10 +8209,11 @@ var ProcessorCosts = class {
8137
8209
  * @param params - The new rate.
8138
8210
  * @param merchantId - The merchant account ID.
8139
8211
  */
8140
- async replace(scheduleId, params, merchantId) {
8212
+ async replace(scheduleId, params, merchantId, options) {
8141
8213
  return this.request("POST", `/processor-costs/${encodeURIComponent(scheduleId)}/replace`, {
8142
8214
  body: params,
8143
- query: { merchant_id: merchantId }
8215
+ query: { merchant_id: merchantId },
8216
+ ...options
8144
8217
  });
8145
8218
  }
8146
8219
  /**
@@ -8165,33 +8238,42 @@ var CheckoutMethods = class {
8165
8238
  }
8166
8239
  /**
8167
8240
  * The shop's layout (stored, or derived from its accounts) and every item
8168
- * it may place. `GET /checkout-methods/{profile_id}`
8241
+ * it may place. Live's by default; `environment: 'test'` reads the Test
8242
+ * checkout's, used by payments with `test_mode: true`, which follows Live's
8243
+ * (`follows_live`) until its first save.
8244
+ * `GET /checkout-methods/{profile_id}` (`/test`)
8169
8245
  */
8170
- async retrieve(merchantId, profileId) {
8171
- return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}`, {
8172
- query: { merchant_id: merchantId }
8246
+ async retrieve(merchantId, profileId, params = {}, options) {
8247
+ return this.request("GET", methodsPath(profileId, params.environment), {
8248
+ query: { merchant_id: merchantId },
8249
+ ...options
8173
8250
  });
8174
8251
  }
8175
8252
  /**
8176
8253
  * The same document as {@link retrieve}, on the route that stays open to a
8177
8254
  * reader of the checkout's appearance while the role's payment-data
8178
- * visibility is restricted. `GET /checkout-methods/{profile_id}/preview`
8255
+ * visibility is restricted.
8256
+ * `GET /checkout-methods/{profile_id}/preview` (`/test/preview`)
8179
8257
  */
8180
- async preview(merchantId, profileId) {
8181
- return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}/preview`, {
8182
- query: { merchant_id: merchantId }
8258
+ async preview(merchantId, profileId, params = {}, options) {
8259
+ return this.request("GET", `${methodsPath(profileId, params.environment)}/preview`, {
8260
+ query: { merchant_id: merchantId },
8261
+ ...options
8183
8262
  });
8184
8263
  }
8185
8264
  /**
8186
- * Replace the shop's layout. The router refuses an express item that does
8187
- * not draw its own button, more than two rows of two in the express strip,
8188
- * a title without text, or an item no account of the shop offers.
8189
- * `PUT /checkout-methods/{profile_id}`
8265
+ * Replace the layout of one environment. The router refuses an express
8266
+ * item that does not draw its own button, more than two rows of two in the
8267
+ * express strip, a title without text, or an item no account of the shop
8268
+ * offers. Pass `options.headers` with the `If-Match` of the version read to
8269
+ * have a save over a newer change refused.
8270
+ * `PUT /checkout-methods/{profile_id}` (`/test`)
8190
8271
  */
8191
- async update(merchantId, profileId, body) {
8192
- return this.request("PUT", `/checkout-methods/${encodeURIComponent(profileId)}`, {
8272
+ async update(merchantId, profileId, body, params = {}, options) {
8273
+ return this.request("PUT", methodsPath(profileId, params.environment), {
8193
8274
  query: { merchant_id: merchantId },
8194
- body
8275
+ body,
8276
+ ...options
8195
8277
  });
8196
8278
  }
8197
8279
  /**
@@ -8241,14 +8323,59 @@ var CheckoutMethods = class {
8241
8323
  });
8242
8324
  }
8243
8325
  /**
8244
- * Delete the stored layout; the shop is back on the derived one.
8245
- * `DELETE /checkout-methods/{profile_id}`
8326
+ * Delete the stored layout of one environment; Live is back on the derived
8327
+ * layout, Test follows Live again.
8328
+ * `DELETE /checkout-methods/{profile_id}` (`/test`)
8246
8329
  */
8247
- async reset(merchantId, profileId) {
8248
- return this.request("DELETE", `/checkout-methods/${encodeURIComponent(profileId)}`, {
8249
- query: { merchant_id: merchantId }
8330
+ async reset(merchantId, profileId, params = {}, options) {
8331
+ return this.request("DELETE", methodsPath(profileId, params.environment), {
8332
+ query: { merchant_id: merchantId },
8333
+ ...options
8250
8334
  });
8251
8335
  }
8336
+ /**
8337
+ * The methods a payment of the shop can be limited to through
8338
+ * `allowed_payment_method_types`, in the order its checkout places them, for
8339
+ * one environment. Names methods only, never a processor or account.
8340
+ * `GET /checkout-methods/{profile_id}/payment-method-options` (`/test/…`)
8341
+ */
8342
+ async paymentMethodOptions(merchantId, profileId, params = {}, options) {
8343
+ return this.request(
8344
+ "GET",
8345
+ `${methodsPath(profileId, params.environment)}/payment-method-options`,
8346
+ { query: { merchant_id: merchantId }, ...options }
8347
+ );
8348
+ }
8349
+ /**
8350
+ * What the given redirect rules, saved or not, decide for the buyer the
8351
+ * body describes, and how each rule fared. The buyer's options are the
8352
+ * shop's layout after its availability rules and the cap states; nothing is
8353
+ * stored. Live's checkout by default, `environment: 'test'` for the Test
8354
+ * checkout's. Refused with 422 when the rules are malformed or name an
8355
+ * account that is not the shop's, and with 403 when they name one the
8356
+ * caller may not read.
8357
+ * `POST /checkout-methods/{profile_id}/redirect-rules/test` (`/test/…`)
8358
+ */
8359
+ async testRedirectRules(merchantId, profileId, body, params = {}, options) {
8360
+ return this.request(
8361
+ "POST",
8362
+ `${methodsPath(profileId, params.environment)}/redirect-rules/test`,
8363
+ { query: { merchant_id: merchantId }, body, ...options }
8364
+ );
8365
+ }
8366
+ /**
8367
+ * Hide a connector account from the checkout of the named environments, or
8368
+ * show it again. Its items stay in the layout, listed with
8369
+ * `account_enabled: false`; routing and credentials are not changed.
8370
+ * `PUT /checkout-methods/{profile_id}/accounts/{merchant_connector_id}/visibility`
8371
+ */
8372
+ async setAccountVisibility(merchantId, profileId, merchantConnectorId, body, options) {
8373
+ return this.request(
8374
+ "PUT",
8375
+ `/checkout-methods/${encodeURIComponent(profileId)}/accounts/${encodeURIComponent(merchantConnectorId)}/visibility`,
8376
+ { query: { merchant_id: merchantId }, body, ...options }
8377
+ );
8378
+ }
8252
8379
  /**
8253
8380
  * The shop's checkout entries: separate ways into the hosted checkout of
8254
8381
  * one payment (`?entry=<key>`), such as a card form embedded in the shop's
@@ -8287,6 +8414,10 @@ var CheckoutMethods = class {
8287
8414
  });
8288
8415
  }
8289
8416
  };
8417
+ function methodsPath(profileId, environment) {
8418
+ const shop = `/checkout-methods/${encodeURIComponent(profileId)}`;
8419
+ return environment === "test" ? `${shop}/test` : shop;
8420
+ }
8290
8421
  function entriesPath(profileId, environment) {
8291
8422
  const shop = `/checkout-methods/${encodeURIComponent(profileId)}`;
8292
8423
  return environment === "test" ? `${shop}/test/entries` : `${shop}/entries`;