aeremmiddleware 1.0.41 → 1.0.43
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/idfy.d.ts +1 -1
- package/dist/Finance/idfy.js +9 -11
- package/dist/Finance/idfy.js.map +1 -1
- package/package.json +1 -1
- package/src/Finance/idfy.ts +628 -649
package/src/Finance/idfy.ts
CHANGED
|
@@ -1,676 +1,655 @@
|
|
|
1
1
|
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
2
|
interface ObjectTypes {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
callbackUrl: string;
|
|
9
9
|
}
|
|
10
10
|
export default class IdfyAPIWrapper {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
private bodyTaskIdGroupId = {
|
|
12
|
+
task_id: "",
|
|
13
|
+
group_id: "",
|
|
14
|
+
};
|
|
15
|
+
private defaultHeaderIdfyApi = {
|
|
16
|
+
"account-id": "",
|
|
17
|
+
"api-key": "",
|
|
18
|
+
};
|
|
19
|
+
private standardErrorThrowFormat = {
|
|
20
|
+
statusCode: 400,
|
|
21
|
+
message: ["bad request"],
|
|
22
|
+
};
|
|
23
|
+
private baseUrl: string = "https://eve.idfy.com/";
|
|
24
|
+
private gstVerificationEndPoint =
|
|
25
|
+
"v3/tasks/sync/verify_with_source/ind_gst_certificate";
|
|
26
|
+
private panIndividualVerificationEndPoint =
|
|
27
|
+
"v3/tasks/async/verify_with_source/ind_pan_plus";
|
|
28
|
+
private cinCompanyVerificationEndPoint =
|
|
29
|
+
"v3/tasks/async/verify_with_source/ind_mca";
|
|
30
|
+
private taskUrl = "v3/tasks?request_id=";
|
|
31
|
+
private asyncIndividualAadhaarLiteInfoEndPoint =
|
|
32
|
+
"v3/tasks/async/verify_with_source/aadhaar_lite";
|
|
33
|
+
private syncIndividualAadharScanInfoEndpoint =
|
|
34
|
+
"v3/tasks/sync/extract/ind_aadhaar_plus";
|
|
35
|
+
private syncIndividualPANScanInfoEndpoint = "v3/tasks/sync/extract/ind_pan";
|
|
36
|
+
private syncIndividualGSTScanInfoEndpoint =
|
|
37
|
+
"v3/tasks/sync/extract/ind_gst_certificate";
|
|
38
|
+
private syncIndividualLiveFaceLivenessEndpoint =
|
|
39
|
+
"v3/tasks/sync/check_photo_liveness/face";
|
|
40
|
+
private getDigilockerDetailsEndpoint =
|
|
41
|
+
"v3/tasks/async/verify_with_source/ind_digilocker_fetch_documents";
|
|
42
|
+
private key_id = "ed9cedf1-d587-4e38-bce6-b74ac9f3520d";
|
|
43
|
+
private ou_id = "e0d2add9d3c1";
|
|
44
|
+
private secret = "NzY3NmM3NzY1Y2ZjNDZmYWE1Y2QyNDM0YTljNDY2MzY=";
|
|
45
|
+
private doc_type = ["ADHAR", "PANCR"];
|
|
46
|
+
private file_format = "xml";
|
|
47
|
+
private callbackUrl: string;
|
|
48
|
+
|
|
49
|
+
private idfyCompanySearch = {
|
|
50
|
+
defaultHeader: {
|
|
51
|
+
"api-key": "",
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
},
|
|
54
|
+
version: "v1",
|
|
55
|
+
companySearchUrl: "https://riskai.idfystaging.com/api/v1/company/search",
|
|
56
|
+
taskBaseUrl: "https://riskai.idfystaging.com/api/v1/task/",
|
|
57
|
+
cinllpinUrl: "https://riskai.idfystaging.com/api/v1/company/basic",
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
private idfyError = {
|
|
61
|
+
INVALID_IMAGE: {
|
|
62
|
+
idfyErrorCode: "IDFY_ERR_100",
|
|
63
|
+
message: "Please scan correct document",
|
|
64
|
+
},
|
|
65
|
+
INSUFFICIENT_CREDITS: {
|
|
66
|
+
idfyErrorCode: "IDFY_ERR_101",
|
|
67
|
+
message: "Please renew credit",
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
constructor({
|
|
72
|
+
IDFY_TASK_ID,
|
|
73
|
+
IDFY_GROUP_ID,
|
|
74
|
+
IDFY_ACCOUNT_ID,
|
|
75
|
+
IDFY_API_KEY,
|
|
76
|
+
IDFY_COMPANY_SEARCH_API_KEY,
|
|
77
|
+
callbackUrl,
|
|
78
|
+
}: ObjectTypes) {
|
|
79
|
+
this.bodyTaskIdGroupId.task_id = IDFY_TASK_ID;
|
|
80
|
+
this.bodyTaskIdGroupId.group_id = IDFY_GROUP_ID;
|
|
81
|
+
this.defaultHeaderIdfyApi["account-id"] = IDFY_ACCOUNT_ID;
|
|
82
|
+
this.defaultHeaderIdfyApi["api-key"] = IDFY_API_KEY;
|
|
83
|
+
this.idfyCompanySearch.defaultHeader["api-key"] =
|
|
84
|
+
IDFY_COMPANY_SEARCH_API_KEY;
|
|
85
|
+
this.callbackUrl = callbackUrl;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private async makeRequest<T>(
|
|
89
|
+
method: string,
|
|
90
|
+
endpoint: string,
|
|
91
|
+
data?: any
|
|
92
|
+
): Promise<T> {
|
|
93
|
+
const requestConfig: AxiosRequestConfig = {
|
|
94
|
+
method,
|
|
95
|
+
url: this.baseUrl + endpoint,
|
|
96
|
+
headers: this.defaultHeaderIdfyApi,
|
|
97
|
+
data,
|
|
14
98
|
};
|
|
15
|
-
private defaultHeaderIdfyApi = {
|
|
16
|
-
"account-id": "",
|
|
17
|
-
"api-key": "",
|
|
18
|
-
};
|
|
19
|
-
private standardErrorThrowFormat = {
|
|
20
|
-
statusCode: 400,
|
|
21
|
-
message: ["bad request"],
|
|
22
|
-
};
|
|
23
|
-
private baseUrl: string = "https://eve.idfy.com/";
|
|
24
|
-
private gstVerificationEndPoint =
|
|
25
|
-
"v3/tasks/sync/verify_with_source/ind_gst_certificate";
|
|
26
|
-
private panIndividualVerificationEndPoint =
|
|
27
|
-
"v3/tasks/async/verify_with_source/ind_pan_plus";
|
|
28
|
-
private cinCompanyVerificationEndPoint =
|
|
29
|
-
"v3/tasks/async/verify_with_source/ind_mca";
|
|
30
|
-
private taskUrl = "v3/tasks?request_id=";
|
|
31
|
-
private asyncIndividualAadhaarLiteInfoEndPoint =
|
|
32
|
-
"v3/tasks/async/verify_with_source/aadhaar_lite";
|
|
33
|
-
private syncIndividualAadharScanInfoEndpoint =
|
|
34
|
-
"v3/tasks/sync/extract/ind_aadhaar_plus";
|
|
35
|
-
private syncIndividualPANScanInfoEndpoint = "v3/tasks/sync/extract/ind_pan";
|
|
36
|
-
private syncIndividualGSTScanInfoEndpoint =
|
|
37
|
-
"v3/tasks/sync/extract/ind_gst_certificate";
|
|
38
|
-
private syncIndividualLiveFaceLivenessEndpoint =
|
|
39
|
-
"v3/tasks/sync/check_photo_liveness/face";
|
|
40
|
-
private getDigilockerDetailsEndpoint =
|
|
41
|
-
"v3/tasks/async/verify_with_source/ind_digilocker_fetch_documents";
|
|
42
|
-
private key_id = "ed9cedf1-d587-4e38-bce6-b74ac9f3520d";
|
|
43
|
-
private ou_id = "e0d2add9d3c1";
|
|
44
|
-
private secret = "NzY3NmM3NzY1Y2ZjNDZmYWE1Y2QyNDM0YTljNDY2MzY=";
|
|
45
|
-
private doc_type = ["ADHAR", "PANCR"];
|
|
46
|
-
private file_format = "xml";
|
|
47
|
-
private callbackUrl: string;
|
|
48
|
-
|
|
49
|
-
private idfyCompanySearch = {
|
|
50
|
-
defaultHeader: {
|
|
51
|
-
"api-key": "",
|
|
52
|
-
"Content-Type": "application/json",
|
|
53
|
-
},
|
|
54
|
-
version: "v1",
|
|
55
|
-
companySearchUrl:
|
|
56
|
-
"https://riskai.idfystaging.com/api/v1/company/search",
|
|
57
|
-
taskBaseUrl: "https://riskai.idfystaging.com/api/v1/task/",
|
|
58
|
-
cinllpinUrl: "https://riskai.idfystaging.com/api/v1/company/basic",
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
private idfyError = {
|
|
62
|
-
INVALID_IMAGE: {
|
|
63
|
-
idfyErrorCode: "IDFY_ERR_100",
|
|
64
|
-
message: "Please scan correct document",
|
|
65
|
-
},
|
|
66
|
-
INSUFFICIENT_CREDITS: {
|
|
67
|
-
idfyErrorCode: "IDFY_ERR_101",
|
|
68
|
-
message: "Please renew credit",
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
constructor({
|
|
73
|
-
IDFY_TASK_ID,
|
|
74
|
-
IDFY_GROUP_ID,
|
|
75
|
-
IDFY_ACCOUNT_ID,
|
|
76
|
-
IDFY_API_KEY,
|
|
77
|
-
IDFY_COMPANY_SEARCH_API_KEY,
|
|
78
|
-
callbackUrl,
|
|
79
|
-
}: ObjectTypes) {
|
|
80
|
-
this.bodyTaskIdGroupId.task_id = IDFY_TASK_ID;
|
|
81
|
-
this.bodyTaskIdGroupId.group_id = IDFY_GROUP_ID;
|
|
82
|
-
this.defaultHeaderIdfyApi["account-id"] = IDFY_ACCOUNT_ID;
|
|
83
|
-
this.defaultHeaderIdfyApi["api-key"] = IDFY_API_KEY;
|
|
84
|
-
this.idfyCompanySearch.defaultHeader["api-key"] =
|
|
85
|
-
IDFY_COMPANY_SEARCH_API_KEY;
|
|
86
|
-
this.callbackUrl = callbackUrl;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private async makeRequest<T>(
|
|
90
|
-
method: string,
|
|
91
|
-
endpoint: string,
|
|
92
|
-
data?: any
|
|
93
|
-
): Promise<T> {
|
|
94
|
-
const requestConfig: AxiosRequestConfig = {
|
|
95
|
-
method,
|
|
96
|
-
url: this.baseUrl + endpoint,
|
|
97
|
-
headers: this.defaultHeaderIdfyApi,
|
|
98
|
-
data,
|
|
99
|
-
};
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
100
|
+
try {
|
|
101
|
+
const response: AxiosResponse<T> = await axios(requestConfig);
|
|
102
|
+
return response.data;
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error("Error while making Idfy Axios API request:", error);
|
|
105
|
+
throw error;
|
|
108
106
|
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private async makeAxiosRequest<T>({
|
|
110
|
+
method,
|
|
111
|
+
url,
|
|
112
|
+
data,
|
|
113
|
+
headers,
|
|
114
|
+
}: {
|
|
115
|
+
method: string;
|
|
116
|
+
url: string;
|
|
117
|
+
data?: any;
|
|
118
|
+
headers: any;
|
|
119
|
+
}): Promise<T> {
|
|
120
|
+
const requestConfig: AxiosRequestConfig = {
|
|
121
|
+
method,
|
|
122
|
+
url,
|
|
123
|
+
headers,
|
|
124
|
+
data,
|
|
125
|
+
};
|
|
109
126
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
headers: any;
|
|
120
|
-
}): Promise<T> {
|
|
121
|
-
const requestConfig: AxiosRequestConfig = {
|
|
122
|
-
method,
|
|
123
|
-
url,
|
|
124
|
-
headers,
|
|
125
|
-
data,
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
try {
|
|
129
|
-
const response: AxiosResponse<T> = await axios(requestConfig);
|
|
130
|
-
return response.data;
|
|
131
|
-
} catch (error) {
|
|
132
|
-
console.error(
|
|
133
|
-
"Error while making Idfy makeAxiosRequest API request:",
|
|
134
|
-
error
|
|
135
|
-
);
|
|
136
|
-
throw error;
|
|
137
|
-
}
|
|
127
|
+
try {
|
|
128
|
+
const response: AxiosResponse<T> = await axios(requestConfig);
|
|
129
|
+
return response.data;
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error(
|
|
132
|
+
"Error while making Idfy makeAxiosRequest API request:",
|
|
133
|
+
error
|
|
134
|
+
);
|
|
135
|
+
throw error;
|
|
138
136
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private async getTask(requestId: string): Promise<any> {
|
|
140
|
+
try {
|
|
141
|
+
// const data = {}
|
|
142
|
+
const urlEndPoint = this.taskUrl + requestId;
|
|
143
|
+
const response = await this.makeRequest<any>("get", urlEndPoint);
|
|
144
|
+
return response;
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.error("Error while fetching Idfy getTask API data:", error);
|
|
147
|
+
throw error;
|
|
150
148
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private async getCompanySearchTask({
|
|
152
|
+
requestId,
|
|
153
|
+
}: {
|
|
154
|
+
requestId: string;
|
|
155
|
+
}): Promise<any> {
|
|
156
|
+
try {
|
|
157
|
+
const taskBaseUrl = this.idfyCompanySearch.taskBaseUrl + requestId;
|
|
158
|
+
const response = await this.makeAxiosRequest({
|
|
159
|
+
method: "get",
|
|
160
|
+
url: taskBaseUrl,
|
|
161
|
+
headers: this.idfyCompanySearch.defaultHeader,
|
|
162
|
+
});
|
|
163
|
+
return response;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.error(
|
|
166
|
+
"Error while fetching Idfy getCompanySearchTask API data:",
|
|
167
|
+
error
|
|
168
|
+
);
|
|
169
|
+
throw error;
|
|
172
170
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private async pingTaskUntilSuccess(requestId: string): Promise<any> {
|
|
174
|
+
try {
|
|
175
|
+
let res: any = null;
|
|
176
|
+
const checkTaskAfter1sec = (requestId: any) => {
|
|
177
|
+
return new Promise<any>((resolve, reject) => {
|
|
178
|
+
try {
|
|
179
|
+
setTimeout(async () => {
|
|
180
|
+
const data = await this.getTask(requestId);
|
|
181
|
+
if (res?.[0].status == "failed") {
|
|
182
|
+
reject(res);
|
|
183
|
+
}
|
|
184
|
+
resolve(data);
|
|
185
|
+
}, 1000);
|
|
186
|
+
} catch (e) {
|
|
187
|
+
reject(e);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
do {
|
|
192
|
+
res = await checkTaskAfter1sec(requestId);
|
|
193
|
+
|
|
194
|
+
console.log("### res ", res);
|
|
195
|
+
} while (res?.[0].status !== "completed");
|
|
196
|
+
|
|
197
|
+
return res;
|
|
198
|
+
} catch (error) {
|
|
199
|
+
console.error("Error while fetching Idfy getTask API data:", error);
|
|
200
|
+
throw error;
|
|
203
201
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
throw error;
|
|
238
|
-
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private async pingCompanySearchTaskUntilSuccess(
|
|
205
|
+
requestId: string
|
|
206
|
+
): Promise<any> {
|
|
207
|
+
try {
|
|
208
|
+
console.log(" ## requestId ", requestId);
|
|
209
|
+
let res: any = null;
|
|
210
|
+
const checkTaskAfter1sec = (requestId: string) => {
|
|
211
|
+
return new Promise<any>((resolve, reject) => {
|
|
212
|
+
try {
|
|
213
|
+
setTimeout(async () => {
|
|
214
|
+
const data = await this.getCompanySearchTask({ requestId });
|
|
215
|
+
if (data.status != "failed") {
|
|
216
|
+
resolve(data);
|
|
217
|
+
} else {
|
|
218
|
+
reject(res);
|
|
219
|
+
}
|
|
220
|
+
}, 1000);
|
|
221
|
+
} catch (e) {
|
|
222
|
+
reject(e);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
do {
|
|
227
|
+
res = await checkTaskAfter1sec(requestId);
|
|
228
|
+
console.log("### res ", res);
|
|
229
|
+
} while (res?.status !== "completed");
|
|
230
|
+
|
|
231
|
+
return res;
|
|
232
|
+
} catch (error) {
|
|
233
|
+
console.error("Error while fetching Idfy getTask API data:", error);
|
|
234
|
+
throw error;
|
|
239
235
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
236
|
+
}
|
|
237
|
+
async getCompanyGstInfo({ gstNo }: { gstNo: string }): Promise<any> {
|
|
238
|
+
try {
|
|
239
|
+
const data = {
|
|
240
|
+
...this.bodyTaskIdGroupId,
|
|
241
|
+
data: {
|
|
242
|
+
gstin: gstNo,
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
const response = await this.makeRequest<any>(
|
|
246
|
+
"post",
|
|
247
|
+
this.gstVerificationEndPoint,
|
|
248
|
+
data
|
|
249
|
+
);
|
|
250
|
+
return response;
|
|
251
|
+
} catch (error: any) {
|
|
252
|
+
if (error?.response?.data?.error) {
|
|
253
|
+
let obj = this.idfyError;
|
|
254
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
255
|
+
if (errorObj)
|
|
256
|
+
throw {
|
|
257
|
+
...this.standardErrorThrowFormat,
|
|
258
|
+
message: [errorObj.message],
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
throw error;
|
|
268
263
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
throw error;
|
|
299
|
-
}
|
|
264
|
+
}
|
|
265
|
+
async getCompanyCINInfo({ cinNo }: { cinNo: string }): Promise<any> {
|
|
266
|
+
try {
|
|
267
|
+
const data = {
|
|
268
|
+
...this.bodyTaskIdGroupId,
|
|
269
|
+
data: {
|
|
270
|
+
cin: cinNo,
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
const response = await this.makeRequest<any>(
|
|
274
|
+
"post",
|
|
275
|
+
this.cinCompanyVerificationEndPoint,
|
|
276
|
+
data
|
|
277
|
+
);
|
|
278
|
+
const successData = await this.pingTaskUntilSuccess(response.request_id);
|
|
279
|
+
|
|
280
|
+
return successData?.[0]?.result?.source_output;
|
|
281
|
+
} catch (error: any) {
|
|
282
|
+
if (error?.response?.data?.error) {
|
|
283
|
+
let obj = this.idfyError;
|
|
284
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
285
|
+
if (errorObj)
|
|
286
|
+
throw {
|
|
287
|
+
...this.standardErrorThrowFormat,
|
|
288
|
+
message: [errorObj.message],
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
throw error;
|
|
300
292
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
throw error;
|
|
331
|
-
}
|
|
293
|
+
}
|
|
294
|
+
async getIndividualPANInfo({ panNo }: { panNo: string }): Promise<any> {
|
|
295
|
+
try {
|
|
296
|
+
const data = {
|
|
297
|
+
...this.bodyTaskIdGroupId,
|
|
298
|
+
data: {
|
|
299
|
+
id_number: panNo,
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
const response = await this.makeRequest<any>(
|
|
303
|
+
"post",
|
|
304
|
+
this.panIndividualVerificationEndPoint,
|
|
305
|
+
data
|
|
306
|
+
);
|
|
307
|
+
const successData = await this.pingTaskUntilSuccess(response.request_id);
|
|
308
|
+
|
|
309
|
+
return successData;
|
|
310
|
+
} catch (error: any) {
|
|
311
|
+
if (error?.response?.data?.error) {
|
|
312
|
+
let obj = this.idfyError;
|
|
313
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
314
|
+
if (errorObj)
|
|
315
|
+
throw {
|
|
316
|
+
...this.standardErrorThrowFormat,
|
|
317
|
+
message: [errorObj.message],
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
throw error;
|
|
332
321
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
async getSyncIndividualAadharScanInfo({
|
|
325
|
+
frontScanBase64,
|
|
326
|
+
backScanBase64,
|
|
327
|
+
}: {
|
|
328
|
+
frontScanBase64: string;
|
|
329
|
+
backScanBase64: string;
|
|
330
|
+
}): Promise<any> {
|
|
331
|
+
try {
|
|
332
|
+
const data = {
|
|
333
|
+
...this.bodyTaskIdGroupId,
|
|
334
|
+
data: {
|
|
335
|
+
document1: frontScanBase64,
|
|
336
|
+
document2: backScanBase64,
|
|
337
|
+
consent: "yes",
|
|
338
|
+
advanced_details: {
|
|
339
|
+
extract_qr_info: true,
|
|
340
|
+
extract_last_4_digit: false,
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
const response = await this.makeRequest<any>(
|
|
345
|
+
"post",
|
|
346
|
+
this.syncIndividualAadharScanInfoEndpoint,
|
|
347
|
+
data
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
return response?.result;
|
|
351
|
+
} catch (error: any) {
|
|
352
|
+
if (error?.response?.data?.error) {
|
|
353
|
+
let obj = this.idfyError;
|
|
354
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
355
|
+
if (errorObj)
|
|
356
|
+
throw {
|
|
357
|
+
...this.standardErrorThrowFormat,
|
|
358
|
+
message: [errorObj.message],
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
throw error;
|
|
374
362
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
async getSyncIndividualPANScanInfo({
|
|
366
|
+
frontScanBase64,
|
|
367
|
+
}: {
|
|
368
|
+
frontScanBase64: string;
|
|
369
|
+
}): Promise<any> {
|
|
370
|
+
try {
|
|
371
|
+
const data = {
|
|
372
|
+
...this.bodyTaskIdGroupId,
|
|
373
|
+
data: {
|
|
374
|
+
document1: frontScanBase64,
|
|
375
|
+
consent: "yes",
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
const response = await this.makeRequest<any>(
|
|
379
|
+
"post",
|
|
380
|
+
this.syncIndividualPANScanInfoEndpoint,
|
|
381
|
+
data
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
return response?.result;
|
|
385
|
+
} catch (error: any) {
|
|
386
|
+
if (error?.response?.data?.error) {
|
|
387
|
+
let obj = this.idfyError;
|
|
388
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
389
|
+
if (errorObj)
|
|
390
|
+
throw {
|
|
391
|
+
...this.standardErrorThrowFormat,
|
|
392
|
+
message: [errorObj.message],
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
throw error;
|
|
409
396
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
async getSyncCompanyGSTScanInfo({
|
|
400
|
+
frontScanBase64,
|
|
401
|
+
}: {
|
|
402
|
+
frontScanBase64: string;
|
|
403
|
+
}): Promise<any> {
|
|
404
|
+
try {
|
|
405
|
+
const data = {
|
|
406
|
+
...this.bodyTaskIdGroupId,
|
|
407
|
+
data: {
|
|
408
|
+
document1: frontScanBase64,
|
|
409
|
+
},
|
|
410
|
+
};
|
|
411
|
+
const response = await this.makeRequest<any>(
|
|
412
|
+
"post",
|
|
413
|
+
this.syncIndividualGSTScanInfoEndpoint,
|
|
414
|
+
data
|
|
415
|
+
);
|
|
416
|
+
|
|
417
|
+
return response?.result;
|
|
418
|
+
} catch (error: any) {
|
|
419
|
+
if (error?.response?.data?.error) {
|
|
420
|
+
let obj = this.idfyError;
|
|
421
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
422
|
+
if (errorObj)
|
|
423
|
+
throw {
|
|
424
|
+
...this.standardErrorThrowFormat,
|
|
425
|
+
message: [errorObj.message],
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
throw error;
|
|
443
429
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
async getSyncIndividualLivenessSelfyScanInfo({
|
|
433
|
+
faceScanBase64,
|
|
434
|
+
}: {
|
|
435
|
+
faceScanBase64: string;
|
|
436
|
+
}): Promise<any> {
|
|
437
|
+
try {
|
|
438
|
+
const data = {
|
|
439
|
+
...this.bodyTaskIdGroupId,
|
|
440
|
+
data: {
|
|
441
|
+
document1: faceScanBase64,
|
|
442
|
+
consent: "yes",
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
const response = await this.makeRequest<any>(
|
|
446
|
+
"post",
|
|
447
|
+
this.syncIndividualLiveFaceLivenessEndpoint,
|
|
448
|
+
data
|
|
449
|
+
);
|
|
450
|
+
|
|
451
|
+
return response?.result;
|
|
452
|
+
} catch (error: any) {
|
|
453
|
+
if (error?.response?.data?.error) {
|
|
454
|
+
let obj = this.idfyError;
|
|
455
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
456
|
+
if (errorObj)
|
|
457
|
+
throw {
|
|
458
|
+
...this.standardErrorThrowFormat,
|
|
459
|
+
message: [errorObj.message],
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
throw error;
|
|
478
463
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
throw error;
|
|
514
|
-
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
async getAsyncAadhaarLiteInfo({
|
|
467
|
+
aadhaarNo,
|
|
468
|
+
}: {
|
|
469
|
+
aadhaarNo: string;
|
|
470
|
+
}): Promise<any> {
|
|
471
|
+
try {
|
|
472
|
+
const data = {
|
|
473
|
+
...this.bodyTaskIdGroupId,
|
|
474
|
+
data: {
|
|
475
|
+
aadhaar_number: aadhaarNo,
|
|
476
|
+
},
|
|
477
|
+
};
|
|
478
|
+
const response = await this.makeRequest<any>(
|
|
479
|
+
"post",
|
|
480
|
+
this.asyncIndividualAadhaarLiteInfoEndPoint,
|
|
481
|
+
data
|
|
482
|
+
);
|
|
483
|
+
const successData = await this.pingTaskUntilSuccess(response.request_id);
|
|
484
|
+
|
|
485
|
+
return successData;
|
|
486
|
+
} catch (error: any) {
|
|
487
|
+
if (error?.response?.data?.error) {
|
|
488
|
+
let obj = this.idfyError;
|
|
489
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
490
|
+
if (errorObj)
|
|
491
|
+
throw {
|
|
492
|
+
...this.standardErrorThrowFormat,
|
|
493
|
+
message: [errorObj.message],
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
throw error;
|
|
515
497
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
async getCompanyDetailsByName({
|
|
501
|
+
legalName,
|
|
502
|
+
}: {
|
|
503
|
+
legalName: string;
|
|
504
|
+
}): Promise<any> {
|
|
505
|
+
try {
|
|
506
|
+
const data = {
|
|
507
|
+
version: this.idfyCompanySearch.version,
|
|
508
|
+
...this.bodyTaskIdGroupId,
|
|
509
|
+
data: {
|
|
510
|
+
name: legalName,
|
|
511
|
+
},
|
|
512
|
+
};
|
|
513
|
+
const response = await this.makeAxiosRequest<any>({
|
|
514
|
+
method: "post",
|
|
515
|
+
url: this.idfyCompanySearch.companySearchUrl,
|
|
516
|
+
data,
|
|
517
|
+
headers: this.idfyCompanySearch.defaultHeader,
|
|
518
|
+
});
|
|
519
|
+
const successData = await this.pingCompanySearchTaskUntilSuccess(
|
|
520
|
+
response.request_id
|
|
521
|
+
);
|
|
522
|
+
|
|
523
|
+
return { request_id: response, successData: successData };
|
|
524
|
+
} catch (error) {
|
|
525
|
+
throw error;
|
|
544
526
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
async getCompanyDetailsByLlpinOrCin({
|
|
530
|
+
cinOrLlpin,
|
|
531
|
+
}: {
|
|
532
|
+
cinOrLlpin: string;
|
|
533
|
+
}): Promise<any> {
|
|
534
|
+
try {
|
|
535
|
+
const data = {
|
|
536
|
+
version: this.idfyCompanySearch.version,
|
|
537
|
+
...this.bodyTaskIdGroupId,
|
|
538
|
+
data: {
|
|
539
|
+
cin_llpin: cinOrLlpin,
|
|
540
|
+
},
|
|
541
|
+
};
|
|
542
|
+
const response = await this.makeAxiosRequest<any>({
|
|
543
|
+
method: "post",
|
|
544
|
+
url: this.idfyCompanySearch.cinllpinUrl,
|
|
545
|
+
data,
|
|
546
|
+
headers: this.idfyCompanySearch.defaultHeader,
|
|
547
|
+
});
|
|
548
|
+
return { response: response };
|
|
549
|
+
} catch (error) {
|
|
550
|
+
throw error;
|
|
569
551
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
async getAsyncFaceComparisionInfo({
|
|
555
|
+
document1,
|
|
556
|
+
document2,
|
|
557
|
+
}: {
|
|
558
|
+
document1: string;
|
|
559
|
+
document2: string;
|
|
560
|
+
}): Promise<any> {
|
|
561
|
+
try {
|
|
562
|
+
const data = {
|
|
563
|
+
task_id: "74f4c926-250c-43hca-9c53-453e87ceacd1",
|
|
564
|
+
group_id: "8e16424a-58fc-4ba4-ab20-5bc8e7c3c41e",
|
|
565
|
+
data: {
|
|
566
|
+
document1: document1,
|
|
567
|
+
document2: document2,
|
|
568
|
+
consent: "yes",
|
|
569
|
+
},
|
|
570
|
+
};
|
|
571
|
+
const res = await this.makeRequest<any>(
|
|
572
|
+
"post",
|
|
573
|
+
"v3/tasks/async/compare/face",
|
|
574
|
+
data
|
|
575
|
+
);
|
|
576
|
+
const requestId = res.request_id;
|
|
577
|
+
const response = (await this.pingTaskUntilSuccess(requestId))?.[0];
|
|
578
|
+
if (response.result) {
|
|
579
|
+
return {
|
|
580
|
+
isMatch: response.result.is_a_match,
|
|
581
|
+
matchScore: response.result.match_score,
|
|
582
|
+
};
|
|
583
|
+
} else {
|
|
584
|
+
return response;
|
|
585
|
+
}
|
|
586
|
+
} catch (error: any) {
|
|
587
|
+
if (error?.response?.data?.error) {
|
|
588
|
+
let obj = this.idfyError;
|
|
589
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
590
|
+
if (errorObj)
|
|
591
|
+
throw {
|
|
592
|
+
...this.standardErrorThrowFormat,
|
|
593
|
+
message: [errorObj.message],
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
throw error;
|
|
615
597
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
async getAsyncDigilockerFetchDocument({
|
|
601
|
+
referenceId,
|
|
602
|
+
extraFields,
|
|
603
|
+
}: {
|
|
604
|
+
referenceId: string;
|
|
605
|
+
extraFields: {
|
|
606
|
+
panno: string;
|
|
607
|
+
PANFullName: string;
|
|
608
|
+
};
|
|
609
|
+
}): Promise<any> {
|
|
610
|
+
try {
|
|
611
|
+
const datas = {
|
|
612
|
+
task_id: "74f4c926-250c-43hca-9c53-453e87ceacd1",
|
|
613
|
+
group_id: "8e16424a-58fc-4ba4-ab20-5bc8e7c3c41e",
|
|
614
|
+
data: {
|
|
615
|
+
reference_id: referenceId,
|
|
616
|
+
key_id: this.key_id,
|
|
617
|
+
ou_id: this.ou_id,
|
|
618
|
+
secret: this.secret,
|
|
619
|
+
callback_url: this.callbackUrl,
|
|
620
|
+
doc_type: this.doc_type,
|
|
621
|
+
file_format: this.file_format,
|
|
622
|
+
extra_fields: extraFields,
|
|
623
|
+
},
|
|
624
|
+
};
|
|
625
|
+
const res = await this.makeRequest<any>(
|
|
626
|
+
"post",
|
|
627
|
+
this.getDigilockerDetailsEndpoint,
|
|
628
|
+
datas
|
|
629
|
+
);
|
|
630
|
+
const requestId = res.request_id;
|
|
631
|
+
const response = (await this.pingTaskUntilSuccess(requestId))?.[0];
|
|
632
|
+
if (response.result.source_output) {
|
|
633
|
+
return {
|
|
634
|
+
redirectUrl: response.result.source_output.redirect_url,
|
|
635
|
+
referenceId: response.result.source_output.reference_id,
|
|
636
|
+
sessionExists: response.result.source_output.session_exists,
|
|
637
|
+
status: response.result.source_output.status,
|
|
624
638
|
};
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
callback_url: this.callbackUrl,
|
|
640
|
-
doc_type: this.doc_type,
|
|
641
|
-
file_format: this.file_format,
|
|
642
|
-
extra_fields: extraFields1,
|
|
643
|
-
},
|
|
644
|
-
};
|
|
645
|
-
const res = await this.makeRequest<any>(
|
|
646
|
-
"post",
|
|
647
|
-
this.getDigilockerDetailsEndpoint,
|
|
648
|
-
datas
|
|
649
|
-
);
|
|
650
|
-
const requestId = res.request_id;
|
|
651
|
-
const response = (await this.pingTaskUntilSuccess(requestId))?.[0];
|
|
652
|
-
if (response.result.source_output) {
|
|
653
|
-
return {
|
|
654
|
-
redirectUrl: response.result.source_output.redirect_url,
|
|
655
|
-
referenceId: response.result.source_output.reference_id,
|
|
656
|
-
sessionExists: response.result.source_output.session_exists,
|
|
657
|
-
status: response.result.source_output.status,
|
|
658
|
-
};
|
|
659
|
-
} else {
|
|
660
|
-
return response;
|
|
661
|
-
}
|
|
662
|
-
} catch (error: any) {
|
|
663
|
-
if (error?.response?.data?.error) {
|
|
664
|
-
let obj = this.idfyError;
|
|
665
|
-
const errorObj =
|
|
666
|
-
obj[error?.response?.data?.error as keyof typeof obj];
|
|
667
|
-
if (errorObj)
|
|
668
|
-
throw {
|
|
669
|
-
...this.standardErrorThrowFormat,
|
|
670
|
-
message: [errorObj.message],
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
throw error;
|
|
674
|
-
}
|
|
639
|
+
} else {
|
|
640
|
+
return response;
|
|
641
|
+
}
|
|
642
|
+
} catch (error: any) {
|
|
643
|
+
if (error?.response?.data?.error) {
|
|
644
|
+
let obj = this.idfyError;
|
|
645
|
+
const errorObj = obj[error?.response?.data?.error as keyof typeof obj];
|
|
646
|
+
if (errorObj)
|
|
647
|
+
throw {
|
|
648
|
+
...this.standardErrorThrowFormat,
|
|
649
|
+
message: [errorObj.message],
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
throw error;
|
|
675
653
|
}
|
|
654
|
+
}
|
|
676
655
|
}
|