@delopay/sdk 0.297.0 → 0.300.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
@@ -8586,29 +8586,35 @@ var BuyerAccount = class {
8586
8586
  /**
8587
8587
  * The buyer's subscriptions across shops, newest first. A record the buyer
8588
8588
  * has not confirmed shows what a receipt carries, without its period or
8589
- * cancellation.
8589
+ * cancellation. Follow `next_cursor` with the same shop and mode; an
8590
+ * omitted mode includes both modes.
8590
8591
  */
8591
8592
  async listSubscriptions(query, options) {
8592
8593
  return this.request("GET", "/buyer-account/subscriptions", {
8593
- query,
8594
+ query: query ? { ...query } : void 0,
8594
8595
  ...options
8595
8596
  });
8596
8597
  }
8597
8598
  /**
8598
8599
  * The issued invoices of the records the buyer has confirmed through a
8599
8600
  * shop's own link, newest first. `unconfirmed_records` says when records
8600
- * were left out.
8601
+ * were left out. Follow `next_cursor` with the same shop and mode; an
8602
+ * omitted mode includes both modes.
8601
8603
  */
8602
8604
  async listInvoices(query, options) {
8603
8605
  return this.request("GET", "/buyer-account/invoices", {
8604
- query,
8606
+ query: query ? { ...query } : void 0,
8605
8607
  ...options
8606
8608
  });
8607
8609
  }
8608
- /** The refund requests of the records the buyer has confirmed, newest first, with the shop's decision. */
8610
+ /**
8611
+ * The confirmed records' refund requests, newest first, with the shop's
8612
+ * decision. Follow `next_cursor` with the same shop and mode; an omitted
8613
+ * mode includes both modes.
8614
+ */
8609
8615
  async listRefundRequests(query, options) {
8610
8616
  return this.request("GET", "/buyer-account/refund-requests", {
8611
- query,
8617
+ query: query ? { ...query } : void 0,
8612
8618
  ...options
8613
8619
  });
8614
8620
  }
@@ -8718,11 +8724,13 @@ var BuyerAccount = class {
8718
8724
  /**
8719
8725
  * What the buyer spent in a period: paid purchases summed per currency,
8720
8726
  * never converted, for the whole period, per day, week or month, per shop
8721
- * and per kind of purchase.
8727
+ * and per kind of purchase. `subscriptions`, when present, summarizes all
8728
+ * current subscriptions in the same shop and mode, independently of the
8729
+ * spending period and subscription list pagination.
8722
8730
  */
8723
8731
  async analytics(query, options) {
8724
8732
  return this.request("GET", "/buyer-account/analytics", {
8725
- query,
8733
+ query: { ...query },
8726
8734
  ...options
8727
8735
  });
8728
8736
  }
@@ -9845,7 +9853,62 @@ var Risk = class {
9845
9853
  async retrieveShop(profileId, options) {
9846
9854
  return this.request("GET", `/risk/shops/${encodeURIComponent(profileId)}`, options);
9847
9855
  }
9856
+ /**
9857
+ * One scope's tuning of the merchant's own, adjusted risk assessment: what
9858
+ * it sets, what applies there and where each part comes from, and DeloPay's
9859
+ * reference beside it. Needs the `RiskTuning` area's `Read` at that scope.
9860
+ *
9861
+ * `GET /risk/tuning`, `GET /risk/tuning/{projects|shops}/{id}`
9862
+ */
9863
+ async retrieveTuning(target = { scope: "merchant" }, options) {
9864
+ return this.request("GET", riskTuningPath(target), options);
9865
+ }
9866
+ /**
9867
+ * Replace one scope's tuning. A shop or project needs the area's `Edit`, the
9868
+ * merchant-wide tuning its `Write`. A save on top of a newer revision is
9869
+ * refused with `IR_16`; a tuning that would leave a reached shop with
9870
+ * nothing to score with is refused with `IR_06`.
9871
+ *
9872
+ * `PUT /risk/tuning`, `PUT /risk/tuning/{projects|shops}/{id}`
9873
+ */
9874
+ async updateTuning(target, params, options) {
9875
+ return this.request("PUT", riskTuningPath(target), { ...options, body: params });
9876
+ }
9877
+ /**
9878
+ * Hand every part of one scope's tuning back to what it inherits.
9879
+ *
9880
+ * `DELETE /risk/tuning?expected_revision=…`
9881
+ */
9882
+ async resetTuning(target, expectedRevision, options) {
9883
+ return this.request("DELETE", riskTuningPath(target), {
9884
+ ...options,
9885
+ query: { expected_revision: expectedRevision }
9886
+ });
9887
+ }
9888
+ /**
9889
+ * Estimate what a change would do to every shop it reaches, from the
9890
+ * evidence stored up to today. Stores, scores and sends nothing; a pair
9891
+ * with no usable evidence says why rather than showing a band.
9892
+ *
9893
+ * `POST /risk/tuning/preview`, `POST /risk/tuning/{projects|shops}/{id}/preview`
9894
+ */
9895
+ async previewTuning(target, adjustments, options) {
9896
+ return this.request("POST", `${riskTuningPath(target)}/preview`, {
9897
+ ...options,
9898
+ body: { adjustments }
9899
+ });
9900
+ }
9848
9901
  };
9902
+ function riskTuningPath(target, prefix = "") {
9903
+ switch (target.scope) {
9904
+ case "merchant":
9905
+ return `${prefix}/risk/tuning`;
9906
+ case "project":
9907
+ return `${prefix}/risk/tuning/projects/${encodeURIComponent(target.id)}`;
9908
+ case "shop":
9909
+ return `${prefix}/risk/tuning/shops/${encodeURIComponent(target.id)}`;
9910
+ }
9911
+ }
9849
9912
 
9850
9913
  // src/resources/live.ts
9851
9914
  function readField(data, key) {
@@ -16643,6 +16706,48 @@ var AdminPortal = class {
16643
16706
  async getMerchantRisk(merchantId) {
16644
16707
  return this.request("GET", `/admin-portal/accounts/${encodeURIComponent(merchantId)}/risk`);
16645
16708
  }
16709
+ /**
16710
+ * A merchant's tuning of its own risk assessment at one scope, as the
16711
+ * merchant sees it, for operators.
16712
+ *
16713
+ * `GET /admin-portal/accounts/{merchant_id}/risk/tuning[/{projects|shops}/{id}]`
16714
+ */
16715
+ async getMerchantRiskTuning(merchantId, target = { scope: "merchant" }) {
16716
+ return this.request("GET", riskTuningPath(target, adminAccount(merchantId)));
16717
+ }
16718
+ /**
16719
+ * Replace a merchant's tuning at one scope on its behalf. Needs
16720
+ * `AccountManage`; the merchant sees the change as `platform_operator`, the
16721
+ * audit names the operator. Validated and revision-checked as the
16722
+ * merchant's own save is.
16723
+ *
16724
+ * `PUT /admin-portal/accounts/{merchant_id}/risk/tuning[/{projects|shops}/{id}]`
16725
+ */
16726
+ async updateMerchantRiskTuning(merchantId, target, params) {
16727
+ return this.request("PUT", riskTuningPath(target, adminAccount(merchantId)), {
16728
+ body: params
16729
+ });
16730
+ }
16731
+ /**
16732
+ * Reset a merchant's tuning at one scope on its behalf.
16733
+ *
16734
+ * `DELETE /admin-portal/accounts/{merchant_id}/risk/tuning[/{projects|shops}/{id}]`
16735
+ */
16736
+ async resetMerchantRiskTuning(merchantId, target, expectedRevision) {
16737
+ return this.request("DELETE", riskTuningPath(target, adminAccount(merchantId)), {
16738
+ query: { expected_revision: expectedRevision }
16739
+ });
16740
+ }
16741
+ /**
16742
+ * Estimate a change to a merchant's tuning. Stores, scores and sends nothing.
16743
+ *
16744
+ * `POST /admin-portal/accounts/{merchant_id}/risk/tuning[/{projects|shops}/{id}]/preview`
16745
+ */
16746
+ async previewMerchantRiskTuning(merchantId, target, adjustments) {
16747
+ return this.request("POST", `${riskTuningPath(target, adminAccount(merchantId))}/preview`, {
16748
+ body: { adjustments }
16749
+ });
16750
+ }
16646
16751
  /**
16647
16752
  * The shop risk model the daily scoring pass uses, where it comes from and
16648
16753
  * the `revision` to name when changing it. When no model can be used,
@@ -16698,6 +16803,9 @@ function transactionListQuery(params) {
16698
16803
  ...product_ids?.length ? { product_ids: product_ids.join(",") } : {}
16699
16804
  };
16700
16805
  }
16806
+ function adminAccount(merchantId) {
16807
+ return `/admin-portal/accounts/${encodeURIComponent(merchantId)}`;
16808
+ }
16701
16809
 
16702
16810
  // src/internal/resources/auditLogs.ts
16703
16811
  var AuditLogs = class {