@delopay/sdk 0.112.0 → 0.115.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-3O5MU6FP.js → chunk-VH5NCMH6.js} +18 -2
- package/dist/chunk-VH5NCMH6.js.map +1 -0
- package/dist/index.cjs +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -5
- package/dist/index.d.ts +33 -5
- package/dist/index.js +1 -1
- package/dist/internal.cjs +83 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +159 -2
- package/dist/internal.d.ts +159 -2
- package/dist/internal.js +67 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3O5MU6FP.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1603,6 +1603,18 @@ interface BillingProfileResponse {
|
|
|
1603
1603
|
suspension_source?: string | null;
|
|
1604
1604
|
/** Admin-provided reason for a manual suspension. Absent otherwise. */
|
|
1605
1605
|
suspension_reason?: string | null;
|
|
1606
|
+
/**
|
|
1607
|
+
* Free (not billed) merchant. While set, no platform fee is deducted on
|
|
1608
|
+
* any payment, the payment gate never blocks on `billing_status`, top-ups
|
|
1609
|
+
* are refused and auto-recharge is inert. Orthogonal to `is_trusted`, which
|
|
1610
|
+
* only shields against suspension. Absent on a router that predates the
|
|
1611
|
+
* flag (delopay-backend#378); read absent as `false`.
|
|
1612
|
+
*/
|
|
1613
|
+
is_free?: boolean;
|
|
1614
|
+
/** Admin-provided reason the merchant is free. Absent when not free. */
|
|
1615
|
+
free_reason?: string | null;
|
|
1616
|
+
/** When the free flag was set (ISO 8601). Absent when not free. */
|
|
1617
|
+
free_set_at?: string | null;
|
|
1606
1618
|
created_at: string;
|
|
1607
1619
|
modified_at: string;
|
|
1608
1620
|
/**
|
|
@@ -6485,13 +6497,15 @@ interface CheckoutBrandingUpdate {
|
|
|
6485
6497
|
payment_link_config?: BusinessPaymentLinkConfig | null;
|
|
6486
6498
|
}
|
|
6487
6499
|
/**
|
|
6488
|
-
* Response of
|
|
6500
|
+
* Response of both checkout-branding routes: the `GET` on
|
|
6501
|
+
* `/shops/{merchant_id}/{shop_id}/checkout-branding`, and the `POST` echoing
|
|
6502
|
+
* back what it persisted.
|
|
6489
6503
|
*
|
|
6490
6504
|
* Deliberately not a `ProfileResponse`: that carries `payment_response_hash_key`
|
|
6491
6505
|
* — the webhook signing secret — plus the card-vault and authentication
|
|
6492
6506
|
* configuration, and a role that may only restyle a checkout has no business
|
|
6493
|
-
* reading any of it
|
|
6494
|
-
* else.
|
|
6507
|
+
* reading any of it, whether it asked to load the checkout or has just saved
|
|
6508
|
+
* it. This carries what the branding editor renders and nothing else.
|
|
6495
6509
|
*/
|
|
6496
6510
|
interface CheckoutBrandingResponse {
|
|
6497
6511
|
/** The shop (business profile) this branding belongs to. */
|
|
@@ -8555,6 +8569,17 @@ declare class Routing {
|
|
|
8555
8569
|
updateDefault(params: Record<string, unknown>): Promise<RoutableConnectorChoice[]>;
|
|
8556
8570
|
/** Retrieve default config for profiles. `GET /routing/default/profile` */
|
|
8557
8571
|
getDefaultProfile(): Promise<RoutableConnectorChoice[] | ProfileDefaultRoutingConfig[]>;
|
|
8572
|
+
/**
|
|
8573
|
+
* Retrieve one profile's default config. `GET /routing/default/profile/{profileId}`
|
|
8574
|
+
*
|
|
8575
|
+
* The narrow counterpart of `getDefaultProfile()`: that one returns every
|
|
8576
|
+
* profile of the merchant and needs merchant-level routing read, so a
|
|
8577
|
+
* profile-scoped (shop) role could write its own default through
|
|
8578
|
+
* `updateDefaultProfile()` but never read it back. This read is gated on
|
|
8579
|
+
* profile-level routing read and pinned to the caller's own profile — a shop
|
|
8580
|
+
* role asking for a sibling profile is refused.
|
|
8581
|
+
*/
|
|
8582
|
+
getDefaultForProfile(profileId: string): Promise<ProfileDefaultRoutingConfig>;
|
|
8558
8583
|
/** Update default config for a profile. `POST /routing/default/profile/{profileId}` */
|
|
8559
8584
|
updateDefaultProfile(profileId: string, params: Record<string, unknown>): Promise<ProfileDefaultRoutingConfig>;
|
|
8560
8585
|
/** List routing configs for profile. `GET /routing/list/profile` */
|
|
@@ -8972,9 +8997,12 @@ declare class Shops {
|
|
|
8972
8997
|
* @param merchantId - The merchant account ID.
|
|
8973
8998
|
* @param shopId - The shop (business profile) ID to restyle.
|
|
8974
8999
|
* @param params - The new `payment_link_config` blob (full replacement).
|
|
8975
|
-
* @returns The
|
|
9000
|
+
* @returns The saved branding — the same shape `retrieveCheckoutBranding`
|
|
9001
|
+
* returns, not the whole shop. A role whose only power is restyling a
|
|
9002
|
+
* checkout must not receive the webhook signing key or the card-vault
|
|
9003
|
+
* configuration back from a save.
|
|
8976
9004
|
*/
|
|
8977
|
-
updateCheckoutBranding(merchantId: string, shopId: string, params: CheckoutBrandingUpdate, options?: RequestExtras): Promise<
|
|
9005
|
+
updateCheckoutBranding(merchantId: string, shopId: string, params: CheckoutBrandingUpdate, options?: RequestExtras): Promise<CheckoutBrandingResponse>;
|
|
8978
9006
|
/**
|
|
8979
9007
|
* Read only the checkout appearance of a shop, so the role that may restyle a
|
|
8980
9008
|
* checkout can load the checkout it may restyle.
|
package/dist/index.d.ts
CHANGED
|
@@ -1603,6 +1603,18 @@ interface BillingProfileResponse {
|
|
|
1603
1603
|
suspension_source?: string | null;
|
|
1604
1604
|
/** Admin-provided reason for a manual suspension. Absent otherwise. */
|
|
1605
1605
|
suspension_reason?: string | null;
|
|
1606
|
+
/**
|
|
1607
|
+
* Free (not billed) merchant. While set, no platform fee is deducted on
|
|
1608
|
+
* any payment, the payment gate never blocks on `billing_status`, top-ups
|
|
1609
|
+
* are refused and auto-recharge is inert. Orthogonal to `is_trusted`, which
|
|
1610
|
+
* only shields against suspension. Absent on a router that predates the
|
|
1611
|
+
* flag (delopay-backend#378); read absent as `false`.
|
|
1612
|
+
*/
|
|
1613
|
+
is_free?: boolean;
|
|
1614
|
+
/** Admin-provided reason the merchant is free. Absent when not free. */
|
|
1615
|
+
free_reason?: string | null;
|
|
1616
|
+
/** When the free flag was set (ISO 8601). Absent when not free. */
|
|
1617
|
+
free_set_at?: string | null;
|
|
1606
1618
|
created_at: string;
|
|
1607
1619
|
modified_at: string;
|
|
1608
1620
|
/**
|
|
@@ -6485,13 +6497,15 @@ interface CheckoutBrandingUpdate {
|
|
|
6485
6497
|
payment_link_config?: BusinessPaymentLinkConfig | null;
|
|
6486
6498
|
}
|
|
6487
6499
|
/**
|
|
6488
|
-
* Response of
|
|
6500
|
+
* Response of both checkout-branding routes: the `GET` on
|
|
6501
|
+
* `/shops/{merchant_id}/{shop_id}/checkout-branding`, and the `POST` echoing
|
|
6502
|
+
* back what it persisted.
|
|
6489
6503
|
*
|
|
6490
6504
|
* Deliberately not a `ProfileResponse`: that carries `payment_response_hash_key`
|
|
6491
6505
|
* — the webhook signing secret — plus the card-vault and authentication
|
|
6492
6506
|
* configuration, and a role that may only restyle a checkout has no business
|
|
6493
|
-
* reading any of it
|
|
6494
|
-
* else.
|
|
6507
|
+
* reading any of it, whether it asked to load the checkout or has just saved
|
|
6508
|
+
* it. This carries what the branding editor renders and nothing else.
|
|
6495
6509
|
*/
|
|
6496
6510
|
interface CheckoutBrandingResponse {
|
|
6497
6511
|
/** The shop (business profile) this branding belongs to. */
|
|
@@ -8555,6 +8569,17 @@ declare class Routing {
|
|
|
8555
8569
|
updateDefault(params: Record<string, unknown>): Promise<RoutableConnectorChoice[]>;
|
|
8556
8570
|
/** Retrieve default config for profiles. `GET /routing/default/profile` */
|
|
8557
8571
|
getDefaultProfile(): Promise<RoutableConnectorChoice[] | ProfileDefaultRoutingConfig[]>;
|
|
8572
|
+
/**
|
|
8573
|
+
* Retrieve one profile's default config. `GET /routing/default/profile/{profileId}`
|
|
8574
|
+
*
|
|
8575
|
+
* The narrow counterpart of `getDefaultProfile()`: that one returns every
|
|
8576
|
+
* profile of the merchant and needs merchant-level routing read, so a
|
|
8577
|
+
* profile-scoped (shop) role could write its own default through
|
|
8578
|
+
* `updateDefaultProfile()` but never read it back. This read is gated on
|
|
8579
|
+
* profile-level routing read and pinned to the caller's own profile — a shop
|
|
8580
|
+
* role asking for a sibling profile is refused.
|
|
8581
|
+
*/
|
|
8582
|
+
getDefaultForProfile(profileId: string): Promise<ProfileDefaultRoutingConfig>;
|
|
8558
8583
|
/** Update default config for a profile. `POST /routing/default/profile/{profileId}` */
|
|
8559
8584
|
updateDefaultProfile(profileId: string, params: Record<string, unknown>): Promise<ProfileDefaultRoutingConfig>;
|
|
8560
8585
|
/** List routing configs for profile. `GET /routing/list/profile` */
|
|
@@ -8972,9 +8997,12 @@ declare class Shops {
|
|
|
8972
8997
|
* @param merchantId - The merchant account ID.
|
|
8973
8998
|
* @param shopId - The shop (business profile) ID to restyle.
|
|
8974
8999
|
* @param params - The new `payment_link_config` blob (full replacement).
|
|
8975
|
-
* @returns The
|
|
9000
|
+
* @returns The saved branding — the same shape `retrieveCheckoutBranding`
|
|
9001
|
+
* returns, not the whole shop. A role whose only power is restyling a
|
|
9002
|
+
* checkout must not receive the webhook signing key or the card-vault
|
|
9003
|
+
* configuration back from a save.
|
|
8976
9004
|
*/
|
|
8977
|
-
updateCheckoutBranding(merchantId: string, shopId: string, params: CheckoutBrandingUpdate, options?: RequestExtras): Promise<
|
|
9005
|
+
updateCheckoutBranding(merchantId: string, shopId: string, params: CheckoutBrandingUpdate, options?: RequestExtras): Promise<CheckoutBrandingResponse>;
|
|
8978
9006
|
/**
|
|
8979
9007
|
* Read only the checkout appearance of a shop, so the role that may restyle a
|
|
8980
9008
|
* checkout can load the checkout it may restyle.
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -2536,6 +2536,19 @@ var Routing = class {
|
|
|
2536
2536
|
async getDefaultProfile() {
|
|
2537
2537
|
return this.request("GET", "/routing/default/profile");
|
|
2538
2538
|
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Retrieve one profile's default config. `GET /routing/default/profile/{profileId}`
|
|
2541
|
+
*
|
|
2542
|
+
* The narrow counterpart of `getDefaultProfile()`: that one returns every
|
|
2543
|
+
* profile of the merchant and needs merchant-level routing read, so a
|
|
2544
|
+
* profile-scoped (shop) role could write its own default through
|
|
2545
|
+
* `updateDefaultProfile()` but never read it back. This read is gated on
|
|
2546
|
+
* profile-level routing read and pinned to the caller's own profile — a shop
|
|
2547
|
+
* role asking for a sibling profile is refused.
|
|
2548
|
+
*/
|
|
2549
|
+
async getDefaultForProfile(profileId) {
|
|
2550
|
+
return this.request("GET", `/routing/default/profile/${encodeURIComponent(profileId)}`);
|
|
2551
|
+
}
|
|
2539
2552
|
/** Update default config for a profile. `POST /routing/default/profile/{profileId}` */
|
|
2540
2553
|
async updateDefaultProfile(profileId, params) {
|
|
2541
2554
|
return this.request("POST", `/routing/default/profile/${encodeURIComponent(profileId)}`, {
|
|
@@ -2978,7 +2991,10 @@ var Shops = class {
|
|
|
2978
2991
|
* @param merchantId - The merchant account ID.
|
|
2979
2992
|
* @param shopId - The shop (business profile) ID to restyle.
|
|
2980
2993
|
* @param params - The new `payment_link_config` blob (full replacement).
|
|
2981
|
-
* @returns The
|
|
2994
|
+
* @returns The saved branding — the same shape `retrieveCheckoutBranding`
|
|
2995
|
+
* returns, not the whole shop. A role whose only power is restyling a
|
|
2996
|
+
* checkout must not receive the webhook signing key or the card-vault
|
|
2997
|
+
* configuration back from a save.
|
|
2982
2998
|
*/
|
|
2983
2999
|
async updateCheckoutBranding(merchantId, shopId, params, options) {
|
|
2984
3000
|
return this.request(
|
|
@@ -7132,6 +7148,13 @@ var AdminPortal = class {
|
|
|
7132
7148
|
* against signup policy + JWT blacklist). `reset_2fa` clears TOTP state
|
|
7133
7149
|
* so the user re-enrolls on next login. `is_active` supports both
|
|
7134
7150
|
* directions: false soft-disables, true reactivates a soft-disabled user.
|
|
7151
|
+
*
|
|
7152
|
+
* Throws a `400` with `code === 'UR_66'` when the change would leave a
|
|
7153
|
+
* merchant with no administrator — `is_active: false` or `is_verified:
|
|
7154
|
+
* false` on, or a `role_id` demoting, the only active user whose role can
|
|
7155
|
+
* manage that merchant's users. Nothing is written. `error.data` carries a
|
|
7156
|
+
* {@link LastAdministratorRefusal} naming the merchant and which change was
|
|
7157
|
+
* refused; render that rather than the generic message.
|
|
7135
7158
|
*/
|
|
7136
7159
|
async updateUser(userId, body) {
|
|
7137
7160
|
return this.request("PATCH", `/admin-portal/users/${encodeURIComponent(userId)}`, { body });
|
|
@@ -7140,6 +7163,9 @@ var AdminPortal = class {
|
|
|
7140
7163
|
* Soft-delete a user globally: deactivates the row, blacklists existing
|
|
7141
7164
|
* JWTs, and wipes credentials. Distinct from `deleteUserRole`, which
|
|
7142
7165
|
* removes a single role binding while leaving the user signed-in elsewhere.
|
|
7166
|
+
*
|
|
7167
|
+
* Throws the same `UR_66` as {@link updateUser} when the user is the last
|
|
7168
|
+
* administrator of any merchant they belong to, with `route: 'delete'`.
|
|
7143
7169
|
*/
|
|
7144
7170
|
async deleteUser(userId) {
|
|
7145
7171
|
return this.request("DELETE", `/admin-portal/users/${encodeURIComponent(userId)}`);
|
|
@@ -7647,6 +7673,62 @@ var PlatformBilling = class {
|
|
|
7647
7673
|
body: params
|
|
7648
7674
|
});
|
|
7649
7675
|
}
|
|
7676
|
+
/**
|
|
7677
|
+
* Mark a merchant free (not billed), or put it back on the prepaid model
|
|
7678
|
+
* (delopay-backend#378). While free, no platform fee is deducted, the
|
|
7679
|
+
* payment gate never blocks on billing status, top-ups are refused and
|
|
7680
|
+
* auto-recharge is inert. Marking free needs a `reason` and is refused
|
|
7681
|
+
* (412) while an admin suspension is in force — lift that first.
|
|
7682
|
+
*
|
|
7683
|
+
* Requires a router with delopay-backend#378; older routers answer `404`.
|
|
7684
|
+
*
|
|
7685
|
+
* @param merchantId - The merchant account ID.
|
|
7686
|
+
* @param params - The desired free state and, when marking free, the reason.
|
|
7687
|
+
* @returns The updated billing profile.
|
|
7688
|
+
*/
|
|
7689
|
+
async setFree(merchantId, params) {
|
|
7690
|
+
return this.request("PATCH", `/billing/${encodeURIComponent(merchantId)}/admin/free`, {
|
|
7691
|
+
body: params
|
|
7692
|
+
});
|
|
7693
|
+
}
|
|
7694
|
+
/**
|
|
7695
|
+
* Delete a merchant's **entire** ledger (delopay-backend#378). Every live
|
|
7696
|
+
* entry is soft-deleted — kept, so a replayed fee deduction or top-up
|
|
7697
|
+
* webhook still no-ops — the balance is set to zero and the status
|
|
7698
|
+
* re-derived (`active` for a free merchant; an active paying merchant
|
|
7699
|
+
* lands in `delinquent`). Refused (412) while the merchant has shop
|
|
7700
|
+
* allocations. Audited.
|
|
7701
|
+
*
|
|
7702
|
+
* Requires a router with delopay-backend#378; older routers answer `404`.
|
|
7703
|
+
*
|
|
7704
|
+
* @param merchantId - The merchant account ID.
|
|
7705
|
+
* @param params - The reason, required for audit.
|
|
7706
|
+
* @returns What was removed and the post-reset profile.
|
|
7707
|
+
*/
|
|
7708
|
+
async resetLedger(merchantId, params) {
|
|
7709
|
+
return this.request("DELETE", `/billing/${encodeURIComponent(merchantId)}/admin/ledger`, {
|
|
7710
|
+
body: params
|
|
7711
|
+
});
|
|
7712
|
+
}
|
|
7713
|
+
/**
|
|
7714
|
+
* (Re)create a merchant's ledger, optionally seeded with an opening balance
|
|
7715
|
+
* (delopay-backend#378). Ensures the billing profile exists (created
|
|
7716
|
+
* without the welcome promo credit) and, when `opening_balance` is set,
|
|
7717
|
+
* writes one `opening_balance` entry through the same atomic helper an
|
|
7718
|
+
* admin credit uses. Refused (412) while live entries or a non-zero balance
|
|
7719
|
+
* remain — reset first. Does not clear the free flag. Audited.
|
|
7720
|
+
*
|
|
7721
|
+
* Requires a router with delopay-backend#378; older routers answer `404`.
|
|
7722
|
+
*
|
|
7723
|
+
* @param merchantId - The merchant account ID.
|
|
7724
|
+
* @param params - Opening balance (minor units), currency for a new profile, and the reason.
|
|
7725
|
+
* @returns The opening entry id (if one was written) and the profile.
|
|
7726
|
+
*/
|
|
7727
|
+
async createLedger(merchantId, params) {
|
|
7728
|
+
return this.request("POST", `/billing/${encodeURIComponent(merchantId)}/admin/ledger`, {
|
|
7729
|
+
body: params
|
|
7730
|
+
});
|
|
7731
|
+
}
|
|
7650
7732
|
};
|
|
7651
7733
|
|
|
7652
7734
|
// src/internal/resources/platformFees.ts
|