@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 CHANGED
@@ -55,8 +55,11 @@ var DelopayAuthenticationError = class extends DelopayError {
55
55
  constructor(message = "Invalid API key", options) {
56
56
  super(message, {
57
57
  status: 401,
58
- code: "AUTH_01",
59
- type: "authentication_error",
58
+ // Default to the generic "invalid API key" code, but let callers pass
59
+ // through the server-reported code (e.g. `UR_05` for unverified-email
60
+ // 401s) so they can differentiate between auth failure reasons.
61
+ code: options?.code || "AUTH_01",
62
+ type: options?.type || "authentication_error",
60
63
  requestId: options?.requestId,
61
64
  rawBody: options?.rawBody
62
65
  });
@@ -136,6 +139,30 @@ var AdminPortal = class {
136
139
  query: params
137
140
  });
138
141
  }
142
+ /**
143
+ * Retrieve a merchant account via the admin portal. Unlike
144
+ * `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
145
+ * key) and does not require the JWT to be scoped to the target merchant.
146
+ */
147
+ async retrieveAccount(merchantId) {
148
+ return this.request("GET", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);
149
+ }
150
+ /**
151
+ * Update a merchant account via the admin portal. Authenticated via admin JWT
152
+ * or admin API key.
153
+ */
154
+ async updateAccount(merchantId, params) {
155
+ return this.request("POST", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`, {
156
+ body: params
157
+ });
158
+ }
159
+ /**
160
+ * Delete a merchant account via the admin portal. Authenticated via admin JWT
161
+ * or admin API key.
162
+ */
163
+ async deleteAccount(merchantId) {
164
+ return this.request("DELETE", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);
165
+ }
139
166
  };
140
167
 
141
168
  // src/resources/apiKeys.ts
@@ -2980,6 +3007,8 @@ var Delopay = class {
2980
3007
  const truncatedRaw = truncateRawBody(rawBody);
2981
3008
  if (response.status === 401) {
2982
3009
  throw new DelopayAuthenticationError(message, {
3010
+ code,
3011
+ type,
2983
3012
  requestId,
2984
3013
  rawBody: truncatedRaw
2985
3014
  });