@kuvarpay/sdk 1.4.0 → 1.4.2
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 +23 -3
- package/index.js +17 -7
- package/index.mjs +21 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -30,6 +30,26 @@ export interface VerifyPaymentResult {
|
|
|
30
30
|
raw: any;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export interface CreateSubaccountRequest {
|
|
34
|
+
business_name: string;
|
|
35
|
+
percentage_charge?: number | string;
|
|
36
|
+
currency?: string;
|
|
37
|
+
account_name?: string;
|
|
38
|
+
settlement_bank?: string;
|
|
39
|
+
account_number?: string;
|
|
40
|
+
mobile_money_number?: string;
|
|
41
|
+
mobile_money_provider?: string;
|
|
42
|
+
crypto_currency?: string;
|
|
43
|
+
crypto_network?: string;
|
|
44
|
+
wallet_address?: string;
|
|
45
|
+
primary_contact_email?: string;
|
|
46
|
+
primary_contact_phone?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
metadata?: Record<string, any>;
|
|
49
|
+
type?: string | 'BANK_TRANSFER' | 'MOBILE_MONEY' | 'CRYPTO';
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}
|
|
52
|
+
|
|
33
53
|
export class KuvarPayServer {
|
|
34
54
|
constructor(config?: KuvarPayServerConfig);
|
|
35
55
|
getSessionStatus(sessionId: string): Promise<SessionStatusResult>;
|
|
@@ -97,11 +117,10 @@ export class KuvarPayServer {
|
|
|
97
117
|
getOptimalTransferFee(amount: number, currency?: string): Promise<any>;
|
|
98
118
|
sendInvoiceEmail(sessionId: string): Promise<any>;
|
|
99
119
|
|
|
100
|
-
|
|
101
|
-
createSubaccount(subaccountData: Record<string, any>): Promise<any>;
|
|
120
|
+
createSubaccount(subaccountData: CreateSubaccountRequest): Promise<any>;
|
|
102
121
|
listSubaccounts(params?: { page?: number; perPage?: number }): Promise<any>;
|
|
103
122
|
getSubaccount(code: string): Promise<any>;
|
|
104
|
-
updateSubaccount(code: string, subaccountData:
|
|
123
|
+
updateSubaccount(code: string, subaccountData: Partial<CreateSubaccountRequest>): Promise<any>;
|
|
105
124
|
deleteSubaccount(code: string): Promise<any>;
|
|
106
125
|
|
|
107
126
|
// Split Groups
|
|
@@ -143,6 +162,7 @@ export class KuvarPayServer {
|
|
|
143
162
|
renewSubscription(subscriptionId: string, body?: Record<string, any>): Promise<any>;
|
|
144
163
|
|
|
145
164
|
// Banks
|
|
165
|
+
getBanks(currency: string, options?: { type?: 'bank' | 'mobile_money'; country?: string }): Promise<any>;
|
|
146
166
|
getBanks(params?: { currency?: string; type?: 'bank' | 'mobile_money'; country?: string }): Promise<any>;
|
|
147
167
|
resolveBankAccount(data: { bank_code: string; account_number: string; country_code?: string }): Promise<any>;
|
|
148
168
|
|
package/index.js
CHANGED
|
@@ -299,7 +299,7 @@ class KuvarPayServer {
|
|
|
299
299
|
|
|
300
300
|
/**
|
|
301
301
|
* Create a new subaccount
|
|
302
|
-
* @param {Object} subaccountData - { business_name, percentage_charge, ... }
|
|
302
|
+
* @param {Object} subaccountData - { business_name, percentage_charge, currency, type, crypto_currency, crypto_network, wallet_address, ... }
|
|
303
303
|
*/
|
|
304
304
|
async createSubaccount(subaccountData) {
|
|
305
305
|
return this._post('/api/v1/subaccounts', subaccountData);
|
|
@@ -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
|
-
//
|
|
444
|
+
async getBanks(params = {}, options = {}) {
|
|
445
|
+
// Handle (currency, options) signature
|
|
445
446
|
if (typeof params === 'string') {
|
|
446
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
311
|
-
|
|
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
|
}
|