@kuvarpay/sdk 1.4.0 → 1.4.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/index.d.ts CHANGED
@@ -143,6 +143,7 @@ export class KuvarPayServer {
143
143
  renewSubscription(subscriptionId: string, body?: Record<string, any>): Promise<any>;
144
144
 
145
145
  // Banks
146
+ getBanks(currency: string, options?: { type?: 'bank' | 'mobile_money'; country?: string }): Promise<any>;
146
147
  getBanks(params?: { currency?: string; type?: 'bank' | 'mobile_money'; country?: string }): Promise<any>;
147
148
  resolveBankAccount(data: { bank_code: string; account_number: string; country_code?: string }): Promise<any>;
148
149
 
package/index.js CHANGED
@@ -437,16 +437,26 @@ class KuvarPayServer {
437
437
 
438
438
  /**
439
439
  * List supported banks
440
- * GET /api/v1/banks
441
- * @param {Object} params - { currency, type, country }
440
+ * GET /api/v1/banks or GET /api/v1/banks/:currency
441
+ * @param {string|Object} [params] - Currency string or params object { currency, type, country }
442
+ * @param {Object} [options] - Additional query params if first arg is currency string
442
443
  */
443
- async getBanks(params = {}) {
444
- // If params is a string, treat it as currency and use path-based endpoint for better reliability
444
+ async getBanks(params = {}, options = {}) {
445
+ // Handle (currency, options) signature
445
446
  if (typeof params === 'string') {
446
- return this._get(`/api/v1/banks/${encodeURIComponent(params)}`);
447
+ const query = new URLSearchParams(options).toString();
448
+ const path = query ? `/api/v1/banks/${encodeURIComponent(params)}?${query}` : `/api/v1/banks/${encodeURIComponent(params)}`;
449
+ return this._get(path);
447
450
  }
448
451
 
449
- const query = new URLSearchParams(params).toString();
452
+ const { currency, ...rest } = params || {};
453
+ if (currency) {
454
+ const query = new URLSearchParams(rest).toString();
455
+ const path = query ? `/api/v1/banks/${encodeURIComponent(currency)}?${query}` : `/api/v1/banks/${encodeURIComponent(currency)}`;
456
+ return this._get(path);
457
+ }
458
+
459
+ const query = new URLSearchParams(rest).toString();
450
460
  const path = query ? `/api/v1/banks?${query}` : '/api/v1/banks';
451
461
  return this._get(path);
452
462
  }
package/index.mjs CHANGED
@@ -305,10 +305,28 @@ export class KuvarPayServer {
305
305
  return data;
306
306
  }
307
307
 
308
- // --- Banks & Account Verification ---
308
+ /**
309
+ * List supported banks
310
+ * GET /api/v1/banks or GET /api/v1/banks/:currency
311
+ * @param {string|Object} [params] - Currency string or params object { currency, type, country }
312
+ * @param {Object} [options] - Additional query params if first arg is currency string
313
+ */
314
+ async getBanks(params = {}, options = {}) {
315
+ // Handle (currency, options) signature
316
+ if (typeof params === 'string') {
317
+ const query = new URLSearchParams(options).toString();
318
+ const path = query ? `/api/v1/banks/${encodeURIComponent(params)}?${query}` : `/api/v1/banks/${encodeURIComponent(params)}`;
319
+ return this._get(path);
320
+ }
309
321
 
310
- async getBanks(params = {}) {
311
- const query = new URLSearchParams(params).toString();
322
+ const { currency, ...rest } = params || {};
323
+ if (currency) {
324
+ const query = new URLSearchParams(rest).toString();
325
+ const path = query ? `/api/v1/banks/${encodeURIComponent(currency)}?${query}` : `/api/v1/banks/${encodeURIComponent(currency)}`;
326
+ return this._get(path);
327
+ }
328
+
329
+ const query = new URLSearchParams(rest).toString();
312
330
  const path = query ? `/api/v1/banks?${query}` : '/api/v1/banks';
313
331
  return this._get(path);
314
332
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuvarpay/sdk",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Official KuvarPay Server SDK for Node.js",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",