@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.
@@ -3889,9 +3889,19 @@ var Users = class {
3889
3889
  * Mints a session token **as** the given member, so the dashboard renders
3890
3890
  * exactly what they see (useful for support and role verification). The
3891
3891
  * caller needs the *Impersonation* permission, and the member's role must
3892
- * rank **strictly below** the caller's (`Profile < Merchant < Organization`);
3893
- * the server rejects self-impersonation, cross-merchant targets, and
3894
- * equal/higher roles.
3892
+ * either rank **strictly below** the caller's
3893
+ * (`Profile < Merchant < Organization`), or sit at the caller's own
3894
+ * merchant-or-higher level and be **strictly narrower** than the caller's
3895
+ * role (grant nothing the caller's role does not, and less in total). The
3896
+ * server rejects self-impersonation and cross-merchant targets.
3897
+ * `MinimalRoleInfo.can_impersonate` in `listUsersInLineage` answers the same rule
3898
+ * per binding, so a UI can offer the action only where it will succeed.
3899
+ *
3900
+ * A role refusal is a `UR_33` error whose `data.reason` names the rule:
3901
+ * `impersonation_target_not_narrower` (the member's role is above, equal to,
3902
+ * or not contained in the caller's), or `act_as_token_cannot_impersonate`
3903
+ * (the caller is itself signed in as another member — start from your own
3904
+ * session).
3895
3905
  *
3896
3906
  * The returned token is tab-scoped by design: open it in a fresh tab (e.g.
3897
3907
  * `/auth/impersonate?token=…`) rather than replacing the caller's own
@@ -4010,6 +4020,20 @@ var Users = class {
4010
4020
  async deleteUserRole(params) {
4011
4021
  return this.request("DELETE", "/user/employees/delete", { body: params });
4012
4022
  }
4023
+ /**
4024
+ * Move a team member between a merchant-level role and shop-level roles.
4025
+ * `POST /user/employees/change-scope`
4026
+ *
4027
+ * A merchant-level `role_id` takes no `profile_ids`; a shop-level one needs
4028
+ * at least one. Every earlier merchant- and shop-level binding of the member
4029
+ * in your merchant is replaced. When the change takes a scope away, the
4030
+ * member's sessions end (`sessions_revoked: true`). Needs a caller at
4031
+ * merchant level or above. A refusal is a `UR_23` error whose `data.reason`
4032
+ * names the rule; an unknown `role_id` is `UR_22`.
4033
+ */
4034
+ async changeMemberScope(params) {
4035
+ return this.request("POST", "/user/employees/change-scope", { body: params });
4036
+ }
4013
4037
  /** Sign in via OIDC. `POST /user/oidc` */
4014
4038
  async signInOidc(params) {
4015
4039
  return this.request("POST", "/user/oidc", { body: params });
@@ -4559,6 +4583,24 @@ var Export = class {
4559
4583
  options
4560
4584
  );
4561
4585
  }
4586
+ async transactionLines(params, options) {
4587
+ return runExport(
4588
+ this.request,
4589
+ "POST",
4590
+ "/export/transactions/lines",
4591
+ { body: params ?? {} },
4592
+ options
4593
+ );
4594
+ }
4595
+ async transactionLinesForProfile(params, options) {
4596
+ return runExport(
4597
+ this.request,
4598
+ "POST",
4599
+ "/export/profile/transactions/lines",
4600
+ { body: params ?? {} },
4601
+ options
4602
+ );
4603
+ }
4562
4604
  async refunds(params, options) {
4563
4605
  return runExport(this.request, "POST", "/refunds/list/export", { body: params ?? {} }, options);
4564
4606
  }
@@ -4980,6 +5022,20 @@ var Products = class {
4980
5022
  ...this.scoped(profileId, options)
4981
5023
  });
4982
5024
  }
5025
+ /**
5026
+ * What a product sold in a window, per currency, net of the refunds credited
5027
+ * to its lines. Refunds that named no product line are not included.
5028
+ * `GET /products/{product_id}/sales`
5029
+ *
5030
+ * Needs payment read; refused (403) to a caller limited to some connector
5031
+ * accounts.
5032
+ */
5033
+ async sales(productId, query, profileId, options) {
5034
+ return this.request("GET", `/products/${encodeURIComponent(productId)}/sales`, {
5035
+ ...this.scoped(profileId, options),
5036
+ query: { ...query }
5037
+ });
5038
+ }
4983
5039
  /**
4984
5040
  * Change a product's name, description, image, metadata or category
4985
5041
  * (`category_id: null` makes it uncategorized).
@@ -5021,6 +5077,20 @@ var Products = class {
5021
5077
  ...this.scoped(profileId, options)
5022
5078
  });
5023
5079
  }
5080
+ /**
5081
+ * Delete an archived product, then carry out the chosen action at each
5082
+ * connected account it is tied to. An account not named in
5083
+ * `provider_actions` is kept as it is. A failed provider action does not
5084
+ * undo the delete: it is listed by {@link providerCleanups} and retried
5085
+ * with {@link providerArchive}.
5086
+ * `POST /products/{product_id}/delete`
5087
+ */
5088
+ async deleteWithProviders(productId, request, profileId, options) {
5089
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/delete`, {
5090
+ body: request,
5091
+ ...this.scoped(profileId, options)
5092
+ });
5093
+ }
5024
5094
  /**
5025
5095
  * Add a price to an existing product.
5026
5096
  * `POST /products/{product_id}/prices`
@@ -5262,9 +5332,12 @@ var Products = class {
5262
5332
  }
5263
5333
  /**
5264
5334
  * Create a product for every new item and add the new prices of every
5265
- * changed one, tied to the provider's ids. Nothing is edited or removed, and
5266
- * nothing is written to the provider. A failed item is reported with its
5267
- * reason and can be retried by naming it in `connector_product_ids`.
5335
+ * changed one, tied to the provider's ids. Nothing else is edited or
5336
+ * removed, except that `options.archived: 'archive'` archives the catalog
5337
+ * product of every item the provider no longer offers (by default it is
5338
+ * left as it is). Nothing is written to the provider. A failed item is
5339
+ * reported with its reason and can be retried by naming it in
5340
+ * `connector_product_ids`.
5268
5341
  * `POST /products/import/apply`
5269
5342
  */
5270
5343
  async importApply(request, profileId, options) {
@@ -5283,6 +5356,91 @@ var Products = class {
5283
5356
  ...this.scoped(profileId, options)
5284
5357
  });
5285
5358
  }
5359
+ // --- provider sync -----------------------------------------------
5360
+ /**
5361
+ * Compare the product with its copy at every connected account it is tied
5362
+ * to. Reads the providers now; an unreadable provider answers `unknown`,
5363
+ * never `in_sync`.
5364
+ * `GET /products/{product_id}/provider-sync`
5365
+ */
5366
+ async providerSync(productId, profileId, options) {
5367
+ return this.request("GET", `/products/${encodeURIComponent(productId)}/provider-sync`, {
5368
+ ...this.scoped(profileId, options)
5369
+ });
5370
+ }
5371
+ /**
5372
+ * {@link providerSync} for 1 to 50 products at once, such as one page of the
5373
+ * product list. Unknown ids are left out of the answer.
5374
+ * `POST /products/provider-sync`
5375
+ */
5376
+ async providerSyncBatch(request, profileId, options) {
5377
+ return this.request("POST", "/products/provider-sync", {
5378
+ body: request,
5379
+ ...this.scoped(profileId, options)
5380
+ });
5381
+ }
5382
+ /**
5383
+ * Write the catalog's state onto one connected account's copy of the
5384
+ * product, for the differences a push changes and nothing else. When it
5385
+ * would change a difference not named in `confirmed`, nothing is written and
5386
+ * the answer carries `confirmation_outdated: true` with the current
5387
+ * differences in `result`; `nothing_to_push` answers without a provider
5388
+ * write when nothing pushable differs.
5389
+ * `POST /products/{product_id}/provider-sync/push`
5390
+ */
5391
+ async providerPush(productId, request, profileId, options) {
5392
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-sync/push`, {
5393
+ body: request,
5394
+ ...this.scoped(profileId, options)
5395
+ });
5396
+ }
5397
+ // --- provider lifecycle -----------------------------------------
5398
+ /**
5399
+ * The shop's connected accounts the catalog works with, and what each can
5400
+ * do: read, create, push, and how a delete can clean up there.
5401
+ * `GET /products/provider-accounts`
5402
+ */
5403
+ async providerAccounts(profileId, options) {
5404
+ return this.request("GET", "/products/provider-accounts", {
5405
+ ...this.scoped(profileId, options)
5406
+ });
5407
+ }
5408
+ /**
5409
+ * Provider clean-ups still to be carried out: deletes whose action at a
5410
+ * provider failed, or was recorded and never reached.
5411
+ * `GET /products/provider-cleanups`
5412
+ */
5413
+ async providerCleanups(profileId, options) {
5414
+ return this.request("GET", "/products/provider-cleanups", {
5415
+ ...this.scoped(profileId, options)
5416
+ });
5417
+ }
5418
+ /**
5419
+ * Create the product at a connected account it is not at yet. Without
5420
+ * `confirmed` nothing is written and the answer holds the plan to review;
5421
+ * send the plan's `fingerprint` back as `confirmed` to carry it out. When
5422
+ * the plan changed since, nothing is written and the answer carries
5423
+ * `confirmation_outdated: true` with the current plan.
5424
+ * `POST /products/{product_id}/provider-sync/create`
5425
+ */
5426
+ async providerCreate(productId, request, profileId, options) {
5427
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-sync/create`, {
5428
+ body: request,
5429
+ ...this.scoped(profileId, options)
5430
+ });
5431
+ }
5432
+ /**
5433
+ * Archive the product at one connected account, or retry a clean-up that
5434
+ * failed after the product was deleted. Existing subscriptions there keep
5435
+ * billing; the catalog is not changed.
5436
+ * `POST /products/{product_id}/provider-archive`
5437
+ */
5438
+ async providerArchive(productId, request, profileId, options) {
5439
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-archive`, {
5440
+ body: request,
5441
+ ...this.scoped(profileId, options)
5442
+ });
5443
+ }
5286
5444
  };
5287
5445
 
5288
5446
  // src/resources/processorCosts.ts
@@ -6215,7 +6373,10 @@ var OperationLimits = class {
6215
6373
  *
6216
6374
  * Refused for the user who requested it, and for an approver whose own
6217
6375
  * limit would not have covered the operation — the permission is necessary
6218
- * and not sufficient.
6376
+ * and not sufficient. The requester stays refused while signed in as
6377
+ * another team member: that is a `DE_12` error (`approval_decision_refused`)
6378
+ * whose `data.reason` is `requester_acting_as_another_member`, and
6379
+ * {@link reject} refuses the same way.
6219
6380
  *
6220
6381
  * Approval and execution are two facts. A request that was approved but
6221
6382
  * whose operation then failed comes back `approved` with `execution_error`
@@ -9978,6 +10139,27 @@ var CheckoutSession = class {
9978
10139
  headers: this.bearerHeaders(options?.headers)
9979
10140
  });
9980
10141
  }
10142
+ /**
10143
+ * Make the buyer's add-on choice while the checkout data answers
10144
+ * `type: 'addon_choice'`.
10145
+ *
10146
+ * Only price ids and quantities are sent; the router prices them from the
10147
+ * catalog and judges every selection group's bounds. The payment's lines and
10148
+ * amount change together, once: the choice is final afterwards, the same
10149
+ * choice sent again answers the same result, and another is refused with
10150
+ * `IR_16` — as is a choice once anything could have been charged at the
10151
+ * previous amount. Fetch the checkout data again afterwards for the payment
10152
+ * methods at the final amount.
10153
+ *
10154
+ * `POST /payment-link/{merchantId}/{paymentId}/addons`
10155
+ */
10156
+ async chooseAddons(params, options) {
10157
+ return this.client.request("POST", `${this.linkBase}/addons`, {
10158
+ body: params,
10159
+ ...options,
10160
+ headers: this.bearerHeaders(options?.headers)
10161
+ });
10162
+ }
9981
10163
  /**
9982
10164
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
9983
10165
  * form's pre-submit hook.
@@ -10732,4 +10914,4 @@ export {
10732
10914
  decodeNativePanes,
10733
10915
  encodeNativePanes
10734
10916
  };
10735
- //# sourceMappingURL=chunk-LA4KAVRD.js.map
10917
+ //# sourceMappingURL=chunk-UI54GG2H.js.map