blaaiz-nodejs-sdk 1.1.1 → 1.1.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/README.md CHANGED
@@ -94,6 +94,23 @@ const customers = await blaaiz.customers.list();
94
94
  console.log('Customers:', customers.data);
95
95
  ```
96
96
 
97
+ You can also pass optional filters and opt-in pagination. Supported filters
98
+ are `email`, `id_number`, `registration_number`, `verification_status`, and
99
+ `type`. Set `paginate: true` to receive a paginated response that includes
100
+ `links` and `meta` (with `current_page`, `total`, etc.) alongside `data`.
101
+
102
+ ```javascript
103
+ const verified = await blaaiz.customers.list({
104
+ email: 'john@example.com',
105
+ verification_status: 'VERIFIED',
106
+ type: 'individual',
107
+ paginate: true
108
+ });
109
+
110
+ console.log('Page:', verified.data.meta.current_page);
111
+ console.log('Customers:', verified.data.data);
112
+ ```
113
+
97
114
  #### Update Customer
98
115
 
99
116
  ```javascript
package/index.d.ts CHANGED
@@ -35,7 +35,43 @@ export interface CustomerData {
35
35
  export interface Customer extends CustomerData {
36
36
  id: string;
37
37
  business_id: string;
38
- verification_status: 'PENDING' | 'VERIFIED' | 'REJECTED';
38
+ verification_status: 'PENDING' | 'PROCESSING' | 'VERIFIED' | 'REJECTED';
39
+ }
40
+
41
+ export interface CustomerListFilters {
42
+ email?: string;
43
+ id_number?: string;
44
+ registration_number?: string;
45
+ verification_status?: 'PENDING' | 'PROCESSING' | 'VERIFIED' | 'REJECTED';
46
+ type?: 'individual' | 'business';
47
+ paginate?: boolean;
48
+ page?: number;
49
+ per_page?: number;
50
+ [key: string]: string | number | boolean | undefined;
51
+ }
52
+
53
+ export interface PaginationLinks {
54
+ first?: string | null;
55
+ last?: string | null;
56
+ prev?: string | null;
57
+ next?: string | null;
58
+ }
59
+
60
+ export interface PaginationMeta {
61
+ current_page: number;
62
+ from?: number | null;
63
+ last_page?: number;
64
+ path?: string;
65
+ per_page?: number;
66
+ to?: number | null;
67
+ total: number;
68
+ }
69
+
70
+ export interface PaginatedCustomers {
71
+ data: Customer[];
72
+ links: PaginationLinks;
73
+ meta: PaginationMeta;
74
+ message?: string;
39
75
  }
40
76
 
41
77
  export interface CustomerKYCData {
@@ -244,7 +280,7 @@ export interface WebhookEvent {
244
280
  export declare class CustomerService {
245
281
  constructor(client: any);
246
282
  create(customerData: CustomerData): Promise<BlaaizResponse<{ data: Customer }>>;
247
- list(): Promise<BlaaizResponse<Customer[]>>;
283
+ list(filters?: CustomerListFilters): Promise<BlaaizResponse<Customer[] | PaginatedCustomers>>;
248
284
  get(customerId: string): Promise<BlaaizResponse<Customer>>;
249
285
  update(customerId: string, updateData: Partial<CustomerData>): Promise<BlaaizResponse<Customer>>;
250
286
  addKYC(customerId: string, kycData: CustomerKYCData): Promise<BlaaizResponse<any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaaiz-nodejs-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Official Node.js SDK for Blaaiz RaaS (Remittance as a Service) API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -40,10 +40,10 @@
40
40
  "license": "MIT",
41
41
  "repository": {
42
42
  "type": "git",
43
- "url": "https://github.com/blaaiz/nodejs-sdk.git"
43
+ "url": "git+https://github.com/Blaaiz/blaaiz-nodejs-sdk.git"
44
44
  },
45
45
  "bugs": {
46
- "url": "https://github.com/blaaiz/nodejs-sdk/issues"
46
+ "url": "https://github.com/Blaaiz/blaaiz-nodejs-sdk/issues"
47
47
  },
48
48
  "homepage": "https://docs.business.blaaiz.com",
49
49
  "engines": {
@@ -25,8 +25,15 @@ class CustomerService {
25
25
  return this.client.makeRequest('POST', '/api/external/customer', customerData)
26
26
  }
27
27
 
28
- async list () {
29
- return this.client.makeRequest('GET', '/api/external/customer')
28
+ async list (filters = {}) {
29
+ const params = new URLSearchParams()
30
+ for (const [key, value] of Object.entries(filters || {})) {
31
+ if (value === undefined || value === null) continue
32
+ params.append(key, typeof value === 'boolean' ? String(value) : value)
33
+ }
34
+ const query = params.toString()
35
+ const endpoint = query ? `/api/external/customer?${query}` : '/api/external/customer'
36
+ return this.client.makeRequest('GET', endpoint)
30
37
  }
31
38
 
32
39
  async get (customerId) {