@delopay/sdk 0.100.2 → 0.102.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
@@ -2299,6 +2299,22 @@ var Routing = class {
2299
2299
  async deactivate(params = {}) {
2300
2300
  return this.request("POST", "/routing/deactivate", { body: params });
2301
2301
  }
2302
+ /**
2303
+ * Edit a static routing configuration.
2304
+ *
2305
+ * Partial: send only the fields to change. `name`/`description` are
2306
+ * metadata-only; `algorithm` is a wholesale rule replacement, validated
2307
+ * against the shop exactly as at create. `modified_at` is bumped either way.
2308
+ *
2309
+ * `PUT /routing/{algorithmId}`
2310
+ *
2311
+ * @param algorithmId - The routing algorithm ID to edit.
2312
+ * @param params - The fields to change (at least one required).
2313
+ * @returns The updated routing configuration including the algorithm body.
2314
+ */
2315
+ async update(algorithmId, params) {
2316
+ return this.request("PUT", `/routing/${encodeURIComponent(algorithmId)}`, { body: params });
2317
+ }
2302
2318
  /**
2303
2319
  * List all routing algorithms for the current merchant.
2304
2320
  *
@@ -3817,6 +3833,53 @@ var Subscriptions = class {
3817
3833
  async lookupPayments(params, options) {
3818
3834
  return this.request("POST", "/subscriptions/payments/lookup", { body: params, ...options });
3819
3835
  }
3836
+ /**
3837
+ * One subscription's billing history, newest cycle first.
3838
+ * `GET /subscriptions/{subscriptionId}/invoices`
3839
+ *
3840
+ * {@link retrieve} carries only the *latest* invoice, which is the current
3841
+ * cycle — a subscription that has renewed monthly for a year has one of those
3842
+ * and twelve of these. Use this wherever a merchant needs to see what a
3843
+ * subscription has actually billed, in particular on self-charging processors
3844
+ * (Creem, PayPal) where each renewal is charged by the processor and mirrored
3845
+ * here rather than raised as a DeloPay payment.
3846
+ *
3847
+ * Two things to render honestly, both decided rather than incidental:
3848
+ *
3849
+ * - `amount` is **gross** and `refunded_amount` sits beside it. Do not net
3850
+ * them: the difference between the two is not a smaller charge.
3851
+ * - A `refunded_amount` of `null` is "not reported" and must not render as
3852
+ * `0`. Likewise a processor-hosted origination records a bootstrap invoice
3853
+ * at `0` before the buyer has paid anything, so a zero amount on such a
3854
+ * subscription is a placeholder rather than a free cycle.
3855
+ *
3856
+ * Profile-scoped like every other subscription route.
3857
+ */
3858
+ async listInvoices(subscriptionId, params, options) {
3859
+ return this.request("GET", `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices`, {
3860
+ query: params,
3861
+ ...options
3862
+ });
3863
+ }
3864
+ /**
3865
+ * Which billing processor this shop's subscriptions run on.
3866
+ * `GET /subscriptions/billing_processor`
3867
+ *
3868
+ * The same mapping is derivable from the connector inventory
3869
+ * (`GET /account/{merchant_id}/connectors`), but that route is gated by a
3870
+ * connector-read permission granted independently of subscriptions — so a
3871
+ * role authorised to create subscriptions could be unable to learn which
3872
+ * processor it was creating them on. This answers under the same
3873
+ * authorization as the rest of the subscription API.
3874
+ *
3875
+ * Reach for it when the client must branch on the processor *before* calling
3876
+ * — origination differs by processor, and guessing is destructive. Resolve
3877
+ * the shop's `billing_processor_id` first: a shop that runs no subscriptions
3878
+ * has none assigned, and this route has no identity to report for it.
3879
+ */
3880
+ async getBillingProcessor(options) {
3881
+ return this.request("GET", "/subscriptions/billing_processor", { ...options });
3882
+ }
3820
3883
  };
3821
3884
 
3822
3885
  // src/resources/settlement.ts