@delopay/sdk 0.83.0 → 0.86.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/internal.cjs CHANGED
@@ -43,6 +43,7 @@ __export(internal_exports, {
43
43
  Cache: () => Cache,
44
44
  CardIssuers: () => CardIssuers,
45
45
  Cards: () => Cards,
46
+ CheckoutSession: () => CheckoutSession,
46
47
  Configs: () => Configs,
47
48
  ConnectorRestrictionRules: () => ConnectorRestrictionRules,
48
49
  ConnectorRestrictions: () => ConnectorRestrictions,
@@ -63,11 +64,13 @@ __export(internal_exports, {
63
64
  NATIVE_PANES_MAX: () => NATIVE_PANES_MAX,
64
65
  NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
65
66
  NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
67
+ OperationLimits: () => OperationLimits,
66
68
  PlatformBilling: () => PlatformBilling,
67
69
  PlatformFees: () => PlatformFees,
68
70
  Regions: () => Regions,
69
71
  STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
70
72
  Search: () => Search,
73
+ Settlement: () => Settlement,
71
74
  Subscriptions: () => Subscriptions,
72
75
  Webhooks: () => Webhooks,
73
76
  allOf: () => allOf,
@@ -557,6 +560,39 @@ var Connectors = class {
557
560
  async list(accountId) {
558
561
  return this.request("GET", `/account/${encodeURIComponent(accountId)}/connectors`);
559
562
  }
563
+ /**
564
+ * The profile-scoped connector list. The merchant-wide `list()` is
565
+ * merchant-gated and 403s for a profile-entity (shop user) JWT; this
566
+ * variant is scoped server-side to the caller's own profile.
567
+ *
568
+ * `GET /account/{accountId}/profile/connectors`
569
+ */
570
+ async listByProfile(accountId) {
571
+ return this.request("GET", `/account/${encodeURIComponent(accountId)}/profile/connectors`);
572
+ }
573
+ /**
574
+ * The built-in e-Payouts reference catalog — the "Restore defaults" source.
575
+ * `GET /account/{accountId}/connectors/epayouts/catalog/defaults`
576
+ */
577
+ async getEpayoutsCatalogDefaults(accountId) {
578
+ return this.request(
579
+ "GET",
580
+ `/account/${encodeURIComponent(accountId)}/connectors/epayouts/catalog/defaults`
581
+ );
582
+ }
583
+ /**
584
+ * Sweep the merchant's own e-Payouts module and return the rails it
585
+ * actually has enabled. Server-side this makes many upstream calls, so it
586
+ * can take several seconds — show progress.
587
+ *
588
+ * `POST /account/{accountId}/connectors/{connectorId}/epayouts/catalog/sync`
589
+ */
590
+ async syncEpayoutsCatalog(accountId, connectorId) {
591
+ return this.request(
592
+ "POST",
593
+ `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/epayouts/catalog/sync`
594
+ );
595
+ }
560
596
  async update(accountId, connectorId, params) {
561
597
  return this.request(
562
598
  "POST",
@@ -589,6 +625,55 @@ var Connectors = class {
589
625
  );
590
626
  }
591
627
  // --- Advanced operations (Task 4.8) ---
628
+ /**
629
+ * Run the configuration checks for a vault (VGS) connector account:
630
+ * credential validity, write-only Collect scope, reachability, environment
631
+ * coherence, route coverage. Read-only but not cheap — it decrypts the
632
+ * vault's management credential and talks to VGS.
633
+ *
634
+ * `POST /account/{accountId}/connectors/{connectorId}/vault/verify`
635
+ */
636
+ async verifyVault(accountId, connectorId, params) {
637
+ return this.request(
638
+ "POST",
639
+ `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/vault/verify`,
640
+ { body: params }
641
+ );
642
+ }
643
+ /**
644
+ * Compute the route document the vault SHOULD have and diff it against
645
+ * what exists, without writing anything. The returned fingerprints must be
646
+ * echoed byte for byte on {@link Connectors.applyVaultRoutes}.
647
+ *
648
+ * A router without these endpoints answers 404 — render that as "this
649
+ * build cannot configure routes", never as "there is nothing to change".
650
+ *
651
+ * `POST /account/{accountId}/connectors/{connectorId}/vault/routes/preview`
652
+ */
653
+ async previewVaultRoutes(accountId, connectorId, params) {
654
+ return this.request(
655
+ "POST",
656
+ `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/vault/routes/preview`,
657
+ { body: params }
658
+ );
659
+ }
660
+ /**
661
+ * Write the routes the merchant just previewed. Both fingerprints come
662
+ * from the preview and are opaque: `expected_current_fingerprint` says the
663
+ * vault has not moved (`null` = "the preview found no routes" and is sent
664
+ * as `null`, never omitted), `expected_desired_fingerprint` says the
665
+ * document is still the one on screen. A 409 (`DE_04`) means the vault
666
+ * changed since the preview — nothing was written; preview again.
667
+ *
668
+ * `POST /account/{accountId}/connectors/{connectorId}/vault/routes/apply`
669
+ */
670
+ async applyVaultRoutes(accountId, connectorId, params) {
671
+ return this.request(
672
+ "POST",
673
+ `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/vault/routes/apply`,
674
+ { body: params }
675
+ );
676
+ }
592
677
  /** Verify connector credentials. `POST /account/connectors/verify` */
593
678
  async verify(params) {
594
679
  return this.request("POST", "/account/connectors/verify", { body: params });
@@ -1551,6 +1636,39 @@ var Payments = class {
1551
1636
  ...options
1552
1637
  });
1553
1638
  }
1639
+ /**
1640
+ * The status timeline of client/device observations captured while the
1641
+ * buyer interacted with the payment (checkout opens, confirms, redirect
1642
+ * legs, reported client signals), oldest first.
1643
+ *
1644
+ * `GET /payments/{paymentId}/client-context`
1645
+ */
1646
+ async listClientContext(paymentId, options) {
1647
+ return this.request(
1648
+ "GET",
1649
+ `/payments/${encodeURIComponent(paymentId)}/client-context`,
1650
+ options
1651
+ );
1652
+ }
1653
+ /**
1654
+ * Soft-delete a payment. Only payments whose status is in the merchant's
1655
+ * delete policy (see {@link Payments.getDeletePolicy}) can be deleted;
1656
+ * anything else fails with a precondition error.
1657
+ *
1658
+ * `DELETE /payments/{paymentId}`
1659
+ */
1660
+ async delete(paymentId, options) {
1661
+ return this.request("DELETE", `/payments/${encodeURIComponent(paymentId)}`, options);
1662
+ }
1663
+ /**
1664
+ * The effective deletable-status set for the calling merchant — lets a
1665
+ * dashboard show the delete action only where it is allowed.
1666
+ *
1667
+ * `GET /payments/delete-policy`
1668
+ */
1669
+ async getDeletePolicy(options) {
1670
+ return this.request("GET", "/payments/delete-policy", options);
1671
+ }
1554
1672
  // --- Advanced operations (Task 3.2) ---
1555
1673
  /** Generate session tokens. `POST /payments/session-tokens` */
1556
1674
  async sessionTokens(params) {
@@ -1621,10 +1739,30 @@ var Payments = class {
1621
1739
  async listByFilter(params) {
1622
1740
  return this.request("POST", "/payments/list", { body: params });
1623
1741
  }
1742
+ /**
1743
+ * List payments by filter, scoped to the caller's profile (the shop-user
1744
+ * twin of `listByFilter`). The backend narrows to the profile from the
1745
+ * auth context, so `profile_id` / `project_id` must not be sent.
1746
+ *
1747
+ * Not to be confused with {@link Payments.listByProfile}, which is the GET
1748
+ * cursor variant and rejects this body.
1749
+ *
1750
+ * `POST /payments/profile/list`
1751
+ */
1752
+ async listByProfileFilter(params, options) {
1753
+ return this.request("POST", "/payments/profile/list", { body: params, ...options });
1754
+ }
1624
1755
  /** Get payment filter options. `GET /payments/filter` */
1625
1756
  async getFilters(params) {
1626
1757
  return this.request("GET", "/payments/filter", { query: params });
1627
1758
  }
1759
+ /**
1760
+ * Get payment filter options, scoped to the caller's profile.
1761
+ * `GET /payments/profile/filter`
1762
+ */
1763
+ async getFiltersByProfile(params) {
1764
+ return this.request("GET", "/payments/profile/filter", { query: params });
1765
+ }
1628
1766
  /** Get payment aggregates. `GET /payments/aggregate` */
1629
1767
  async aggregate(params) {
1630
1768
  return this.request("GET", "/payments/aggregate", { query: params });
@@ -1825,6 +1963,16 @@ var Profiles = class {
1825
1963
  async list(accountId) {
1826
1964
  return this.request("GET", `/account/${encodeURIComponent(accountId)}/business-profile`);
1827
1965
  }
1966
+ /**
1967
+ * List the business profiles the caller can see at profile scope — the
1968
+ * `ProfileAccountRead` twin of `list()` (which needs merchant-level read).
1969
+ * A shop-scoped user gets exactly their own shop back.
1970
+ *
1971
+ * `GET /account/{accountId}/profile`
1972
+ */
1973
+ async listByProfile(accountId) {
1974
+ return this.request("GET", `/account/${encodeURIComponent(accountId)}/profile`);
1975
+ }
1828
1976
  async update(accountId, profileId, params) {
1829
1977
  return this.request(
1830
1978
  "POST",
@@ -2468,7 +2616,7 @@ var Shops = class {
2468
2616
  /**
2469
2617
  * Upload a logo file for a shop. The file is stored in Delopay's configured
2470
2618
  * object store and a public HTTPS URL is returned. This method does NOT write
2471
- * the URL into the shop's `payment_link_config.default_config.logo` — call
2619
+ * the URL into the shop's `payment_link_config.logo` — call
2472
2620
  * `shops.update` afterwards with the returned `logo_url` to persist the change.
2473
2621
  *
2474
2622
  * Accepts PNG, JPEG, WebP or SVG. The file must be ≤ 1 MiB.
@@ -2482,7 +2630,7 @@ var Shops = class {
2482
2630
  * ```typescript
2483
2631
  * const { logo_url } = await delopay.shops.uploadLogo('merch_1', 'pro_1', file);
2484
2632
  * await delopay.shops.update('merch_1', 'pro_1', {
2485
- * payment_link_config: { default_config: { logo: logo_url } },
2633
+ * payment_link_config: { logo: logo_url },
2486
2634
  * });
2487
2635
  * ```
2488
2636
  */
@@ -2495,6 +2643,29 @@ var Shops = class {
2495
2643
  { body: form }
2496
2644
  );
2497
2645
  }
2646
+ /**
2647
+ * Update only the checkout appearance (the `payment_link_config` blob:
2648
+ * theme, logo, colours, seller name, SDK layout/rules, DeloPay-branding
2649
+ * toggle) of a shop. Applied as a whole-object replace of
2650
+ * `payment_link_config`, mirroring the shop-update semantics.
2651
+ *
2652
+ * Gated on the dedicated `CheckoutBranding` permission, so "may restyle
2653
+ * the checkout" can be granted without full account/shop write.
2654
+ *
2655
+ * `POST /shops/{merchantId}/{shopId}/checkout-branding`
2656
+ *
2657
+ * @param merchantId - The merchant account ID.
2658
+ * @param shopId - The shop (business profile) ID to restyle.
2659
+ * @param params - The new `payment_link_config` blob (full replacement).
2660
+ * @returns The updated business profile.
2661
+ */
2662
+ async updateCheckoutBranding(merchantId, shopId, params, options) {
2663
+ return this.request(
2664
+ "POST",
2665
+ `/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/checkout-branding`,
2666
+ { body: params, ...options }
2667
+ );
2668
+ }
2498
2669
  };
2499
2670
 
2500
2671
  // src/resources/stripeConnect.ts
@@ -2601,6 +2772,26 @@ var Users = class {
2601
2772
  async update(params) {
2602
2773
  return this.request("POST", "/user/update", { body: params });
2603
2774
  }
2775
+ /**
2776
+ * RFC 7396 merge-patch the caller's own user-scoped metadata bucket.
2777
+ * Returns the full user details, so callers can refresh their context
2778
+ * without a second fetch.
2779
+ *
2780
+ * `PATCH /user/metadata`
2781
+ */
2782
+ async updateMetadata(params) {
2783
+ return this.request("PATCH", "/user/metadata", { body: params });
2784
+ }
2785
+ /**
2786
+ * RFC 7396 merge-patch the merchant-scoped metadata bucket shared by
2787
+ * every dashboard user of the merchant. Same response contract as
2788
+ * {@link Users.updateMetadata}.
2789
+ *
2790
+ * `PATCH /user/merchant/metadata`
2791
+ */
2792
+ async updateMerchantMetadata(params) {
2793
+ return this.request("PATCH", "/user/merchant/metadata", { body: params });
2794
+ }
2604
2795
  /**
2605
2796
  * Permanently delete the caller's account. Requires a fresh password
2606
2797
  * (and a current 6-digit TOTP code if the user has TOTP enrolled). On
@@ -3360,6 +3551,283 @@ var Subscriptions = class {
3360
3551
  ...options
3361
3552
  });
3362
3553
  }
3554
+ /**
3555
+ * Resolve which of the given payments were raised by a subscription.
3556
+ * `POST /subscriptions/payments/lookup`
3557
+ *
3558
+ * The linkage exists in one direction only — an invoice points at the payment
3559
+ * it settled, and nothing is stamped on the payment — so this is the only way
3560
+ * to tell a subscription charge from a one-off one when you are holding a
3561
+ * page of payments. In particular, do not use `off_session` or the presence
3562
+ * of a mandate: an ordinary saved-card charge sets those identically.
3563
+ *
3564
+ * Ids that belong to no subscription are **absent** from `links` rather than
3565
+ * returned as an error, so match on presence:
3566
+ *
3567
+ * ```ts
3568
+ * const { links } = await subscriptions.lookupPayments(
3569
+ * { payment_ids: page.map((p) => p.payment_id) },
3570
+ * { headers: { 'X-Profile-Id': profileId } },
3571
+ * );
3572
+ * const bySubscription = new Map(links.map((l) => [l.payment_id, l]));
3573
+ * ```
3574
+ *
3575
+ * Profile-scoped like every other subscription route, and that matters more
3576
+ * here than elsewhere: a `payment_id` is merchant-supplied and only unique
3577
+ * within a merchant, so the shop is part of the question, not an
3578
+ * optimisation. Pass the profile that owns **the payments** — for a list
3579
+ * spanning several shops, group the ids by shop and call once per group.
3580
+ *
3581
+ * At most 200 ids per call.
3582
+ */
3583
+ async lookupPayments(params, options) {
3584
+ return this.request("POST", "/subscriptions/payments/lookup", { body: params, ...options });
3585
+ }
3586
+ };
3587
+
3588
+ // src/resources/settlement.ts
3589
+ var Settlement = class {
3590
+ constructor(request) {
3591
+ this.request = request;
3592
+ }
3593
+ /**
3594
+ * Per-shop settlement rollup for the host merchant: unpaid totals and the
3595
+ * running current period, one row per shop.
3596
+ *
3597
+ * `GET /settlement/overview`
3598
+ */
3599
+ async overview(params, options) {
3600
+ return this.request("GET", "/settlement/overview", {
3601
+ query: { test_mode: params.test_mode },
3602
+ ...options
3603
+ });
3604
+ }
3605
+ /**
3606
+ * Live rollup of the current (not yet statemented) period.
3607
+ *
3608
+ * `GET /settlement/current`
3609
+ */
3610
+ async current(params, options) {
3611
+ return this.request("GET", "/settlement/current", {
3612
+ query: { test_mode: params.test_mode, profile_id: params.profile_id },
3613
+ ...options
3614
+ });
3615
+ }
3616
+ /**
3617
+ * List generated settlement statements, newest first.
3618
+ *
3619
+ * `GET /settlement/statements`
3620
+ */
3621
+ async listStatements(params, options) {
3622
+ return this.request("GET", "/settlement/statements", {
3623
+ query: {
3624
+ test_mode: params.test_mode,
3625
+ profile_id: params.profile_id,
3626
+ limit: params.limit,
3627
+ offset: params.offset
3628
+ },
3629
+ ...options
3630
+ });
3631
+ }
3632
+ /**
3633
+ * One statement with its per-connector/currency breakdown.
3634
+ *
3635
+ * `GET /settlement/statements/{statementId}`
3636
+ */
3637
+ async retrieveStatement(statementId, options) {
3638
+ return this.request(
3639
+ "GET",
3640
+ `/settlement/statements/${encodeURIComponent(statementId)}`,
3641
+ options
3642
+ );
3643
+ }
3644
+ /**
3645
+ * Generate (or regenerate) the statement for one shop and calendar month.
3646
+ *
3647
+ * `POST /settlement/statements/generate`
3648
+ */
3649
+ async generateStatement(params, options) {
3650
+ return this.request("POST", "/settlement/statements/generate", {
3651
+ body: params,
3652
+ ...options
3653
+ });
3654
+ }
3655
+ /**
3656
+ * Record payout progress on a statement (`unpaid` / `partial` / `paid`).
3657
+ *
3658
+ * `POST /settlement/statements/{statementId}/payout`
3659
+ */
3660
+ async updateStatementPayout(statementId, params, options) {
3661
+ return this.request(
3662
+ "POST",
3663
+ `/settlement/statements/${encodeURIComponent(statementId)}/payout`,
3664
+ { body: params, ...options }
3665
+ );
3666
+ }
3667
+ /**
3668
+ * Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
3669
+ * the same auth, retries and error handling as every other call — persist
3670
+ * or object-URL it caller-side.
3671
+ *
3672
+ * `GET /settlement/statements/{statementId}/pdf`
3673
+ *
3674
+ * @example
3675
+ * ```typescript
3676
+ * const pdf = await delopay.settlement.downloadStatementPdf('stmt_1', {
3677
+ * currency: 'EUR',
3678
+ * include_transactions: true,
3679
+ * });
3680
+ * const url = URL.createObjectURL(pdf);
3681
+ * ```
3682
+ */
3683
+ async downloadStatementPdf(statementId, params, options) {
3684
+ return this.request("GET", `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {
3685
+ query: {
3686
+ currency: params?.currency,
3687
+ include_transactions: params?.include_transactions
3688
+ },
3689
+ responseType: "blob",
3690
+ ...options
3691
+ });
3692
+ }
3693
+ /**
3694
+ * The individual settled attempts of one shop's calendar month.
3695
+ *
3696
+ * `GET /settlement/lines`
3697
+ */
3698
+ async listLines(params, options) {
3699
+ return this.request("GET", "/settlement/lines", {
3700
+ query: {
3701
+ profile_id: params.profile_id,
3702
+ year: params.year,
3703
+ month: params.month,
3704
+ test_mode: params.test_mode,
3705
+ limit: params.limit,
3706
+ offset: params.offset
3707
+ },
3708
+ ...options
3709
+ });
3710
+ }
3711
+ /**
3712
+ * The fee schedules that currently apply to a shop.
3713
+ *
3714
+ * `GET /settlement/fee-config`
3715
+ */
3716
+ async feeConfig(params, options) {
3717
+ return this.request("GET", "/settlement/fee-config", {
3718
+ query: { profile_id: params.profile_id },
3719
+ ...options
3720
+ });
3721
+ }
3722
+ /**
3723
+ * Enqueue a settlement-line backfill over historical attempts. Attempts
3724
+ * already covered by a line are always skipped.
3725
+ *
3726
+ * `POST /settlement/backfill`
3727
+ */
3728
+ async backfill(params, options) {
3729
+ return this.request("POST", "/settlement/backfill", { body: params, ...options });
3730
+ }
3731
+ /**
3732
+ * Toggle whether a shop's owner can see their own settlement figures.
3733
+ *
3734
+ * `POST /settlement/shops/visibility`
3735
+ */
3736
+ async setShopVisibility(params, options) {
3737
+ return this.request("POST", "/settlement/shops/visibility", {
3738
+ body: params,
3739
+ ...options
3740
+ });
3741
+ }
3742
+ /**
3743
+ * Manual adjustments recorded on a statement.
3744
+ *
3745
+ * `GET /settlement/statements/{statementId}/adjustments`
3746
+ */
3747
+ async listStatementAdjustments(statementId, options) {
3748
+ return this.request(
3749
+ "GET",
3750
+ `/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,
3751
+ options
3752
+ );
3753
+ }
3754
+ /**
3755
+ * Add a manual adjustment to a statement. Positive `amount_usd` charges
3756
+ * the shop (reducing their payout); negative credits them.
3757
+ *
3758
+ * `POST /settlement/statements/{statementId}/adjustments`
3759
+ */
3760
+ async createStatementAdjustment(statementId, params, options) {
3761
+ return this.request(
3762
+ "POST",
3763
+ `/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,
3764
+ { body: params, ...options }
3765
+ );
3766
+ }
3767
+ /**
3768
+ * Remove a manual adjustment from a statement.
3769
+ *
3770
+ * `DELETE /settlement/statements/{statementId}/adjustments/{adjustmentId}`
3771
+ */
3772
+ async deleteStatementAdjustment(statementId, adjustmentId, options) {
3773
+ return this.request(
3774
+ "DELETE",
3775
+ `/settlement/statements/${encodeURIComponent(statementId)}/adjustments/${encodeURIComponent(adjustmentId)}`,
3776
+ options
3777
+ );
3778
+ }
3779
+ };
3780
+
3781
+ // src/resources/operationLimits.ts
3782
+ var OperationLimits = class {
3783
+ constructor(request) {
3784
+ this.request = request;
3785
+ }
3786
+ /**
3787
+ * List the merchant's limit rules, optionally for one operation.
3788
+ *
3789
+ * `GET /operation-limits/rules`
3790
+ */
3791
+ async listRules(params, options) {
3792
+ return this.request("GET", "/operation-limits/rules", {
3793
+ query: { operation: params?.operation },
3794
+ ...options
3795
+ });
3796
+ }
3797
+ /**
3798
+ * Create or replace the limit rule for one target. Full-replace upsert:
3799
+ * absent limit fields clear that dimension.
3800
+ *
3801
+ * `PUT /operation-limits/rules`
3802
+ */
3803
+ async upsertRule(params, options) {
3804
+ return this.request("PUT", "/operation-limits/rules", { body: params, ...options });
3805
+ }
3806
+ /**
3807
+ * Delete a limit rule.
3808
+ *
3809
+ * `DELETE /operation-limits/rules/{ruleId}`
3810
+ */
3811
+ async deleteRule(ruleId, options) {
3812
+ return this.request("DELETE", `/operation-limits/rules/${encodeURIComponent(ruleId)}`, options);
3813
+ }
3814
+ /**
3815
+ * The merchant-level enforcement settings. An untouched merchant gets the
3816
+ * defaults: rolling window, admins not exempt.
3817
+ *
3818
+ * `GET /operation-limits/settings`
3819
+ */
3820
+ async retrieveSettings(options) {
3821
+ return this.request("GET", "/operation-limits/settings", options);
3822
+ }
3823
+ /**
3824
+ * Update the enforcement settings. Only provided fields change.
3825
+ *
3826
+ * `PUT /operation-limits/settings`
3827
+ */
3828
+ async updateSettings(params, options) {
3829
+ return this.request("PUT", "/operation-limits/settings", { body: params, ...options });
3830
+ }
3363
3831
  };
3364
3832
 
3365
3833
  // src/client.ts
@@ -3489,6 +3957,8 @@ var Delopay = class {
3489
3957
  this.relay = new Relay(request);
3490
3958
  this.stripeConnect = new StripeConnect(request);
3491
3959
  this.threeDsRules = new ThreeDsRules(request);
3960
+ this.settlement = new Settlement(request);
3961
+ this.operationLimits = new OperationLimits(request);
3492
3962
  this.subscriptions = new Subscriptions(request);
3493
3963
  this.files = new Files(request);
3494
3964
  this.export = new Export(request);
@@ -3612,7 +4082,8 @@ var Delopay = class {
3612
4082
  method,
3613
4083
  headers,
3614
4084
  body: serializedBody,
3615
- signal: combined.signal
4085
+ signal: combined.signal,
4086
+ ...options?.keepalive !== void 0 ? { keepalive: options.keepalive } : {}
3616
4087
  });
3617
4088
  const requestId = response.headers?.get("x-request-id") ?? response.headers?.get("x-trace-id") ?? void 0;
3618
4089
  emit("response", { status: response.status, method, path, requestId });
@@ -3659,6 +4130,12 @@ var Delopay = class {
3659
4130
  }
3660
4131
  throw error;
3661
4132
  }
4133
+ if (options?.responseType === "blob") {
4134
+ return await response.blob();
4135
+ }
4136
+ if (options?.responseType === "arraybuffer") {
4137
+ return await response.arrayBuffer();
4138
+ }
3662
4139
  const text = await response.text();
3663
4140
  return text ? JSON.parse(text) : void 0;
3664
4141
  } catch (err) {
@@ -4902,6 +5379,205 @@ function shadowFor(style) {
4902
5379
  }
4903
5380
  }
4904
5381
 
5382
+ // src/checkoutSession.ts
5383
+ function withoutCredentialHeaders(extra) {
5384
+ if (!extra) return {};
5385
+ const out = {};
5386
+ for (const [key, value] of Object.entries(extra)) {
5387
+ const lower = key.toLowerCase();
5388
+ if (lower === "api-key" || lower === "authorization") continue;
5389
+ out[key] = value;
5390
+ }
5391
+ return out;
5392
+ }
5393
+ var CheckoutSession = class {
5394
+ constructor(options) {
5395
+ this.merchantId = options.merchantId;
5396
+ this.paymentId = options.paymentId;
5397
+ this.publishableKey = options.publishableKey;
5398
+ this.clientSecret = options.clientSecret;
5399
+ this.client = new Delopay("", {
5400
+ baseUrl: options.baseUrl,
5401
+ sandbox: options.sandbox,
5402
+ timeout: options.timeout,
5403
+ maxRetries: options.maxRetries,
5404
+ debug: options.debug,
5405
+ logger: options.logger
5406
+ });
5407
+ }
5408
+ get linkBase() {
5409
+ return `/payment-link/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`;
5410
+ }
5411
+ /** Headers for the client-secret bearer routes (`/payment-link/*`). */
5412
+ bearerHeaders(extra) {
5413
+ return {
5414
+ ...withoutCredentialHeaders(extra),
5415
+ Authorization: `Bearer ${this.requireClientSecret()}`
5416
+ };
5417
+ }
5418
+ /** Headers for the publishable-key routes (`/payments/*`, `/payment-methods`). */
5419
+ pkHeaders(extra) {
5420
+ if (!this.publishableKey) {
5421
+ throw new DelopayError("This call requires the publishable key", {
5422
+ status: 0,
5423
+ code: "MISSING_CREDENTIAL",
5424
+ type: "invalid_request"
5425
+ });
5426
+ }
5427
+ return { ...withoutCredentialHeaders(extra), "api-key": this.publishableKey };
5428
+ }
5429
+ requireClientSecret() {
5430
+ if (!this.clientSecret) {
5431
+ throw new DelopayError("This call requires the payment client secret", {
5432
+ status: 0,
5433
+ code: "MISSING_CREDENTIAL",
5434
+ type: "invalid_request"
5435
+ });
5436
+ }
5437
+ return this.clientSecret;
5438
+ }
5439
+ /**
5440
+ * The Paysepro rail catalog for the buyer's country.
5441
+ *
5442
+ * `GET /payment-link/{merchantId}/{paymentId}/paysepro/methods`
5443
+ *
5444
+ * @param country - Lowercase ISO 3166-1 alpha-2 country code.
5445
+ */
5446
+ async payseproMethods(country, options) {
5447
+ return this.client.request("GET", `${this.linkBase}/paysepro/methods`, {
5448
+ query: { cc: country },
5449
+ ...options,
5450
+ headers: this.bearerHeaders(options?.headers)
5451
+ });
5452
+ }
5453
+ /**
5454
+ * The e-Payouts rail catalog for the buyer's country, plus the set of
5455
+ * countries that have at least one vendor.
5456
+ *
5457
+ * `GET /payment-link/{merchantId}/{paymentId}/epayouts/methods`
5458
+ *
5459
+ * @param country - Lowercase ISO 3166-1 alpha-2 country code.
5460
+ */
5461
+ async epayoutsMethods(country, options) {
5462
+ return this.client.request("GET", `${this.linkBase}/epayouts/methods`, {
5463
+ query: { cc: country },
5464
+ ...options,
5465
+ headers: this.bearerHeaders(options?.headers)
5466
+ });
5467
+ }
5468
+ /**
5469
+ * Record a buyer-side checkout event on the payment's status timeline.
5470
+ *
5471
+ * Telemetry semantics, built in so callers can genuinely fire-and-forget:
5472
+ * the request is sent with `keepalive: true` (it survives the document
5473
+ * navigating away, e.g. right before a `window.open`), and transport or
5474
+ * server failures resolve to `undefined` instead of rejecting — telemetry
5475
+ * must never break a checkout or surface an unhandled rejection. Do not
5476
+ * `await` this in a click handler that must stay synchronous.
5477
+ *
5478
+ * A missing client secret still throws `MISSING_CREDENTIAL`: that is a
5479
+ * wiring bug, not a telemetry failure.
5480
+ *
5481
+ * `POST /payment-link/{merchantId}/{paymentId}/checkout-events`
5482
+ */
5483
+ async recordEvent(params, options) {
5484
+ const headers = this.bearerHeaders(options?.headers);
5485
+ try {
5486
+ return await this.client.request("POST", `${this.linkBase}/checkout-events`, {
5487
+ body: params,
5488
+ keepalive: true,
5489
+ ...options,
5490
+ headers
5491
+ });
5492
+ } catch {
5493
+ return void 0;
5494
+ }
5495
+ }
5496
+ /**
5497
+ * A short-lived VGS Collect session for browser-side card capture.
5498
+ *
5499
+ * A 404 — or a 400 carrying the "shop has no vault" code — means the shop
5500
+ * has no vault configured; other errors must NOT be treated that way (a
5501
+ * refused vault falling back to an unprotected card pane is exactly the
5502
+ * bug this endpoint's error contract exists to prevent).
5503
+ *
5504
+ * `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
5505
+ */
5506
+ async vaultCollectSession(options) {
5507
+ return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
5508
+ ...options,
5509
+ headers: this.bearerHeaders(options?.headers)
5510
+ });
5511
+ }
5512
+ /**
5513
+ * Register the aliased card as a payment method and mint the one-shot
5514
+ * `payment_token` the confirm call spends.
5515
+ *
5516
+ * `POST /payment-link/{merchantId}/{paymentId}/vault/payment-method`
5517
+ */
5518
+ async registerVaultPaymentMethod(params, options) {
5519
+ return this.client.request("POST", `${this.linkBase}/vault/payment-method`, {
5520
+ body: params,
5521
+ ...options,
5522
+ headers: this.bearerHeaders(options?.headers)
5523
+ });
5524
+ }
5525
+ /**
5526
+ * The payment's current state — status polling for redirect/popup rails.
5527
+ *
5528
+ * `GET /payments/{paymentId}` (publishable key + client secret)
5529
+ */
5530
+ async retrievePayment(options) {
5531
+ return this.client.request("GET", `/payments/${encodeURIComponent(this.paymentId)}`, {
5532
+ query: { client_secret: this.requireClientSecret() },
5533
+ ...options,
5534
+ headers: this.pkHeaders(options?.headers)
5535
+ });
5536
+ }
5537
+ /**
5538
+ * Update the payment before confirmation (e.g. persist custom-field
5539
+ * answers as `metadata` on rails that never hit `/confirm`). The client
5540
+ * secret is attached automatically.
5541
+ *
5542
+ * `POST /payments/{paymentId}` (publishable key)
5543
+ */
5544
+ async updatePayment(params, options) {
5545
+ return this.client.request("POST", `/payments/${encodeURIComponent(this.paymentId)}`, {
5546
+ body: { ...params, client_secret: this.requireClientSecret() },
5547
+ ...options,
5548
+ headers: this.pkHeaders(options?.headers)
5549
+ });
5550
+ }
5551
+ /**
5552
+ * Confirm the payment. The client secret is attached automatically; pass
5553
+ * an `Idempotency-Key` header via `options` to make retries safe.
5554
+ *
5555
+ * `POST /payments/{paymentId}/confirm` (publishable key)
5556
+ */
5557
+ async confirmPayment(params, options) {
5558
+ return this.client.request("POST", `/payments/${encodeURIComponent(this.paymentId)}/confirm`, {
5559
+ body: { ...params, client_secret: this.requireClientSecret() },
5560
+ ...options,
5561
+ headers: this.pkHeaders(options?.headers)
5562
+ });
5563
+ }
5564
+ /**
5565
+ * Payment methods available for this payment.
5566
+ *
5567
+ * `GET /payment-methods` (publishable key + client secret)
5568
+ *
5569
+ * @param params - Optional filters; `country` is the highest-precedence
5570
+ * geo hint, ahead of billing address and IP geolocation.
5571
+ */
5572
+ async listPaymentMethods(params, options) {
5573
+ return this.client.request("GET", "/payment-methods", {
5574
+ query: { client_secret: this.requireClientSecret(), country: params?.country },
5575
+ ...options,
5576
+ headers: this.pkHeaders(options?.headers)
5577
+ });
5578
+ }
5579
+ };
5580
+
4905
5581
  // src/nativePanes.ts
4906
5582
  var STRIPE_NATIVE_PANE_METHODS = [
4907
5583
  {
@@ -5331,6 +6007,212 @@ var AdminPortal = class {
5331
6007
  { body: { iframe_allowed_origins: origins } }
5332
6008
  );
5333
6009
  }
6010
+ /**
6011
+ * Soft-delete a transaction of ANY merchant. Only payments whose status
6012
+ * is in the admin delete policy can be deleted; the action is audited.
6013
+ *
6014
+ * `DELETE /admin-portal/transactions/{paymentId}`
6015
+ */
6016
+ async deleteTransaction(paymentId) {
6017
+ return this.request("DELETE", `/admin-portal/transactions/${encodeURIComponent(paymentId)}`);
6018
+ }
6019
+ /**
6020
+ * Recover (undelete) a soft-deleted transaction. Audited.
6021
+ *
6022
+ * `POST /admin-portal/transactions/{paymentId}/recover`
6023
+ */
6024
+ async recoverTransaction(paymentId) {
6025
+ return this.request(
6026
+ "POST",
6027
+ `/admin-portal/transactions/${encodeURIComponent(paymentId)}/recover`
6028
+ );
6029
+ }
6030
+ /**
6031
+ * Client/device observations captured while the buyer interacted with a
6032
+ * transaction of ANY merchant, oldest first.
6033
+ *
6034
+ * `GET /admin-portal/transactions/{paymentId}/client-context`
6035
+ */
6036
+ async getTransactionClientContext(paymentId) {
6037
+ return this.request(
6038
+ "GET",
6039
+ `/admin-portal/transactions/${encodeURIComponent(paymentId)}/client-context`
6040
+ );
6041
+ }
6042
+ /**
6043
+ * The global payment auto-close policy.
6044
+ * `GET /admin-portal/auto-close-config`
6045
+ */
6046
+ async getAutoCloseConfig() {
6047
+ return this.request("GET", "/admin-portal/auto-close-config");
6048
+ }
6049
+ /**
6050
+ * Update the global payment auto-close policy. PATCH semantics — omitted
6051
+ * fields are left unchanged.
6052
+ *
6053
+ * `PUT /admin-portal/auto-close-config`
6054
+ */
6055
+ async updateAutoCloseConfig(params) {
6056
+ return this.request("PUT", "/admin-portal/auto-close-config", { body: params });
6057
+ }
6058
+ /**
6059
+ * One merchant's auto-close override plus the effective values.
6060
+ * `GET /admin-portal/accounts/{merchantId}/auto-close-config`
6061
+ */
6062
+ async getMerchantAutoCloseConfig(merchantId) {
6063
+ return this.request(
6064
+ "GET",
6065
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/auto-close-config`
6066
+ );
6067
+ }
6068
+ /**
6069
+ * Replace one merchant's auto-close override. REPLACE semantics — sending
6070
+ * both fields as `null` removes the override entirely.
6071
+ *
6072
+ * `PUT /admin-portal/accounts/{merchantId}/auto-close-config`
6073
+ */
6074
+ async updateMerchantAutoCloseConfig(merchantId, params) {
6075
+ return this.request(
6076
+ "PUT",
6077
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/auto-close-config`,
6078
+ { body: params }
6079
+ );
6080
+ }
6081
+ /**
6082
+ * The global transaction soft-delete policy (statuses admins may delete,
6083
+ * plus the deploy-time env ceiling).
6084
+ *
6085
+ * `GET /admin-portal/transaction-delete-config`
6086
+ */
6087
+ async getTransactionDeleteConfig() {
6088
+ return this.request("GET", "/admin-portal/transaction-delete-config");
6089
+ }
6090
+ /**
6091
+ * Replace the global deletable-status set. Must be a subset of the env
6092
+ * ceiling.
6093
+ *
6094
+ * `PUT /admin-portal/transaction-delete-config`
6095
+ */
6096
+ async updateTransactionDeleteConfig(params) {
6097
+ return this.request("PUT", "/admin-portal/transaction-delete-config", { body: params });
6098
+ }
6099
+ /**
6100
+ * One merchant's deletable-status override plus the effective set.
6101
+ * `GET /admin-portal/accounts/{merchantId}/transaction-delete-config`
6102
+ */
6103
+ async getMerchantTransactionDeleteConfig(merchantId) {
6104
+ return this.request(
6105
+ "GET",
6106
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/transaction-delete-config`
6107
+ );
6108
+ }
6109
+ /**
6110
+ * Replace one merchant's deletable-status override. `statuses: null`
6111
+ * removes the override; an empty list forbids deletion entirely.
6112
+ *
6113
+ * `PUT /admin-portal/accounts/{merchantId}/transaction-delete-config`
6114
+ */
6115
+ async updateMerchantTransactionDeleteConfig(merchantId, params) {
6116
+ return this.request(
6117
+ "PUT",
6118
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/transaction-delete-config`,
6119
+ { body: params }
6120
+ );
6121
+ }
6122
+ /**
6123
+ * A merchant's settlement statements. Same shapes as the merchant-facing
6124
+ * `settlement` resource, admin-authenticated.
6125
+ *
6126
+ * `GET /admin-portal/accounts/{merchantId}/settlement/statements`
6127
+ */
6128
+ async listSettlementStatements(merchantId, params) {
6129
+ return this.request(
6130
+ "GET",
6131
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/statements`,
6132
+ {
6133
+ query: {
6134
+ test_mode: params.test_mode,
6135
+ profile_id: params.profile_id,
6136
+ limit: params.limit,
6137
+ offset: params.offset
6138
+ }
6139
+ }
6140
+ );
6141
+ }
6142
+ /**
6143
+ * One settlement statement with its breakdown.
6144
+ * `GET /admin-portal/accounts/{merchantId}/settlement/statements/{statementId}`
6145
+ */
6146
+ async getSettlementStatement(merchantId, statementId) {
6147
+ return this.request(
6148
+ "GET",
6149
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/statements/${encodeURIComponent(statementId)}`
6150
+ );
6151
+ }
6152
+ /**
6153
+ * Export a settlement statement as PDF. Returns the raw bytes as a `Blob`
6154
+ * with the same auth and error handling as every other call.
6155
+ *
6156
+ * `GET /admin-portal/accounts/{merchantId}/settlement/statements/{statementId}/pdf`
6157
+ */
6158
+ async downloadSettlementStatementPdf(merchantId, statementId, params) {
6159
+ return this.request(
6160
+ "GET",
6161
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/statements/${encodeURIComponent(statementId)}/pdf`,
6162
+ {
6163
+ query: {
6164
+ currency: params?.currency,
6165
+ include_transactions: params?.include_transactions
6166
+ },
6167
+ responseType: "blob"
6168
+ }
6169
+ );
6170
+ }
6171
+ /**
6172
+ * A merchant's per-shop settlement overview.
6173
+ * `GET /admin-portal/accounts/{merchantId}/settlement/overview`
6174
+ */
6175
+ async settlementOverview(merchantId, params) {
6176
+ return this.request(
6177
+ "GET",
6178
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/overview`,
6179
+ { query: { test_mode: params.test_mode } }
6180
+ );
6181
+ }
6182
+ /**
6183
+ * A merchant's live current-period settlement rollup.
6184
+ * `GET /admin-portal/accounts/{merchantId}/settlement/current`
6185
+ */
6186
+ async settlementCurrent(merchantId, params) {
6187
+ return this.request(
6188
+ "GET",
6189
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/current`,
6190
+ { query: { test_mode: params.test_mode, profile_id: params.profile_id } }
6191
+ );
6192
+ }
6193
+ /**
6194
+ * A merchant's vault state: the attach entitlement, and the vault
6195
+ * configuration of every shop.
6196
+ *
6197
+ * `GET /admin-portal/accounts/{merchantId}/vault`
6198
+ */
6199
+ async getVaultState(merchantId) {
6200
+ return this.request("GET", `/admin-portal/accounts/${encodeURIComponent(merchantId)}/vault`);
6201
+ }
6202
+ /**
6203
+ * Attach a vault to one of a merchant's shops — creates the vault
6204
+ * connector account and points the profile at it in one request. The
6205
+ * Collect credentials are verified write-only before anything is stored.
6206
+ *
6207
+ * `POST /admin-portal/accounts/{merchantId}/vault/attach`
6208
+ */
6209
+ async attachVault(merchantId, params) {
6210
+ return this.request(
6211
+ "POST",
6212
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/vault/attach`,
6213
+ { body: params }
6214
+ );
6215
+ }
5334
6216
  /**
5335
6217
  * Fetch the global welcome promotional-credit config (amount + message)
5336
6218
  * granted to newly created billing profiles. Internal-admin route.
@@ -5718,6 +6600,7 @@ var DelopayInternal = class extends Delopay {
5718
6600
  Cache,
5719
6601
  CardIssuers,
5720
6602
  Cards,
6603
+ CheckoutSession,
5721
6604
  Configs,
5722
6605
  ConnectorRestrictionRules,
5723
6606
  ConnectorRestrictions,
@@ -5738,11 +6621,13 @@ var DelopayInternal = class extends Delopay {
5738
6621
  NATIVE_PANES_MAX,
5739
6622
  NATIVE_PANE_CATEGORY_KEYS,
5740
6623
  NATIVE_PANE_ICON_KEYS,
6624
+ OperationLimits,
5741
6625
  PlatformBilling,
5742
6626
  PlatformFees,
5743
6627
  Regions,
5744
6628
  STRIPE_NATIVE_PANE_METHODS,
5745
6629
  Search,
6630
+ Settlement,
5746
6631
  Subscriptions,
5747
6632
  Webhooks,
5748
6633
  allOf,