aeremmiddleware 1.0.60 → 1.0.62

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.
@@ -1,91 +1,92 @@
1
1
  import axios, { AxiosResponse } from "axios";
2
2
  import FormData from "form-data";
3
3
  export interface Address {
4
- city: string | null;
5
- country: any;
6
- full: any;
7
- line_1: string | null;
8
- line_2: string | null;
9
- state: string | null;
10
- street_name: string | null;
11
- zip: string | null;
4
+ city: string | null;
5
+ country: any;
6
+ full: any;
7
+ line_1: string | null;
8
+ line_2: string | null;
9
+ state: string | null;
10
+ street_name: string | null;
11
+ zip: string | null;
12
12
  }
13
13
  export interface SourceOutput {
14
- aadhaar_linked: any;
15
- address: Address;
16
- age: any;
17
- category: any;
18
- dob: any;
19
- dob_check: string | null;
20
- dob_verified: string | null;
21
- email: any;
22
- father_name: string | null;
23
- full_name: any;
24
- full_name_split: any;
25
- gender: any;
26
- input_dob: string | null;
27
- is_minor: any;
28
- less_info: string | null;
29
- masked_aadhaar: any;
30
- pan_alloted_date: string | null;
31
- pan_number: any;
32
- phone_number: any;
33
- status: string;
14
+ aadhaar_linked: any;
15
+ address: Address;
16
+ age: any;
17
+ category: any;
18
+ dob: any;
19
+ dob_check: string | null;
20
+ dob_verified: string | null;
21
+ email: any;
22
+ father_name: string | null;
23
+ full_name: any;
24
+ full_name_split: any;
25
+ gender: any;
26
+ input_dob: string | null;
27
+ is_minor: any;
28
+ less_info: string | null;
29
+ masked_aadhaar: any;
30
+ pan_alloted_date: string | null;
31
+ pan_number: any;
32
+ phone_number: any;
33
+ status: string;
34
34
  }
35
35
 
36
36
  export interface Result {
37
- source_output: SourceOutput;
37
+ source_output: SourceOutput;
38
38
  }
39
39
 
40
40
  export interface PANInfo {
41
- action: string;
42
- completed_at: string;
43
- created_at: string;
44
- group_id: string;
45
- request_id: string;
46
- result: Result;
47
- status: string;
48
- task_id: string;
49
- type: string;
41
+ action: string;
42
+ completed_at: string;
43
+ created_at: string;
44
+ group_id: string;
45
+ request_id: string;
46
+ result: Result;
47
+ status: string;
48
+ task_id: string;
49
+ type: string;
50
+ dataDump: string;
50
51
  }
51
52
  export interface IAadhaarVerificationPayload {
52
- status: {
53
- statusCode: number;
54
- statusMessage: string;
55
- transactionId: string;
56
- checkId: string;
57
- groupId: string;
58
- input: {
59
- aadhaarNo: string;
60
- };
61
- timestamp: string;
62
- };
63
- response: {
64
- code: number;
65
- pan: string;
53
+ status: {
54
+ statusCode: number;
55
+ statusMessage: string;
56
+ transactionId: string;
57
+ checkId: string;
58
+ groupId: string;
59
+ input: {
60
+ aadhaarNo: string;
66
61
  };
62
+ timestamp: string;
63
+ };
64
+ response: {
65
+ code: number;
66
+ pan: string;
67
+ };
67
68
  }
68
69
 
69
70
  export interface IAadhaarOfflineGetOTPResponse {
70
- status: {
71
- statusCode: number;
72
- statusMessage: string;
73
- transactionId: string;
74
- checkId: string;
75
- groupId: string;
76
- input: {
77
- aadhaarNo: string;
78
- task: string;
79
- };
80
- timestamp: string;
71
+ status: {
72
+ statusCode: number;
73
+ statusMessage: string;
74
+ transactionId: string;
75
+ checkId: string;
76
+ groupId: string;
77
+ input: {
78
+ aadhaarNo: string;
79
+ task: string;
81
80
  };
82
- response: {
83
- requestId: string;
84
- result: {
85
- message: string;
86
- };
87
- statusCode: number;
81
+ timestamp: string;
82
+ };
83
+ response: {
84
+ requestId: string;
85
+ result: {
86
+ message: string;
88
87
  };
88
+ statusCode: number;
89
+ };
89
90
  }
90
91
 
91
92
  // export interface IAadhaarOfflineGetFileResponse {
@@ -103,434 +104,437 @@ export interface IAadhaarOfflineGetOTPResponse {
103
104
  // }
104
105
 
105
106
  export interface IAadhaarOfflineGetFileResponse {
106
- status: {
107
- statusCode: number;
108
- statusMessage: string;
109
- transactionId: string;
110
- input: {
111
- aadhaarNo: string;
112
- task: string;
113
- };
114
- timestamp: string;
107
+ status: {
108
+ statusCode: number;
109
+ statusMessage: string;
110
+ transactionId: string;
111
+ input: {
112
+ aadhaarNo: string;
113
+ task: string;
115
114
  };
116
- response: {
117
- maskedAadhaarNumber: string;
118
- name: string;
119
- dob: string;
120
- gender: "M" | "F" | "Other";
121
- fatherName: string;
122
- careOf: string;
123
- address: string;
124
- splitAddress: {
125
- country: string;
126
- dist: string;
127
- state: string;
128
- po: string;
129
- loc: string;
130
- vtc: string;
131
- subdist: string;
132
- street: string;
133
- house: string;
134
- landmark: string;
135
- };
136
- pincode: string;
137
- shareCode: string;
138
- generatedDateTime: string;
139
- image: string; // Base64 image data
115
+ timestamp: string;
116
+ };
117
+ response: {
118
+ maskedAadhaarNumber: string;
119
+ name: string;
120
+ dob: string;
121
+ gender: "M" | "F" | "Other";
122
+ fatherName: string;
123
+ careOf: string;
124
+ address: string;
125
+ splitAddress: {
126
+ country: string;
127
+ dist: string;
128
+ state: string;
129
+ po: string;
130
+ loc: string;
131
+ vtc: string;
132
+ subdist: string;
133
+ street: string;
134
+ house: string;
135
+ landmark: string;
140
136
  };
137
+ pincode: string;
138
+ shareCode: string;
139
+ generatedDateTime: string;
140
+ image: string; // Base64 image data
141
+ };
141
142
  }
142
143
 
143
144
  export interface INameMatchResponse {
144
- status: {
145
- statusCode: number;
146
- statusMessage: string;
147
- transactionId: string;
148
- checkId: string;
149
- groupId: string;
150
- timestamp: string;
151
- };
152
- response: {
153
- name1: string;
154
- name2: string;
155
- similarity: number;
156
- similarityPercentage: string;
157
- };
145
+ status: {
146
+ statusCode: number;
147
+ statusMessage: string;
148
+ transactionId: string;
149
+ checkId: string;
150
+ groupId: string;
151
+ timestamp: string;
152
+ };
153
+ response: {
154
+ name1: string;
155
+ name2: string;
156
+ similarity: number;
157
+ similarityPercentage: string;
158
+ };
158
159
  }
159
160
 
160
161
  export interface INameMatchRequest {
161
- name1: string;
162
- name2: string;
162
+ name1: string;
163
+ name2: string;
163
164
  }
164
165
  export interface IAccountTransferHybridRequest {
165
- accountNumber: string;
166
- ifsc: string;
167
- }
168
-
166
+ accountNumber: string;
167
+ ifsc: string;
168
+ }
169
+
169
170
  export interface IAccountTransferHybridResponse {
170
- status: {
171
- statusCode: number;
172
- statusMessage: string;
173
- transactionId: string;
174
- checkId: string;
175
- groupId: string;
176
- timestamp: string;
177
- };
178
- response: {
179
- account_status: string;
180
- beneficiary_name: string;
181
- bank_name: string;
182
- branch_name: string;
183
- npci_response_code: string;
184
- transaction_id: string;
185
- };
186
- error?: {
187
- code: string;
188
- title: string;
189
- message: string;
190
- };
171
+ status: {
172
+ statusCode: number;
173
+ statusMessage: string;
174
+ transactionId: string;
175
+ checkId: string;
176
+ groupId: string;
177
+ timestamp: string;
178
+ };
179
+ response: {
180
+ account_status: string;
181
+ beneficiary_name: string;
182
+ bank_name: string;
183
+ branch_name: string;
184
+ npci_response_code: string;
185
+ transaction_id: string;
186
+ };
187
+ error?: {
188
+ code: string;
189
+ title: string;
190
+ message: string;
191
+ };
191
192
  }
192
193
  export default class KycCartAPIWrapper {
193
- private apiKey: string;
194
- private baseUrl: string;
195
- static AADHAAR_TASKS = {
196
- GET_OTP: "getOtp",
197
- GET_FILE: "getFile",
198
- };
199
- constructor(apiKey: string) {
200
- this.apiKey = apiKey;
201
- this.baseUrl = "https://api.kyckart.com/api";
202
- }
194
+ private apiKey: string;
195
+ private baseUrl: string;
196
+ static AADHAAR_TASKS = {
197
+ GET_OTP: "getOtp",
198
+ GET_FILE: "getFile",
199
+ };
200
+ constructor(apiKey: string) {
201
+ this.apiKey = apiKey;
202
+ this.baseUrl = "https://api.kyckart.com/api";
203
+ }
203
204
 
204
- public async accountTransfer({
205
- accountNumber,
206
- ifsc,
207
- name,
208
- checkId,
209
- }: {
210
- accountNumber: string;
211
- ifsc: string;
212
- name: string;
213
- checkId: string;
214
- }): Promise<AxiosResponse> {
215
- const form = new FormData();
216
- form.append("accountNumber", accountNumber);
217
- form.append("ifsc", ifsc);
218
- form.append("name", name);
219
- form.append("checkId", checkId);
205
+ public async accountTransfer({
206
+ accountNumber,
207
+ ifsc,
208
+ name,
209
+ checkId,
210
+ }: {
211
+ accountNumber: string;
212
+ ifsc: string;
213
+ name: string;
214
+ checkId: string;
215
+ }): Promise<AxiosResponse> {
216
+ const form = new FormData();
217
+ form.append("accountNumber", accountNumber);
218
+ form.append("ifsc", ifsc);
219
+ form.append("name", name);
220
+ form.append("checkId", checkId);
220
221
 
221
- try {
222
- const response = await axios.post(
223
- `${this.baseUrl}/bank/account-transfer`,
224
- form,
225
- {
226
- headers: {
227
- "x-api-key": this.apiKey,
228
- ...form.getHeaders(),
229
- },
230
- }
231
- );
232
- return response.data;
233
- } catch (error: any) {
234
- throw {
235
- statusCode: error.response.data.status.statusCode,
236
- statusMessage: error.response.data.status.statusMessage,
237
- errorTitle: error.response.data.error.title,
238
- errorMessage: error.response.data.error.message,
239
- };
222
+ try {
223
+ const response = await axios.post(
224
+ `${this.baseUrl}/bank/account-transfer`,
225
+ form,
226
+ {
227
+ headers: {
228
+ "x-api-key": this.apiKey,
229
+ ...form.getHeaders(),
230
+ },
240
231
  }
232
+ );
233
+ return response.data;
234
+ } catch (error: any) {
235
+ throw {
236
+ statusCode: error.response.data.status.statusCode,
237
+ statusMessage: error.response.data.status.statusMessage,
238
+ errorTitle: error.response.data.error.title,
239
+ errorMessage: error.response.data.error.message,
240
+ };
241
241
  }
242
+ }
242
243
 
243
- public async getIndividualPANInfo({
244
- panNo,
245
- }: {
246
- panNo: string;
247
- }): Promise<PANInfo[]> {
248
- const form = new FormData();
249
- form.append("panNumber", panNo);
250
-
251
- try {
252
- const response = await axios.post(
253
- `${this.baseUrl}/panCard/panDetailedContactV4`,
254
- form,
255
- {
256
- headers: {
257
- "x-api-key": this.apiKey,
258
- ...form.getHeaders(),
259
- },
260
- }
261
- );
262
- const data = response?.data?.response;
263
- const panInfo : PANInfo = {
264
- action: "verify_with_source",
265
- completed_at: response?.data?.status?.timestamp,
266
- created_at: response?.data?.status?.timestamp,
267
- group_id: response?.data?.status?.transactionId,
268
- request_id: response?.data?.status?.transactionId,
269
- result: {
270
- source_output: {
271
- aadhaar_linked: data.aadhaarSeedingStatus ?? false,
272
- address: {
273
- city: data?.city || null,
274
- country: data?.country || "India",
275
- full: data?.country || "India",
276
- line_1: data?.address || null,
277
- line_2: data?.address || null,
278
- state: data?.state || null,
279
- street_name: null,
280
- zip: data?.pincode || null,
281
- },
282
- age: 30,
283
- category: data?.typeOfHolder || "person",
284
- dob: data?.dob || "",
285
- dob_check: null,
286
- dob_verified: null,
287
- email: data?.email || "",
288
- father_name: data?.middleName || null,
289
- full_name: data?.name || "",
290
- full_name_split: [
291
- data?.firstName,
292
- data?.middleName,
293
- data?.lastName,
294
- ],
295
- gender: data?.gender || "M",
296
- input_dob: null,
297
- is_minor: false,
298
- less_info: null,
299
- masked_aadhaar: data?.maskedAadhaar || "XXXXXXXXXXXX",
300
- pan_alloted_date: null,
301
- pan_number: panNo || "",
302
- phone_number: "",
303
- status: "id_found",
304
- },
305
- },
306
- status: "completed",
307
- task_id: response?.data?.status?.transactionId,
308
- type: "ind_pan_plus",
309
- };
244
+ public async getIndividualPANInfo({
245
+ panNo,
246
+ }: {
247
+ panNo: string;
248
+ }): Promise<PANInfo[]> {
249
+ const form = new FormData();
250
+ form.append("panNumber", panNo);
310
251
 
311
- const errorPAN : PANInfo = {
312
- action: "verify_with_source",
313
- completed_at: response?.data?.status?.timestamp,
314
- created_at: response?.data?.status?.timestamp,
315
- group_id: response?.data?.status?.transactionId,
316
- request_id: response?.data?.status?.transactionId,
317
- result: {
318
- source_output: {
319
- aadhaar_linked: null,
320
- address: {
321
- city: null,
322
- country: null,
323
- full: null,
324
- line_1: null,
325
- line_2: null,
326
- state: null,
327
- street_name: null,
328
- zip: null,
329
- },
330
- age: null,
331
- category: null,
332
- dob: null,
333
- dob_check: null,
334
- dob_verified: null,
335
- email: null,
336
- father_name: null,
337
- full_name: null,
338
- full_name_split: null,
339
- gender: null,
340
- input_dob: null,
341
- is_minor: null,
342
- less_info: null,
343
- masked_aadhaar: null,
344
- pan_alloted_date: null,
345
- pan_number: null,
346
- phone_number: null,
347
- status: "id_not_found",
348
- },
349
- },
350
- status: "completed",
351
- task_id: response?.data?.status?.transactionId,
352
- type: "ind_pan_plus",
353
- };
354
-
355
- if (response?.data?.response?.code == 200) {
356
- return [panInfo];
357
- } else if(response?.data?.status?.statusCode === 400) {
358
- errorPAN.result.source_output.status = "source_down";
359
- return [errorPAN];
360
- }else{
361
- return [errorPAN];
362
- }
363
- } catch (error: any) {
364
- return [
365
- {
366
- action: "verify_with_source",
367
- completed_at: error?.data?.status?.timestamp,
368
- created_at: error?.data?.status?.timestamp,
369
- group_id: error?.data?.status?.transactionId,
370
- request_id: error?.data?.status?.transactionId,
371
- result: {
372
- source_output: {
373
- aadhaar_linked: null,
374
- address: {
375
- city: null,
376
- country: null,
377
- full: null,
378
- line_1: null,
379
- line_2: null,
380
- state: null,
381
- street_name: null,
382
- zip: null,
383
- },
384
- age: null,
385
- category: null,
386
- dob: null,
387
- dob_check: null,
388
- dob_verified: null,
389
- email: null,
390
- father_name: null,
391
- full_name: null,
392
- full_name_split: null,
393
- gender: null,
394
- input_dob: null,
395
- is_minor: null,
396
- less_info: null,
397
- masked_aadhaar: null,
398
- pan_alloted_date: null,
399
- pan_number: null,
400
- phone_number: null,
401
- status: "id_not_found",
402
- },
403
- },
404
- status: "failed",
405
- task_id: "null",
406
- type: "ind_pan_plus",
407
- },
408
- ];
252
+ try {
253
+ const response = await axios.post(
254
+ `${this.baseUrl}/panCard/panDetailedContactV4`,
255
+ form,
256
+ {
257
+ headers: {
258
+ "x-api-key": this.apiKey,
259
+ ...form.getHeaders(),
260
+ },
409
261
  }
410
- }
262
+ );
263
+ const data = response?.data?.response;
264
+ const panInfo: PANInfo = {
265
+ action: "verify_with_source",
266
+ completed_at: response?.data?.status?.timestamp,
267
+ created_at: response?.data?.status?.timestamp,
268
+ group_id: response?.data?.status?.transactionId,
269
+ request_id: response?.data?.status?.transactionId,
270
+ result: {
271
+ source_output: {
272
+ aadhaar_linked: data.aadhaarSeedingStatus ?? false,
273
+ address: {
274
+ city: data?.city || null,
275
+ country: data?.country || "India",
276
+ full: data?.country || "India",
277
+ line_1: data?.address || null,
278
+ line_2: data?.address || null,
279
+ state: data?.state || null,
280
+ street_name: null,
281
+ zip: data?.pincode || null,
282
+ },
283
+ age: 30,
284
+ category: data?.typeOfHolder || "person",
285
+ dob: data?.dob || "",
286
+ dob_check: null,
287
+ dob_verified: null,
288
+ email: data?.email || "",
289
+ father_name: data?.middleName || null,
290
+ full_name: data?.name || "",
291
+ full_name_split: [
292
+ data?.firstName,
293
+ data?.middleName,
294
+ data?.lastName,
295
+ ],
296
+ gender: data?.gender || "M",
297
+ input_dob: null,
298
+ is_minor: false,
299
+ less_info: null,
300
+ masked_aadhaar: data?.maskedAadhaar || "XXXXXXXXXXXX",
301
+ pan_alloted_date: null,
302
+ pan_number: panNo || "",
303
+ phone_number: "",
304
+ status: "id_found",
305
+ },
306
+ },
307
+ status: "completed",
308
+ task_id: response?.data?.status?.transactionId,
309
+ type: "ind_pan_plus",
310
+ dataDump: JSON.stringify(response?.data),
311
+ };
411
312
 
412
- public async getMaskedPanByAadhaar({ aadhaarNo }: { aadhaarNo: string }) {
413
- try {
414
- const form = new FormData();
415
- form.append("aadhaarNo", aadhaarNo);
416
- const response = await axios.post(
417
- `${this.baseUrl}/aadhaar/aadhaarToPan`,
418
- form,
419
- {
420
- headers: {
421
- "x-api-key": this.apiKey,
422
- ...form.getHeaders(),
423
- },
424
- }
425
- );
313
+ const errorPAN: PANInfo = {
314
+ action: "verify_with_source",
315
+ completed_at: response?.data?.status?.timestamp,
316
+ created_at: response?.data?.status?.timestamp,
317
+ group_id: response?.data?.status?.transactionId,
318
+ request_id: response?.data?.status?.transactionId,
319
+ result: {
320
+ source_output: {
321
+ aadhaar_linked: null,
322
+ address: {
323
+ city: null,
324
+ country: null,
325
+ full: null,
326
+ line_1: null,
327
+ line_2: null,
328
+ state: null,
329
+ street_name: null,
330
+ zip: null,
331
+ },
332
+ age: null,
333
+ category: null,
334
+ dob: null,
335
+ dob_check: null,
336
+ dob_verified: null,
337
+ email: null,
338
+ father_name: null,
339
+ full_name: null,
340
+ full_name_split: null,
341
+ gender: null,
342
+ input_dob: null,
343
+ is_minor: null,
344
+ less_info: null,
345
+ masked_aadhaar: null,
346
+ pan_alloted_date: null,
347
+ pan_number: null,
348
+ phone_number: null,
349
+ status: "id_not_found",
350
+ },
351
+ },
352
+ status: "completed",
353
+ task_id: response?.data?.status?.transactionId,
354
+ type: "ind_pan_plus",
355
+ dataDump: JSON.stringify(response?.data),
356
+ };
426
357
 
427
- const data: IAadhaarVerificationPayload = response?.data;
428
- console.log(data);
358
+ if (response?.data?.response?.code == 200) {
359
+ return [panInfo];
360
+ } else if (response?.data?.status?.statusCode === 400) {
361
+ errorPAN.result.source_output.status = "source_down";
362
+ return [errorPAN];
363
+ } else {
364
+ return [errorPAN];
365
+ }
366
+ } catch (error: any) {
367
+ return [
368
+ {
369
+ action: "verify_with_source",
370
+ completed_at: error?.data?.status?.timestamp,
371
+ created_at: error?.data?.status?.timestamp,
372
+ group_id: error?.data?.status?.transactionId,
373
+ request_id: error?.data?.status?.transactionId,
374
+ result: {
375
+ source_output: {
376
+ aadhaar_linked: null,
377
+ address: {
378
+ city: null,
379
+ country: null,
380
+ full: null,
381
+ line_1: null,
382
+ line_2: null,
383
+ state: null,
384
+ street_name: null,
385
+ zip: null,
386
+ },
387
+ age: null,
388
+ category: null,
389
+ dob: null,
390
+ dob_check: null,
391
+ dob_verified: null,
392
+ email: null,
393
+ father_name: null,
394
+ full_name: null,
395
+ full_name_split: null,
396
+ gender: null,
397
+ input_dob: null,
398
+ is_minor: null,
399
+ less_info: null,
400
+ masked_aadhaar: null,
401
+ pan_alloted_date: null,
402
+ pan_number: null,
403
+ phone_number: null,
404
+ status: "id_not_found",
405
+ },
406
+ },
407
+ status: "failed",
408
+ task_id: "null",
409
+ type: "ind_pan_plus",
410
+ dataDump: "null",
411
+ },
412
+ ];
413
+ }
414
+ }
429
415
 
430
- return data;
431
- } catch (error) {
432
- throw error;
416
+ public async getMaskedPanByAadhaar({ aadhaarNo }: { aadhaarNo: string }) {
417
+ try {
418
+ const form = new FormData();
419
+ form.append("aadhaarNo", aadhaarNo);
420
+ const response = await axios.post(
421
+ `${this.baseUrl}/aadhaar/aadhaarToPan`,
422
+ form,
423
+ {
424
+ headers: {
425
+ "x-api-key": this.apiKey,
426
+ ...form.getHeaders(),
427
+ },
433
428
  }
434
- }
429
+ );
435
430
 
436
- public async getAadhaarOtp({ aadhaarNo }: { aadhaarNo: string }) {
437
- try {
438
- const form = new FormData();
439
- form.append("aadhaarNo", aadhaarNo);
440
- form.append("task", KycCartAPIWrapper.AADHAAR_TASKS.GET_OTP);
441
- const response = await axios.post(
442
- `${this.baseUrl}/aadhaar/aadhaarOfflineOtpV5`,
443
- form,
444
- {
445
- headers: {
446
- "x-api-key": this.apiKey,
447
- ...form.getHeaders(),
448
- },
449
- }
450
- );
451
- const data: IAadhaarOfflineGetOTPResponse = response?.data;
452
- console.log(data);
431
+ const data: IAadhaarVerificationPayload = response?.data;
432
+ console.log(data);
453
433
 
454
- return data;
455
- } catch (error) {
456
- throw error;
457
- }
434
+ return data;
435
+ } catch (error) {
436
+ throw error;
458
437
  }
438
+ }
459
439
 
460
- public async verifyAadhaarOtp({
461
- aadhaarNo,
462
- otp,
463
- requestId,
464
- }: {
465
- requestId: string;
466
- aadhaarNo: string;
467
- otp: string;
468
- }) {
469
- try {
470
- const form = new FormData();
471
- form.append("aadhaarNo", aadhaarNo);
472
- form.append("otp", otp);
473
- form.append("requestId", requestId);
474
- form.append("task", KycCartAPIWrapper.AADHAAR_TASKS.GET_FILE);
475
- const response = await axios.post(
476
- `${this.baseUrl}/aadhaar/aadhaarOfflineOtpV5`,
477
- form,
478
- {
479
- headers: {
480
- "x-api-key": this.apiKey,
481
- ...form.getHeaders(),
482
- },
483
- }
484
- );
485
- const data: IAadhaarOfflineGetFileResponse = response?.data;
486
-
487
- return data;
488
- } catch (error) {
489
- throw error;
440
+ public async getAadhaarOtp({ aadhaarNo }: { aadhaarNo: string }) {
441
+ try {
442
+ const form = new FormData();
443
+ form.append("aadhaarNo", aadhaarNo);
444
+ form.append("task", KycCartAPIWrapper.AADHAAR_TASKS.GET_OTP);
445
+ const response = await axios.post(
446
+ `${this.baseUrl}/aadhaar/aadhaarOfflineOtpV5`,
447
+ form,
448
+ {
449
+ headers: {
450
+ "x-api-key": this.apiKey,
451
+ ...form.getHeaders(),
452
+ },
490
453
  }
454
+ );
455
+ const data: IAadhaarOfflineGetOTPResponse = response?.data;
456
+ console.log(data);
457
+
458
+ return data;
459
+ } catch (error) {
460
+ throw error;
491
461
  }
462
+ }
492
463
 
493
- public async nameMatch(payload: INameMatchRequest) {
494
- try {
495
- const response = await axios.get(
496
- `${this.baseUrl}/match/name?name1=${payload.name1}&name2=${payload.name2}`,
497
- {
498
- headers: {
499
- "x-api-key": this.apiKey,
500
- },
501
- }
502
- );
464
+ public async verifyAadhaarOtp({
465
+ aadhaarNo,
466
+ otp,
467
+ requestId,
468
+ }: {
469
+ requestId: string;
470
+ aadhaarNo: string;
471
+ otp: string;
472
+ }) {
473
+ try {
474
+ const form = new FormData();
475
+ form.append("aadhaarNo", aadhaarNo);
476
+ form.append("otp", otp);
477
+ form.append("requestId", requestId);
478
+ form.append("task", KycCartAPIWrapper.AADHAAR_TASKS.GET_FILE);
479
+ const response = await axios.post(
480
+ `${this.baseUrl}/aadhaar/aadhaarOfflineOtpV5`,
481
+ form,
482
+ {
483
+ headers: {
484
+ "x-api-key": this.apiKey,
485
+ ...form.getHeaders(),
486
+ },
487
+ }
488
+ );
489
+ const data: IAadhaarOfflineGetFileResponse = response?.data;
503
490
 
504
- const data: INameMatchResponse = response?.data;
491
+ return data;
492
+ } catch (error) {
493
+ throw error;
494
+ }
495
+ }
505
496
 
506
- return data;
507
- } catch (error) {
508
- throw error;
497
+ public async nameMatch(payload: INameMatchRequest) {
498
+ try {
499
+ const response = await axios.get(
500
+ `${this.baseUrl}/match/name?name1=${payload.name1}&name2=${payload.name2}`,
501
+ {
502
+ headers: {
503
+ "x-api-key": this.apiKey,
504
+ },
509
505
  }
506
+ );
507
+
508
+ const data: INameMatchResponse = response?.data;
509
+
510
+ return data;
511
+ } catch (error) {
512
+ throw error;
510
513
  }
514
+ }
511
515
 
512
- public async accountTransferHybrid(
513
- payload: IAccountTransferHybridRequest
514
- ): Promise<IAccountTransferHybridResponse> {
515
- try {
516
- const form = new FormData();
517
- form.append("accountNumber", payload.accountNumber);
518
- form.append("ifsc", payload.ifsc);
519
-
520
- const response = await axios.post(
521
- `${this.baseUrl}/bank/accountTransferHybrid`,
522
- form,
523
- {
524
- headers: {
525
- "x-api-key": this.apiKey,
526
- ...form.getHeaders(),
527
- },
528
- }
529
- );
530
-
531
- return response.data;
532
- } catch (error) {
533
- throw error;
516
+ public async accountTransferHybrid(
517
+ payload: IAccountTransferHybridRequest
518
+ ): Promise<IAccountTransferHybridResponse> {
519
+ try {
520
+ const form = new FormData();
521
+ form.append("accountNumber", payload.accountNumber);
522
+ form.append("ifsc", payload.ifsc);
523
+
524
+ const response = await axios.post(
525
+ `${this.baseUrl}/bank/accountTransferHybrid`,
526
+ form,
527
+ {
528
+ headers: {
529
+ "x-api-key": this.apiKey,
530
+ ...form.getHeaders(),
531
+ },
534
532
  }
533
+ );
534
+
535
+ return response.data;
536
+ } catch (error) {
537
+ throw error;
535
538
  }
539
+ }
536
540
  }