@delopay/sdk 0.185.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
@@ -4252,6 +4262,20 @@ var Users = class {
4252
4262
  async deleteUserRole(params) {
4253
4263
  return this.request("DELETE", "/user/employees/delete", { body: params });
4254
4264
  }
4265
+ /**
4266
+ * Move a team member between a merchant-level role and shop-level roles.
4267
+ * `POST /user/employees/change-scope`
4268
+ *
4269
+ * A merchant-level `role_id` takes no `profile_ids`; a shop-level one needs
4270
+ * at least one. Every earlier merchant- and shop-level binding of the member
4271
+ * in your merchant is replaced. When the change takes a scope away, the
4272
+ * member's sessions end (`sessions_revoked: true`). Needs a caller at
4273
+ * merchant level or above. A refusal is a `UR_23` error whose `data.reason`
4274
+ * names the rule; an unknown `role_id` is `UR_22`.
4275
+ */
4276
+ async changeMemberScope(params) {
4277
+ return this.request("POST", "/user/employees/change-scope", { body: params });
4278
+ }
4255
4279
  /** Sign in via OIDC. `POST /user/oidc` */
4256
4280
  async signInOidc(params) {
4257
4281
  return this.request("POST", "/user/oidc", { body: params });
@@ -4801,6 +4825,24 @@ var Export = class {
4801
4825
  options
4802
4826
  );
4803
4827
  }
4828
+ async transactionLines(params, options) {
4829
+ return runExport(
4830
+ this.request,
4831
+ "POST",
4832
+ "/export/transactions/lines",
4833
+ { body: params ?? {} },
4834
+ options
4835
+ );
4836
+ }
4837
+ async transactionLinesForProfile(params, options) {
4838
+ return runExport(
4839
+ this.request,
4840
+ "POST",
4841
+ "/export/profile/transactions/lines",
4842
+ { body: params ?? {} },
4843
+ options
4844
+ );
4845
+ }
4804
4846
  async refunds(params, options) {
4805
4847
  return runExport(this.request, "POST", "/refunds/list/export", { body: params ?? {} }, options);
4806
4848
  }
@@ -5222,6 +5264,20 @@ var Products = class {
5222
5264
  ...this.scoped(profileId, options)
5223
5265
  });
5224
5266
  }
5267
+ /**
5268
+ * What a product sold in a window, per currency, net of the refunds credited
5269
+ * to its lines. Refunds that named no product line are not included.
5270
+ * `GET /products/{product_id}/sales`
5271
+ *
5272
+ * Needs payment read; refused (403) to a caller limited to some connector
5273
+ * accounts.
5274
+ */
5275
+ async sales(productId, query, profileId, options) {
5276
+ return this.request("GET", `/products/${encodeURIComponent(productId)}/sales`, {
5277
+ ...this.scoped(profileId, options),
5278
+ query: { ...query }
5279
+ });
5280
+ }
5225
5281
  /**
5226
5282
  * Change a product's name, description, image, metadata or category
5227
5283
  * (`category_id: null` makes it uncategorized).
@@ -5263,6 +5319,20 @@ var Products = class {
5263
5319
  ...this.scoped(profileId, options)
5264
5320
  });
5265
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
+ }
5266
5336
  /**
5267
5337
  * Add a price to an existing product.
5268
5338
  * `POST /products/{product_id}/prices`
@@ -5504,9 +5574,12 @@ var Products = class {
5504
5574
  }
5505
5575
  /**
5506
5576
  * Create a product for every new item and add the new prices of every
5507
- * changed one, tied to the provider's ids. Nothing is edited or removed, and
5508
- * nothing is written to the provider. A failed item is reported with its
5509
- * 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`.
5510
5583
  * `POST /products/import/apply`
5511
5584
  */
5512
5585
  async importApply(request, profileId, options) {
@@ -5525,6 +5598,91 @@ var Products = class {
5525
5598
  ...this.scoped(profileId, options)
5526
5599
  });
5527
5600
  }
5601
+ // --- provider sync -----------------------------------------------
5602
+ /**
5603
+ * Compare the product with its copy at every connected account it is tied
5604
+ * to. Reads the providers now; an unreadable provider answers `unknown`,
5605
+ * never `in_sync`.
5606
+ * `GET /products/{product_id}/provider-sync`
5607
+ */
5608
+ async providerSync(productId, profileId, options) {
5609
+ return this.request("GET", `/products/${encodeURIComponent(productId)}/provider-sync`, {
5610
+ ...this.scoped(profileId, options)
5611
+ });
5612
+ }
5613
+ /**
5614
+ * {@link providerSync} for 1 to 50 products at once, such as one page of the
5615
+ * product list. Unknown ids are left out of the answer.
5616
+ * `POST /products/provider-sync`
5617
+ */
5618
+ async providerSyncBatch(request, profileId, options) {
5619
+ return this.request("POST", "/products/provider-sync", {
5620
+ body: request,
5621
+ ...this.scoped(profileId, options)
5622
+ });
5623
+ }
5624
+ /**
5625
+ * Write the catalog's state onto one connected account's copy of the
5626
+ * product, for the differences a push changes and nothing else. When it
5627
+ * would change a difference not named in `confirmed`, nothing is written and
5628
+ * the answer carries `confirmation_outdated: true` with the current
5629
+ * differences in `result`; `nothing_to_push` answers without a provider
5630
+ * write when nothing pushable differs.
5631
+ * `POST /products/{product_id}/provider-sync/push`
5632
+ */
5633
+ async providerPush(productId, request, profileId, options) {
5634
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-sync/push`, {
5635
+ body: request,
5636
+ ...this.scoped(profileId, options)
5637
+ });
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
+ }
5528
5686
  };
5529
5687
 
5530
5688
  // src/resources/processorCosts.ts
@@ -6457,7 +6615,10 @@ var OperationLimits = class {
6457
6615
  *
6458
6616
  * Refused for the user who requested it, and for an approver whose own
6459
6617
  * limit would not have covered the operation — the permission is necessary
6460
- * 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.
6461
6622
  *
6462
6623
  * Approval and execution are two facts. A request that was approved but
6463
6624
  * whose operation then failed comes back `approved` with `execution_error`
@@ -10220,6 +10381,27 @@ var CheckoutSession = class {
10220
10381
  headers: this.bearerHeaders(options?.headers)
10221
10382
  });
10222
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
+ }
10223
10405
  /**
10224
10406
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
10225
10407
  * form's pre-submit hook.