@delopay/sdk 0.100.2 → 0.101.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
@@ -3817,6 +3817,53 @@ var Subscriptions = class {
3817
3817
  async lookupPayments(params, options) {
3818
3818
  return this.request("POST", "/subscriptions/payments/lookup", { body: params, ...options });
3819
3819
  }
3820
+ /**
3821
+ * One subscription's billing history, newest cycle first.
3822
+ * `GET /subscriptions/{subscriptionId}/invoices`
3823
+ *
3824
+ * {@link retrieve} carries only the *latest* invoice, which is the current
3825
+ * cycle — a subscription that has renewed monthly for a year has one of those
3826
+ * and twelve of these. Use this wherever a merchant needs to see what a
3827
+ * subscription has actually billed, in particular on self-charging processors
3828
+ * (Creem, PayPal) where each renewal is charged by the processor and mirrored
3829
+ * here rather than raised as a DeloPay payment.
3830
+ *
3831
+ * Two things to render honestly, both decided rather than incidental:
3832
+ *
3833
+ * - `amount` is **gross** and `refunded_amount` sits beside it. Do not net
3834
+ * them: the difference between the two is not a smaller charge.
3835
+ * - A `refunded_amount` of `null` is "not reported" and must not render as
3836
+ * `0`. Likewise a processor-hosted origination records a bootstrap invoice
3837
+ * at `0` before the buyer has paid anything, so a zero amount on such a
3838
+ * subscription is a placeholder rather than a free cycle.
3839
+ *
3840
+ * Profile-scoped like every other subscription route.
3841
+ */
3842
+ async listInvoices(subscriptionId, params, options) {
3843
+ return this.request("GET", `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices`, {
3844
+ query: params,
3845
+ ...options
3846
+ });
3847
+ }
3848
+ /**
3849
+ * Which billing processor this shop's subscriptions run on.
3850
+ * `GET /subscriptions/billing_processor`
3851
+ *
3852
+ * The same mapping is derivable from the connector inventory
3853
+ * (`GET /account/{merchant_id}/connectors`), but that route is gated by a
3854
+ * connector-read permission granted independently of subscriptions — so a
3855
+ * role authorised to create subscriptions could be unable to learn which
3856
+ * processor it was creating them on. This answers under the same
3857
+ * authorization as the rest of the subscription API.
3858
+ *
3859
+ * Reach for it when the client must branch on the processor *before* calling
3860
+ * — origination differs by processor, and guessing is destructive. Resolve
3861
+ * the shop's `billing_processor_id` first: a shop that runs no subscriptions
3862
+ * has none assigned, and this route has no identity to report for it.
3863
+ */
3864
+ async getBillingProcessor(options) {
3865
+ return this.request("GET", "/subscriptions/billing_processor", { ...options });
3866
+ }
3820
3867
  };
3821
3868
 
3822
3869
  // src/resources/settlement.ts