@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/{chunk-G44EQT6Q.js → chunk-DQ36QCU7.js} +680 -4
- package/dist/chunk-DQ36QCU7.js.map +1 -0
- package/dist/index.cjs +682 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1219 -9
- package/dist/index.d.ts +1219 -9
- package/dist/index.js +7 -1
- package/dist/internal.cjs +888 -3
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +312 -3
- package/dist/internal.d.ts +312 -3
- package/dist/internal.js +213 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-G44EQT6Q.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -38,6 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
CUSTOM_FIELD_OPERATORS_BY_SOURCE: () => CUSTOM_FIELD_OPERATORS_BY_SOURCE,
|
|
39
39
|
CUSTOM_FIELD_VALUELESS_OPERATORS: () => CUSTOM_FIELD_VALUELESS_OPERATORS,
|
|
40
40
|
Cards: () => Cards,
|
|
41
|
+
CheckoutSession: () => CheckoutSession,
|
|
41
42
|
DEFAULT_BADGES: () => DEFAULT_BADGES,
|
|
42
43
|
DEFAULT_BADGES_DARK: () => DEFAULT_BADGES_DARK,
|
|
43
44
|
DEFAULT_BRANDING: () => DEFAULT_BRANDING,
|
|
@@ -53,9 +54,11 @@ __export(index_exports, {
|
|
|
53
54
|
NATIVE_PANES_MAX: () => NATIVE_PANES_MAX,
|
|
54
55
|
NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
|
|
55
56
|
NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
|
|
57
|
+
OperationLimits: () => OperationLimits,
|
|
56
58
|
Regions: () => Regions,
|
|
57
59
|
STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
|
|
58
60
|
Search: () => Search,
|
|
61
|
+
Settlement: () => Settlement,
|
|
59
62
|
Subscriptions: () => Subscriptions,
|
|
60
63
|
Webhooks: () => Webhooks,
|
|
61
64
|
allOf: () => allOf,
|
|
@@ -545,6 +548,39 @@ var Connectors = class {
|
|
|
545
548
|
async list(accountId) {
|
|
546
549
|
return this.request("GET", `/account/${encodeURIComponent(accountId)}/connectors`);
|
|
547
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* The profile-scoped connector list. The merchant-wide `list()` is
|
|
553
|
+
* merchant-gated and 403s for a profile-entity (shop user) JWT; this
|
|
554
|
+
* variant is scoped server-side to the caller's own profile.
|
|
555
|
+
*
|
|
556
|
+
* `GET /account/{accountId}/profile/connectors`
|
|
557
|
+
*/
|
|
558
|
+
async listByProfile(accountId) {
|
|
559
|
+
return this.request("GET", `/account/${encodeURIComponent(accountId)}/profile/connectors`);
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* The built-in e-Payouts reference catalog — the "Restore defaults" source.
|
|
563
|
+
* `GET /account/{accountId}/connectors/epayouts/catalog/defaults`
|
|
564
|
+
*/
|
|
565
|
+
async getEpayoutsCatalogDefaults(accountId) {
|
|
566
|
+
return this.request(
|
|
567
|
+
"GET",
|
|
568
|
+
`/account/${encodeURIComponent(accountId)}/connectors/epayouts/catalog/defaults`
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Sweep the merchant's own e-Payouts module and return the rails it
|
|
573
|
+
* actually has enabled. Server-side this makes many upstream calls, so it
|
|
574
|
+
* can take several seconds — show progress.
|
|
575
|
+
*
|
|
576
|
+
* `POST /account/{accountId}/connectors/{connectorId}/epayouts/catalog/sync`
|
|
577
|
+
*/
|
|
578
|
+
async syncEpayoutsCatalog(accountId, connectorId) {
|
|
579
|
+
return this.request(
|
|
580
|
+
"POST",
|
|
581
|
+
`/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/epayouts/catalog/sync`
|
|
582
|
+
);
|
|
583
|
+
}
|
|
548
584
|
async update(accountId, connectorId, params) {
|
|
549
585
|
return this.request(
|
|
550
586
|
"POST",
|
|
@@ -577,6 +613,55 @@ var Connectors = class {
|
|
|
577
613
|
);
|
|
578
614
|
}
|
|
579
615
|
// --- Advanced operations (Task 4.8) ---
|
|
616
|
+
/**
|
|
617
|
+
* Run the configuration checks for a vault (VGS) connector account:
|
|
618
|
+
* credential validity, write-only Collect scope, reachability, environment
|
|
619
|
+
* coherence, route coverage. Read-only but not cheap — it decrypts the
|
|
620
|
+
* vault's management credential and talks to VGS.
|
|
621
|
+
*
|
|
622
|
+
* `POST /account/{accountId}/connectors/{connectorId}/vault/verify`
|
|
623
|
+
*/
|
|
624
|
+
async verifyVault(accountId, connectorId, params) {
|
|
625
|
+
return this.request(
|
|
626
|
+
"POST",
|
|
627
|
+
`/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/vault/verify`,
|
|
628
|
+
{ body: params }
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Compute the route document the vault SHOULD have and diff it against
|
|
633
|
+
* what exists, without writing anything. The returned fingerprints must be
|
|
634
|
+
* echoed byte for byte on {@link Connectors.applyVaultRoutes}.
|
|
635
|
+
*
|
|
636
|
+
* A router without these endpoints answers 404 — render that as "this
|
|
637
|
+
* build cannot configure routes", never as "there is nothing to change".
|
|
638
|
+
*
|
|
639
|
+
* `POST /account/{accountId}/connectors/{connectorId}/vault/routes/preview`
|
|
640
|
+
*/
|
|
641
|
+
async previewVaultRoutes(accountId, connectorId, params) {
|
|
642
|
+
return this.request(
|
|
643
|
+
"POST",
|
|
644
|
+
`/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/vault/routes/preview`,
|
|
645
|
+
{ body: params }
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Write the routes the merchant just previewed. Both fingerprints come
|
|
650
|
+
* from the preview and are opaque: `expected_current_fingerprint` says the
|
|
651
|
+
* vault has not moved (`null` = "the preview found no routes" and is sent
|
|
652
|
+
* as `null`, never omitted), `expected_desired_fingerprint` says the
|
|
653
|
+
* document is still the one on screen. A 409 (`DE_04`) means the vault
|
|
654
|
+
* changed since the preview — nothing was written; preview again.
|
|
655
|
+
*
|
|
656
|
+
* `POST /account/{accountId}/connectors/{connectorId}/vault/routes/apply`
|
|
657
|
+
*/
|
|
658
|
+
async applyVaultRoutes(accountId, connectorId, params) {
|
|
659
|
+
return this.request(
|
|
660
|
+
"POST",
|
|
661
|
+
`/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/vault/routes/apply`,
|
|
662
|
+
{ body: params }
|
|
663
|
+
);
|
|
664
|
+
}
|
|
580
665
|
/** Verify connector credentials. `POST /account/connectors/verify` */
|
|
581
666
|
async verify(params) {
|
|
582
667
|
return this.request("POST", "/account/connectors/verify", { body: params });
|
|
@@ -1539,6 +1624,39 @@ var Payments = class {
|
|
|
1539
1624
|
...options
|
|
1540
1625
|
});
|
|
1541
1626
|
}
|
|
1627
|
+
/**
|
|
1628
|
+
* The status timeline of client/device observations captured while the
|
|
1629
|
+
* buyer interacted with the payment (checkout opens, confirms, redirect
|
|
1630
|
+
* legs, reported client signals), oldest first.
|
|
1631
|
+
*
|
|
1632
|
+
* `GET /payments/{paymentId}/client-context`
|
|
1633
|
+
*/
|
|
1634
|
+
async listClientContext(paymentId, options) {
|
|
1635
|
+
return this.request(
|
|
1636
|
+
"GET",
|
|
1637
|
+
`/payments/${encodeURIComponent(paymentId)}/client-context`,
|
|
1638
|
+
options
|
|
1639
|
+
);
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Soft-delete a payment. Only payments whose status is in the merchant's
|
|
1643
|
+
* delete policy (see {@link Payments.getDeletePolicy}) can be deleted;
|
|
1644
|
+
* anything else fails with a precondition error.
|
|
1645
|
+
*
|
|
1646
|
+
* `DELETE /payments/{paymentId}`
|
|
1647
|
+
*/
|
|
1648
|
+
async delete(paymentId, options) {
|
|
1649
|
+
return this.request("DELETE", `/payments/${encodeURIComponent(paymentId)}`, options);
|
|
1650
|
+
}
|
|
1651
|
+
/**
|
|
1652
|
+
* The effective deletable-status set for the calling merchant — lets a
|
|
1653
|
+
* dashboard show the delete action only where it is allowed.
|
|
1654
|
+
*
|
|
1655
|
+
* `GET /payments/delete-policy`
|
|
1656
|
+
*/
|
|
1657
|
+
async getDeletePolicy(options) {
|
|
1658
|
+
return this.request("GET", "/payments/delete-policy", options);
|
|
1659
|
+
}
|
|
1542
1660
|
// --- Advanced operations (Task 3.2) ---
|
|
1543
1661
|
/** Generate session tokens. `POST /payments/session-tokens` */
|
|
1544
1662
|
async sessionTokens(params) {
|
|
@@ -1609,10 +1727,30 @@ var Payments = class {
|
|
|
1609
1727
|
async listByFilter(params) {
|
|
1610
1728
|
return this.request("POST", "/payments/list", { body: params });
|
|
1611
1729
|
}
|
|
1730
|
+
/**
|
|
1731
|
+
* List payments by filter, scoped to the caller's profile (the shop-user
|
|
1732
|
+
* twin of `listByFilter`). The backend narrows to the profile from the
|
|
1733
|
+
* auth context, so `profile_id` / `project_id` must not be sent.
|
|
1734
|
+
*
|
|
1735
|
+
* Not to be confused with {@link Payments.listByProfile}, which is the GET
|
|
1736
|
+
* cursor variant and rejects this body.
|
|
1737
|
+
*
|
|
1738
|
+
* `POST /payments/profile/list`
|
|
1739
|
+
*/
|
|
1740
|
+
async listByProfileFilter(params, options) {
|
|
1741
|
+
return this.request("POST", "/payments/profile/list", { body: params, ...options });
|
|
1742
|
+
}
|
|
1612
1743
|
/** Get payment filter options. `GET /payments/filter` */
|
|
1613
1744
|
async getFilters(params) {
|
|
1614
1745
|
return this.request("GET", "/payments/filter", { query: params });
|
|
1615
1746
|
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Get payment filter options, scoped to the caller's profile.
|
|
1749
|
+
* `GET /payments/profile/filter`
|
|
1750
|
+
*/
|
|
1751
|
+
async getFiltersByProfile(params) {
|
|
1752
|
+
return this.request("GET", "/payments/profile/filter", { query: params });
|
|
1753
|
+
}
|
|
1616
1754
|
/** Get payment aggregates. `GET /payments/aggregate` */
|
|
1617
1755
|
async aggregate(params) {
|
|
1618
1756
|
return this.request("GET", "/payments/aggregate", { query: params });
|
|
@@ -1813,6 +1951,16 @@ var Profiles = class {
|
|
|
1813
1951
|
async list(accountId) {
|
|
1814
1952
|
return this.request("GET", `/account/${encodeURIComponent(accountId)}/business-profile`);
|
|
1815
1953
|
}
|
|
1954
|
+
/**
|
|
1955
|
+
* List the business profiles the caller can see at profile scope — the
|
|
1956
|
+
* `ProfileAccountRead` twin of `list()` (which needs merchant-level read).
|
|
1957
|
+
* A shop-scoped user gets exactly their own shop back.
|
|
1958
|
+
*
|
|
1959
|
+
* `GET /account/{accountId}/profile`
|
|
1960
|
+
*/
|
|
1961
|
+
async listByProfile(accountId) {
|
|
1962
|
+
return this.request("GET", `/account/${encodeURIComponent(accountId)}/profile`);
|
|
1963
|
+
}
|
|
1816
1964
|
async update(accountId, profileId, params) {
|
|
1817
1965
|
return this.request(
|
|
1818
1966
|
"POST",
|
|
@@ -2456,7 +2604,7 @@ var Shops = class {
|
|
|
2456
2604
|
/**
|
|
2457
2605
|
* Upload a logo file for a shop. The file is stored in Delopay's configured
|
|
2458
2606
|
* object store and a public HTTPS URL is returned. This method does NOT write
|
|
2459
|
-
* the URL into the shop's `payment_link_config.
|
|
2607
|
+
* the URL into the shop's `payment_link_config.logo` — call
|
|
2460
2608
|
* `shops.update` afterwards with the returned `logo_url` to persist the change.
|
|
2461
2609
|
*
|
|
2462
2610
|
* Accepts PNG, JPEG, WebP or SVG. The file must be ≤ 1 MiB.
|
|
@@ -2470,7 +2618,7 @@ var Shops = class {
|
|
|
2470
2618
|
* ```typescript
|
|
2471
2619
|
* const { logo_url } = await delopay.shops.uploadLogo('merch_1', 'pro_1', file);
|
|
2472
2620
|
* await delopay.shops.update('merch_1', 'pro_1', {
|
|
2473
|
-
* payment_link_config: {
|
|
2621
|
+
* payment_link_config: { logo: logo_url },
|
|
2474
2622
|
* });
|
|
2475
2623
|
* ```
|
|
2476
2624
|
*/
|
|
@@ -2483,6 +2631,29 @@ var Shops = class {
|
|
|
2483
2631
|
{ body: form }
|
|
2484
2632
|
);
|
|
2485
2633
|
}
|
|
2634
|
+
/**
|
|
2635
|
+
* Update only the checkout appearance (the `payment_link_config` blob:
|
|
2636
|
+
* theme, logo, colours, seller name, SDK layout/rules, DeloPay-branding
|
|
2637
|
+
* toggle) of a shop. Applied as a whole-object replace of
|
|
2638
|
+
* `payment_link_config`, mirroring the shop-update semantics.
|
|
2639
|
+
*
|
|
2640
|
+
* Gated on the dedicated `CheckoutBranding` permission, so "may restyle
|
|
2641
|
+
* the checkout" can be granted without full account/shop write.
|
|
2642
|
+
*
|
|
2643
|
+
* `POST /shops/{merchantId}/{shopId}/checkout-branding`
|
|
2644
|
+
*
|
|
2645
|
+
* @param merchantId - The merchant account ID.
|
|
2646
|
+
* @param shopId - The shop (business profile) ID to restyle.
|
|
2647
|
+
* @param params - The new `payment_link_config` blob (full replacement).
|
|
2648
|
+
* @returns The updated business profile.
|
|
2649
|
+
*/
|
|
2650
|
+
async updateCheckoutBranding(merchantId, shopId, params, options) {
|
|
2651
|
+
return this.request(
|
|
2652
|
+
"POST",
|
|
2653
|
+
`/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/checkout-branding`,
|
|
2654
|
+
{ body: params, ...options }
|
|
2655
|
+
);
|
|
2656
|
+
}
|
|
2486
2657
|
};
|
|
2487
2658
|
|
|
2488
2659
|
// src/resources/stripeConnect.ts
|
|
@@ -2589,6 +2760,26 @@ var Users = class {
|
|
|
2589
2760
|
async update(params) {
|
|
2590
2761
|
return this.request("POST", "/user/update", { body: params });
|
|
2591
2762
|
}
|
|
2763
|
+
/**
|
|
2764
|
+
* RFC 7396 merge-patch the caller's own user-scoped metadata bucket.
|
|
2765
|
+
* Returns the full user details, so callers can refresh their context
|
|
2766
|
+
* without a second fetch.
|
|
2767
|
+
*
|
|
2768
|
+
* `PATCH /user/metadata`
|
|
2769
|
+
*/
|
|
2770
|
+
async updateMetadata(params) {
|
|
2771
|
+
return this.request("PATCH", "/user/metadata", { body: params });
|
|
2772
|
+
}
|
|
2773
|
+
/**
|
|
2774
|
+
* RFC 7396 merge-patch the merchant-scoped metadata bucket shared by
|
|
2775
|
+
* every dashboard user of the merchant. Same response contract as
|
|
2776
|
+
* {@link Users.updateMetadata}.
|
|
2777
|
+
*
|
|
2778
|
+
* `PATCH /user/merchant/metadata`
|
|
2779
|
+
*/
|
|
2780
|
+
async updateMerchantMetadata(params) {
|
|
2781
|
+
return this.request("PATCH", "/user/merchant/metadata", { body: params });
|
|
2782
|
+
}
|
|
2592
2783
|
/**
|
|
2593
2784
|
* Permanently delete the caller's account. Requires a fresh password
|
|
2594
2785
|
* (and a current 6-digit TOTP code if the user has TOTP enrolled). On
|
|
@@ -3348,6 +3539,283 @@ var Subscriptions = class {
|
|
|
3348
3539
|
...options
|
|
3349
3540
|
});
|
|
3350
3541
|
}
|
|
3542
|
+
/**
|
|
3543
|
+
* Resolve which of the given payments were raised by a subscription.
|
|
3544
|
+
* `POST /subscriptions/payments/lookup`
|
|
3545
|
+
*
|
|
3546
|
+
* The linkage exists in one direction only — an invoice points at the payment
|
|
3547
|
+
* it settled, and nothing is stamped on the payment — so this is the only way
|
|
3548
|
+
* to tell a subscription charge from a one-off one when you are holding a
|
|
3549
|
+
* page of payments. In particular, do not use `off_session` or the presence
|
|
3550
|
+
* of a mandate: an ordinary saved-card charge sets those identically.
|
|
3551
|
+
*
|
|
3552
|
+
* Ids that belong to no subscription are **absent** from `links` rather than
|
|
3553
|
+
* returned as an error, so match on presence:
|
|
3554
|
+
*
|
|
3555
|
+
* ```ts
|
|
3556
|
+
* const { links } = await subscriptions.lookupPayments(
|
|
3557
|
+
* { payment_ids: page.map((p) => p.payment_id) },
|
|
3558
|
+
* { headers: { 'X-Profile-Id': profileId } },
|
|
3559
|
+
* );
|
|
3560
|
+
* const bySubscription = new Map(links.map((l) => [l.payment_id, l]));
|
|
3561
|
+
* ```
|
|
3562
|
+
*
|
|
3563
|
+
* Profile-scoped like every other subscription route, and that matters more
|
|
3564
|
+
* here than elsewhere: a `payment_id` is merchant-supplied and only unique
|
|
3565
|
+
* within a merchant, so the shop is part of the question, not an
|
|
3566
|
+
* optimisation. Pass the profile that owns **the payments** — for a list
|
|
3567
|
+
* spanning several shops, group the ids by shop and call once per group.
|
|
3568
|
+
*
|
|
3569
|
+
* At most 200 ids per call.
|
|
3570
|
+
*/
|
|
3571
|
+
async lookupPayments(params, options) {
|
|
3572
|
+
return this.request("POST", "/subscriptions/payments/lookup", { body: params, ...options });
|
|
3573
|
+
}
|
|
3574
|
+
};
|
|
3575
|
+
|
|
3576
|
+
// src/resources/settlement.ts
|
|
3577
|
+
var Settlement = class {
|
|
3578
|
+
constructor(request) {
|
|
3579
|
+
this.request = request;
|
|
3580
|
+
}
|
|
3581
|
+
/**
|
|
3582
|
+
* Per-shop settlement rollup for the host merchant: unpaid totals and the
|
|
3583
|
+
* running current period, one row per shop.
|
|
3584
|
+
*
|
|
3585
|
+
* `GET /settlement/overview`
|
|
3586
|
+
*/
|
|
3587
|
+
async overview(params, options) {
|
|
3588
|
+
return this.request("GET", "/settlement/overview", {
|
|
3589
|
+
query: { test_mode: params.test_mode },
|
|
3590
|
+
...options
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
/**
|
|
3594
|
+
* Live rollup of the current (not yet statemented) period.
|
|
3595
|
+
*
|
|
3596
|
+
* `GET /settlement/current`
|
|
3597
|
+
*/
|
|
3598
|
+
async current(params, options) {
|
|
3599
|
+
return this.request("GET", "/settlement/current", {
|
|
3600
|
+
query: { test_mode: params.test_mode, profile_id: params.profile_id },
|
|
3601
|
+
...options
|
|
3602
|
+
});
|
|
3603
|
+
}
|
|
3604
|
+
/**
|
|
3605
|
+
* List generated settlement statements, newest first.
|
|
3606
|
+
*
|
|
3607
|
+
* `GET /settlement/statements`
|
|
3608
|
+
*/
|
|
3609
|
+
async listStatements(params, options) {
|
|
3610
|
+
return this.request("GET", "/settlement/statements", {
|
|
3611
|
+
query: {
|
|
3612
|
+
test_mode: params.test_mode,
|
|
3613
|
+
profile_id: params.profile_id,
|
|
3614
|
+
limit: params.limit,
|
|
3615
|
+
offset: params.offset
|
|
3616
|
+
},
|
|
3617
|
+
...options
|
|
3618
|
+
});
|
|
3619
|
+
}
|
|
3620
|
+
/**
|
|
3621
|
+
* One statement with its per-connector/currency breakdown.
|
|
3622
|
+
*
|
|
3623
|
+
* `GET /settlement/statements/{statementId}`
|
|
3624
|
+
*/
|
|
3625
|
+
async retrieveStatement(statementId, options) {
|
|
3626
|
+
return this.request(
|
|
3627
|
+
"GET",
|
|
3628
|
+
`/settlement/statements/${encodeURIComponent(statementId)}`,
|
|
3629
|
+
options
|
|
3630
|
+
);
|
|
3631
|
+
}
|
|
3632
|
+
/**
|
|
3633
|
+
* Generate (or regenerate) the statement for one shop and calendar month.
|
|
3634
|
+
*
|
|
3635
|
+
* `POST /settlement/statements/generate`
|
|
3636
|
+
*/
|
|
3637
|
+
async generateStatement(params, options) {
|
|
3638
|
+
return this.request("POST", "/settlement/statements/generate", {
|
|
3639
|
+
body: params,
|
|
3640
|
+
...options
|
|
3641
|
+
});
|
|
3642
|
+
}
|
|
3643
|
+
/**
|
|
3644
|
+
* Record payout progress on a statement (`unpaid` / `partial` / `paid`).
|
|
3645
|
+
*
|
|
3646
|
+
* `POST /settlement/statements/{statementId}/payout`
|
|
3647
|
+
*/
|
|
3648
|
+
async updateStatementPayout(statementId, params, options) {
|
|
3649
|
+
return this.request(
|
|
3650
|
+
"POST",
|
|
3651
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/payout`,
|
|
3652
|
+
{ body: params, ...options }
|
|
3653
|
+
);
|
|
3654
|
+
}
|
|
3655
|
+
/**
|
|
3656
|
+
* Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
|
|
3657
|
+
* the same auth, retries and error handling as every other call — persist
|
|
3658
|
+
* or object-URL it caller-side.
|
|
3659
|
+
*
|
|
3660
|
+
* `GET /settlement/statements/{statementId}/pdf`
|
|
3661
|
+
*
|
|
3662
|
+
* @example
|
|
3663
|
+
* ```typescript
|
|
3664
|
+
* const pdf = await delopay.settlement.downloadStatementPdf('stmt_1', {
|
|
3665
|
+
* currency: 'EUR',
|
|
3666
|
+
* include_transactions: true,
|
|
3667
|
+
* });
|
|
3668
|
+
* const url = URL.createObjectURL(pdf);
|
|
3669
|
+
* ```
|
|
3670
|
+
*/
|
|
3671
|
+
async downloadStatementPdf(statementId, params, options) {
|
|
3672
|
+
return this.request("GET", `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {
|
|
3673
|
+
query: {
|
|
3674
|
+
currency: params?.currency,
|
|
3675
|
+
include_transactions: params?.include_transactions
|
|
3676
|
+
},
|
|
3677
|
+
responseType: "blob",
|
|
3678
|
+
...options
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
/**
|
|
3682
|
+
* The individual settled attempts of one shop's calendar month.
|
|
3683
|
+
*
|
|
3684
|
+
* `GET /settlement/lines`
|
|
3685
|
+
*/
|
|
3686
|
+
async listLines(params, options) {
|
|
3687
|
+
return this.request("GET", "/settlement/lines", {
|
|
3688
|
+
query: {
|
|
3689
|
+
profile_id: params.profile_id,
|
|
3690
|
+
year: params.year,
|
|
3691
|
+
month: params.month,
|
|
3692
|
+
test_mode: params.test_mode,
|
|
3693
|
+
limit: params.limit,
|
|
3694
|
+
offset: params.offset
|
|
3695
|
+
},
|
|
3696
|
+
...options
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
/**
|
|
3700
|
+
* The fee schedules that currently apply to a shop.
|
|
3701
|
+
*
|
|
3702
|
+
* `GET /settlement/fee-config`
|
|
3703
|
+
*/
|
|
3704
|
+
async feeConfig(params, options) {
|
|
3705
|
+
return this.request("GET", "/settlement/fee-config", {
|
|
3706
|
+
query: { profile_id: params.profile_id },
|
|
3707
|
+
...options
|
|
3708
|
+
});
|
|
3709
|
+
}
|
|
3710
|
+
/**
|
|
3711
|
+
* Enqueue a settlement-line backfill over historical attempts. Attempts
|
|
3712
|
+
* already covered by a line are always skipped.
|
|
3713
|
+
*
|
|
3714
|
+
* `POST /settlement/backfill`
|
|
3715
|
+
*/
|
|
3716
|
+
async backfill(params, options) {
|
|
3717
|
+
return this.request("POST", "/settlement/backfill", { body: params, ...options });
|
|
3718
|
+
}
|
|
3719
|
+
/**
|
|
3720
|
+
* Toggle whether a shop's owner can see their own settlement figures.
|
|
3721
|
+
*
|
|
3722
|
+
* `POST /settlement/shops/visibility`
|
|
3723
|
+
*/
|
|
3724
|
+
async setShopVisibility(params, options) {
|
|
3725
|
+
return this.request("POST", "/settlement/shops/visibility", {
|
|
3726
|
+
body: params,
|
|
3727
|
+
...options
|
|
3728
|
+
});
|
|
3729
|
+
}
|
|
3730
|
+
/**
|
|
3731
|
+
* Manual adjustments recorded on a statement.
|
|
3732
|
+
*
|
|
3733
|
+
* `GET /settlement/statements/{statementId}/adjustments`
|
|
3734
|
+
*/
|
|
3735
|
+
async listStatementAdjustments(statementId, options) {
|
|
3736
|
+
return this.request(
|
|
3737
|
+
"GET",
|
|
3738
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,
|
|
3739
|
+
options
|
|
3740
|
+
);
|
|
3741
|
+
}
|
|
3742
|
+
/**
|
|
3743
|
+
* Add a manual adjustment to a statement. Positive `amount_usd` charges
|
|
3744
|
+
* the shop (reducing their payout); negative credits them.
|
|
3745
|
+
*
|
|
3746
|
+
* `POST /settlement/statements/{statementId}/adjustments`
|
|
3747
|
+
*/
|
|
3748
|
+
async createStatementAdjustment(statementId, params, options) {
|
|
3749
|
+
return this.request(
|
|
3750
|
+
"POST",
|
|
3751
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,
|
|
3752
|
+
{ body: params, ...options }
|
|
3753
|
+
);
|
|
3754
|
+
}
|
|
3755
|
+
/**
|
|
3756
|
+
* Remove a manual adjustment from a statement.
|
|
3757
|
+
*
|
|
3758
|
+
* `DELETE /settlement/statements/{statementId}/adjustments/{adjustmentId}`
|
|
3759
|
+
*/
|
|
3760
|
+
async deleteStatementAdjustment(statementId, adjustmentId, options) {
|
|
3761
|
+
return this.request(
|
|
3762
|
+
"DELETE",
|
|
3763
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/adjustments/${encodeURIComponent(adjustmentId)}`,
|
|
3764
|
+
options
|
|
3765
|
+
);
|
|
3766
|
+
}
|
|
3767
|
+
};
|
|
3768
|
+
|
|
3769
|
+
// src/resources/operationLimits.ts
|
|
3770
|
+
var OperationLimits = class {
|
|
3771
|
+
constructor(request) {
|
|
3772
|
+
this.request = request;
|
|
3773
|
+
}
|
|
3774
|
+
/**
|
|
3775
|
+
* List the merchant's limit rules, optionally for one operation.
|
|
3776
|
+
*
|
|
3777
|
+
* `GET /operation-limits/rules`
|
|
3778
|
+
*/
|
|
3779
|
+
async listRules(params, options) {
|
|
3780
|
+
return this.request("GET", "/operation-limits/rules", {
|
|
3781
|
+
query: { operation: params?.operation },
|
|
3782
|
+
...options
|
|
3783
|
+
});
|
|
3784
|
+
}
|
|
3785
|
+
/**
|
|
3786
|
+
* Create or replace the limit rule for one target. Full-replace upsert:
|
|
3787
|
+
* absent limit fields clear that dimension.
|
|
3788
|
+
*
|
|
3789
|
+
* `PUT /operation-limits/rules`
|
|
3790
|
+
*/
|
|
3791
|
+
async upsertRule(params, options) {
|
|
3792
|
+
return this.request("PUT", "/operation-limits/rules", { body: params, ...options });
|
|
3793
|
+
}
|
|
3794
|
+
/**
|
|
3795
|
+
* Delete a limit rule.
|
|
3796
|
+
*
|
|
3797
|
+
* `DELETE /operation-limits/rules/{ruleId}`
|
|
3798
|
+
*/
|
|
3799
|
+
async deleteRule(ruleId, options) {
|
|
3800
|
+
return this.request("DELETE", `/operation-limits/rules/${encodeURIComponent(ruleId)}`, options);
|
|
3801
|
+
}
|
|
3802
|
+
/**
|
|
3803
|
+
* The merchant-level enforcement settings. An untouched merchant gets the
|
|
3804
|
+
* defaults: rolling window, admins not exempt.
|
|
3805
|
+
*
|
|
3806
|
+
* `GET /operation-limits/settings`
|
|
3807
|
+
*/
|
|
3808
|
+
async retrieveSettings(options) {
|
|
3809
|
+
return this.request("GET", "/operation-limits/settings", options);
|
|
3810
|
+
}
|
|
3811
|
+
/**
|
|
3812
|
+
* Update the enforcement settings. Only provided fields change.
|
|
3813
|
+
*
|
|
3814
|
+
* `PUT /operation-limits/settings`
|
|
3815
|
+
*/
|
|
3816
|
+
async updateSettings(params, options) {
|
|
3817
|
+
return this.request("PUT", "/operation-limits/settings", { body: params, ...options });
|
|
3818
|
+
}
|
|
3351
3819
|
};
|
|
3352
3820
|
|
|
3353
3821
|
// src/client.ts
|
|
@@ -3477,6 +3945,8 @@ var Delopay = class {
|
|
|
3477
3945
|
this.relay = new Relay(request);
|
|
3478
3946
|
this.stripeConnect = new StripeConnect(request);
|
|
3479
3947
|
this.threeDsRules = new ThreeDsRules(request);
|
|
3948
|
+
this.settlement = new Settlement(request);
|
|
3949
|
+
this.operationLimits = new OperationLimits(request);
|
|
3480
3950
|
this.subscriptions = new Subscriptions(request);
|
|
3481
3951
|
this.files = new Files(request);
|
|
3482
3952
|
this.export = new Export(request);
|
|
@@ -3600,7 +4070,8 @@ var Delopay = class {
|
|
|
3600
4070
|
method,
|
|
3601
4071
|
headers,
|
|
3602
4072
|
body: serializedBody,
|
|
3603
|
-
signal: combined.signal
|
|
4073
|
+
signal: combined.signal,
|
|
4074
|
+
...options?.keepalive !== void 0 ? { keepalive: options.keepalive } : {}
|
|
3604
4075
|
});
|
|
3605
4076
|
const requestId = response.headers?.get("x-request-id") ?? response.headers?.get("x-trace-id") ?? void 0;
|
|
3606
4077
|
emit("response", { status: response.status, method, path, requestId });
|
|
@@ -3647,6 +4118,12 @@ var Delopay = class {
|
|
|
3647
4118
|
}
|
|
3648
4119
|
throw error;
|
|
3649
4120
|
}
|
|
4121
|
+
if (options?.responseType === "blob") {
|
|
4122
|
+
return await response.blob();
|
|
4123
|
+
}
|
|
4124
|
+
if (options?.responseType === "arraybuffer") {
|
|
4125
|
+
return await response.arrayBuffer();
|
|
4126
|
+
}
|
|
3650
4127
|
const text = await response.text();
|
|
3651
4128
|
return text ? JSON.parse(text) : void 0;
|
|
3652
4129
|
} catch (err) {
|
|
@@ -4890,6 +5367,205 @@ function shadowFor(style) {
|
|
|
4890
5367
|
}
|
|
4891
5368
|
}
|
|
4892
5369
|
|
|
5370
|
+
// src/checkoutSession.ts
|
|
5371
|
+
function withoutCredentialHeaders(extra) {
|
|
5372
|
+
if (!extra) return {};
|
|
5373
|
+
const out = {};
|
|
5374
|
+
for (const [key, value] of Object.entries(extra)) {
|
|
5375
|
+
const lower = key.toLowerCase();
|
|
5376
|
+
if (lower === "api-key" || lower === "authorization") continue;
|
|
5377
|
+
out[key] = value;
|
|
5378
|
+
}
|
|
5379
|
+
return out;
|
|
5380
|
+
}
|
|
5381
|
+
var CheckoutSession = class {
|
|
5382
|
+
constructor(options) {
|
|
5383
|
+
this.merchantId = options.merchantId;
|
|
5384
|
+
this.paymentId = options.paymentId;
|
|
5385
|
+
this.publishableKey = options.publishableKey;
|
|
5386
|
+
this.clientSecret = options.clientSecret;
|
|
5387
|
+
this.client = new Delopay("", {
|
|
5388
|
+
baseUrl: options.baseUrl,
|
|
5389
|
+
sandbox: options.sandbox,
|
|
5390
|
+
timeout: options.timeout,
|
|
5391
|
+
maxRetries: options.maxRetries,
|
|
5392
|
+
debug: options.debug,
|
|
5393
|
+
logger: options.logger
|
|
5394
|
+
});
|
|
5395
|
+
}
|
|
5396
|
+
get linkBase() {
|
|
5397
|
+
return `/payment-link/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`;
|
|
5398
|
+
}
|
|
5399
|
+
/** Headers for the client-secret bearer routes (`/payment-link/*`). */
|
|
5400
|
+
bearerHeaders(extra) {
|
|
5401
|
+
return {
|
|
5402
|
+
...withoutCredentialHeaders(extra),
|
|
5403
|
+
Authorization: `Bearer ${this.requireClientSecret()}`
|
|
5404
|
+
};
|
|
5405
|
+
}
|
|
5406
|
+
/** Headers for the publishable-key routes (`/payments/*`, `/payment-methods`). */
|
|
5407
|
+
pkHeaders(extra) {
|
|
5408
|
+
if (!this.publishableKey) {
|
|
5409
|
+
throw new DelopayError("This call requires the publishable key", {
|
|
5410
|
+
status: 0,
|
|
5411
|
+
code: "MISSING_CREDENTIAL",
|
|
5412
|
+
type: "invalid_request"
|
|
5413
|
+
});
|
|
5414
|
+
}
|
|
5415
|
+
return { ...withoutCredentialHeaders(extra), "api-key": this.publishableKey };
|
|
5416
|
+
}
|
|
5417
|
+
requireClientSecret() {
|
|
5418
|
+
if (!this.clientSecret) {
|
|
5419
|
+
throw new DelopayError("This call requires the payment client secret", {
|
|
5420
|
+
status: 0,
|
|
5421
|
+
code: "MISSING_CREDENTIAL",
|
|
5422
|
+
type: "invalid_request"
|
|
5423
|
+
});
|
|
5424
|
+
}
|
|
5425
|
+
return this.clientSecret;
|
|
5426
|
+
}
|
|
5427
|
+
/**
|
|
5428
|
+
* The Paysepro rail catalog for the buyer's country.
|
|
5429
|
+
*
|
|
5430
|
+
* `GET /payment-link/{merchantId}/{paymentId}/paysepro/methods`
|
|
5431
|
+
*
|
|
5432
|
+
* @param country - Lowercase ISO 3166-1 alpha-2 country code.
|
|
5433
|
+
*/
|
|
5434
|
+
async payseproMethods(country, options) {
|
|
5435
|
+
return this.client.request("GET", `${this.linkBase}/paysepro/methods`, {
|
|
5436
|
+
query: { cc: country },
|
|
5437
|
+
...options,
|
|
5438
|
+
headers: this.bearerHeaders(options?.headers)
|
|
5439
|
+
});
|
|
5440
|
+
}
|
|
5441
|
+
/**
|
|
5442
|
+
* The e-Payouts rail catalog for the buyer's country, plus the set of
|
|
5443
|
+
* countries that have at least one vendor.
|
|
5444
|
+
*
|
|
5445
|
+
* `GET /payment-link/{merchantId}/{paymentId}/epayouts/methods`
|
|
5446
|
+
*
|
|
5447
|
+
* @param country - Lowercase ISO 3166-1 alpha-2 country code.
|
|
5448
|
+
*/
|
|
5449
|
+
async epayoutsMethods(country, options) {
|
|
5450
|
+
return this.client.request("GET", `${this.linkBase}/epayouts/methods`, {
|
|
5451
|
+
query: { cc: country },
|
|
5452
|
+
...options,
|
|
5453
|
+
headers: this.bearerHeaders(options?.headers)
|
|
5454
|
+
});
|
|
5455
|
+
}
|
|
5456
|
+
/**
|
|
5457
|
+
* Record a buyer-side checkout event on the payment's status timeline.
|
|
5458
|
+
*
|
|
5459
|
+
* Telemetry semantics, built in so callers can genuinely fire-and-forget:
|
|
5460
|
+
* the request is sent with `keepalive: true` (it survives the document
|
|
5461
|
+
* navigating away, e.g. right before a `window.open`), and transport or
|
|
5462
|
+
* server failures resolve to `undefined` instead of rejecting — telemetry
|
|
5463
|
+
* must never break a checkout or surface an unhandled rejection. Do not
|
|
5464
|
+
* `await` this in a click handler that must stay synchronous.
|
|
5465
|
+
*
|
|
5466
|
+
* A missing client secret still throws `MISSING_CREDENTIAL`: that is a
|
|
5467
|
+
* wiring bug, not a telemetry failure.
|
|
5468
|
+
*
|
|
5469
|
+
* `POST /payment-link/{merchantId}/{paymentId}/checkout-events`
|
|
5470
|
+
*/
|
|
5471
|
+
async recordEvent(params, options) {
|
|
5472
|
+
const headers = this.bearerHeaders(options?.headers);
|
|
5473
|
+
try {
|
|
5474
|
+
return await this.client.request("POST", `${this.linkBase}/checkout-events`, {
|
|
5475
|
+
body: params,
|
|
5476
|
+
keepalive: true,
|
|
5477
|
+
...options,
|
|
5478
|
+
headers
|
|
5479
|
+
});
|
|
5480
|
+
} catch {
|
|
5481
|
+
return void 0;
|
|
5482
|
+
}
|
|
5483
|
+
}
|
|
5484
|
+
/**
|
|
5485
|
+
* A short-lived VGS Collect session for browser-side card capture.
|
|
5486
|
+
*
|
|
5487
|
+
* A 404 — or a 400 carrying the "shop has no vault" code — means the shop
|
|
5488
|
+
* has no vault configured; other errors must NOT be treated that way (a
|
|
5489
|
+
* refused vault falling back to an unprotected card pane is exactly the
|
|
5490
|
+
* bug this endpoint's error contract exists to prevent).
|
|
5491
|
+
*
|
|
5492
|
+
* `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
|
|
5493
|
+
*/
|
|
5494
|
+
async vaultCollectSession(options) {
|
|
5495
|
+
return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
|
|
5496
|
+
...options,
|
|
5497
|
+
headers: this.bearerHeaders(options?.headers)
|
|
5498
|
+
});
|
|
5499
|
+
}
|
|
5500
|
+
/**
|
|
5501
|
+
* Register the aliased card as a payment method and mint the one-shot
|
|
5502
|
+
* `payment_token` the confirm call spends.
|
|
5503
|
+
*
|
|
5504
|
+
* `POST /payment-link/{merchantId}/{paymentId}/vault/payment-method`
|
|
5505
|
+
*/
|
|
5506
|
+
async registerVaultPaymentMethod(params, options) {
|
|
5507
|
+
return this.client.request("POST", `${this.linkBase}/vault/payment-method`, {
|
|
5508
|
+
body: params,
|
|
5509
|
+
...options,
|
|
5510
|
+
headers: this.bearerHeaders(options?.headers)
|
|
5511
|
+
});
|
|
5512
|
+
}
|
|
5513
|
+
/**
|
|
5514
|
+
* The payment's current state — status polling for redirect/popup rails.
|
|
5515
|
+
*
|
|
5516
|
+
* `GET /payments/{paymentId}` (publishable key + client secret)
|
|
5517
|
+
*/
|
|
5518
|
+
async retrievePayment(options) {
|
|
5519
|
+
return this.client.request("GET", `/payments/${encodeURIComponent(this.paymentId)}`, {
|
|
5520
|
+
query: { client_secret: this.requireClientSecret() },
|
|
5521
|
+
...options,
|
|
5522
|
+
headers: this.pkHeaders(options?.headers)
|
|
5523
|
+
});
|
|
5524
|
+
}
|
|
5525
|
+
/**
|
|
5526
|
+
* Update the payment before confirmation (e.g. persist custom-field
|
|
5527
|
+
* answers as `metadata` on rails that never hit `/confirm`). The client
|
|
5528
|
+
* secret is attached automatically.
|
|
5529
|
+
*
|
|
5530
|
+
* `POST /payments/{paymentId}` (publishable key)
|
|
5531
|
+
*/
|
|
5532
|
+
async updatePayment(params, options) {
|
|
5533
|
+
return this.client.request("POST", `/payments/${encodeURIComponent(this.paymentId)}`, {
|
|
5534
|
+
body: { ...params, client_secret: this.requireClientSecret() },
|
|
5535
|
+
...options,
|
|
5536
|
+
headers: this.pkHeaders(options?.headers)
|
|
5537
|
+
});
|
|
5538
|
+
}
|
|
5539
|
+
/**
|
|
5540
|
+
* Confirm the payment. The client secret is attached automatically; pass
|
|
5541
|
+
* an `Idempotency-Key` header via `options` to make retries safe.
|
|
5542
|
+
*
|
|
5543
|
+
* `POST /payments/{paymentId}/confirm` (publishable key)
|
|
5544
|
+
*/
|
|
5545
|
+
async confirmPayment(params, options) {
|
|
5546
|
+
return this.client.request("POST", `/payments/${encodeURIComponent(this.paymentId)}/confirm`, {
|
|
5547
|
+
body: { ...params, client_secret: this.requireClientSecret() },
|
|
5548
|
+
...options,
|
|
5549
|
+
headers: this.pkHeaders(options?.headers)
|
|
5550
|
+
});
|
|
5551
|
+
}
|
|
5552
|
+
/**
|
|
5553
|
+
* Payment methods available for this payment.
|
|
5554
|
+
*
|
|
5555
|
+
* `GET /payment-methods` (publishable key + client secret)
|
|
5556
|
+
*
|
|
5557
|
+
* @param params - Optional filters; `country` is the highest-precedence
|
|
5558
|
+
* geo hint, ahead of billing address and IP geolocation.
|
|
5559
|
+
*/
|
|
5560
|
+
async listPaymentMethods(params, options) {
|
|
5561
|
+
return this.client.request("GET", "/payment-methods", {
|
|
5562
|
+
query: { client_secret: this.requireClientSecret(), country: params?.country },
|
|
5563
|
+
...options,
|
|
5564
|
+
headers: this.pkHeaders(options?.headers)
|
|
5565
|
+
});
|
|
5566
|
+
}
|
|
5567
|
+
};
|
|
5568
|
+
|
|
4893
5569
|
// src/nativePanes.ts
|
|
4894
5570
|
var STRIPE_NATIVE_PANE_METHODS = [
|
|
4895
5571
|
{
|
|
@@ -5138,6 +5814,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
5138
5814
|
CUSTOM_FIELD_OPERATORS_BY_SOURCE,
|
|
5139
5815
|
CUSTOM_FIELD_VALUELESS_OPERATORS,
|
|
5140
5816
|
Cards,
|
|
5817
|
+
CheckoutSession,
|
|
5141
5818
|
DEFAULT_BADGES,
|
|
5142
5819
|
DEFAULT_BADGES_DARK,
|
|
5143
5820
|
DEFAULT_BRANDING,
|
|
@@ -5153,9 +5830,11 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
5153
5830
|
NATIVE_PANES_MAX,
|
|
5154
5831
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
5155
5832
|
NATIVE_PANE_ICON_KEYS,
|
|
5833
|
+
OperationLimits,
|
|
5156
5834
|
Regions,
|
|
5157
5835
|
STRIPE_NATIVE_PANE_METHODS,
|
|
5158
5836
|
Search,
|
|
5837
|
+
Settlement,
|
|
5159
5838
|
Subscriptions,
|
|
5160
5839
|
Webhooks,
|
|
5161
5840
|
allOf,
|