@delopay/sdk 0.7.0 → 0.9.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-NKSNI5HS.js → chunk-WTVISXEY.js} +39 -27
- package/dist/chunk-WTVISXEY.js.map +1 -0
- package/dist/index.cjs +38 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -25
- package/dist/index.d.ts +117 -25
- package/dist/index.js +1 -1
- package/dist/internal.cjs +71 -26
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +38 -2
- package/dist/internal.d.ts +38 -2
- package/dist/internal.js +33 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-NKSNI5HS.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -321,30 +321,6 @@ var Billing = class {
|
|
|
321
321
|
body: params
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
|
-
/**
|
|
325
|
-
* Admin: manually credit a merchant's balance (e.g. promotional credit).
|
|
326
|
-
*
|
|
327
|
-
* @param merchantId - The merchant account ID.
|
|
328
|
-
* @param params - Credit amount and reason.
|
|
329
|
-
* @returns The adjustment result.
|
|
330
|
-
*/
|
|
331
|
-
async adminCredit(merchantId, params) {
|
|
332
|
-
return this.request("POST", `/billing/${encodeURIComponent(merchantId)}/admin/credit`, {
|
|
333
|
-
body: params
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Admin: manually debit a merchant's balance.
|
|
338
|
-
*
|
|
339
|
-
* @param merchantId - The merchant account ID.
|
|
340
|
-
* @param params - Debit amount and reason.
|
|
341
|
-
* @returns The adjustment result.
|
|
342
|
-
*/
|
|
343
|
-
async adminDebit(merchantId, params) {
|
|
344
|
-
return this.request("POST", `/billing/${encodeURIComponent(merchantId)}/admin/debit`, {
|
|
345
|
-
body: params
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
324
|
};
|
|
349
325
|
|
|
350
326
|
// src/resources/blocklist.ts
|
|
@@ -1813,6 +1789,36 @@ var Shops = class {
|
|
|
1813
1789
|
async list(merchantId) {
|
|
1814
1790
|
return this.request("GET", `/shops/${encodeURIComponent(merchantId)}`);
|
|
1815
1791
|
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Upload a logo file for a shop. The file is stored in Delopay's configured
|
|
1794
|
+
* object store and a public HTTPS URL is returned. This method does NOT write
|
|
1795
|
+
* the URL into the shop's `payment_link_config.default_config.logo` — call
|
|
1796
|
+
* `shops.update` afterwards with the returned `logo_url` to persist the change.
|
|
1797
|
+
*
|
|
1798
|
+
* Accepts PNG, JPEG, WebP or SVG. The file must be ≤ 1 MiB.
|
|
1799
|
+
*
|
|
1800
|
+
* @param merchantId - The merchant account ID.
|
|
1801
|
+
* @param shopId - The shop (business profile) ID.
|
|
1802
|
+
* @param file - The logo file (Blob / File in browsers).
|
|
1803
|
+
* @returns The publicly-reachable URL of the uploaded logo.
|
|
1804
|
+
*
|
|
1805
|
+
* @example
|
|
1806
|
+
* ```typescript
|
|
1807
|
+
* const { logo_url } = await delopay.shops.uploadLogo('merch_1', 'pro_1', file);
|
|
1808
|
+
* await delopay.shops.update('merch_1', 'pro_1', {
|
|
1809
|
+
* payment_link_config: { default_config: { logo: logo_url } },
|
|
1810
|
+
* });
|
|
1811
|
+
* ```
|
|
1812
|
+
*/
|
|
1813
|
+
async uploadLogo(merchantId, shopId, file) {
|
|
1814
|
+
const form = new FormData();
|
|
1815
|
+
form.append("file", file);
|
|
1816
|
+
return this.request(
|
|
1817
|
+
"POST",
|
|
1818
|
+
`/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/logo`,
|
|
1819
|
+
{ body: form }
|
|
1820
|
+
);
|
|
1821
|
+
}
|
|
1816
1822
|
};
|
|
1817
1823
|
|
|
1818
1824
|
// src/resources/stripeConnect.ts
|
|
@@ -2662,12 +2668,18 @@ var Delopay = class {
|
|
|
2662
2668
|
...this.jwtToken ? { Authorization: `Bearer ${this.jwtToken}` } : this.apiKey ? { "api-key": this.apiKey } : {},
|
|
2663
2669
|
...options?.headers
|
|
2664
2670
|
};
|
|
2665
|
-
|
|
2671
|
+
const isRawBody = options?.body !== void 0 && options?.body !== null && (options.body instanceof FormData || options.body instanceof Blob || options.body instanceof ArrayBuffer || options.body instanceof URLSearchParams);
|
|
2672
|
+
if (options?.body && !isRawBody) {
|
|
2666
2673
|
headers["Content-Type"] = "application/json";
|
|
2667
2674
|
}
|
|
2668
2675
|
const idempotencyKey = findIdempotencyKey(headers)?.trim();
|
|
2669
2676
|
const isRetryable = method === "GET" || method === "DELETE" || idempotencyKey !== void 0 && idempotencyKey !== "";
|
|
2670
|
-
|
|
2677
|
+
let serializedBody;
|
|
2678
|
+
if (isRawBody) {
|
|
2679
|
+
serializedBody = options?.body;
|
|
2680
|
+
} else if (options?.body) {
|
|
2681
|
+
serializedBody = JSON.stringify(options.body);
|
|
2682
|
+
}
|
|
2671
2683
|
const callerSignal = options?.signal;
|
|
2672
2684
|
if (callerSignal?.aborted) {
|
|
2673
2685
|
throw new DelopayError("Request aborted", {
|