@delopay/sdk 0.186.0 → 0.187.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
@@ -4131,9 +4131,19 @@ var Users = class {
4131
4131
  * Mints a session token **as** the given member, so the dashboard renders
4132
4132
  * exactly what they see (useful for support and role verification). The
4133
4133
  * caller needs the *Impersonation* permission, and the member's role must
4134
- * rank **strictly below** the caller's (`Profile < Merchant < Organization`);
4135
- * the server rejects self-impersonation, cross-merchant targets, and
4136
- * equal/higher roles.
4134
+ * either rank **strictly below** the caller's
4135
+ * (`Profile < Merchant < Organization`), or sit at the caller's own
4136
+ * merchant-or-higher level and be **strictly narrower** than the caller's
4137
+ * role (grant nothing the caller's role does not, and less in total). The
4138
+ * server rejects self-impersonation and cross-merchant targets.
4139
+ * `MinimalRoleInfo.can_impersonate` in `listUsersInLineage` answers the same rule
4140
+ * per binding, so a UI can offer the action only where it will succeed.
4141
+ *
4142
+ * A role refusal is a `UR_33` error whose `data.reason` names the rule:
4143
+ * `impersonation_target_not_narrower` (the member's role is above, equal to,
4144
+ * or not contained in the caller's), or `act_as_token_cannot_impersonate`
4145
+ * (the caller is itself signed in as another member — start from your own
4146
+ * session).
4137
4147
  *
4138
4148
  * The returned token is tab-scoped by design: open it in a fresh tab (e.g.
4139
4149
  * `/auth/impersonate?token=…`) rather than replacing the caller's own
@@ -5309,6 +5319,20 @@ var Products = class {
5309
5319
  ...this.scoped(profileId, options)
5310
5320
  });
5311
5321
  }
5322
+ /**
5323
+ * Delete an archived product, then carry out the chosen action at each
5324
+ * connected account it is tied to. An account not named in
5325
+ * `provider_actions` is kept as it is. A failed provider action does not
5326
+ * undo the delete: it is listed by {@link providerCleanups} and retried
5327
+ * with {@link providerArchive}.
5328
+ * `POST /products/{product_id}/delete`
5329
+ */
5330
+ async deleteWithProviders(productId, request, profileId, options) {
5331
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/delete`, {
5332
+ body: request,
5333
+ ...this.scoped(profileId, options)
5334
+ });
5335
+ }
5312
5336
  /**
5313
5337
  * Add a price to an existing product.
5314
5338
  * `POST /products/{product_id}/prices`
@@ -5550,9 +5574,12 @@ var Products = class {
5550
5574
  }
5551
5575
  /**
5552
5576
  * Create a product for every new item and add the new prices of every
5553
- * changed one, tied to the provider's ids. Nothing is edited or removed, and
5554
- * nothing is written to the provider. A failed item is reported with its
5555
- * reason and can be retried by naming it in `connector_product_ids`.
5577
+ * changed one, tied to the provider's ids. Nothing else is edited or
5578
+ * removed, except that `options.archived: 'archive'` archives the catalog
5579
+ * product of every item the provider no longer offers (by default it is
5580
+ * left as it is). Nothing is written to the provider. A failed item is
5581
+ * reported with its reason and can be retried by naming it in
5582
+ * `connector_product_ids`.
5556
5583
  * `POST /products/import/apply`
5557
5584
  */
5558
5585
  async importApply(request, profileId, options) {
@@ -5609,6 +5636,53 @@ var Products = class {
5609
5636
  ...this.scoped(profileId, options)
5610
5637
  });
5611
5638
  }
5639
+ // --- provider lifecycle -----------------------------------------
5640
+ /**
5641
+ * The shop's connected accounts the catalog works with, and what each can
5642
+ * do: read, create, push, and how a delete can clean up there.
5643
+ * `GET /products/provider-accounts`
5644
+ */
5645
+ async providerAccounts(profileId, options) {
5646
+ return this.request("GET", "/products/provider-accounts", {
5647
+ ...this.scoped(profileId, options)
5648
+ });
5649
+ }
5650
+ /**
5651
+ * Provider clean-ups still to be carried out: deletes whose action at a
5652
+ * provider failed, or was recorded and never reached.
5653
+ * `GET /products/provider-cleanups`
5654
+ */
5655
+ async providerCleanups(profileId, options) {
5656
+ return this.request("GET", "/products/provider-cleanups", {
5657
+ ...this.scoped(profileId, options)
5658
+ });
5659
+ }
5660
+ /**
5661
+ * Create the product at a connected account it is not at yet. Without
5662
+ * `confirmed` nothing is written and the answer holds the plan to review;
5663
+ * send the plan's `fingerprint` back as `confirmed` to carry it out. When
5664
+ * the plan changed since, nothing is written and the answer carries
5665
+ * `confirmation_outdated: true` with the current plan.
5666
+ * `POST /products/{product_id}/provider-sync/create`
5667
+ */
5668
+ async providerCreate(productId, request, profileId, options) {
5669
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-sync/create`, {
5670
+ body: request,
5671
+ ...this.scoped(profileId, options)
5672
+ });
5673
+ }
5674
+ /**
5675
+ * Archive the product at one connected account, or retry a clean-up that
5676
+ * failed after the product was deleted. Existing subscriptions there keep
5677
+ * billing; the catalog is not changed.
5678
+ * `POST /products/{product_id}/provider-archive`
5679
+ */
5680
+ async providerArchive(productId, request, profileId, options) {
5681
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-archive`, {
5682
+ body: request,
5683
+ ...this.scoped(profileId, options)
5684
+ });
5685
+ }
5612
5686
  };
5613
5687
 
5614
5688
  // src/resources/processorCosts.ts
@@ -6541,7 +6615,10 @@ var OperationLimits = class {
6541
6615
  *
6542
6616
  * Refused for the user who requested it, and for an approver whose own
6543
6617
  * limit would not have covered the operation — the permission is necessary
6544
- * and not sufficient.
6618
+ * and not sufficient. The requester stays refused while signed in as
6619
+ * another team member: that is a `DE_12` error (`approval_decision_refused`)
6620
+ * whose `data.reason` is `requester_acting_as_another_member`, and
6621
+ * {@link reject} refuses the same way.
6545
6622
  *
6546
6623
  * Approval and execution are two facts. A request that was approved but
6547
6624
  * whose operation then failed comes back `approved` with `execution_error`
@@ -10304,6 +10381,27 @@ var CheckoutSession = class {
10304
10381
  headers: this.bearerHeaders(options?.headers)
10305
10382
  });
10306
10383
  }
10384
+ /**
10385
+ * Make the buyer's add-on choice while the checkout data answers
10386
+ * `type: 'addon_choice'`.
10387
+ *
10388
+ * Only price ids and quantities are sent; the router prices them from the
10389
+ * catalog and judges every selection group's bounds. The payment's lines and
10390
+ * amount change together, once: the choice is final afterwards, the same
10391
+ * choice sent again answers the same result, and another is refused with
10392
+ * `IR_16` — as is a choice once anything could have been charged at the
10393
+ * previous amount. Fetch the checkout data again afterwards for the payment
10394
+ * methods at the final amount.
10395
+ *
10396
+ * `POST /payment-link/{merchantId}/{paymentId}/addons`
10397
+ */
10398
+ async chooseAddons(params, options) {
10399
+ return this.client.request("POST", `${this.linkBase}/addons`, {
10400
+ body: params,
10401
+ ...options,
10402
+ headers: this.bearerHeaders(options?.headers)
10403
+ });
10404
+ }
10307
10405
  /**
10308
10406
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
10309
10407
  * form's pre-submit hook.