carbon-baas-sdk 1.0.4 → 1.0.5

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/README.md CHANGED
@@ -40,12 +40,17 @@ carbon.fetchAccount('account_number')
40
40
  carbon.fetchAccounts(1, 10) // page 1, limit 10
41
41
  .then(response => console.log(response))
42
42
  .catch(error => console.error(error));
43
+
44
+ // Fetch account balance
45
+ carbon.fetchAccountBalance('account_number')
46
+ .then(response => console.log(response))
47
+ .catch(error => console.error(error));
43
48
  ```
44
49
 
45
50
  ### ES Modules
46
51
 
47
52
  ```javascript
48
- import { initialize, createAccount, fetchAccount, fetchAccounts } from 'carbon-baas-sdk';
53
+ import { initialize, createAccount, fetchAccount, fetchAccounts, fetchAccountBalance } from 'carbon-baas-sdk';
49
54
 
50
55
  initialize('your_api_key_here', 'sandbox');
51
56
 
@@ -64,6 +69,10 @@ console.log(accountDetails);
64
69
  // Fetch accounts
65
70
  const accounts = await fetchAccounts(1, 10); // page 1, limit 10
66
71
  console.log(accounts);
72
+
73
+ // Fetch account balance
74
+ const balance = await fetchAccountBalance('account_number');
75
+ console.log(balance);
67
76
  ```
68
77
 
69
78
  ```javascript
@@ -92,6 +101,8 @@ createAccount(accountData: CreateAccountRequest)
92
101
  fetchAccount(accountNumber: string)
93
102
 
94
103
  fetchAccounts(page?: number, limit?: number)
104
+
105
+ fetchAccountBalance(accountNumber: string)
95
106
  ```
96
107
 
97
108
  ### Customers
@@ -142,6 +153,8 @@ initiatePayout(payoutData: InitiatePayoutRequest)
142
153
  // }
143
154
 
144
155
  fetchPayout(payoutId: string)
156
+
157
+ fetchPayoutsWithPendingApprovals(includeExpired?: boolean)
145
158
  ```
146
159
 
147
160
  ### Banks
@@ -156,10 +169,6 @@ fetchBanksUptime()
156
169
 
157
170
  ### Webhooks
158
171
  ```javascript
159
- fetchWebhook()
160
-
161
- updateWebhook(data: UpdateWebhookRequest)
162
- // data: { url: string }
163
172
 
164
173
  fetchWebhookHistory(page?: number, limit?: number)
165
174
 
@@ -170,7 +179,7 @@ resendWebhookEvent(eventId: string)
170
179
 
171
180
  ### Managing Accounts
172
181
  ```javascript
173
- import { createAccount, fetchAccount, fetchAccounts } from 'carbon-baas-sdk';
182
+ import { createAccount, fetchAccount, fetchAccounts, fetchAccountBalance } from 'carbon-baas-sdk';
174
183
 
175
184
  // Create an account for a third-party customer
176
185
  const newCustomerAccount = await createAccount({
@@ -189,6 +198,9 @@ const newSubAccount = await createAccount({
189
198
  // Fetch account details
190
199
  const accountDetails = await fetchAccount('1234567890');
191
200
 
201
+ // Fetch account balance
202
+ const balance = await fetchAccountBalance('1234567890');
203
+
192
204
  // Fetch all accounts (with pagination)
193
205
  const accounts = await fetchAccounts(1, 20); // page 1, 20 items per page
194
206
  ```
@@ -219,6 +231,37 @@ const newCustomer = await createCustomer(customerData);
219
231
  const customerDetails = await fetchCustomer('customer_id');
220
232
  ```
221
233
 
234
+ ### Managing Payouts
235
+ ```javascript
236
+ import { initiatePayout, fetchPayout, fetchPayoutsWithPendingApprovals } from 'carbon-baas-sdk';
237
+
238
+ // Initiate a payout
239
+ const payoutData = {
240
+ amount: 1000,
241
+ source: { account_number: '1234567890' },
242
+ beneficiary: {
243
+ bank_code: '058',
244
+ bank_name: 'GTB',
245
+ account_number: '0987654321',
246
+ account_name: 'John Doe'
247
+ },
248
+ reference: 'payout_ref_123',
249
+ meta_data: { description: 'Payment for services' },
250
+ remark: 'Service payment'
251
+ };
252
+
253
+ const payout = await initiatePayout(payoutData);
254
+
255
+ // Fetch payout details
256
+ const payoutDetails = await fetchPayout('payout_id');
257
+
258
+ // Fetch payouts with pending approvals
259
+ const pendingPayouts = await fetchPayoutsWithPendingApprovals();
260
+
261
+ // Fetch payouts with pending approvals including expired ones
262
+ const allPendingPayouts = await fetchPayoutsWithPendingApprovals(true);
263
+ ```
264
+
222
265
  ### Managing Webhooks
223
266
  ```javascript
224
267
  import { resendWebhookEvent, fetchWebhookHistory } from 'carbon-baas-sdk';
@@ -15,4 +15,5 @@ interface CreateAccountRequest {
15
15
  export declare function createAccount(accountData: CreateAccountRequest): Promise<any>;
16
16
  export declare function fetchAccount(accountNumber: string): Promise<any>;
17
17
  export declare function fetchAccounts(page?: number, limit?: number): Promise<any>;
18
+ export declare function fetchAccountBalance(accountNumber: string): Promise<any>;
18
19
  export {};
@@ -0,0 +1,5 @@
1
+ export interface EnvironmentConfig {
2
+ baseUrl: string;
3
+ accessKey: string;
4
+ }
5
+ export declare const CONFIG: Record<'live' | 'sandbox', EnvironmentConfig>;
@@ -10,7 +10,7 @@ interface CreateCustomerRequest {
10
10
  state: string;
11
11
  country: string;
12
12
  bvn: string;
13
- nin: string;
13
+ nin?: string;
14
14
  }
15
15
  export declare function createCustomer(customerData: CreateCustomerRequest): Promise<any>;
16
16
  export declare function fetchCustomer(customerId: string): Promise<any>;