@delopay/sdk 0.100.0 → 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.
@@ -105,8 +105,7 @@ var ApiKeys = class {
105
105
  // JWT-authenticated routes under `/account/{merchantId}/profile/api-keys`.
106
106
  // The caller's shop (business profile) comes from the JWT, never from the
107
107
  // request, so a shop-scoped user can only mint/list/manage keys pinned to
108
- // their own shop. Requires a backend with profile-scoped API key support
109
- // (DeloPay-net/delopay-backend#344).
108
+ // their own shop. Requires a backend with profile-scoped API key support.
110
109
  /**
111
110
  * Create a new API key pinned to the caller's shop (business profile).
112
111
  * `POST /account/{merchantId}/profile/api-keys`
@@ -3704,6 +3703,53 @@ var Subscriptions = class {
3704
3703
  async lookupPayments(params, options) {
3705
3704
  return this.request("POST", "/subscriptions/payments/lookup", { body: params, ...options });
3706
3705
  }
3706
+ /**
3707
+ * One subscription's billing history, newest cycle first.
3708
+ * `GET /subscriptions/{subscriptionId}/invoices`
3709
+ *
3710
+ * {@link retrieve} carries only the *latest* invoice, which is the current
3711
+ * cycle — a subscription that has renewed monthly for a year has one of those
3712
+ * and twelve of these. Use this wherever a merchant needs to see what a
3713
+ * subscription has actually billed, in particular on self-charging processors
3714
+ * (Creem, PayPal) where each renewal is charged by the processor and mirrored
3715
+ * here rather than raised as a DeloPay payment.
3716
+ *
3717
+ * Two things to render honestly, both decided rather than incidental:
3718
+ *
3719
+ * - `amount` is **gross** and `refunded_amount` sits beside it. Do not net
3720
+ * them: the difference between the two is not a smaller charge.
3721
+ * - A `refunded_amount` of `null` is "not reported" and must not render as
3722
+ * `0`. Likewise a processor-hosted origination records a bootstrap invoice
3723
+ * at `0` before the buyer has paid anything, so a zero amount on such a
3724
+ * subscription is a placeholder rather than a free cycle.
3725
+ *
3726
+ * Profile-scoped like every other subscription route.
3727
+ */
3728
+ async listInvoices(subscriptionId, params, options) {
3729
+ return this.request("GET", `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices`, {
3730
+ query: params,
3731
+ ...options
3732
+ });
3733
+ }
3734
+ /**
3735
+ * Which billing processor this shop's subscriptions run on.
3736
+ * `GET /subscriptions/billing_processor`
3737
+ *
3738
+ * The same mapping is derivable from the connector inventory
3739
+ * (`GET /account/{merchant_id}/connectors`), but that route is gated by a
3740
+ * connector-read permission granted independently of subscriptions — so a
3741
+ * role authorised to create subscriptions could be unable to learn which
3742
+ * processor it was creating them on. This answers under the same
3743
+ * authorization as the rest of the subscription API.
3744
+ *
3745
+ * Reach for it when the client must branch on the processor *before* calling
3746
+ * — origination differs by processor, and guessing is destructive. Resolve
3747
+ * the shop's `billing_processor_id` first: a shop that runs no subscriptions
3748
+ * has none assigned, and this route has no identity to report for it.
3749
+ */
3750
+ async getBillingProcessor(options) {
3751
+ return this.request("GET", "/subscriptions/billing_processor", { ...options });
3752
+ }
3707
3753
  };
3708
3754
 
3709
3755
  // src/resources/settlement.ts
@@ -5611,7 +5657,7 @@ var CheckoutSession = class {
5611
5657
  * own types and runtime gates — hence the loose return type.
5612
5658
  *
5613
5659
  * `theme` is the route's one declared query parameter (a named checkout
5614
- * variant, backend#793). `locale` travels as `Accept-Language` — the only
5660
+ * variant). `locale` travels as `Accept-Language` — the only
5615
5661
  * channel the backend's locale resolution reads; a `?locale=` query is
5616
5662
  * silently ignored by this route.
5617
5663
  *
@@ -5766,10 +5812,17 @@ var CheckoutSession = class {
5766
5812
  /**
5767
5813
  * A short-lived VGS Collect session for browser-side card capture.
5768
5814
  *
5769
- * A 404 or a 400 carrying the "shop has no vault" code means the shop
5770
- * has no vault configured; other errors must NOT be treated that way (a
5771
- * refused vault falling back to an unprotected card pane is exactly the
5772
- * bug this endpoint's error contract exists to prevent).
5815
+ * **Exactly one refusal means "this shop has no vault": a 400 carrying
5816
+ * `IR_19`.** Every other refusal means a vault exists and could not be used,
5817
+ * and answering it by falling back to the processor's own card pane sends an
5818
+ * unprotected card number to the very processor the shop pays to hide it
5819
+ * from — the bug this endpoint's error contract exists to prevent.
5820
+ *
5821
+ * A **404 is not benign.** The router answers it when the shop's vault
5822
+ * account cannot be found — the state a shop is left in when its vault
5823
+ * connector is deleted while the profile keeps naming the id: it still
5824
+ * reports the vault as enabled and still expects its cards cloaked. The same
5825
+ * status also covers a payment that does not exist.
5773
5826
  *
5774
5827
  * `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
5775
5828
  */
@@ -6168,4 +6221,4 @@ export {
6168
6221
  focusedCheckoutUrl,
6169
6222
  CHECKOUT_EVENT_KINDS
6170
6223
  };
6171
- //# sourceMappingURL=chunk-HK4S2SQB.js.map
6224
+ //# sourceMappingURL=chunk-NLUEZQZF.js.map