@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.js CHANGED
@@ -216,7 +216,7 @@ import {
216
216
  validatePanes,
217
217
  verticalGapValue,
218
218
  visibleCustomFields
219
- } from "./chunk-LA4KAVRD.js";
219
+ } from "./chunk-UI54GG2H.js";
220
220
  export {
221
221
  AIRWALLEX_AUTOFILL_TREATMENTS,
222
222
  AIRWALLEX_CARD_LAYOUTS,
package/dist/internal.cjs CHANGED
@@ -4144,9 +4144,19 @@ var Users = class {
4144
4144
  * Mints a session token **as** the given member, so the dashboard renders
4145
4145
  * exactly what they see (useful for support and role verification). The
4146
4146
  * caller needs the *Impersonation* permission, and the member's role must
4147
- * rank **strictly below** the caller's (`Profile < Merchant < Organization`);
4148
- * the server rejects self-impersonation, cross-merchant targets, and
4149
- * equal/higher roles.
4147
+ * either rank **strictly below** the caller's
4148
+ * (`Profile < Merchant < Organization`), or sit at the caller's own
4149
+ * merchant-or-higher level and be **strictly narrower** than the caller's
4150
+ * role (grant nothing the caller's role does not, and less in total). The
4151
+ * server rejects self-impersonation and cross-merchant targets.
4152
+ * `MinimalRoleInfo.can_impersonate` in `listUsersInLineage` answers the same rule
4153
+ * per binding, so a UI can offer the action only where it will succeed.
4154
+ *
4155
+ * A role refusal is a `UR_33` error whose `data.reason` names the rule:
4156
+ * `impersonation_target_not_narrower` (the member's role is above, equal to,
4157
+ * or not contained in the caller's), or `act_as_token_cannot_impersonate`
4158
+ * (the caller is itself signed in as another member — start from your own
4159
+ * session).
4150
4160
  *
4151
4161
  * The returned token is tab-scoped by design: open it in a fresh tab (e.g.
4152
4162
  * `/auth/impersonate?token=…`) rather than replacing the caller's own
@@ -4265,6 +4275,20 @@ var Users = class {
4265
4275
  async deleteUserRole(params) {
4266
4276
  return this.request("DELETE", "/user/employees/delete", { body: params });
4267
4277
  }
4278
+ /**
4279
+ * Move a team member between a merchant-level role and shop-level roles.
4280
+ * `POST /user/employees/change-scope`
4281
+ *
4282
+ * A merchant-level `role_id` takes no `profile_ids`; a shop-level one needs
4283
+ * at least one. Every earlier merchant- and shop-level binding of the member
4284
+ * in your merchant is replaced. When the change takes a scope away, the
4285
+ * member's sessions end (`sessions_revoked: true`). Needs a caller at
4286
+ * merchant level or above. A refusal is a `UR_23` error whose `data.reason`
4287
+ * names the rule; an unknown `role_id` is `UR_22`.
4288
+ */
4289
+ async changeMemberScope(params) {
4290
+ return this.request("POST", "/user/employees/change-scope", { body: params });
4291
+ }
4268
4292
  /** Sign in via OIDC. `POST /user/oidc` */
4269
4293
  async signInOidc(params) {
4270
4294
  return this.request("POST", "/user/oidc", { body: params });
@@ -4814,6 +4838,24 @@ var Export = class {
4814
4838
  options
4815
4839
  );
4816
4840
  }
4841
+ async transactionLines(params, options) {
4842
+ return runExport(
4843
+ this.request,
4844
+ "POST",
4845
+ "/export/transactions/lines",
4846
+ { body: params ?? {} },
4847
+ options
4848
+ );
4849
+ }
4850
+ async transactionLinesForProfile(params, options) {
4851
+ return runExport(
4852
+ this.request,
4853
+ "POST",
4854
+ "/export/profile/transactions/lines",
4855
+ { body: params ?? {} },
4856
+ options
4857
+ );
4858
+ }
4817
4859
  async refunds(params, options) {
4818
4860
  return runExport(this.request, "POST", "/refunds/list/export", { body: params ?? {} }, options);
4819
4861
  }
@@ -5235,6 +5277,20 @@ var Products = class {
5235
5277
  ...this.scoped(profileId, options)
5236
5278
  });
5237
5279
  }
5280
+ /**
5281
+ * What a product sold in a window, per currency, net of the refunds credited
5282
+ * to its lines. Refunds that named no product line are not included.
5283
+ * `GET /products/{product_id}/sales`
5284
+ *
5285
+ * Needs payment read; refused (403) to a caller limited to some connector
5286
+ * accounts.
5287
+ */
5288
+ async sales(productId, query, profileId, options) {
5289
+ return this.request("GET", `/products/${encodeURIComponent(productId)}/sales`, {
5290
+ ...this.scoped(profileId, options),
5291
+ query: { ...query }
5292
+ });
5293
+ }
5238
5294
  /**
5239
5295
  * Change a product's name, description, image, metadata or category
5240
5296
  * (`category_id: null` makes it uncategorized).
@@ -5276,6 +5332,20 @@ var Products = class {
5276
5332
  ...this.scoped(profileId, options)
5277
5333
  });
5278
5334
  }
5335
+ /**
5336
+ * Delete an archived product, then carry out the chosen action at each
5337
+ * connected account it is tied to. An account not named in
5338
+ * `provider_actions` is kept as it is. A failed provider action does not
5339
+ * undo the delete: it is listed by {@link providerCleanups} and retried
5340
+ * with {@link providerArchive}.
5341
+ * `POST /products/{product_id}/delete`
5342
+ */
5343
+ async deleteWithProviders(productId, request, profileId, options) {
5344
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/delete`, {
5345
+ body: request,
5346
+ ...this.scoped(profileId, options)
5347
+ });
5348
+ }
5279
5349
  /**
5280
5350
  * Add a price to an existing product.
5281
5351
  * `POST /products/{product_id}/prices`
@@ -5517,9 +5587,12 @@ var Products = class {
5517
5587
  }
5518
5588
  /**
5519
5589
  * Create a product for every new item and add the new prices of every
5520
- * changed one, tied to the provider's ids. Nothing is edited or removed, and
5521
- * nothing is written to the provider. A failed item is reported with its
5522
- * reason and can be retried by naming it in `connector_product_ids`.
5590
+ * changed one, tied to the provider's ids. Nothing else is edited or
5591
+ * removed, except that `options.archived: 'archive'` archives the catalog
5592
+ * product of every item the provider no longer offers (by default it is
5593
+ * left as it is). Nothing is written to the provider. A failed item is
5594
+ * reported with its reason and can be retried by naming it in
5595
+ * `connector_product_ids`.
5523
5596
  * `POST /products/import/apply`
5524
5597
  */
5525
5598
  async importApply(request, profileId, options) {
@@ -5538,6 +5611,91 @@ var Products = class {
5538
5611
  ...this.scoped(profileId, options)
5539
5612
  });
5540
5613
  }
5614
+ // --- provider sync -----------------------------------------------
5615
+ /**
5616
+ * Compare the product with its copy at every connected account it is tied
5617
+ * to. Reads the providers now; an unreadable provider answers `unknown`,
5618
+ * never `in_sync`.
5619
+ * `GET /products/{product_id}/provider-sync`
5620
+ */
5621
+ async providerSync(productId, profileId, options) {
5622
+ return this.request("GET", `/products/${encodeURIComponent(productId)}/provider-sync`, {
5623
+ ...this.scoped(profileId, options)
5624
+ });
5625
+ }
5626
+ /**
5627
+ * {@link providerSync} for 1 to 50 products at once, such as one page of the
5628
+ * product list. Unknown ids are left out of the answer.
5629
+ * `POST /products/provider-sync`
5630
+ */
5631
+ async providerSyncBatch(request, profileId, options) {
5632
+ return this.request("POST", "/products/provider-sync", {
5633
+ body: request,
5634
+ ...this.scoped(profileId, options)
5635
+ });
5636
+ }
5637
+ /**
5638
+ * Write the catalog's state onto one connected account's copy of the
5639
+ * product, for the differences a push changes and nothing else. When it
5640
+ * would change a difference not named in `confirmed`, nothing is written and
5641
+ * the answer carries `confirmation_outdated: true` with the current
5642
+ * differences in `result`; `nothing_to_push` answers without a provider
5643
+ * write when nothing pushable differs.
5644
+ * `POST /products/{product_id}/provider-sync/push`
5645
+ */
5646
+ async providerPush(productId, request, profileId, options) {
5647
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-sync/push`, {
5648
+ body: request,
5649
+ ...this.scoped(profileId, options)
5650
+ });
5651
+ }
5652
+ // --- provider lifecycle -----------------------------------------
5653
+ /**
5654
+ * The shop's connected accounts the catalog works with, and what each can
5655
+ * do: read, create, push, and how a delete can clean up there.
5656
+ * `GET /products/provider-accounts`
5657
+ */
5658
+ async providerAccounts(profileId, options) {
5659
+ return this.request("GET", "/products/provider-accounts", {
5660
+ ...this.scoped(profileId, options)
5661
+ });
5662
+ }
5663
+ /**
5664
+ * Provider clean-ups still to be carried out: deletes whose action at a
5665
+ * provider failed, or was recorded and never reached.
5666
+ * `GET /products/provider-cleanups`
5667
+ */
5668
+ async providerCleanups(profileId, options) {
5669
+ return this.request("GET", "/products/provider-cleanups", {
5670
+ ...this.scoped(profileId, options)
5671
+ });
5672
+ }
5673
+ /**
5674
+ * Create the product at a connected account it is not at yet. Without
5675
+ * `confirmed` nothing is written and the answer holds the plan to review;
5676
+ * send the plan's `fingerprint` back as `confirmed` to carry it out. When
5677
+ * the plan changed since, nothing is written and the answer carries
5678
+ * `confirmation_outdated: true` with the current plan.
5679
+ * `POST /products/{product_id}/provider-sync/create`
5680
+ */
5681
+ async providerCreate(productId, request, profileId, options) {
5682
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-sync/create`, {
5683
+ body: request,
5684
+ ...this.scoped(profileId, options)
5685
+ });
5686
+ }
5687
+ /**
5688
+ * Archive the product at one connected account, or retry a clean-up that
5689
+ * failed after the product was deleted. Existing subscriptions there keep
5690
+ * billing; the catalog is not changed.
5691
+ * `POST /products/{product_id}/provider-archive`
5692
+ */
5693
+ async providerArchive(productId, request, profileId, options) {
5694
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-archive`, {
5695
+ body: request,
5696
+ ...this.scoped(profileId, options)
5697
+ });
5698
+ }
5541
5699
  };
5542
5700
 
5543
5701
  // src/resources/processorCosts.ts
@@ -6470,7 +6628,10 @@ var OperationLimits = class {
6470
6628
  *
6471
6629
  * Refused for the user who requested it, and for an approver whose own
6472
6630
  * limit would not have covered the operation — the permission is necessary
6473
- * and not sufficient.
6631
+ * and not sufficient. The requester stays refused while signed in as
6632
+ * another team member: that is a `DE_12` error (`approval_decision_refused`)
6633
+ * whose `data.reason` is `requester_acting_as_another_member`, and
6634
+ * {@link reject} refuses the same way.
6474
6635
  *
6475
6636
  * Approval and execution are two facts. A request that was approved but
6476
6637
  * whose operation then failed comes back `approved` with `execution_error`
@@ -10233,6 +10394,27 @@ var CheckoutSession = class {
10233
10394
  headers: this.bearerHeaders(options?.headers)
10234
10395
  });
10235
10396
  }
10397
+ /**
10398
+ * Make the buyer's add-on choice while the checkout data answers
10399
+ * `type: 'addon_choice'`.
10400
+ *
10401
+ * Only price ids and quantities are sent; the router prices them from the
10402
+ * catalog and judges every selection group's bounds. The payment's lines and
10403
+ * amount change together, once: the choice is final afterwards, the same
10404
+ * choice sent again answers the same result, and another is refused with
10405
+ * `IR_16` — as is a choice once anything could have been charged at the
10406
+ * previous amount. Fetch the checkout data again afterwards for the payment
10407
+ * methods at the final amount.
10408
+ *
10409
+ * `POST /payment-link/{merchantId}/{paymentId}/addons`
10410
+ */
10411
+ async chooseAddons(params, options) {
10412
+ return this.client.request("POST", `${this.linkBase}/addons`, {
10413
+ body: params,
10414
+ ...options,
10415
+ headers: this.bearerHeaders(options?.headers)
10416
+ });
10417
+ }
10236
10418
  /**
10237
10419
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
10238
10420
  * form's pre-submit hook.
@@ -10835,6 +11017,15 @@ var AdminPortal = class {
10835
11017
  options
10836
11018
  );
10837
11019
  }
11020
+ async exportTransactionLines(params, options) {
11021
+ return runExport(
11022
+ this.request,
11023
+ "GET",
11024
+ "/admin-portal/transactions/export/lines",
11025
+ { query: transactionListQuery(params) },
11026
+ options
11027
+ );
11028
+ }
10838
11029
  /**
10839
11030
  * Full detail for a single transaction of ANY merchant — the same
10840
11031
  * `PaymentResponse` the merchant `payments.retrieve` returns. Admin-scoped: