@delopay/sdk 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +31 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1771,6 +1771,22 @@ declare class AdminPortal {
|
|
|
1771
1771
|
analytics(params: AdminAnalyticsRequest): Promise<PlatformAnalyticsResponse>;
|
|
1772
1772
|
overviewStats(): Promise<OverviewStatsResponse>;
|
|
1773
1773
|
paymentAnalytics(params: PaymentAnalyticsRequest): Promise<PaymentAnalyticsResponse>;
|
|
1774
|
+
/**
|
|
1775
|
+
* Retrieve a merchant account via the admin portal. Unlike
|
|
1776
|
+
* `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
|
|
1777
|
+
* key) and does not require the JWT to be scoped to the target merchant.
|
|
1778
|
+
*/
|
|
1779
|
+
retrieveAccount(merchantId: string): Promise<MerchantAccountResponse>;
|
|
1780
|
+
/**
|
|
1781
|
+
* Update a merchant account via the admin portal. Authenticated via admin JWT
|
|
1782
|
+
* or admin API key.
|
|
1783
|
+
*/
|
|
1784
|
+
updateAccount(merchantId: string, params: MerchantAccountUpdateRequest): Promise<MerchantAccountResponse>;
|
|
1785
|
+
/**
|
|
1786
|
+
* Delete a merchant account via the admin portal. Authenticated via admin JWT
|
|
1787
|
+
* or admin API key.
|
|
1788
|
+
*/
|
|
1789
|
+
deleteAccount(merchantId: string): Promise<MerchantAccountResponse>;
|
|
1774
1790
|
}
|
|
1775
1791
|
|
|
1776
1792
|
/** Create and manage API keys for a merchant account. */
|
|
@@ -3543,6 +3559,8 @@ declare class DelopayError extends Error {
|
|
|
3543
3559
|
*/
|
|
3544
3560
|
declare class DelopayAuthenticationError extends DelopayError {
|
|
3545
3561
|
constructor(message?: string, options?: {
|
|
3562
|
+
code?: string;
|
|
3563
|
+
type?: string;
|
|
3546
3564
|
requestId?: string;
|
|
3547
3565
|
rawBody?: string;
|
|
3548
3566
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1771,6 +1771,22 @@ declare class AdminPortal {
|
|
|
1771
1771
|
analytics(params: AdminAnalyticsRequest): Promise<PlatformAnalyticsResponse>;
|
|
1772
1772
|
overviewStats(): Promise<OverviewStatsResponse>;
|
|
1773
1773
|
paymentAnalytics(params: PaymentAnalyticsRequest): Promise<PaymentAnalyticsResponse>;
|
|
1774
|
+
/**
|
|
1775
|
+
* Retrieve a merchant account via the admin portal. Unlike
|
|
1776
|
+
* `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
|
|
1777
|
+
* key) and does not require the JWT to be scoped to the target merchant.
|
|
1778
|
+
*/
|
|
1779
|
+
retrieveAccount(merchantId: string): Promise<MerchantAccountResponse>;
|
|
1780
|
+
/**
|
|
1781
|
+
* Update a merchant account via the admin portal. Authenticated via admin JWT
|
|
1782
|
+
* or admin API key.
|
|
1783
|
+
*/
|
|
1784
|
+
updateAccount(merchantId: string, params: MerchantAccountUpdateRequest): Promise<MerchantAccountResponse>;
|
|
1785
|
+
/**
|
|
1786
|
+
* Delete a merchant account via the admin portal. Authenticated via admin JWT
|
|
1787
|
+
* or admin API key.
|
|
1788
|
+
*/
|
|
1789
|
+
deleteAccount(merchantId: string): Promise<MerchantAccountResponse>;
|
|
1774
1790
|
}
|
|
1775
1791
|
|
|
1776
1792
|
/** Create and manage API keys for a merchant account. */
|
|
@@ -3543,6 +3559,8 @@ declare class DelopayError extends Error {
|
|
|
3543
3559
|
*/
|
|
3544
3560
|
declare class DelopayAuthenticationError extends DelopayError {
|
|
3545
3561
|
constructor(message?: string, options?: {
|
|
3562
|
+
code?: string;
|
|
3563
|
+
type?: string;
|
|
3546
3564
|
requestId?: string;
|
|
3547
3565
|
rawBody?: string;
|
|
3548
3566
|
});
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,11 @@ var DelopayAuthenticationError = class extends DelopayError {
|
|
|
15
15
|
constructor(message = "Invalid API key", options) {
|
|
16
16
|
super(message, {
|
|
17
17
|
status: 401,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
// Default to the generic "invalid API key" code, but let callers pass
|
|
19
|
+
// through the server-reported code (e.g. `UR_05` for unverified-email
|
|
20
|
+
// 401s) so they can differentiate between auth failure reasons.
|
|
21
|
+
code: options?.code || "AUTH_01",
|
|
22
|
+
type: options?.type || "authentication_error",
|
|
20
23
|
requestId: options?.requestId,
|
|
21
24
|
rawBody: options?.rawBody
|
|
22
25
|
});
|
|
@@ -96,6 +99,30 @@ var AdminPortal = class {
|
|
|
96
99
|
query: params
|
|
97
100
|
});
|
|
98
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Retrieve a merchant account via the admin portal. Unlike
|
|
104
|
+
* `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
|
|
105
|
+
* key) and does not require the JWT to be scoped to the target merchant.
|
|
106
|
+
*/
|
|
107
|
+
async retrieveAccount(merchantId) {
|
|
108
|
+
return this.request("GET", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Update a merchant account via the admin portal. Authenticated via admin JWT
|
|
112
|
+
* or admin API key.
|
|
113
|
+
*/
|
|
114
|
+
async updateAccount(merchantId, params) {
|
|
115
|
+
return this.request("POST", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`, {
|
|
116
|
+
body: params
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Delete a merchant account via the admin portal. Authenticated via admin JWT
|
|
121
|
+
* or admin API key.
|
|
122
|
+
*/
|
|
123
|
+
async deleteAccount(merchantId) {
|
|
124
|
+
return this.request("DELETE", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);
|
|
125
|
+
}
|
|
99
126
|
};
|
|
100
127
|
|
|
101
128
|
// src/resources/apiKeys.ts
|
|
@@ -2940,6 +2967,8 @@ var Delopay = class {
|
|
|
2940
2967
|
const truncatedRaw = truncateRawBody(rawBody);
|
|
2941
2968
|
if (response.status === 401) {
|
|
2942
2969
|
throw new DelopayAuthenticationError(message, {
|
|
2970
|
+
code,
|
|
2971
|
+
type,
|
|
2943
2972
|
requestId,
|
|
2944
2973
|
rawBody: truncatedRaw
|
|
2945
2974
|
});
|