aeremmiddleware 1.0.3 → 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/dist/Finance/Ingenico.types.d.ts +21 -0
- package/dist/Finance/Ingenico.types.js +3 -0
- package/dist/Finance/Ingenico.types.js.map +1 -0
- package/dist/Finance/crimeCheck.d.ts +16 -0
- package/dist/Finance/crimeCheck.js +137 -0
- package/dist/Finance/crimeCheck.js.map +1 -0
- package/dist/Finance/crimecheck.types.d.ts +30 -0
- package/dist/Finance/crimecheck.types.js +3 -0
- package/dist/Finance/crimecheck.types.js.map +1 -0
- package/dist/Finance/encrypt.d.ts +1 -0
- package/dist/Finance/encrypt.js +20 -0
- package/dist/Finance/encrypt.js.map +1 -0
- package/dist/Finance/idfy.d.ts +63 -35
- package/dist/Finance/idfy.js +411 -201
- package/dist/Finance/idfy.js.map +1 -1
- package/dist/Finance/index.d.ts +6 -4
- package/dist/Finance/index.js +12 -10
- package/dist/Finance/index.js.map +1 -1
- package/dist/Finance/ingenico.d.ts +13 -0
- package/dist/Finance/ingenico.js +122 -0
- package/dist/Finance/ingenico.js.map +1 -0
- package/dist/Finance/ingenicoHtml.d.ts +2 -0
- package/dist/Finance/ingenicoHtml.js +122 -0
- package/dist/Finance/ingenicoHtml.js.map +1 -0
- package/dist/Finance/novel.d.ts +35 -0
- package/dist/Finance/novel.js +222 -0
- package/dist/Finance/novel.js.map +1 -0
- package/dist/Finance/novel.types.d.ts +23 -0
- package/dist/Finance/novel.types.js +10 -0
- package/dist/Finance/novel.types.js.map +1 -0
- package/dist/Maps/index.js +1 -1
- package/dist/Socials/Sms.types.d.ts +8 -0
- package/dist/Socials/Sms.types.js +9 -0
- package/dist/Socials/Sms.types.js.map +1 -0
- package/dist/Socials/SmsSender.d.ts +17 -0
- package/dist/Socials/SmsSender.js +74 -0
- package/dist/Socials/SmsSender.js.map +1 -0
- package/dist/Socials/Whatsapp.types.d.ts +93 -97
- package/dist/Socials/Whatsapp.types.js +8 -8
- package/dist/Socials/Whatsapp.types.js.map +1 -1
- package/dist/Socials/index.d.ts +6 -4
- package/dist/Socials/index.js +12 -10
- package/dist/Socials/index.js.map +1 -1
- package/dist/Socials/whatsApp.d.ts +23 -0
- package/dist/Socials/whatsApp.js +169 -0
- package/dist/Socials/whatsApp.js.map +1 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.js +8 -8
- package/package.json +1 -1
- package/src/Finance/Ingenico.types.ts +3 -0
- package/src/Finance/crimeCheck.ts +135 -0
- package/src/Finance/crimecheck.types.ts +31 -0
- package/src/Finance/idfy.ts +497 -255
- package/src/Finance/ingenico.ts +36 -136
- package/src/Finance/ingenicoHtml.ts +119 -0
- package/src/Socials/SmsSender.ts +20 -21
package/src/Finance/idfy.ts
CHANGED
|
@@ -1,292 +1,534 @@
|
|
|
1
1
|
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
|
+
interface ObjectTypes {
|
|
3
|
+
IDFY_TASK_ID: string;
|
|
4
|
+
IDFY_GROUP_ID: string;
|
|
5
|
+
IDFY_ACCOUNT_ID: string;
|
|
6
|
+
IDFY_API_KEY: string;
|
|
7
|
+
IDFY_COMPANY_SEARCH_API_KEY: string;
|
|
8
|
+
}
|
|
9
|
+
export default class IdfyAPIWrapper {
|
|
10
|
+
private bodyTaskIdGroupId = {
|
|
11
|
+
task_id: "",
|
|
12
|
+
group_id: "",
|
|
13
|
+
};
|
|
14
|
+
private defaultHeaderIdfyApi = {
|
|
15
|
+
"account-id": "",
|
|
16
|
+
"api-key": "",
|
|
17
|
+
};
|
|
18
|
+
private standardErrorThrowFormat = {
|
|
19
|
+
statusCode: 400,
|
|
20
|
+
message: ["bad request"],
|
|
21
|
+
};
|
|
22
|
+
private baseUrl: string = "https://eve.idfy.com/";
|
|
23
|
+
private gstVerificationEndPoint =
|
|
24
|
+
"v3/tasks/sync/verify_with_source/ind_gst_certificate";
|
|
25
|
+
private panIndividualVerificationEndPoint =
|
|
26
|
+
"v3/tasks/async/verify_with_source/ind_pan_plus";
|
|
27
|
+
private cinCompanyVerificationEndPoint =
|
|
28
|
+
"v3/tasks/async/verify_with_source/ind_mca";
|
|
29
|
+
private taskUrl = "v3/tasks?request_id=";
|
|
30
|
+
private asyncIndividualAadhaarLiteInfoEndPoint =
|
|
31
|
+
"v3/tasks/async/verify_with_source/aadhaar_lite";
|
|
32
|
+
private syncIndividualAadharScanInfoEndpoint =
|
|
33
|
+
"v3/tasks/sync/extract/ind_aadhaar_plus";
|
|
34
|
+
private syncIndividualPANScanInfoEndpoint = "v3/tasks/sync/extract/ind_pan";
|
|
35
|
+
private syncIndividualGSTScanInfoEndpoint =
|
|
36
|
+
"v3/tasks/sync/extract/ind_gst_certificate";
|
|
37
|
+
private syncIndividualLiveFaceLivenessEndpoint =
|
|
38
|
+
"v3/tasks/sync/check_photo_liveness/face";
|
|
2
39
|
|
|
40
|
+
private idfyCompanySearch = {
|
|
41
|
+
defaultHeader: {
|
|
42
|
+
"api-key": "",
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
},
|
|
45
|
+
version: "v1",
|
|
46
|
+
companySearchUrl: "https://riskai.idfystaging.com/api/v1/company/search",
|
|
47
|
+
taskBaseUrl: "https://riskai.idfystaging.com/api/v1/task/",
|
|
48
|
+
cinllpinUrl: "https://riskai.idfystaging.com/api/v1/company/basic",
|
|
49
|
+
};
|
|
3
50
|
|
|
4
|
-
|
|
51
|
+
private idfyError = {
|
|
52
|
+
INVALID_IMAGE: {
|
|
53
|
+
idfyErrorCode: "IDFY_ERR_100",
|
|
54
|
+
message: "Please scan correct document",
|
|
55
|
+
},
|
|
56
|
+
INSUFFICIENT_CREDITS: {
|
|
57
|
+
idfyErrorCode: "IDFY_ERR_101",
|
|
58
|
+
message: "Please renew credit",
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
constructor({
|
|
63
|
+
IDFY_TASK_ID,
|
|
64
|
+
IDFY_GROUP_ID,
|
|
65
|
+
IDFY_ACCOUNT_ID,
|
|
66
|
+
IDFY_API_KEY,
|
|
67
|
+
IDFY_COMPANY_SEARCH_API_KEY,
|
|
68
|
+
}: ObjectTypes) {
|
|
69
|
+
this.bodyTaskIdGroupId.task_id = IDFY_TASK_ID;
|
|
70
|
+
this.bodyTaskIdGroupId.group_id = IDFY_GROUP_ID;
|
|
71
|
+
this.defaultHeaderIdfyApi["account-id"] = IDFY_ACCOUNT_ID;
|
|
72
|
+
this.defaultHeaderIdfyApi["api-key"] = IDFY_API_KEY;
|
|
73
|
+
this.idfyCompanySearch.defaultHeader["api-key"] =
|
|
74
|
+
IDFY_COMPANY_SEARCH_API_KEY;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private async makeRequest<T>(
|
|
78
|
+
method: string,
|
|
79
|
+
endpoint: string,
|
|
80
|
+
data?: any
|
|
81
|
+
): Promise<T> {
|
|
82
|
+
const requestConfig: AxiosRequestConfig = {
|
|
83
|
+
method,
|
|
84
|
+
url: this.baseUrl + endpoint,
|
|
85
|
+
headers: this.defaultHeaderIdfyApi,
|
|
86
|
+
data,
|
|
87
|
+
};
|
|
5
88
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
89
|
+
try {
|
|
90
|
+
const response: AxiosResponse<T> = await axios(requestConfig);
|
|
91
|
+
return response.data;
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error("Error while making Idfy Axios API request:", error);
|
|
94
|
+
throw error;
|
|
9
95
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private async makeAxiosRequest<T>({
|
|
99
|
+
method,
|
|
100
|
+
url,
|
|
101
|
+
data,
|
|
102
|
+
headers,
|
|
103
|
+
}: {
|
|
104
|
+
method: string;
|
|
105
|
+
url: string;
|
|
106
|
+
data?: any;
|
|
107
|
+
headers: any;
|
|
108
|
+
}): Promise<T> {
|
|
109
|
+
const requestConfig: AxiosRequestConfig = {
|
|
110
|
+
method,
|
|
111
|
+
url,
|
|
112
|
+
headers,
|
|
113
|
+
data,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
const response: AxiosResponse<T> = await axios(requestConfig);
|
|
118
|
+
return response.data;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error(
|
|
121
|
+
"Error while making Idfy makeAxiosRequest API request:",
|
|
122
|
+
error
|
|
123
|
+
);
|
|
124
|
+
throw error;
|
|
13
125
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private async getTask(requestId: string): Promise<any> {
|
|
129
|
+
try {
|
|
130
|
+
// const data = {}
|
|
131
|
+
const urlEndPoint = this.taskUrl + requestId;
|
|
132
|
+
const response = await this.makeRequest<any>("get", urlEndPoint);
|
|
133
|
+
return response;
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.error("Error while fetching Idfy getTask API data:", error);
|
|
136
|
+
throw error;
|
|
17
137
|
}
|
|
18
|
-
|
|
19
|
-
private gstVerificationEndPoint = 'v3/tasks/sync/verify_with_source/ind_gst_certificate'
|
|
20
|
-
private panIndividualVerificationEndPoint = 'v3/tasks/async/verify_with_source/ind_pan_plus'
|
|
21
|
-
private cinCompanyVerificationEndPoint = 'v3/tasks/async/verify_with_source/ind_mca'
|
|
22
|
-
private taskUrl = 'v3/tasks?request_id='
|
|
23
|
-
private asyncIndividualAadhaarLiteInfoEndPoint='v3/tasks/async/verify_with_source/aadhaar_lite'
|
|
24
|
-
private syncIndividualAadharScanInfoEndpoint = 'v3/tasks/sync/extract/ind_aadhaar_plus'
|
|
25
|
-
private syncIndividualPANScanInfoEndpoint = 'v3/tasks/sync/extract/ind_pan'
|
|
26
|
-
private syncIndividualGSTScanInfoEndpoint = 'v3/tasks/sync/extract/ind_gst_certificate'
|
|
27
|
-
private syncIndividualLiveFaceLivenessEndpoint = 'v3/tasks/sync/check_photo_liveness/face'
|
|
138
|
+
}
|
|
28
139
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
140
|
+
private async getCompanySearchTask({
|
|
141
|
+
requestId,
|
|
142
|
+
}: {
|
|
143
|
+
requestId: string;
|
|
144
|
+
}): Promise<any> {
|
|
145
|
+
try {
|
|
146
|
+
const taskBaseUrl = this.idfyCompanySearch.taskBaseUrl + requestId;
|
|
147
|
+
const response = await this.makeAxiosRequest({
|
|
148
|
+
method: "get",
|
|
149
|
+
url: taskBaseUrl,
|
|
150
|
+
headers: this.idfyCompanySearch.defaultHeader,
|
|
151
|
+
});
|
|
152
|
+
return response;
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.error(
|
|
155
|
+
"Error while fetching Idfy getCompanySearchTask API data:",
|
|
156
|
+
error
|
|
157
|
+
);
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
39
161
|
|
|
40
|
-
|
|
162
|
+
private async pingTaskUntilSuccess(requestId: string): Promise<any> {
|
|
163
|
+
try {
|
|
164
|
+
let res: any = null;
|
|
165
|
+
const checkTaskAfter1sec = (requestId: any) => {
|
|
166
|
+
return new Promise<any>((resolve, reject) => {
|
|
167
|
+
try {
|
|
168
|
+
setTimeout(async () => {
|
|
169
|
+
const data = await this.getTask(requestId);
|
|
170
|
+
if (res?.[0].status == "failed") {
|
|
171
|
+
reject(res);
|
|
172
|
+
}
|
|
173
|
+
resolve(data);
|
|
174
|
+
}, 1000);
|
|
175
|
+
} catch (e) {
|
|
176
|
+
reject(e);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
do {
|
|
181
|
+
res = await checkTaskAfter1sec(requestId);
|
|
41
182
|
|
|
183
|
+
console.log("### res ", res);
|
|
184
|
+
} while (res?.[0].status !== "completed");
|
|
42
185
|
|
|
43
|
-
|
|
186
|
+
return res;
|
|
187
|
+
} catch (error) {
|
|
188
|
+
console.error("Error while fetching Idfy getTask API data:", error);
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
44
192
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
193
|
+
private async pingCompanySearchTaskUntilSuccess(
|
|
194
|
+
requestId: string
|
|
195
|
+
): Promise<any> {
|
|
196
|
+
try {
|
|
197
|
+
console.log(" ## requestId ", requestId);
|
|
198
|
+
let res: any = null;
|
|
199
|
+
const checkTaskAfter1sec = (requestId: string) => {
|
|
200
|
+
return new Promise<any>((resolve, reject) => {
|
|
201
|
+
try {
|
|
202
|
+
setTimeout(async () => {
|
|
203
|
+
const data = await this.getCompanySearchTask({ requestId });
|
|
204
|
+
if (data.status != "failed") {
|
|
205
|
+
resolve(data);
|
|
206
|
+
} else {
|
|
207
|
+
reject(res);
|
|
208
|
+
}
|
|
209
|
+
}, 1000);
|
|
210
|
+
} catch (e) {
|
|
211
|
+
reject(e);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
do {
|
|
216
|
+
res = await checkTaskAfter1sec(requestId);
|
|
217
|
+
console.log("### res ", res);
|
|
218
|
+
} while (res?.status !== "completed");
|
|
56
219
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
console.error("Error while making Idfy Axios API request:", error);
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
220
|
+
return res;
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.error("Error while fetching Idfy getTask API data:", error);
|
|
223
|
+
throw error;
|
|
64
224
|
}
|
|
225
|
+
}
|
|
226
|
+
async getCompanyGstInfo({ gstNo }: { gstNo: string }): Promise<any> {
|
|
227
|
+
try {
|
|
228
|
+
const data = {
|
|
229
|
+
...this.bodyTaskIdGroupId,
|
|
230
|
+
data: {
|
|
231
|
+
gstin: gstNo,
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
const response = await this.makeRequest<any>(
|
|
235
|
+
"post",
|
|
236
|
+
this.gstVerificationEndPoint,
|
|
237
|
+
data
|
|
238
|
+
);
|
|
239
|
+
return response;
|
|
240
|
+
} catch (error: any) {
|
|
241
|
+
if (error?.response?.data?.error) {
|
|
242
|
+
const errorObj = this.idfyError[error?.response?.data?.error];
|
|
243
|
+
if (errorObj)
|
|
244
|
+
throw {
|
|
245
|
+
...this.standardErrorThrowFormat,
|
|
246
|
+
message: this.idfyError[errorKey],
|
|
247
|
+
};
|
|
248
|
+
}
|
|
65
249
|
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
// const data = {}
|
|
69
|
-
const urlEndPoint = this.taskUrl + requestId
|
|
70
|
-
const response = await this.makeRequest<any>("get", urlEndPoint);
|
|
71
|
-
return response;
|
|
72
|
-
} catch (error) {
|
|
73
|
-
console.error("Error while fetching Idfy getTask API data:", error);
|
|
74
|
-
throw error;
|
|
75
|
-
}
|
|
250
|
+
throw error;
|
|
76
251
|
}
|
|
252
|
+
}
|
|
253
|
+
async getCompanyCINInfo({ cinNo }: { cinNo: string }): Promise<any> {
|
|
254
|
+
try {
|
|
255
|
+
const data = {
|
|
256
|
+
...this.bodyTaskIdGroupId,
|
|
257
|
+
data: {
|
|
258
|
+
cin: cinNo,
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
const response = await this.makeRequest<any>(
|
|
262
|
+
"post",
|
|
263
|
+
this.cinCompanyVerificationEndPoint,
|
|
264
|
+
data
|
|
265
|
+
);
|
|
266
|
+
const successData = await this.pingTaskUntilSuccess(response.request_id);
|
|
77
267
|
|
|
78
|
-
|
|
79
|
-
|
|
268
|
+
return successData?.[0]?.result?.source_output;
|
|
269
|
+
} catch (error) {
|
|
270
|
+
if (error?.response?.data?.error) {
|
|
271
|
+
const errorObj = this.idfyError[error?.response?.data?.error];
|
|
272
|
+
if (errorObj)
|
|
273
|
+
throw {
|
|
274
|
+
...this.standardErrorThrowFormat,
|
|
275
|
+
message: [errorObj.message],
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
throw error;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async getIndividualPANInfo({ panNo }: { panNo: string }): Promise<any> {
|
|
282
|
+
try {
|
|
283
|
+
const data = {
|
|
284
|
+
...this.bodyTaskIdGroupId,
|
|
285
|
+
data: {
|
|
286
|
+
id_number: panNo,
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
const response = await this.makeRequest<any>(
|
|
290
|
+
"post",
|
|
291
|
+
this.panIndividualVerificationEndPoint,
|
|
292
|
+
data
|
|
293
|
+
);
|
|
294
|
+
const successData = await this.pingTaskUntilSuccess(response.request_id);
|
|
80
295
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
reject(e)
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
do {
|
|
99
|
-
res = await checkTaskAfter1sec(requestId)
|
|
100
|
-
|
|
101
|
-
console.log( "### res ",res) ;
|
|
102
|
-
} while (res?.[0].status !== 'completed')
|
|
296
|
+
return successData;
|
|
297
|
+
} catch (error) {
|
|
298
|
+
if (error?.response?.data?.error) {
|
|
299
|
+
const errorObj = this.idfyError[error?.response?.data?.error];
|
|
300
|
+
if (errorObj)
|
|
301
|
+
throw {
|
|
302
|
+
...this.standardErrorThrowFormat,
|
|
303
|
+
message: [errorObj.message],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
throw error;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
103
309
|
|
|
104
|
-
|
|
310
|
+
async getSyncIndividualAadharScanInfo({
|
|
311
|
+
frontScanBase64,
|
|
312
|
+
backScanBase64,
|
|
313
|
+
}: {
|
|
314
|
+
frontScanBase64: string;
|
|
315
|
+
backScanBase64: string;
|
|
316
|
+
}): Promise<any> {
|
|
317
|
+
try {
|
|
318
|
+
const data = {
|
|
319
|
+
...this.bodyTaskIdGroupId,
|
|
320
|
+
data: {
|
|
321
|
+
document1: frontScanBase64,
|
|
322
|
+
document2: backScanBase64,
|
|
323
|
+
consent: "yes",
|
|
324
|
+
advanced_details: {
|
|
325
|
+
extract_qr_info: true,
|
|
326
|
+
extract_last_4_digit: false,
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
const response = await this.makeRequest<any>(
|
|
331
|
+
"post",
|
|
332
|
+
this.syncIndividualAadharScanInfoEndpoint,
|
|
333
|
+
data
|
|
334
|
+
);
|
|
105
335
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
336
|
+
return response?.result;
|
|
337
|
+
} catch (error) {
|
|
338
|
+
if (error?.response?.data?.error) {
|
|
339
|
+
const errorObj = this.idfyError[error?.response?.data?.error];
|
|
340
|
+
if (errorObj)
|
|
341
|
+
throw {
|
|
342
|
+
...this.standardErrorThrowFormat,
|
|
343
|
+
message: [errorObj.message],
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
throw error;
|
|
110
347
|
}
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
const data = {
|
|
114
|
-
...(this.bodyTaskIdGroupId),
|
|
115
|
-
data: {
|
|
116
|
-
gstin: gstNo,
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
const response = await this.makeRequest<any>("post", this.gstVerificationEndPoint, data);
|
|
120
|
-
return response;
|
|
121
|
-
} catch (error) {
|
|
122
|
-
|
|
123
|
-
// if(error?.response?.data?.error){
|
|
124
|
-
// const errorObj = this.idfyError[error?.response?.data?.error]
|
|
125
|
-
// if(errorObj)
|
|
126
|
-
// throw ({ ...this.standardErrorThrowFormat, message: [errorObj.message] })
|
|
127
|
-
// }
|
|
348
|
+
}
|
|
128
349
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
350
|
+
async getSyncIndividualPANScanInfo({
|
|
351
|
+
frontScanBase64,
|
|
352
|
+
}: {
|
|
353
|
+
frontScanBase64: string;
|
|
354
|
+
}): Promise<any> {
|
|
355
|
+
try {
|
|
356
|
+
const data = {
|
|
357
|
+
...this.bodyTaskIdGroupId,
|
|
358
|
+
data: {
|
|
359
|
+
document1: frontScanBase64,
|
|
360
|
+
consent: "yes",
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
const response = await this.makeRequest<any>(
|
|
364
|
+
"post",
|
|
365
|
+
this.syncIndividualPANScanInfoEndpoint,
|
|
366
|
+
data
|
|
367
|
+
);
|
|
142
368
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
369
|
+
return response?.result;
|
|
370
|
+
} catch (error) {
|
|
371
|
+
if (error?.response?.data?.error) {
|
|
372
|
+
const errorObj = this.idfyError[error?.response?.data?.error];
|
|
373
|
+
if (errorObj)
|
|
374
|
+
throw {
|
|
375
|
+
...this.standardErrorThrowFormat,
|
|
376
|
+
message: [errorObj.message],
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
throw error;
|
|
152
380
|
}
|
|
153
|
-
|
|
154
|
-
try {
|
|
155
|
-
const data = {
|
|
156
|
-
...(this.bodyTaskIdGroupId),
|
|
157
|
-
data: {
|
|
158
|
-
"id_number": panNo,
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
const response = await this.makeRequest<any>("post", this.panIndividualVerificationEndPoint, data);
|
|
162
|
-
const successData = await this.pingTaskUntilSuccess(response.request_id)
|
|
381
|
+
}
|
|
163
382
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
383
|
+
async getSyncCompanyGSTScanInfo({
|
|
384
|
+
frontScanBase64,
|
|
385
|
+
}: {
|
|
386
|
+
frontScanBase64: string;
|
|
387
|
+
}): Promise<any> {
|
|
388
|
+
try {
|
|
389
|
+
const data = {
|
|
390
|
+
...this.bodyTaskIdGroupId,
|
|
391
|
+
data: {
|
|
392
|
+
document1: frontScanBase64,
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
const response = await this.makeRequest<any>(
|
|
396
|
+
"post",
|
|
397
|
+
this.syncIndividualGSTScanInfoEndpoint,
|
|
398
|
+
data
|
|
399
|
+
);
|
|
174
400
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
const response = await this.makeRequest<any>("post", this.syncIndividualAadharScanInfoEndpoint, data);
|
|
190
|
-
|
|
191
|
-
return response?.result;
|
|
192
|
-
} catch (error) {
|
|
193
|
-
// if(error?.response?.data?.error){
|
|
194
|
-
// const errorObj = this.idfyError[error?.response?.data?.error]
|
|
195
|
-
// if(errorObj)
|
|
196
|
-
// throw ({ ...this.standardErrorThrowFormat, message: [errorObj.message] })
|
|
197
|
-
// }
|
|
198
|
-
throw error;
|
|
199
|
-
}
|
|
401
|
+
return response?.result;
|
|
402
|
+
} catch (error) {
|
|
403
|
+
if (error?.response?.data?.error) {
|
|
404
|
+
const errorObj = this.idfyError[error?.response?.data?.error];
|
|
405
|
+
if (errorObj)
|
|
406
|
+
throw {
|
|
407
|
+
...this.standardErrorThrowFormat,
|
|
408
|
+
message: [errorObj.message],
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
throw error;
|
|
200
412
|
}
|
|
413
|
+
}
|
|
201
414
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
415
|
+
async getSyncIndividualLivenessSelfyScanInfo({
|
|
416
|
+
faceScanBase64,
|
|
417
|
+
}: {
|
|
418
|
+
faceScanBase64: string;
|
|
419
|
+
}): Promise<any> {
|
|
420
|
+
try {
|
|
421
|
+
const data = {
|
|
422
|
+
...this.bodyTaskIdGroupId,
|
|
423
|
+
data: {
|
|
424
|
+
document1: faceScanBase64,
|
|
425
|
+
consent: "yes",
|
|
426
|
+
},
|
|
427
|
+
};
|
|
428
|
+
const response = await this.makeRequest<any>(
|
|
429
|
+
"post",
|
|
430
|
+
this.syncIndividualLiveFaceLivenessEndpoint,
|
|
431
|
+
data
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
return response?.result;
|
|
435
|
+
} catch (error) {
|
|
436
|
+
if (error?.response?.data?.error) {
|
|
437
|
+
const errorObj = this.idfyError[error?.response?.data?.error];
|
|
438
|
+
if (errorObj)
|
|
439
|
+
throw {
|
|
440
|
+
...this.standardErrorThrowFormat,
|
|
441
|
+
message: [errorObj.message],
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
throw error;
|
|
222
445
|
}
|
|
446
|
+
}
|
|
223
447
|
|
|
448
|
+
async getAsyncAadhaarLiteInfo({
|
|
449
|
+
aadhaarNo,
|
|
450
|
+
}: {
|
|
451
|
+
aadhaarNo: string;
|
|
452
|
+
}): Promise<any> {
|
|
453
|
+
try {
|
|
454
|
+
const data = {
|
|
455
|
+
...this.bodyTaskIdGroupId,
|
|
456
|
+
data: {
|
|
457
|
+
aadhaar_number: aadhaarNo,
|
|
458
|
+
},
|
|
459
|
+
};
|
|
460
|
+
const response = await this.makeRequest<any>(
|
|
461
|
+
"post",
|
|
462
|
+
this.asyncIndividualAadhaarLiteInfoEndPoint,
|
|
463
|
+
data
|
|
464
|
+
);
|
|
465
|
+
const successData = await this.pingTaskUntilSuccess(response.request_id);
|
|
224
466
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
} catch (error) {
|
|
237
|
-
// if(error?.response?.data?.error){
|
|
238
|
-
// const errorObj = this.idfyError[error?.response?.data?.error]
|
|
239
|
-
// if(errorObj)
|
|
240
|
-
// throw ({ ...this.standardErrorThrowFormat, message: [errorObj.message] })
|
|
241
|
-
// }
|
|
242
|
-
throw error;
|
|
243
|
-
}
|
|
467
|
+
return successData;
|
|
468
|
+
} catch (error) {
|
|
469
|
+
if (error?.response?.data?.error) {
|
|
470
|
+
const errorObj = this.idfyError[error?.response?.data?.error];
|
|
471
|
+
if (errorObj)
|
|
472
|
+
throw {
|
|
473
|
+
...this.standardErrorThrowFormat,
|
|
474
|
+
message: [errorObj.message],
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
throw error;
|
|
244
478
|
}
|
|
479
|
+
}
|
|
245
480
|
|
|
481
|
+
async getCompanyDetailsByName({
|
|
482
|
+
legalName,
|
|
483
|
+
}: {
|
|
484
|
+
legalName: string;
|
|
485
|
+
}): Promise<any> {
|
|
486
|
+
try {
|
|
487
|
+
const data = {
|
|
488
|
+
version: this.idfyCompanySearch.version,
|
|
489
|
+
...this.bodyTaskIdGroupId,
|
|
490
|
+
data: {
|
|
491
|
+
name: legalName,
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
const response = await this.makeAxiosRequest<any>({
|
|
495
|
+
method: "post",
|
|
496
|
+
url: this.idfyCompanySearch.companySearchUrl,
|
|
497
|
+
data,
|
|
498
|
+
headers: this.idfyCompanySearch.defaultHeader,
|
|
499
|
+
});
|
|
500
|
+
const successData = await this.pingCompanySearchTaskUntilSuccess(
|
|
501
|
+
response.request_id
|
|
502
|
+
);
|
|
246
503
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
...(this.bodyTaskIdGroupId),
|
|
251
|
-
data: {
|
|
252
|
-
"document1":faceScanBase64,
|
|
253
|
-
"consent":"yes",
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
const response = await this.makeRequest<any>("post", this.syncIndividualLiveFaceLivenessEndpoint, data);
|
|
257
|
-
|
|
258
|
-
return response?.result;
|
|
259
|
-
} catch (error) {
|
|
260
|
-
// if(error?.response?.data?.error){
|
|
261
|
-
// const errorObj = this.idfyError[error?.response?.data?.error]
|
|
262
|
-
// if(errorObj)
|
|
263
|
-
// throw ({ ...this.standardErrorThrowFormat, message: [errorObj.message] })
|
|
264
|
-
// }
|
|
265
|
-
throw error;
|
|
266
|
-
}
|
|
504
|
+
return { request_id: response, successData: successData };
|
|
505
|
+
} catch (error) {
|
|
506
|
+
throw error;
|
|
267
507
|
}
|
|
508
|
+
}
|
|
268
509
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
510
|
+
async getCompanyDetailsByLlpinOrCin({
|
|
511
|
+
cinOrLlpin,
|
|
512
|
+
}: {
|
|
513
|
+
cinOrLlpin: string;
|
|
514
|
+
}): Promise<any> {
|
|
515
|
+
try {
|
|
516
|
+
const data = {
|
|
517
|
+
version: this.idfyCompanySearch.version,
|
|
518
|
+
...this.bodyTaskIdGroupId,
|
|
519
|
+
data: {
|
|
520
|
+
cin_llpin: cinOrLlpin,
|
|
521
|
+
},
|
|
522
|
+
};
|
|
523
|
+
const response = await this.makeAxiosRequest<any>({
|
|
524
|
+
method: "post",
|
|
525
|
+
url: this.idfyCompanySearch.cinllpinUrl,
|
|
526
|
+
data,
|
|
527
|
+
headers: this.idfyCompanySearch.defaultHeader,
|
|
528
|
+
});
|
|
529
|
+
return { response: response };
|
|
530
|
+
} catch (error) {
|
|
531
|
+
throw error;
|
|
290
532
|
}
|
|
291
|
-
|
|
292
|
-
}
|
|
533
|
+
}
|
|
534
|
+
}
|