@delopay/sdk 0.82.0 → 0.85.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-HSUVEFKO.js} +578 -4
- package/dist/chunk-HSUVEFKO.js.map +1 -0
- package/dist/index.cjs +580 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1023 -9
- package/dist/index.d.ts +1023 -9
- package/dist/index.js +7 -1
- package/dist/internal.cjs +786 -3
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +314 -3
- package/dist/internal.d.ts +314 -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,
|
|
@@ -1539,6 +1542,39 @@ var Payments = class {
|
|
|
1539
1542
|
...options
|
|
1540
1543
|
});
|
|
1541
1544
|
}
|
|
1545
|
+
/**
|
|
1546
|
+
* The status timeline of client/device observations captured while the
|
|
1547
|
+
* buyer interacted with the payment (checkout opens, confirms, redirect
|
|
1548
|
+
* legs, reported client signals), oldest first.
|
|
1549
|
+
*
|
|
1550
|
+
* `GET /payments/{paymentId}/client-context`
|
|
1551
|
+
*/
|
|
1552
|
+
async listClientContext(paymentId, options) {
|
|
1553
|
+
return this.request(
|
|
1554
|
+
"GET",
|
|
1555
|
+
`/payments/${encodeURIComponent(paymentId)}/client-context`,
|
|
1556
|
+
options
|
|
1557
|
+
);
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Soft-delete a payment. Only payments whose status is in the merchant's
|
|
1561
|
+
* delete policy (see {@link Payments.getDeletePolicy}) can be deleted;
|
|
1562
|
+
* anything else fails with a precondition error.
|
|
1563
|
+
*
|
|
1564
|
+
* `DELETE /payments/{paymentId}`
|
|
1565
|
+
*/
|
|
1566
|
+
async delete(paymentId, options) {
|
|
1567
|
+
return this.request("DELETE", `/payments/${encodeURIComponent(paymentId)}`, options);
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* The effective deletable-status set for the calling merchant — lets a
|
|
1571
|
+
* dashboard show the delete action only where it is allowed.
|
|
1572
|
+
*
|
|
1573
|
+
* `GET /payments/delete-policy`
|
|
1574
|
+
*/
|
|
1575
|
+
async getDeletePolicy(options) {
|
|
1576
|
+
return this.request("GET", "/payments/delete-policy", options);
|
|
1577
|
+
}
|
|
1542
1578
|
// --- Advanced operations (Task 3.2) ---
|
|
1543
1579
|
/** Generate session tokens. `POST /payments/session-tokens` */
|
|
1544
1580
|
async sessionTokens(params) {
|
|
@@ -1609,10 +1645,30 @@ var Payments = class {
|
|
|
1609
1645
|
async listByFilter(params) {
|
|
1610
1646
|
return this.request("POST", "/payments/list", { body: params });
|
|
1611
1647
|
}
|
|
1648
|
+
/**
|
|
1649
|
+
* List payments by filter, scoped to the caller's profile (the shop-user
|
|
1650
|
+
* twin of `listByFilter`). The backend narrows to the profile from the
|
|
1651
|
+
* auth context, so `profile_id` / `project_id` must not be sent.
|
|
1652
|
+
*
|
|
1653
|
+
* Not to be confused with {@link Payments.listByProfile}, which is the GET
|
|
1654
|
+
* cursor variant and rejects this body.
|
|
1655
|
+
*
|
|
1656
|
+
* `POST /payments/profile/list`
|
|
1657
|
+
*/
|
|
1658
|
+
async listByProfileFilter(params, options) {
|
|
1659
|
+
return this.request("POST", "/payments/profile/list", { body: params, ...options });
|
|
1660
|
+
}
|
|
1612
1661
|
/** Get payment filter options. `GET /payments/filter` */
|
|
1613
1662
|
async getFilters(params) {
|
|
1614
1663
|
return this.request("GET", "/payments/filter", { query: params });
|
|
1615
1664
|
}
|
|
1665
|
+
/**
|
|
1666
|
+
* Get payment filter options, scoped to the caller's profile.
|
|
1667
|
+
* `GET /payments/profile/filter`
|
|
1668
|
+
*/
|
|
1669
|
+
async getFiltersByProfile(params) {
|
|
1670
|
+
return this.request("GET", "/payments/profile/filter", { query: params });
|
|
1671
|
+
}
|
|
1616
1672
|
/** Get payment aggregates. `GET /payments/aggregate` */
|
|
1617
1673
|
async aggregate(params) {
|
|
1618
1674
|
return this.request("GET", "/payments/aggregate", { query: params });
|
|
@@ -1813,6 +1869,16 @@ var Profiles = class {
|
|
|
1813
1869
|
async list(accountId) {
|
|
1814
1870
|
return this.request("GET", `/account/${encodeURIComponent(accountId)}/business-profile`);
|
|
1815
1871
|
}
|
|
1872
|
+
/**
|
|
1873
|
+
* List the business profiles the caller can see at profile scope — the
|
|
1874
|
+
* `ProfileAccountRead` twin of `list()` (which needs merchant-level read).
|
|
1875
|
+
* A shop-scoped user gets exactly their own shop back.
|
|
1876
|
+
*
|
|
1877
|
+
* `GET /account/{accountId}/profile`
|
|
1878
|
+
*/
|
|
1879
|
+
async listByProfile(accountId) {
|
|
1880
|
+
return this.request("GET", `/account/${encodeURIComponent(accountId)}/profile`);
|
|
1881
|
+
}
|
|
1816
1882
|
async update(accountId, profileId, params) {
|
|
1817
1883
|
return this.request(
|
|
1818
1884
|
"POST",
|
|
@@ -2456,7 +2522,7 @@ var Shops = class {
|
|
|
2456
2522
|
/**
|
|
2457
2523
|
* Upload a logo file for a shop. The file is stored in Delopay's configured
|
|
2458
2524
|
* object store and a public HTTPS URL is returned. This method does NOT write
|
|
2459
|
-
* the URL into the shop's `payment_link_config.
|
|
2525
|
+
* the URL into the shop's `payment_link_config.logo` — call
|
|
2460
2526
|
* `shops.update` afterwards with the returned `logo_url` to persist the change.
|
|
2461
2527
|
*
|
|
2462
2528
|
* Accepts PNG, JPEG, WebP or SVG. The file must be ≤ 1 MiB.
|
|
@@ -2470,7 +2536,7 @@ var Shops = class {
|
|
|
2470
2536
|
* ```typescript
|
|
2471
2537
|
* const { logo_url } = await delopay.shops.uploadLogo('merch_1', 'pro_1', file);
|
|
2472
2538
|
* await delopay.shops.update('merch_1', 'pro_1', {
|
|
2473
|
-
* payment_link_config: {
|
|
2539
|
+
* payment_link_config: { logo: logo_url },
|
|
2474
2540
|
* });
|
|
2475
2541
|
* ```
|
|
2476
2542
|
*/
|
|
@@ -2483,6 +2549,29 @@ var Shops = class {
|
|
|
2483
2549
|
{ body: form }
|
|
2484
2550
|
);
|
|
2485
2551
|
}
|
|
2552
|
+
/**
|
|
2553
|
+
* Update only the checkout appearance (the `payment_link_config` blob:
|
|
2554
|
+
* theme, logo, colours, seller name, SDK layout/rules, DeloPay-branding
|
|
2555
|
+
* toggle) of a shop. Applied as a whole-object replace of
|
|
2556
|
+
* `payment_link_config`, mirroring the shop-update semantics.
|
|
2557
|
+
*
|
|
2558
|
+
* Gated on the dedicated `CheckoutBranding` permission, so "may restyle
|
|
2559
|
+
* the checkout" can be granted without full account/shop write.
|
|
2560
|
+
*
|
|
2561
|
+
* `POST /shops/{merchantId}/{shopId}/checkout-branding`
|
|
2562
|
+
*
|
|
2563
|
+
* @param merchantId - The merchant account ID.
|
|
2564
|
+
* @param shopId - The shop (business profile) ID to restyle.
|
|
2565
|
+
* @param params - The new `payment_link_config` blob (full replacement).
|
|
2566
|
+
* @returns The updated business profile.
|
|
2567
|
+
*/
|
|
2568
|
+
async updateCheckoutBranding(merchantId, shopId, params, options) {
|
|
2569
|
+
return this.request(
|
|
2570
|
+
"POST",
|
|
2571
|
+
`/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/checkout-branding`,
|
|
2572
|
+
{ body: params, ...options }
|
|
2573
|
+
);
|
|
2574
|
+
}
|
|
2486
2575
|
};
|
|
2487
2576
|
|
|
2488
2577
|
// src/resources/stripeConnect.ts
|
|
@@ -3348,6 +3437,283 @@ var Subscriptions = class {
|
|
|
3348
3437
|
...options
|
|
3349
3438
|
});
|
|
3350
3439
|
}
|
|
3440
|
+
/**
|
|
3441
|
+
* Resolve which of the given payments were raised by a subscription.
|
|
3442
|
+
* `POST /subscriptions/payments/lookup`
|
|
3443
|
+
*
|
|
3444
|
+
* The linkage exists in one direction only — an invoice points at the payment
|
|
3445
|
+
* it settled, and nothing is stamped on the payment — so this is the only way
|
|
3446
|
+
* to tell a subscription charge from a one-off one when you are holding a
|
|
3447
|
+
* page of payments. In particular, do not use `off_session` or the presence
|
|
3448
|
+
* of a mandate: an ordinary saved-card charge sets those identically.
|
|
3449
|
+
*
|
|
3450
|
+
* Ids that belong to no subscription are **absent** from `links` rather than
|
|
3451
|
+
* returned as an error, so match on presence:
|
|
3452
|
+
*
|
|
3453
|
+
* ```ts
|
|
3454
|
+
* const { links } = await subscriptions.lookupPayments(
|
|
3455
|
+
* { payment_ids: page.map((p) => p.payment_id) },
|
|
3456
|
+
* { headers: { 'X-Profile-Id': profileId } },
|
|
3457
|
+
* );
|
|
3458
|
+
* const bySubscription = new Map(links.map((l) => [l.payment_id, l]));
|
|
3459
|
+
* ```
|
|
3460
|
+
*
|
|
3461
|
+
* Profile-scoped like every other subscription route, and that matters more
|
|
3462
|
+
* here than elsewhere: a `payment_id` is merchant-supplied and only unique
|
|
3463
|
+
* within a merchant, so the shop is part of the question, not an
|
|
3464
|
+
* optimisation. Pass the profile that owns **the payments** — for a list
|
|
3465
|
+
* spanning several shops, group the ids by shop and call once per group.
|
|
3466
|
+
*
|
|
3467
|
+
* At most 200 ids per call.
|
|
3468
|
+
*/
|
|
3469
|
+
async lookupPayments(params, options) {
|
|
3470
|
+
return this.request("POST", "/subscriptions/payments/lookup", { body: params, ...options });
|
|
3471
|
+
}
|
|
3472
|
+
};
|
|
3473
|
+
|
|
3474
|
+
// src/resources/settlement.ts
|
|
3475
|
+
var Settlement = class {
|
|
3476
|
+
constructor(request) {
|
|
3477
|
+
this.request = request;
|
|
3478
|
+
}
|
|
3479
|
+
/**
|
|
3480
|
+
* Per-shop settlement rollup for the host merchant: unpaid totals and the
|
|
3481
|
+
* running current period, one row per shop.
|
|
3482
|
+
*
|
|
3483
|
+
* `GET /settlement/overview`
|
|
3484
|
+
*/
|
|
3485
|
+
async overview(params, options) {
|
|
3486
|
+
return this.request("GET", "/settlement/overview", {
|
|
3487
|
+
query: { test_mode: params.test_mode },
|
|
3488
|
+
...options
|
|
3489
|
+
});
|
|
3490
|
+
}
|
|
3491
|
+
/**
|
|
3492
|
+
* Live rollup of the current (not yet statemented) period.
|
|
3493
|
+
*
|
|
3494
|
+
* `GET /settlement/current`
|
|
3495
|
+
*/
|
|
3496
|
+
async current(params, options) {
|
|
3497
|
+
return this.request("GET", "/settlement/current", {
|
|
3498
|
+
query: { test_mode: params.test_mode, profile_id: params.profile_id },
|
|
3499
|
+
...options
|
|
3500
|
+
});
|
|
3501
|
+
}
|
|
3502
|
+
/**
|
|
3503
|
+
* List generated settlement statements, newest first.
|
|
3504
|
+
*
|
|
3505
|
+
* `GET /settlement/statements`
|
|
3506
|
+
*/
|
|
3507
|
+
async listStatements(params, options) {
|
|
3508
|
+
return this.request("GET", "/settlement/statements", {
|
|
3509
|
+
query: {
|
|
3510
|
+
test_mode: params.test_mode,
|
|
3511
|
+
profile_id: params.profile_id,
|
|
3512
|
+
limit: params.limit,
|
|
3513
|
+
offset: params.offset
|
|
3514
|
+
},
|
|
3515
|
+
...options
|
|
3516
|
+
});
|
|
3517
|
+
}
|
|
3518
|
+
/**
|
|
3519
|
+
* One statement with its per-connector/currency breakdown.
|
|
3520
|
+
*
|
|
3521
|
+
* `GET /settlement/statements/{statementId}`
|
|
3522
|
+
*/
|
|
3523
|
+
async retrieveStatement(statementId, options) {
|
|
3524
|
+
return this.request(
|
|
3525
|
+
"GET",
|
|
3526
|
+
`/settlement/statements/${encodeURIComponent(statementId)}`,
|
|
3527
|
+
options
|
|
3528
|
+
);
|
|
3529
|
+
}
|
|
3530
|
+
/**
|
|
3531
|
+
* Generate (or regenerate) the statement for one shop and calendar month.
|
|
3532
|
+
*
|
|
3533
|
+
* `POST /settlement/statements/generate`
|
|
3534
|
+
*/
|
|
3535
|
+
async generateStatement(params, options) {
|
|
3536
|
+
return this.request("POST", "/settlement/statements/generate", {
|
|
3537
|
+
body: params,
|
|
3538
|
+
...options
|
|
3539
|
+
});
|
|
3540
|
+
}
|
|
3541
|
+
/**
|
|
3542
|
+
* Record payout progress on a statement (`unpaid` / `partial` / `paid`).
|
|
3543
|
+
*
|
|
3544
|
+
* `POST /settlement/statements/{statementId}/payout`
|
|
3545
|
+
*/
|
|
3546
|
+
async updateStatementPayout(statementId, params, options) {
|
|
3547
|
+
return this.request(
|
|
3548
|
+
"POST",
|
|
3549
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/payout`,
|
|
3550
|
+
{ body: params, ...options }
|
|
3551
|
+
);
|
|
3552
|
+
}
|
|
3553
|
+
/**
|
|
3554
|
+
* Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
|
|
3555
|
+
* the same auth, retries and error handling as every other call — persist
|
|
3556
|
+
* or object-URL it caller-side.
|
|
3557
|
+
*
|
|
3558
|
+
* `GET /settlement/statements/{statementId}/pdf`
|
|
3559
|
+
*
|
|
3560
|
+
* @example
|
|
3561
|
+
* ```typescript
|
|
3562
|
+
* const pdf = await delopay.settlement.downloadStatementPdf('stmt_1', {
|
|
3563
|
+
* currency: 'EUR',
|
|
3564
|
+
* include_transactions: true,
|
|
3565
|
+
* });
|
|
3566
|
+
* const url = URL.createObjectURL(pdf);
|
|
3567
|
+
* ```
|
|
3568
|
+
*/
|
|
3569
|
+
async downloadStatementPdf(statementId, params, options) {
|
|
3570
|
+
return this.request("GET", `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {
|
|
3571
|
+
query: {
|
|
3572
|
+
currency: params?.currency,
|
|
3573
|
+
include_transactions: params?.include_transactions
|
|
3574
|
+
},
|
|
3575
|
+
responseType: "blob",
|
|
3576
|
+
...options
|
|
3577
|
+
});
|
|
3578
|
+
}
|
|
3579
|
+
/**
|
|
3580
|
+
* The individual settled attempts of one shop's calendar month.
|
|
3581
|
+
*
|
|
3582
|
+
* `GET /settlement/lines`
|
|
3583
|
+
*/
|
|
3584
|
+
async listLines(params, options) {
|
|
3585
|
+
return this.request("GET", "/settlement/lines", {
|
|
3586
|
+
query: {
|
|
3587
|
+
profile_id: params.profile_id,
|
|
3588
|
+
year: params.year,
|
|
3589
|
+
month: params.month,
|
|
3590
|
+
test_mode: params.test_mode,
|
|
3591
|
+
limit: params.limit,
|
|
3592
|
+
offset: params.offset
|
|
3593
|
+
},
|
|
3594
|
+
...options
|
|
3595
|
+
});
|
|
3596
|
+
}
|
|
3597
|
+
/**
|
|
3598
|
+
* The fee schedules that currently apply to a shop.
|
|
3599
|
+
*
|
|
3600
|
+
* `GET /settlement/fee-config`
|
|
3601
|
+
*/
|
|
3602
|
+
async feeConfig(params, options) {
|
|
3603
|
+
return this.request("GET", "/settlement/fee-config", {
|
|
3604
|
+
query: { profile_id: params.profile_id },
|
|
3605
|
+
...options
|
|
3606
|
+
});
|
|
3607
|
+
}
|
|
3608
|
+
/**
|
|
3609
|
+
* Enqueue a settlement-line backfill over historical attempts. Attempts
|
|
3610
|
+
* already covered by a line are always skipped.
|
|
3611
|
+
*
|
|
3612
|
+
* `POST /settlement/backfill`
|
|
3613
|
+
*/
|
|
3614
|
+
async backfill(params, options) {
|
|
3615
|
+
return this.request("POST", "/settlement/backfill", { body: params, ...options });
|
|
3616
|
+
}
|
|
3617
|
+
/**
|
|
3618
|
+
* Toggle whether a shop's owner can see their own settlement figures.
|
|
3619
|
+
*
|
|
3620
|
+
* `POST /settlement/shops/visibility`
|
|
3621
|
+
*/
|
|
3622
|
+
async setShopVisibility(params, options) {
|
|
3623
|
+
return this.request("POST", "/settlement/shops/visibility", {
|
|
3624
|
+
body: params,
|
|
3625
|
+
...options
|
|
3626
|
+
});
|
|
3627
|
+
}
|
|
3628
|
+
/**
|
|
3629
|
+
* Manual adjustments recorded on a statement.
|
|
3630
|
+
*
|
|
3631
|
+
* `GET /settlement/statements/{statementId}/adjustments`
|
|
3632
|
+
*/
|
|
3633
|
+
async listStatementAdjustments(statementId, options) {
|
|
3634
|
+
return this.request(
|
|
3635
|
+
"GET",
|
|
3636
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,
|
|
3637
|
+
options
|
|
3638
|
+
);
|
|
3639
|
+
}
|
|
3640
|
+
/**
|
|
3641
|
+
* Add a manual adjustment to a statement. Positive `amount_usd` charges
|
|
3642
|
+
* the shop (reducing their payout); negative credits them.
|
|
3643
|
+
*
|
|
3644
|
+
* `POST /settlement/statements/{statementId}/adjustments`
|
|
3645
|
+
*/
|
|
3646
|
+
async createStatementAdjustment(statementId, params, options) {
|
|
3647
|
+
return this.request(
|
|
3648
|
+
"POST",
|
|
3649
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,
|
|
3650
|
+
{ body: params, ...options }
|
|
3651
|
+
);
|
|
3652
|
+
}
|
|
3653
|
+
/**
|
|
3654
|
+
* Remove a manual adjustment from a statement.
|
|
3655
|
+
*
|
|
3656
|
+
* `DELETE /settlement/statements/{statementId}/adjustments/{adjustmentId}`
|
|
3657
|
+
*/
|
|
3658
|
+
async deleteStatementAdjustment(statementId, adjustmentId, options) {
|
|
3659
|
+
return this.request(
|
|
3660
|
+
"DELETE",
|
|
3661
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/adjustments/${encodeURIComponent(adjustmentId)}`,
|
|
3662
|
+
options
|
|
3663
|
+
);
|
|
3664
|
+
}
|
|
3665
|
+
};
|
|
3666
|
+
|
|
3667
|
+
// src/resources/operationLimits.ts
|
|
3668
|
+
var OperationLimits = class {
|
|
3669
|
+
constructor(request) {
|
|
3670
|
+
this.request = request;
|
|
3671
|
+
}
|
|
3672
|
+
/**
|
|
3673
|
+
* List the merchant's limit rules, optionally for one operation.
|
|
3674
|
+
*
|
|
3675
|
+
* `GET /operation-limits/rules`
|
|
3676
|
+
*/
|
|
3677
|
+
async listRules(params, options) {
|
|
3678
|
+
return this.request("GET", "/operation-limits/rules", {
|
|
3679
|
+
query: { operation: params?.operation },
|
|
3680
|
+
...options
|
|
3681
|
+
});
|
|
3682
|
+
}
|
|
3683
|
+
/**
|
|
3684
|
+
* Create or replace the limit rule for one target. Full-replace upsert:
|
|
3685
|
+
* absent limit fields clear that dimension.
|
|
3686
|
+
*
|
|
3687
|
+
* `PUT /operation-limits/rules`
|
|
3688
|
+
*/
|
|
3689
|
+
async upsertRule(params, options) {
|
|
3690
|
+
return this.request("PUT", "/operation-limits/rules", { body: params, ...options });
|
|
3691
|
+
}
|
|
3692
|
+
/**
|
|
3693
|
+
* Delete a limit rule.
|
|
3694
|
+
*
|
|
3695
|
+
* `DELETE /operation-limits/rules/{ruleId}`
|
|
3696
|
+
*/
|
|
3697
|
+
async deleteRule(ruleId, options) {
|
|
3698
|
+
return this.request("DELETE", `/operation-limits/rules/${encodeURIComponent(ruleId)}`, options);
|
|
3699
|
+
}
|
|
3700
|
+
/**
|
|
3701
|
+
* The merchant-level enforcement settings. An untouched merchant gets the
|
|
3702
|
+
* defaults: rolling window, admins not exempt.
|
|
3703
|
+
*
|
|
3704
|
+
* `GET /operation-limits/settings`
|
|
3705
|
+
*/
|
|
3706
|
+
async retrieveSettings(options) {
|
|
3707
|
+
return this.request("GET", "/operation-limits/settings", options);
|
|
3708
|
+
}
|
|
3709
|
+
/**
|
|
3710
|
+
* Update the enforcement settings. Only provided fields change.
|
|
3711
|
+
*
|
|
3712
|
+
* `PUT /operation-limits/settings`
|
|
3713
|
+
*/
|
|
3714
|
+
async updateSettings(params, options) {
|
|
3715
|
+
return this.request("PUT", "/operation-limits/settings", { body: params, ...options });
|
|
3716
|
+
}
|
|
3351
3717
|
};
|
|
3352
3718
|
|
|
3353
3719
|
// src/client.ts
|
|
@@ -3477,6 +3843,8 @@ var Delopay = class {
|
|
|
3477
3843
|
this.relay = new Relay(request);
|
|
3478
3844
|
this.stripeConnect = new StripeConnect(request);
|
|
3479
3845
|
this.threeDsRules = new ThreeDsRules(request);
|
|
3846
|
+
this.settlement = new Settlement(request);
|
|
3847
|
+
this.operationLimits = new OperationLimits(request);
|
|
3480
3848
|
this.subscriptions = new Subscriptions(request);
|
|
3481
3849
|
this.files = new Files(request);
|
|
3482
3850
|
this.export = new Export(request);
|
|
@@ -3600,7 +3968,8 @@ var Delopay = class {
|
|
|
3600
3968
|
method,
|
|
3601
3969
|
headers,
|
|
3602
3970
|
body: serializedBody,
|
|
3603
|
-
signal: combined.signal
|
|
3971
|
+
signal: combined.signal,
|
|
3972
|
+
...options?.keepalive !== void 0 ? { keepalive: options.keepalive } : {}
|
|
3604
3973
|
});
|
|
3605
3974
|
const requestId = response.headers?.get("x-request-id") ?? response.headers?.get("x-trace-id") ?? void 0;
|
|
3606
3975
|
emit("response", { status: response.status, method, path, requestId });
|
|
@@ -3647,6 +4016,12 @@ var Delopay = class {
|
|
|
3647
4016
|
}
|
|
3648
4017
|
throw error;
|
|
3649
4018
|
}
|
|
4019
|
+
if (options?.responseType === "blob") {
|
|
4020
|
+
return await response.blob();
|
|
4021
|
+
}
|
|
4022
|
+
if (options?.responseType === "arraybuffer") {
|
|
4023
|
+
return await response.arrayBuffer();
|
|
4024
|
+
}
|
|
3650
4025
|
const text = await response.text();
|
|
3651
4026
|
return text ? JSON.parse(text) : void 0;
|
|
3652
4027
|
} catch (err) {
|
|
@@ -4890,6 +5265,205 @@ function shadowFor(style) {
|
|
|
4890
5265
|
}
|
|
4891
5266
|
}
|
|
4892
5267
|
|
|
5268
|
+
// src/checkoutSession.ts
|
|
5269
|
+
function withoutCredentialHeaders(extra) {
|
|
5270
|
+
if (!extra) return {};
|
|
5271
|
+
const out = {};
|
|
5272
|
+
for (const [key, value] of Object.entries(extra)) {
|
|
5273
|
+
const lower = key.toLowerCase();
|
|
5274
|
+
if (lower === "api-key" || lower === "authorization") continue;
|
|
5275
|
+
out[key] = value;
|
|
5276
|
+
}
|
|
5277
|
+
return out;
|
|
5278
|
+
}
|
|
5279
|
+
var CheckoutSession = class {
|
|
5280
|
+
constructor(options) {
|
|
5281
|
+
this.merchantId = options.merchantId;
|
|
5282
|
+
this.paymentId = options.paymentId;
|
|
5283
|
+
this.publishableKey = options.publishableKey;
|
|
5284
|
+
this.clientSecret = options.clientSecret;
|
|
5285
|
+
this.client = new Delopay("", {
|
|
5286
|
+
baseUrl: options.baseUrl,
|
|
5287
|
+
sandbox: options.sandbox,
|
|
5288
|
+
timeout: options.timeout,
|
|
5289
|
+
maxRetries: options.maxRetries,
|
|
5290
|
+
debug: options.debug,
|
|
5291
|
+
logger: options.logger
|
|
5292
|
+
});
|
|
5293
|
+
}
|
|
5294
|
+
get linkBase() {
|
|
5295
|
+
return `/payment-link/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`;
|
|
5296
|
+
}
|
|
5297
|
+
/** Headers for the client-secret bearer routes (`/payment-link/*`). */
|
|
5298
|
+
bearerHeaders(extra) {
|
|
5299
|
+
return {
|
|
5300
|
+
...withoutCredentialHeaders(extra),
|
|
5301
|
+
Authorization: `Bearer ${this.requireClientSecret()}`
|
|
5302
|
+
};
|
|
5303
|
+
}
|
|
5304
|
+
/** Headers for the publishable-key routes (`/payments/*`, `/payment-methods`). */
|
|
5305
|
+
pkHeaders(extra) {
|
|
5306
|
+
if (!this.publishableKey) {
|
|
5307
|
+
throw new DelopayError("This call requires the publishable key", {
|
|
5308
|
+
status: 0,
|
|
5309
|
+
code: "MISSING_CREDENTIAL",
|
|
5310
|
+
type: "invalid_request"
|
|
5311
|
+
});
|
|
5312
|
+
}
|
|
5313
|
+
return { ...withoutCredentialHeaders(extra), "api-key": this.publishableKey };
|
|
5314
|
+
}
|
|
5315
|
+
requireClientSecret() {
|
|
5316
|
+
if (!this.clientSecret) {
|
|
5317
|
+
throw new DelopayError("This call requires the payment client secret", {
|
|
5318
|
+
status: 0,
|
|
5319
|
+
code: "MISSING_CREDENTIAL",
|
|
5320
|
+
type: "invalid_request"
|
|
5321
|
+
});
|
|
5322
|
+
}
|
|
5323
|
+
return this.clientSecret;
|
|
5324
|
+
}
|
|
5325
|
+
/**
|
|
5326
|
+
* The Paysepro rail catalog for the buyer's country.
|
|
5327
|
+
*
|
|
5328
|
+
* `GET /payment-link/{merchantId}/{paymentId}/paysepro/methods`
|
|
5329
|
+
*
|
|
5330
|
+
* @param country - Lowercase ISO 3166-1 alpha-2 country code.
|
|
5331
|
+
*/
|
|
5332
|
+
async payseproMethods(country, options) {
|
|
5333
|
+
return this.client.request("GET", `${this.linkBase}/paysepro/methods`, {
|
|
5334
|
+
query: { cc: country },
|
|
5335
|
+
...options,
|
|
5336
|
+
headers: this.bearerHeaders(options?.headers)
|
|
5337
|
+
});
|
|
5338
|
+
}
|
|
5339
|
+
/**
|
|
5340
|
+
* The e-Payouts rail catalog for the buyer's country, plus the set of
|
|
5341
|
+
* countries that have at least one vendor.
|
|
5342
|
+
*
|
|
5343
|
+
* `GET /payment-link/{merchantId}/{paymentId}/epayouts/methods`
|
|
5344
|
+
*
|
|
5345
|
+
* @param country - Lowercase ISO 3166-1 alpha-2 country code.
|
|
5346
|
+
*/
|
|
5347
|
+
async epayoutsMethods(country, options) {
|
|
5348
|
+
return this.client.request("GET", `${this.linkBase}/epayouts/methods`, {
|
|
5349
|
+
query: { cc: country },
|
|
5350
|
+
...options,
|
|
5351
|
+
headers: this.bearerHeaders(options?.headers)
|
|
5352
|
+
});
|
|
5353
|
+
}
|
|
5354
|
+
/**
|
|
5355
|
+
* Record a buyer-side checkout event on the payment's status timeline.
|
|
5356
|
+
*
|
|
5357
|
+
* Telemetry semantics, built in so callers can genuinely fire-and-forget:
|
|
5358
|
+
* the request is sent with `keepalive: true` (it survives the document
|
|
5359
|
+
* navigating away, e.g. right before a `window.open`), and transport or
|
|
5360
|
+
* server failures resolve to `undefined` instead of rejecting — telemetry
|
|
5361
|
+
* must never break a checkout or surface an unhandled rejection. Do not
|
|
5362
|
+
* `await` this in a click handler that must stay synchronous.
|
|
5363
|
+
*
|
|
5364
|
+
* A missing client secret still throws `MISSING_CREDENTIAL`: that is a
|
|
5365
|
+
* wiring bug, not a telemetry failure.
|
|
5366
|
+
*
|
|
5367
|
+
* `POST /payment-link/{merchantId}/{paymentId}/checkout-events`
|
|
5368
|
+
*/
|
|
5369
|
+
async recordEvent(params, options) {
|
|
5370
|
+
const headers = this.bearerHeaders(options?.headers);
|
|
5371
|
+
try {
|
|
5372
|
+
return await this.client.request("POST", `${this.linkBase}/checkout-events`, {
|
|
5373
|
+
body: params,
|
|
5374
|
+
keepalive: true,
|
|
5375
|
+
...options,
|
|
5376
|
+
headers
|
|
5377
|
+
});
|
|
5378
|
+
} catch {
|
|
5379
|
+
return void 0;
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
/**
|
|
5383
|
+
* A short-lived VGS Collect session for browser-side card capture.
|
|
5384
|
+
*
|
|
5385
|
+
* A 404 — or a 400 carrying the "shop has no vault" code — means the shop
|
|
5386
|
+
* has no vault configured; other errors must NOT be treated that way (a
|
|
5387
|
+
* refused vault falling back to an unprotected card pane is exactly the
|
|
5388
|
+
* bug this endpoint's error contract exists to prevent).
|
|
5389
|
+
*
|
|
5390
|
+
* `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
|
|
5391
|
+
*/
|
|
5392
|
+
async vaultCollectSession(options) {
|
|
5393
|
+
return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
|
|
5394
|
+
...options,
|
|
5395
|
+
headers: this.bearerHeaders(options?.headers)
|
|
5396
|
+
});
|
|
5397
|
+
}
|
|
5398
|
+
/**
|
|
5399
|
+
* Register the aliased card as a payment method and mint the one-shot
|
|
5400
|
+
* `payment_token` the confirm call spends.
|
|
5401
|
+
*
|
|
5402
|
+
* `POST /payment-link/{merchantId}/{paymentId}/vault/payment-method`
|
|
5403
|
+
*/
|
|
5404
|
+
async registerVaultPaymentMethod(params, options) {
|
|
5405
|
+
return this.client.request("POST", `${this.linkBase}/vault/payment-method`, {
|
|
5406
|
+
body: params,
|
|
5407
|
+
...options,
|
|
5408
|
+
headers: this.bearerHeaders(options?.headers)
|
|
5409
|
+
});
|
|
5410
|
+
}
|
|
5411
|
+
/**
|
|
5412
|
+
* The payment's current state — status polling for redirect/popup rails.
|
|
5413
|
+
*
|
|
5414
|
+
* `GET /payments/{paymentId}` (publishable key + client secret)
|
|
5415
|
+
*/
|
|
5416
|
+
async retrievePayment(options) {
|
|
5417
|
+
return this.client.request("GET", `/payments/${encodeURIComponent(this.paymentId)}`, {
|
|
5418
|
+
query: { client_secret: this.requireClientSecret() },
|
|
5419
|
+
...options,
|
|
5420
|
+
headers: this.pkHeaders(options?.headers)
|
|
5421
|
+
});
|
|
5422
|
+
}
|
|
5423
|
+
/**
|
|
5424
|
+
* Update the payment before confirmation (e.g. persist custom-field
|
|
5425
|
+
* answers as `metadata` on rails that never hit `/confirm`). The client
|
|
5426
|
+
* secret is attached automatically.
|
|
5427
|
+
*
|
|
5428
|
+
* `POST /payments/{paymentId}` (publishable key)
|
|
5429
|
+
*/
|
|
5430
|
+
async updatePayment(params, options) {
|
|
5431
|
+
return this.client.request("POST", `/payments/${encodeURIComponent(this.paymentId)}`, {
|
|
5432
|
+
body: { ...params, client_secret: this.requireClientSecret() },
|
|
5433
|
+
...options,
|
|
5434
|
+
headers: this.pkHeaders(options?.headers)
|
|
5435
|
+
});
|
|
5436
|
+
}
|
|
5437
|
+
/**
|
|
5438
|
+
* Confirm the payment. The client secret is attached automatically; pass
|
|
5439
|
+
* an `Idempotency-Key` header via `options` to make retries safe.
|
|
5440
|
+
*
|
|
5441
|
+
* `POST /payments/{paymentId}/confirm` (publishable key)
|
|
5442
|
+
*/
|
|
5443
|
+
async confirmPayment(params, options) {
|
|
5444
|
+
return this.client.request("POST", `/payments/${encodeURIComponent(this.paymentId)}/confirm`, {
|
|
5445
|
+
body: { ...params, client_secret: this.requireClientSecret() },
|
|
5446
|
+
...options,
|
|
5447
|
+
headers: this.pkHeaders(options?.headers)
|
|
5448
|
+
});
|
|
5449
|
+
}
|
|
5450
|
+
/**
|
|
5451
|
+
* Payment methods available for this payment.
|
|
5452
|
+
*
|
|
5453
|
+
* `GET /payment-methods` (publishable key + client secret)
|
|
5454
|
+
*
|
|
5455
|
+
* @param params - Optional filters; `country` is the highest-precedence
|
|
5456
|
+
* geo hint, ahead of billing address and IP geolocation.
|
|
5457
|
+
*/
|
|
5458
|
+
async listPaymentMethods(params, options) {
|
|
5459
|
+
return this.client.request("GET", "/payment-methods", {
|
|
5460
|
+
query: { client_secret: this.requireClientSecret(), country: params?.country },
|
|
5461
|
+
...options,
|
|
5462
|
+
headers: this.pkHeaders(options?.headers)
|
|
5463
|
+
});
|
|
5464
|
+
}
|
|
5465
|
+
};
|
|
5466
|
+
|
|
4893
5467
|
// src/nativePanes.ts
|
|
4894
5468
|
var STRIPE_NATIVE_PANE_METHODS = [
|
|
4895
5469
|
{
|
|
@@ -5138,6 +5712,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
5138
5712
|
CUSTOM_FIELD_OPERATORS_BY_SOURCE,
|
|
5139
5713
|
CUSTOM_FIELD_VALUELESS_OPERATORS,
|
|
5140
5714
|
Cards,
|
|
5715
|
+
CheckoutSession,
|
|
5141
5716
|
DEFAULT_BADGES,
|
|
5142
5717
|
DEFAULT_BADGES_DARK,
|
|
5143
5718
|
DEFAULT_BRANDING,
|
|
@@ -5153,9 +5728,11 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
5153
5728
|
NATIVE_PANES_MAX,
|
|
5154
5729
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
5155
5730
|
NATIVE_PANE_ICON_KEYS,
|
|
5731
|
+
OperationLimits,
|
|
5156
5732
|
Regions,
|
|
5157
5733
|
STRIPE_NATIVE_PANE_METHODS,
|
|
5158
5734
|
Search,
|
|
5735
|
+
Settlement,
|
|
5159
5736
|
Subscriptions,
|
|
5160
5737
|
Webhooks,
|
|
5161
5738
|
allOf,
|