@delopay/sdk 0.295.0 → 0.299.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
@@ -8568,29 +8568,35 @@ var BuyerAccount = class {
8568
8568
  /**
8569
8569
  * The buyer's subscriptions across shops, newest first. A record the buyer
8570
8570
  * has not confirmed shows what a receipt carries, without its period or
8571
- * cancellation.
8571
+ * cancellation. Follow `next_cursor` with the same shop and mode; an
8572
+ * omitted mode includes both modes.
8572
8573
  */
8573
8574
  async listSubscriptions(query, options) {
8574
8575
  return this.request("GET", "/buyer-account/subscriptions", {
8575
- query,
8576
+ query: query ? { ...query } : void 0,
8576
8577
  ...options
8577
8578
  });
8578
8579
  }
8579
8580
  /**
8580
8581
  * The issued invoices of the records the buyer has confirmed through a
8581
8582
  * shop's own link, newest first. `unconfirmed_records` says when records
8582
- * were left out.
8583
+ * were left out. Follow `next_cursor` with the same shop and mode; an
8584
+ * omitted mode includes both modes.
8583
8585
  */
8584
8586
  async listInvoices(query, options) {
8585
8587
  return this.request("GET", "/buyer-account/invoices", {
8586
- query,
8588
+ query: query ? { ...query } : void 0,
8587
8589
  ...options
8588
8590
  });
8589
8591
  }
8590
- /** The refund requests of the records the buyer has confirmed, newest first, with the shop's decision. */
8592
+ /**
8593
+ * The confirmed records' refund requests, newest first, with the shop's
8594
+ * decision. Follow `next_cursor` with the same shop and mode; an omitted
8595
+ * mode includes both modes.
8596
+ */
8591
8597
  async listRefundRequests(query, options) {
8592
8598
  return this.request("GET", "/buyer-account/refund-requests", {
8593
- query,
8599
+ query: query ? { ...query } : void 0,
8594
8600
  ...options
8595
8601
  });
8596
8602
  }
@@ -8700,11 +8706,13 @@ var BuyerAccount = class {
8700
8706
  /**
8701
8707
  * What the buyer spent in a period: paid purchases summed per currency,
8702
8708
  * never converted, for the whole period, per day, week or month, per shop
8703
- * and per kind of purchase.
8709
+ * and per kind of purchase. `subscriptions`, when present, summarizes all
8710
+ * current subscriptions in the same shop and mode, independently of the
8711
+ * spending period and subscription list pagination.
8704
8712
  */
8705
8713
  async analytics(query, options) {
8706
8714
  return this.request("GET", "/buyer-account/analytics", {
8707
- query,
8715
+ query: { ...query },
8708
8716
  ...options
8709
8717
  });
8710
8718
  }
@@ -9827,7 +9835,62 @@ var Risk = class {
9827
9835
  async retrieveShop(profileId, options) {
9828
9836
  return this.request("GET", `/risk/shops/${encodeURIComponent(profileId)}`, options);
9829
9837
  }
9838
+ /**
9839
+ * One scope's tuning of the merchant's own, adjusted risk assessment: what
9840
+ * it sets, what applies there and where each part comes from, and DeloPay's
9841
+ * reference beside it. Needs the `RiskTuning` area's `Read` at that scope.
9842
+ *
9843
+ * `GET /risk/tuning`, `GET /risk/tuning/{projects|shops}/{id}`
9844
+ */
9845
+ async retrieveTuning(target = { scope: "merchant" }, options) {
9846
+ return this.request("GET", riskTuningPath(target), options);
9847
+ }
9848
+ /**
9849
+ * Replace one scope's tuning. A shop or project needs the area's `Edit`, the
9850
+ * merchant-wide tuning its `Write`. A save on top of a newer revision is
9851
+ * refused with `IR_16`; a tuning that would leave a reached shop with
9852
+ * nothing to score with is refused with `IR_06`.
9853
+ *
9854
+ * `PUT /risk/tuning`, `PUT /risk/tuning/{projects|shops}/{id}`
9855
+ */
9856
+ async updateTuning(target, params, options) {
9857
+ return this.request("PUT", riskTuningPath(target), { ...options, body: params });
9858
+ }
9859
+ /**
9860
+ * Hand every part of one scope's tuning back to what it inherits.
9861
+ *
9862
+ * `DELETE /risk/tuning?expected_revision=…`
9863
+ */
9864
+ async resetTuning(target, expectedRevision, options) {
9865
+ return this.request("DELETE", riskTuningPath(target), {
9866
+ ...options,
9867
+ query: { expected_revision: expectedRevision }
9868
+ });
9869
+ }
9870
+ /**
9871
+ * Estimate what a change would do to every shop it reaches, from the
9872
+ * evidence stored up to today. Stores, scores and sends nothing; a pair
9873
+ * with no usable evidence says why rather than showing a band.
9874
+ *
9875
+ * `POST /risk/tuning/preview`, `POST /risk/tuning/{projects|shops}/{id}/preview`
9876
+ */
9877
+ async previewTuning(target, adjustments, options) {
9878
+ return this.request("POST", `${riskTuningPath(target)}/preview`, {
9879
+ ...options,
9880
+ body: { adjustments }
9881
+ });
9882
+ }
9830
9883
  };
9884
+ function riskTuningPath(target, prefix = "") {
9885
+ switch (target.scope) {
9886
+ case "merchant":
9887
+ return `${prefix}/risk/tuning`;
9888
+ case "project":
9889
+ return `${prefix}/risk/tuning/projects/${encodeURIComponent(target.id)}`;
9890
+ case "shop":
9891
+ return `${prefix}/risk/tuning/shops/${encodeURIComponent(target.id)}`;
9892
+ }
9893
+ }
9831
9894
 
9832
9895
  // src/resources/live.ts
9833
9896
  function readField(data, key) {