@delopay/sdk 0.159.0 → 0.162.1

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
@@ -37,6 +37,7 @@ import {
37
37
  Cards,
38
38
  CheckoutMethods,
39
39
  CheckoutSession,
40
+ CostRules,
40
41
  DEFAULT_BADGES,
41
42
  DEFAULT_BADGES_DARK,
42
43
  DEFAULT_BRANDING,
@@ -68,6 +69,7 @@ import {
68
69
  PAYPAL_CARD_LAYOUTS,
69
70
  PAYPAL_LABEL_STYLES,
70
71
  PaypalDisputes,
72
+ ProcessorCosts,
71
73
  RTL_CHECKOUT_LOCALES,
72
74
  Regions,
73
75
  Risk,
@@ -193,7 +195,7 @@ import {
193
195
  validatePanes,
194
196
  verticalGapValue,
195
197
  visibleCustomFields
196
- } from "./chunk-NQJP5VBB.js";
198
+ } from "./chunk-P2KP3WRS.js";
197
199
  export {
198
200
  AIRWALLEX_AUTOFILL_TREATMENTS,
199
201
  AIRWALLEX_CARD_LAYOUTS,
@@ -233,6 +235,7 @@ export {
233
235
  Cards,
234
236
  CheckoutMethods,
235
237
  CheckoutSession,
238
+ CostRules,
236
239
  DEFAULT_BADGES,
237
240
  DEFAULT_BADGES_DARK,
238
241
  DEFAULT_BRANDING,
@@ -264,6 +267,7 @@ export {
264
267
  PAYPAL_CARD_LAYOUTS,
265
268
  PAYPAL_LABEL_STYLES,
266
269
  PaypalDisputes,
270
+ ProcessorCosts,
267
271
  RTL_CHECKOUT_LOCALES,
268
272
  Regions,
269
273
  Risk,
package/dist/internal.cjs CHANGED
@@ -66,6 +66,7 @@ __export(internal_exports, {
66
66
  Configs: () => Configs,
67
67
  ConnectorRestrictionRules: () => ConnectorRestrictionRules,
68
68
  ConnectorRestrictions: () => ConnectorRestrictions,
69
+ CostRules: () => CostRules,
69
70
  DEFAULT_BADGES: () => DEFAULT_BADGES,
70
71
  DEFAULT_BADGES_DARK: () => DEFAULT_BADGES_DARK,
71
72
  DEFAULT_BRANDING: () => DEFAULT_BRANDING,
@@ -102,6 +103,7 @@ __export(internal_exports, {
102
103
  PaypalDisputes: () => PaypalDisputes,
103
104
  PlatformBilling: () => PlatformBilling,
104
105
  PlatformFees: () => PlatformFees,
106
+ ProcessorCosts: () => ProcessorCosts,
105
107
  RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
106
108
  Regions: () => Regions,
107
109
  Risk: () => Risk,
@@ -2922,8 +2924,9 @@ var Routing = class {
2922
2924
  });
2923
2925
  }
2924
2926
  /**
2925
- * A shop's lifetime per-connector payment caps, each with how much of it is
2926
- * already spent.
2927
+ * A shop's per-connector caps, each with its unit and window and how much of
2928
+ * the current window is spent (`used`) or held by payments in flight
2929
+ * (`reserved`).
2927
2930
  *
2928
2931
  * `GET /routing/connector-caps/{profileId}`
2929
2932
  */
@@ -2948,13 +2951,17 @@ var Routing = class {
2948
2951
  return this.request("GET", `/routing/volume-counters/${encodeURIComponent(profileId)}`);
2949
2952
  }
2950
2953
  /**
2951
- * Replace a shop's per-connector payment caps.
2954
+ * Replace a shop's per-connector caps.
2952
2955
  *
2953
2956
  * Whole-set replacement, not a patch: the list sent becomes the complete set
2954
2957
  * of capped connectors, and an empty list clears them all — which is how
2955
2958
  * acquirer onboarding finishes, the new account ceasing to be a special case.
2959
+ * Re-send every other cap with its `unit`, `window` and `currency` as read:
2960
+ * an amount cap sent back without its `unit` is refused, because it carries a
2961
+ * currency and would otherwise be a payment count.
2956
2962
  *
2957
2963
  * Every account named must belong to this shop; one that does not is refused.
2964
+ * So is an amount cap without a `currency`, and a payment cap with one.
2958
2965
  *
2959
2966
  * `PUT /routing/connector-caps/{profileId}`
2960
2967
  */
@@ -4620,6 +4627,161 @@ var SellToRestrictions = class {
4620
4627
  }
4621
4628
  };
4622
4629
 
4630
+ // src/resources/costRules.ts
4631
+ var CostRules = class {
4632
+ constructor(request) {
4633
+ this.request = request;
4634
+ }
4635
+ /**
4636
+ * Every cost rule of the merchant.
4637
+ * `GET /cost-rules`
4638
+ *
4639
+ * @param merchantId - The merchant account ID.
4640
+ */
4641
+ async list(merchantId) {
4642
+ return this.request("GET", "/cost-rules", { query: { merchant_id: merchantId } });
4643
+ }
4644
+ /**
4645
+ * Record a cost rule.
4646
+ * `POST /cost-rules`
4647
+ *
4648
+ * @param params - The rule.
4649
+ * @param merchantId - The merchant account ID.
4650
+ */
4651
+ async create(params, merchantId) {
4652
+ return this.request("POST", "/cost-rules", {
4653
+ body: params,
4654
+ query: { merchant_id: merchantId }
4655
+ });
4656
+ }
4657
+ /**
4658
+ * Close, deactivate or rename a cost rule.
4659
+ * `PUT /cost-rules/{rule_id}`
4660
+ *
4661
+ * @param ruleId - The rule ID.
4662
+ * @param params - What to change.
4663
+ * @param merchantId - The merchant account ID.
4664
+ */
4665
+ async update(ruleId, params, merchantId) {
4666
+ return this.request("PUT", `/cost-rules/${encodeURIComponent(ruleId)}`, {
4667
+ body: params,
4668
+ query: { merchant_id: merchantId }
4669
+ });
4670
+ }
4671
+ /**
4672
+ * Delete a cost rule.
4673
+ * `DELETE /cost-rules/{rule_id}`
4674
+ *
4675
+ * @param ruleId - The rule ID.
4676
+ * @param merchantId - The merchant account ID.
4677
+ */
4678
+ async delete(ruleId, merchantId) {
4679
+ return this.request("DELETE", `/cost-rules/${encodeURIComponent(ruleId)}`, {
4680
+ query: { merchant_id: merchantId }
4681
+ });
4682
+ }
4683
+ };
4684
+
4685
+ // src/resources/processorCosts.ts
4686
+ var ProcessorCosts = class {
4687
+ constructor(request) {
4688
+ this.request = request;
4689
+ }
4690
+ /**
4691
+ * Every processor cost schedule of the merchant.
4692
+ * `GET /processor-costs`
4693
+ *
4694
+ * @param merchantId - The merchant account ID.
4695
+ */
4696
+ async list(merchantId) {
4697
+ return this.request("GET", "/processor-costs", { query: { merchant_id: merchantId } });
4698
+ }
4699
+ /**
4700
+ * Record a processor cost schedule.
4701
+ * `POST /processor-costs`
4702
+ *
4703
+ * A `shop_id` that is well formed but not a shop of this merchant is
4704
+ * answered `404` and nothing is recorded: a rate scoped to a shop the
4705
+ * merchant does not own would price no attempt, leaving every line it was
4706
+ * meant to price `unavailable` while the screen showed a configured rate.
4707
+ *
4708
+ * @param params - The schedule.
4709
+ * @param merchantId - The merchant account ID.
4710
+ */
4711
+ async create(params, merchantId) {
4712
+ return this.request("POST", "/processor-costs", {
4713
+ body: params,
4714
+ query: { merchant_id: merchantId }
4715
+ });
4716
+ }
4717
+ /**
4718
+ * Record several schedules at once, all or none — copy a price list across
4719
+ * methods or shops.
4720
+ * `POST /processor-costs/bulk`
4721
+ *
4722
+ * 1 to 200 entries. Every entry is validated before anything is stored: an
4723
+ * invalid one is answered `422` naming its index, and nothing is stored.
4724
+ * The answer lists the created schedules in request order.
4725
+ *
4726
+ * @param params - The schedules.
4727
+ * @param merchantId - The merchant account ID.
4728
+ */
4729
+ async bulkCreate(params, merchantId) {
4730
+ return this.request("POST", "/processor-costs/bulk", {
4731
+ body: params,
4732
+ query: { merchant_id: merchantId }
4733
+ });
4734
+ }
4735
+ /**
4736
+ * Close, deactivate or annotate a schedule. The rate is not editable.
4737
+ * `PUT /processor-costs/{schedule_id}`
4738
+ *
4739
+ * @param scheduleId - The schedule ID.
4740
+ * @param params - What to change.
4741
+ * @param merchantId - The merchant account ID.
4742
+ */
4743
+ async update(scheduleId, params, merchantId) {
4744
+ return this.request("PUT", `/processor-costs/${encodeURIComponent(scheduleId)}`, {
4745
+ body: params,
4746
+ query: { merchant_id: merchantId }
4747
+ });
4748
+ }
4749
+ /**
4750
+ * Close a schedule at `effective_from` and open its successor with the same
4751
+ * scope and the same end, in one step: no transaction is priced by both
4752
+ * rates, and none falls between them.
4753
+ * `POST /processor-costs/{schedule_id}/replace`
4754
+ *
4755
+ * Answers the successor schedule. An `effective_from` outside the old
4756
+ * schedule's window, an inactive schedule, or one a concurrent replacement
4757
+ * already moved is answered `400` — retry against the schedule as it now
4758
+ * stands rather than forcing the write.
4759
+ *
4760
+ * @param scheduleId - The schedule to replace.
4761
+ * @param params - The new rate.
4762
+ * @param merchantId - The merchant account ID.
4763
+ */
4764
+ async replace(scheduleId, params, merchantId) {
4765
+ return this.request("POST", `/processor-costs/${encodeURIComponent(scheduleId)}/replace`, {
4766
+ body: params,
4767
+ query: { merchant_id: merchantId }
4768
+ });
4769
+ }
4770
+ /**
4771
+ * Delete a schedule. Restates nothing: every figure it derived is already
4772
+ * stamped on the settlement lines it priced.
4773
+ * `DELETE /processor-costs/{schedule_id}`
4774
+ *
4775
+ * @param scheduleId - The schedule ID.
4776
+ * @param merchantId - The merchant account ID.
4777
+ */
4778
+ async delete(scheduleId, merchantId) {
4779
+ return this.request("DELETE", `/processor-costs/${encodeURIComponent(scheduleId)}`, {
4780
+ query: { merchant_id: merchantId }
4781
+ });
4782
+ }
4783
+ };
4784
+
4623
4785
  // src/resources/checkoutMethods.ts
4624
4786
  var CheckoutMethods = class {
4625
4787
  constructor(request) {
@@ -5540,6 +5702,8 @@ var Delopay = class {
5540
5702
  this.regions = new Regions(request);
5541
5703
  this.availabilityOverrides = new AvailabilityOverrides(request);
5542
5704
  this.sellToRestrictions = new SellToRestrictions(request);
5705
+ this.costRules = new CostRules(request);
5706
+ this.processorCosts = new ProcessorCosts(request);
5543
5707
  this.checkoutMethods = new CheckoutMethods(request);
5544
5708
  this.analytics = new Analytics(request);
5545
5709
  this.analyticsDashboard = new AnalyticsDashboard(request);
@@ -8429,11 +8593,62 @@ var CheckoutSession = class {
8429
8593
  *
8430
8594
  * `GET /payment-link/{merchantId}/{paymentId}/epayouts/methods`
8431
8595
  *
8596
+ * Pass `{ paypalSdk: true }` from a checkout drawing an experimental PayPal
8597
+ * SDK pane to also receive e-Payouts' PayPal client id
8598
+ * (`paypal_client_id`, `paypal_currency`); it is present only when `ppal`
8599
+ * is among the methods.
8600
+ *
8432
8601
  * @param country - Lowercase ISO 3166-1 alpha-2 country code.
8433
8602
  */
8434
8603
  async epayoutsMethods(country, options) {
8604
+ const { paypalSdk, merchantConnectorId, ...extras } = options ?? {};
8435
8605
  return this.client.request("GET", `${this.linkBase}/epayouts/methods`, {
8436
- query: { cc: country },
8606
+ query: paypalSdk ? {
8607
+ cc: country,
8608
+ paypal_sdk: "true",
8609
+ ...merchantConnectorId ? { merchant_connector_id: merchantConnectorId } : {}
8610
+ } : { cc: country },
8611
+ ...extras,
8612
+ headers: this.bearerHeaders(extras.headers)
8613
+ });
8614
+ }
8615
+ /**
8616
+ * The PayPal order for the payment's e-Payouts access code, from the PayPal
8617
+ * SDK's `createOrder` on an experimental PayPal SDK pane — after the payment
8618
+ * was confirmed through that pane, which mints the code.
8619
+ *
8620
+ * The router reads the order off e-Payouts' own PayPal page for the code, so
8621
+ * `amount` and `currency` are what e-Payouts charges for it. Repeated calls
8622
+ * answer the same order, so a cancelled PayPal popup is retried with the same
8623
+ * code. When `captured` is `true` a capture was already reported: create no
8624
+ * order and wait for the payment's status instead.
8625
+ *
8626
+ * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-order`
8627
+ */
8628
+ async epayoutsPaypalOrder(options) {
8629
+ return this.client.request("POST", `${this.linkBase}/epayouts/paypal-order`, {
8630
+ ...options,
8631
+ headers: this.bearerHeaders(options?.headers)
8632
+ });
8633
+ }
8634
+ /**
8635
+ * Report a PayPal order's progress from `onApprove` on an experimental PayPal
8636
+ * SDK pane: the approval, before asking PayPal to capture — and capture only
8637
+ * once the router has it — then the capture PayPal answered, or a decline.
8638
+ * When the approval's answer is lost, do not capture: report `NOT_CAPTURED`
8639
+ * instead, which releases an approval the router may have recorded.
8640
+ *
8641
+ * The router records each on the payment and relays a capture that took money
8642
+ * to e-Payouts the way e-Payouts' own PayPal page does. It does not mark the
8643
+ * payment paid: that happens only on e-Payouts' notification, so poll the
8644
+ * payment's status afterwards. A repeated report is answered, not recorded
8645
+ * twice.
8646
+ *
8647
+ * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-capture`
8648
+ */
8649
+ async epayoutsPaypalCapture(params, options) {
8650
+ return this.client.request("POST", `${this.linkBase}/epayouts/paypal-capture`, {
8651
+ body: params,
8437
8652
  ...options,
8438
8653
  headers: this.bearerHeaders(options?.headers)
8439
8654
  });
@@ -9537,6 +9752,79 @@ var AdminPortal = class {
9537
9752
  }
9538
9753
  );
9539
9754
  }
9755
+ /**
9756
+ * DeloPay's own processor cost schedules — our acquirer contract, which
9757
+ * prices every merchant that has no schedule of its own, except an account
9758
+ * a shop owner brought (that rate is in their contract, not ours, and lives
9759
+ * on the merchant surface).
9760
+ *
9761
+ * Never returned on the merchant surface: these rates are DeloPay's cost
9762
+ * base. The rows carry no merchant.
9763
+ *
9764
+ * `GET /admin-portal/processor-costs`
9765
+ */
9766
+ async listProcessorCostSchedules() {
9767
+ return this.request("GET", "/admin-portal/processor-costs");
9768
+ }
9769
+ /**
9770
+ * Record a DeloPay-wide cost schedule — what a rail charges DeloPay, for
9771
+ * rails that report no fee on the payment itself. A cost derived from one
9772
+ * of these is marked `estimated` on the settlement line, never `reported`.
9773
+ *
9774
+ * `POST /admin-portal/processor-costs`
9775
+ */
9776
+ async createProcessorCostSchedule(params) {
9777
+ return this.request("POST", "/admin-portal/processor-costs", { body: params });
9778
+ }
9779
+ /**
9780
+ * Record several DeloPay-wide schedules at once, all or none — copy a price
9781
+ * list across methods. 1 to 200 entries; an invalid entry is answered `422`
9782
+ * naming its index and nothing is stored. The answer lists them in request
9783
+ * order.
9784
+ *
9785
+ * `POST /admin-portal/processor-costs/bulk`
9786
+ */
9787
+ async bulkCreateProcessorCostSchedules(params) {
9788
+ return this.request("POST", "/admin-portal/processor-costs/bulk", { body: params });
9789
+ }
9790
+ /**
9791
+ * Close a window, deactivate a DeloPay-wide schedule or annotate it. The
9792
+ * rate itself is not editable: it priced transactions that already
9793
+ * happened, and a new rate is a new row.
9794
+ *
9795
+ * `PUT /admin-portal/processor-costs/{scheduleId}`
9796
+ */
9797
+ async updateProcessorCostSchedule(scheduleId, params) {
9798
+ return this.request("PUT", `/admin-portal/processor-costs/${encodeURIComponent(scheduleId)}`, {
9799
+ body: params
9800
+ });
9801
+ }
9802
+ /**
9803
+ * Close a DeloPay-wide schedule at `effective_from` and open its successor
9804
+ * with the same scope and the same end, in one step: no transaction is
9805
+ * priced by both rates, and none falls between them. Answers the successor.
9806
+ *
9807
+ * `POST /admin-portal/processor-costs/{scheduleId}/replace`
9808
+ */
9809
+ async replaceProcessorCostSchedule(scheduleId, params) {
9810
+ return this.request(
9811
+ "POST",
9812
+ `/admin-portal/processor-costs/${encodeURIComponent(scheduleId)}/replace`,
9813
+ { body: params }
9814
+ );
9815
+ }
9816
+ /**
9817
+ * Delete a DeloPay-wide schedule. Restates nothing: every figure it derived
9818
+ * is already stamped on the settlement lines it priced.
9819
+ *
9820
+ * `DELETE /admin-portal/processor-costs/{scheduleId}`
9821
+ */
9822
+ async deleteProcessorCostSchedule(scheduleId) {
9823
+ return this.request(
9824
+ "DELETE",
9825
+ `/admin-portal/processor-costs/${encodeURIComponent(scheduleId)}`
9826
+ );
9827
+ }
9540
9828
  /** Get the connector health polling interval. `GET /admin-portal/connector-health-config` */
9541
9829
  async getConnectorHealthConfig() {
9542
9830
  return this.request("GET", "/admin-portal/connector-health-config");
@@ -10451,6 +10739,7 @@ var DelopayInternal = class extends Delopay {
10451
10739
  Configs,
10452
10740
  ConnectorRestrictionRules,
10453
10741
  ConnectorRestrictions,
10742
+ CostRules,
10454
10743
  DEFAULT_BADGES,
10455
10744
  DEFAULT_BADGES_DARK,
10456
10745
  DEFAULT_BRANDING,
@@ -10487,6 +10776,7 @@ var DelopayInternal = class extends Delopay {
10487
10776
  PaypalDisputes,
10488
10777
  PlatformBilling,
10489
10778
  PlatformFees,
10779
+ ProcessorCosts,
10490
10780
  RTL_CHECKOUT_LOCALES,
10491
10781
  Regions,
10492
10782
  Risk,