aeremmiddleware 1.0.4 → 1.0.6

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.
Files changed (65) hide show
  1. package/dist/Finance/Ingenico.types.d.ts +21 -0
  2. package/dist/Finance/Ingenico.types.js +3 -0
  3. package/dist/Finance/Ingenico.types.js.map +1 -0
  4. package/dist/Finance/crimeCheck.d.ts +16 -0
  5. package/dist/Finance/crimeCheck.js +137 -0
  6. package/dist/Finance/crimeCheck.js.map +1 -0
  7. package/dist/Finance/crimecheck.types.d.ts +30 -0
  8. package/dist/Finance/crimecheck.types.js +3 -0
  9. package/dist/Finance/crimecheck.types.js.map +1 -0
  10. package/dist/Finance/encrypt.d.ts +1 -0
  11. package/dist/Finance/encrypt.js +20 -0
  12. package/dist/Finance/encrypt.js.map +1 -0
  13. package/dist/Finance/idfy.d.ts +63 -35
  14. package/dist/Finance/idfy.js +419 -201
  15. package/dist/Finance/idfy.js.map +1 -1
  16. package/dist/Finance/index.d.ts +12 -4
  17. package/dist/Finance/index.js +18 -10
  18. package/dist/Finance/index.js.map +1 -1
  19. package/dist/Finance/ingenico.d.ts +13 -0
  20. package/dist/Finance/ingenico.js +122 -0
  21. package/dist/Finance/ingenico.js.map +1 -0
  22. package/dist/Finance/ingenicoHtml.d.ts +2 -0
  23. package/dist/Finance/ingenicoHtml.js +122 -0
  24. package/dist/Finance/ingenicoHtml.js.map +1 -0
  25. package/dist/Finance/novel.d.ts +35 -0
  26. package/dist/Finance/novel.js +222 -0
  27. package/dist/Finance/novel.js.map +1 -0
  28. package/dist/Finance/novel.types.d.ts +23 -0
  29. package/dist/Finance/novel.types.js +10 -0
  30. package/dist/Finance/novel.types.js.map +1 -0
  31. package/dist/Finance/qbrik.d.ts +89 -0
  32. package/dist/Finance/qbrik.js +463 -0
  33. package/dist/Finance/qbrik.js.map +1 -0
  34. package/dist/Finance/qbrik.types.d.ts +76 -0
  35. package/dist/Finance/qbrik.types.js +3 -0
  36. package/dist/Finance/qbrik.types.js.map +1 -0
  37. package/dist/Maps/index.js +1 -1
  38. package/dist/Socials/Sms.types.d.ts +8 -0
  39. package/dist/Socials/Sms.types.js +9 -0
  40. package/dist/Socials/Sms.types.js.map +1 -0
  41. package/dist/Socials/SmsSender.d.ts +17 -0
  42. package/dist/Socials/SmsSender.js +74 -0
  43. package/dist/Socials/SmsSender.js.map +1 -0
  44. package/dist/Socials/Whatsapp.types.d.ts +93 -97
  45. package/dist/Socials/Whatsapp.types.js +8 -8
  46. package/dist/Socials/Whatsapp.types.js.map +1 -1
  47. package/dist/Socials/index.d.ts +6 -4
  48. package/dist/Socials/index.js +12 -10
  49. package/dist/Socials/index.js.map +1 -1
  50. package/dist/Socials/{message.d.ts → whatsApp.d.ts} +23 -26
  51. package/dist/Socials/{message.js → whatsApp.js} +169 -212
  52. package/dist/Socials/{message.js.map → whatsApp.js.map} +1 -1
  53. package/dist/index.d.ts +13 -8
  54. package/dist/index.js +8 -8
  55. package/package.json +1 -1
  56. package/src/Finance/Ingenico.types.ts +3 -0
  57. package/src/Finance/crimeCheck.ts +135 -0
  58. package/src/Finance/crimecheck.types.ts +31 -0
  59. package/src/Finance/idfy.ts +34 -20
  60. package/src/Finance/index.ts +6 -0
  61. package/src/Finance/ingenico.ts +36 -136
  62. package/src/Finance/ingenicoHtml.ts +119 -0
  63. package/src/Finance/qbrik.ts +760 -0
  64. package/src/Finance/qbrik.types.ts +81 -0
  65. package/src/Socials/SmsSender.ts +20 -21
@@ -1,202 +1,420 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const axios_1 = __importDefault(require("axios"));
16
- class IdfyAPIWrapper {
17
- constructor() {
18
- this.bodyTaskIdGroupId = {
19
- task_id: '74f4c926-250c-43ca-9c53-453e87ceacd1',
20
- group_id: '8e16424a-58fc-4ba4-ab20-5bc8e7c3c41e',
21
- };
22
- this.defaultHeaderIdfyApi = {
23
- "account-id": "e0d2add9d3c1/86e1d197-adb5-4f8f-af82-2728599a3615",
24
- "api-key": "7fad350f-5519-4ec7-b977-d8c8b131b8e4"
25
- };
26
- this.baseUrl = "https://eve.idfy.com/";
27
- this.gstVerificationEndPoint = 'v3/tasks/sync/verify_with_source/ind_gst_certificate';
28
- this.panIndividualVerificationEndPoint = 'v3/tasks/async/verify_with_source/ind_pan';
29
- this.cinCompanyVerificationEndPoint = 'v3/tasks/async/verify_with_source/ind_mca';
30
- this.taskUrl = 'v3/tasks?request_id=';
31
- this.syncIndividualAadharScanInfoEndpoint = 'v3/tasks/sync/extract/ind_aadhaar_plus';
32
- this.syncIndividualPANScanInfoEndpoint = 'v3/tasks/sync/extract/ind_pan';
33
- this.syncIndividualLiveFaceLivenessEndpoint = 'v3/tasks/sync/check_photo_liveness/face';
34
- }
35
- makeRequest(method, endpoint, data) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const requestConfig = {
38
- method,
39
- url: this.baseUrl + endpoint,
40
- headers: this.defaultHeaderIdfyApi,
41
- data,
42
- };
43
- try {
44
- const response = yield (0, axios_1.default)(requestConfig);
45
- return response.data;
46
- }
47
- catch (error) {
48
- console.error("Error while making Idfy Axios API request:", error);
49
- throw error;
50
- }
51
- });
52
- }
53
- getTask(requestId) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- try {
56
- const urlEndPoint = this.taskUrl + requestId;
57
- const response = yield this.makeRequest("get", urlEndPoint);
58
- return response;
59
- }
60
- catch (error) {
61
- console.error("Error while fetching Idfy getTask API data:", error);
62
- throw error;
63
- }
64
- });
65
- }
66
- pingTaskUntilSuccess(requestId) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- try {
69
- let res = null;
70
- const checkTaskAfter1sec = (requestId) => {
71
- return new Promise((resolve, reject) => {
72
- try {
73
- setTimeout(() => __awaiter(this, void 0, void 0, function* () {
74
- const data = yield this.getTask(requestId);
75
- if ((res === null || res === void 0 ? void 0 : res[0].status) == 'failed') {
76
- reject(res);
77
- }
78
- resolve(data);
79
- }), 1000);
80
- }
81
- catch (e) {
82
- reject(e);
83
- }
84
- });
85
- };
86
- do {
87
- res = yield checkTaskAfter1sec(requestId);
88
- console.log("### res ", res);
89
- } while ((res === null || res === void 0 ? void 0 : res[0].status) !== 'completed');
90
- return res;
91
- }
92
- catch (error) {
93
- console.error("Error while fetching Idfy getTask API data:", error);
94
- throw error;
95
- }
96
- });
97
- }
98
- getCompanyGstInfo({ gstNo }) {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- try {
101
- const data = Object.assign(Object.assign({}, (this.bodyTaskIdGroupId)), { data: {
102
- gstin: gstNo,
103
- } });
104
- const response = yield this.makeRequest("post", this.gstVerificationEndPoint, data);
105
- return response;
106
- }
107
- catch (error) {
108
- console.error("Error while fetching Idfy API data:", error);
109
- throw error;
110
- }
111
- });
112
- }
113
- getCompanyCINInfo({ cinNo }) {
114
- var _a, _b;
115
- return __awaiter(this, void 0, void 0, function* () {
116
- try {
117
- const data = Object.assign(Object.assign({}, (this.bodyTaskIdGroupId)), { data: {
118
- "cin": cinNo,
119
- } });
120
- const response = yield this.makeRequest("post", this.cinCompanyVerificationEndPoint, data);
121
- const successData = yield this.pingTaskUntilSuccess(response.request_id);
122
- return (_b = (_a = successData === null || successData === void 0 ? void 0 : successData[0]) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.source_output;
123
- }
124
- catch (error) {
125
- console.error("Error while fetching Idfy CIN API data:", error);
126
- throw error;
127
- }
128
- });
129
- }
130
- getIndividualPANInfo({ panNo }) {
131
- var _a, _b;
132
- return __awaiter(this, void 0, void 0, function* () {
133
- try {
134
- const data = Object.assign(Object.assign({}, (this.bodyTaskIdGroupId)), { data: {
135
- "id_number": panNo,
136
- } });
137
- const response = yield this.makeRequest("post", this.panIndividualVerificationEndPoint, data);
138
- const successData = yield this.pingTaskUntilSuccess(response.request_id);
139
- return (_b = (_a = successData === null || successData === void 0 ? void 0 : successData[0]) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.source_output;
140
- }
141
- catch (error) {
142
- console.error("Error while fetching Idfy PAN API data:", error);
143
- throw error;
144
- }
145
- });
146
- }
147
- getSyncIndividualAadharScanInfo({ frontScanBase64, backScanBase64 }) {
148
- return __awaiter(this, void 0, void 0, function* () {
149
- try {
150
- const data = Object.assign(Object.assign({}, (this.bodyTaskIdGroupId)), { data: {
151
- "document1": frontScanBase64,
152
- "document2": backScanBase64,
153
- "consent": "yes",
154
- "advanced_details": {
155
- "extract_qr_info": true,
156
- "extract_last_4_digit": false
157
- }
158
- } });
159
- const response = yield this.makeRequest("post", this.syncIndividualAadharScanInfoEndpoint, data);
160
- return response === null || response === void 0 ? void 0 : response.result;
161
- }
162
- catch (error) {
163
- console.error("Error while fetching Idfy PAN API data:", error);
164
- throw error;
165
- }
166
- });
167
- }
168
- getSyncIndividualPANScanInfo({ frontScanBase64 }) {
169
- return __awaiter(this, void 0, void 0, function* () {
170
- try {
171
- const data = Object.assign(Object.assign({}, (this.bodyTaskIdGroupId)), { data: {
172
- "document1": frontScanBase64,
173
- "consent": "yes",
174
- } });
175
- const response = yield this.makeRequest("post", this.syncIndividualPANScanInfoEndpoint, data);
176
- return response === null || response === void 0 ? void 0 : response.result;
177
- }
178
- catch (error) {
179
- console.error("Error while fetching Idfy PAN API data:", error);
180
- throw error;
181
- }
182
- });
183
- }
184
- getSyncIndividualLivenessSelfyScanInfo({ faceScanBase64 }) {
185
- return __awaiter(this, void 0, void 0, function* () {
186
- try {
187
- const data = Object.assign(Object.assign({}, (this.bodyTaskIdGroupId)), { data: {
188
- "document1": faceScanBase64,
189
- "consent": "yes",
190
- } });
191
- const response = yield this.makeRequest("post", this.syncIndividualLiveFaceLivenessEndpoint, data);
192
- return response === null || response === void 0 ? void 0 : response.result;
193
- }
194
- catch (error) {
195
- console.error("Error while fetching Idfy PAN API data:", error);
196
- throw error;
197
- }
198
- });
199
- }
200
- }
201
- exports.default = IdfyAPIWrapper;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const axios_1 = __importDefault(require("axios"));
16
+ class IdfyAPIWrapper {
17
+ constructor({ IDFY_TASK_ID, IDFY_GROUP_ID, IDFY_ACCOUNT_ID, IDFY_API_KEY, IDFY_COMPANY_SEARCH_API_KEY, }) {
18
+ this.bodyTaskIdGroupId = {
19
+ task_id: "",
20
+ group_id: "",
21
+ };
22
+ this.defaultHeaderIdfyApi = {
23
+ "account-id": "",
24
+ "api-key": "",
25
+ };
26
+ this.standardErrorThrowFormat = {
27
+ statusCode: 400,
28
+ message: ["bad request"],
29
+ };
30
+ this.baseUrl = "https://eve.idfy.com/";
31
+ this.gstVerificationEndPoint = "v3/tasks/sync/verify_with_source/ind_gst_certificate";
32
+ this.panIndividualVerificationEndPoint = "v3/tasks/async/verify_with_source/ind_pan_plus";
33
+ this.cinCompanyVerificationEndPoint = "v3/tasks/async/verify_with_source/ind_mca";
34
+ this.taskUrl = "v3/tasks?request_id=";
35
+ this.asyncIndividualAadhaarLiteInfoEndPoint = "v3/tasks/async/verify_with_source/aadhaar_lite";
36
+ this.syncIndividualAadharScanInfoEndpoint = "v3/tasks/sync/extract/ind_aadhaar_plus";
37
+ this.syncIndividualPANScanInfoEndpoint = "v3/tasks/sync/extract/ind_pan";
38
+ this.syncIndividualGSTScanInfoEndpoint = "v3/tasks/sync/extract/ind_gst_certificate";
39
+ this.syncIndividualLiveFaceLivenessEndpoint = "v3/tasks/sync/check_photo_liveness/face";
40
+ this.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
+ };
50
+ this.idfyError = {
51
+ INVALID_IMAGE: {
52
+ idfyErrorCode: "IDFY_ERR_100",
53
+ message: "Please scan correct document",
54
+ },
55
+ INSUFFICIENT_CREDITS: {
56
+ idfyErrorCode: "IDFY_ERR_101",
57
+ message: "Please renew credit",
58
+ },
59
+ };
60
+ this.bodyTaskIdGroupId.task_id = IDFY_TASK_ID;
61
+ this.bodyTaskIdGroupId.group_id = IDFY_GROUP_ID;
62
+ this.defaultHeaderIdfyApi["account-id"] = IDFY_ACCOUNT_ID;
63
+ this.defaultHeaderIdfyApi["api-key"] = IDFY_API_KEY;
64
+ this.idfyCompanySearch.defaultHeader["api-key"] =
65
+ IDFY_COMPANY_SEARCH_API_KEY;
66
+ }
67
+ makeRequest(method, endpoint, data) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const requestConfig = {
70
+ method,
71
+ url: this.baseUrl + endpoint,
72
+ headers: this.defaultHeaderIdfyApi,
73
+ data,
74
+ };
75
+ try {
76
+ const response = yield (0, axios_1.default)(requestConfig);
77
+ return response.data;
78
+ }
79
+ catch (error) {
80
+ console.error("Error while making Idfy Axios API request:", error);
81
+ throw error;
82
+ }
83
+ });
84
+ }
85
+ makeAxiosRequest({ method, url, data, headers, }) {
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ const requestConfig = {
88
+ method,
89
+ url,
90
+ headers,
91
+ data,
92
+ };
93
+ try {
94
+ const response = yield (0, axios_1.default)(requestConfig);
95
+ return response.data;
96
+ }
97
+ catch (error) {
98
+ console.error("Error while making Idfy makeAxiosRequest API request:", error);
99
+ throw error;
100
+ }
101
+ });
102
+ }
103
+ getTask(requestId) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ try {
106
+ const urlEndPoint = this.taskUrl + requestId;
107
+ const response = yield this.makeRequest("get", urlEndPoint);
108
+ return response;
109
+ }
110
+ catch (error) {
111
+ console.error("Error while fetching Idfy getTask API data:", error);
112
+ throw error;
113
+ }
114
+ });
115
+ }
116
+ getCompanySearchTask({ requestId, }) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ try {
119
+ const taskBaseUrl = this.idfyCompanySearch.taskBaseUrl + requestId;
120
+ const response = yield this.makeAxiosRequest({
121
+ method: "get",
122
+ url: taskBaseUrl,
123
+ headers: this.idfyCompanySearch.defaultHeader,
124
+ });
125
+ return response;
126
+ }
127
+ catch (error) {
128
+ console.error("Error while fetching Idfy getCompanySearchTask API data:", error);
129
+ throw error;
130
+ }
131
+ });
132
+ }
133
+ pingTaskUntilSuccess(requestId) {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ try {
136
+ let res = null;
137
+ const checkTaskAfter1sec = (requestId) => {
138
+ return new Promise((resolve, reject) => {
139
+ try {
140
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
141
+ const data = yield this.getTask(requestId);
142
+ if ((res === null || res === void 0 ? void 0 : res[0].status) == "failed") {
143
+ reject(res);
144
+ }
145
+ resolve(data);
146
+ }), 1000);
147
+ }
148
+ catch (e) {
149
+ reject(e);
150
+ }
151
+ });
152
+ };
153
+ do {
154
+ res = yield checkTaskAfter1sec(requestId);
155
+ console.log("### res ", res);
156
+ } while ((res === null || res === void 0 ? void 0 : res[0].status) !== "completed");
157
+ return res;
158
+ }
159
+ catch (error) {
160
+ console.error("Error while fetching Idfy getTask API data:", error);
161
+ throw error;
162
+ }
163
+ });
164
+ }
165
+ pingCompanySearchTaskUntilSuccess(requestId) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ try {
168
+ console.log(" ## requestId ", requestId);
169
+ let res = null;
170
+ const checkTaskAfter1sec = (requestId) => {
171
+ return new Promise((resolve, reject) => {
172
+ try {
173
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
174
+ const data = yield this.getCompanySearchTask({ requestId });
175
+ if (data.status != "failed") {
176
+ resolve(data);
177
+ }
178
+ else {
179
+ reject(res);
180
+ }
181
+ }), 1000);
182
+ }
183
+ catch (e) {
184
+ reject(e);
185
+ }
186
+ });
187
+ };
188
+ do {
189
+ res = yield checkTaskAfter1sec(requestId);
190
+ console.log("### res ", res);
191
+ } while ((res === null || res === void 0 ? void 0 : res.status) !== "completed");
192
+ return res;
193
+ }
194
+ catch (error) {
195
+ console.error("Error while fetching Idfy getTask API data:", error);
196
+ throw error;
197
+ }
198
+ });
199
+ }
200
+ getCompanyGstInfo({ gstNo }) {
201
+ var _a, _b, _c, _d;
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ try {
204
+ const data = Object.assign(Object.assign({}, this.bodyTaskIdGroupId), { data: {
205
+ gstin: gstNo,
206
+ } });
207
+ const response = yield this.makeRequest("post", this.gstVerificationEndPoint, data);
208
+ return response;
209
+ }
210
+ catch (error) {
211
+ if ((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) {
212
+ let obj = this.idfyError;
213
+ const errorObj = obj[(_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.error];
214
+ if (errorObj)
215
+ throw Object.assign(Object.assign({}, this.standardErrorThrowFormat), { message: [errorObj.message] });
216
+ }
217
+ throw error;
218
+ }
219
+ });
220
+ }
221
+ getCompanyCINInfo({ cinNo }) {
222
+ var _a, _b, _c, _d, _e, _f;
223
+ return __awaiter(this, void 0, void 0, function* () {
224
+ try {
225
+ const data = Object.assign(Object.assign({}, this.bodyTaskIdGroupId), { data: {
226
+ cin: cinNo,
227
+ } });
228
+ const response = yield this.makeRequest("post", this.cinCompanyVerificationEndPoint, data);
229
+ const successData = yield this.pingTaskUntilSuccess(response.request_id);
230
+ return (_b = (_a = successData === null || successData === void 0 ? void 0 : successData[0]) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.source_output;
231
+ }
232
+ catch (error) {
233
+ if ((_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.error) {
234
+ let obj = this.idfyError;
235
+ const errorObj = obj[(_f = (_e = error === null || error === void 0 ? void 0 : error.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.error];
236
+ if (errorObj)
237
+ throw Object.assign(Object.assign({}, this.standardErrorThrowFormat), { message: [errorObj.message] });
238
+ }
239
+ throw error;
240
+ }
241
+ });
242
+ }
243
+ getIndividualPANInfo({ panNo }) {
244
+ var _a, _b, _c, _d;
245
+ return __awaiter(this, void 0, void 0, function* () {
246
+ try {
247
+ const data = Object.assign(Object.assign({}, this.bodyTaskIdGroupId), { data: {
248
+ id_number: panNo,
249
+ } });
250
+ const response = yield this.makeRequest("post", this.panIndividualVerificationEndPoint, data);
251
+ const successData = yield this.pingTaskUntilSuccess(response.request_id);
252
+ return successData;
253
+ }
254
+ catch (error) {
255
+ if ((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) {
256
+ let obj = this.idfyError;
257
+ const errorObj = obj[(_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.error];
258
+ if (errorObj)
259
+ throw Object.assign(Object.assign({}, this.standardErrorThrowFormat), { message: [errorObj.message] });
260
+ }
261
+ throw error;
262
+ }
263
+ });
264
+ }
265
+ getSyncIndividualAadharScanInfo({ frontScanBase64, backScanBase64, }) {
266
+ var _a, _b, _c, _d;
267
+ return __awaiter(this, void 0, void 0, function* () {
268
+ try {
269
+ const data = Object.assign(Object.assign({}, this.bodyTaskIdGroupId), { data: {
270
+ document1: frontScanBase64,
271
+ document2: backScanBase64,
272
+ consent: "yes",
273
+ advanced_details: {
274
+ extract_qr_info: true,
275
+ extract_last_4_digit: false,
276
+ },
277
+ } });
278
+ const response = yield this.makeRequest("post", this.syncIndividualAadharScanInfoEndpoint, data);
279
+ return response === null || response === void 0 ? void 0 : response.result;
280
+ }
281
+ catch (error) {
282
+ if ((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) {
283
+ let obj = this.idfyError;
284
+ const errorObj = obj[(_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.error];
285
+ if (errorObj)
286
+ throw Object.assign(Object.assign({}, this.standardErrorThrowFormat), { message: [errorObj.message] });
287
+ }
288
+ throw error;
289
+ }
290
+ });
291
+ }
292
+ getSyncIndividualPANScanInfo({ frontScanBase64, }) {
293
+ var _a, _b, _c, _d;
294
+ return __awaiter(this, void 0, void 0, function* () {
295
+ try {
296
+ const data = Object.assign(Object.assign({}, this.bodyTaskIdGroupId), { data: {
297
+ document1: frontScanBase64,
298
+ consent: "yes",
299
+ } });
300
+ const response = yield this.makeRequest("post", this.syncIndividualPANScanInfoEndpoint, data);
301
+ return response === null || response === void 0 ? void 0 : response.result;
302
+ }
303
+ catch (error) {
304
+ if ((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) {
305
+ let obj = this.idfyError;
306
+ const errorObj = obj[(_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.error];
307
+ if (errorObj)
308
+ throw Object.assign(Object.assign({}, this.standardErrorThrowFormat), { message: [errorObj.message] });
309
+ }
310
+ throw error;
311
+ }
312
+ });
313
+ }
314
+ getSyncCompanyGSTScanInfo({ frontScanBase64, }) {
315
+ var _a, _b, _c, _d;
316
+ return __awaiter(this, void 0, void 0, function* () {
317
+ try {
318
+ const data = Object.assign(Object.assign({}, this.bodyTaskIdGroupId), { data: {
319
+ document1: frontScanBase64,
320
+ } });
321
+ const response = yield this.makeRequest("post", this.syncIndividualGSTScanInfoEndpoint, data);
322
+ return response === null || response === void 0 ? void 0 : response.result;
323
+ }
324
+ catch (error) {
325
+ if ((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) {
326
+ let obj = this.idfyError;
327
+ const errorObj = obj[(_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.error];
328
+ if (errorObj)
329
+ throw Object.assign(Object.assign({}, this.standardErrorThrowFormat), { message: [errorObj.message] });
330
+ }
331
+ throw error;
332
+ }
333
+ });
334
+ }
335
+ getSyncIndividualLivenessSelfyScanInfo({ faceScanBase64, }) {
336
+ var _a, _b, _c, _d;
337
+ return __awaiter(this, void 0, void 0, function* () {
338
+ try {
339
+ const data = Object.assign(Object.assign({}, this.bodyTaskIdGroupId), { data: {
340
+ document1: faceScanBase64,
341
+ consent: "yes",
342
+ } });
343
+ const response = yield this.makeRequest("post", this.syncIndividualLiveFaceLivenessEndpoint, data);
344
+ return response === null || response === void 0 ? void 0 : response.result;
345
+ }
346
+ catch (error) {
347
+ if ((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) {
348
+ let obj = this.idfyError;
349
+ const errorObj = obj[(_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.error];
350
+ if (errorObj)
351
+ throw Object.assign(Object.assign({}, this.standardErrorThrowFormat), { message: [errorObj.message] });
352
+ }
353
+ throw error;
354
+ }
355
+ });
356
+ }
357
+ getAsyncAadhaarLiteInfo({ aadhaarNo, }) {
358
+ var _a, _b, _c, _d;
359
+ return __awaiter(this, void 0, void 0, function* () {
360
+ try {
361
+ const data = Object.assign(Object.assign({}, this.bodyTaskIdGroupId), { data: {
362
+ aadhaar_number: aadhaarNo,
363
+ } });
364
+ const response = yield this.makeRequest("post", this.asyncIndividualAadhaarLiteInfoEndPoint, data);
365
+ const successData = yield this.pingTaskUntilSuccess(response.request_id);
366
+ return successData;
367
+ }
368
+ catch (error) {
369
+ if ((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) {
370
+ let obj = this.idfyError;
371
+ const errorObj = obj[(_d = (_c = error === null || error === void 0 ? void 0 : error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.error];
372
+ if (errorObj)
373
+ throw Object.assign(Object.assign({}, this.standardErrorThrowFormat), { message: [errorObj.message] });
374
+ }
375
+ throw error;
376
+ }
377
+ });
378
+ }
379
+ getCompanyDetailsByName({ legalName, }) {
380
+ return __awaiter(this, void 0, void 0, function* () {
381
+ try {
382
+ const data = Object.assign(Object.assign({ version: this.idfyCompanySearch.version }, this.bodyTaskIdGroupId), { data: {
383
+ name: legalName,
384
+ } });
385
+ const response = yield this.makeAxiosRequest({
386
+ method: "post",
387
+ url: this.idfyCompanySearch.companySearchUrl,
388
+ data,
389
+ headers: this.idfyCompanySearch.defaultHeader,
390
+ });
391
+ const successData = yield this.pingCompanySearchTaskUntilSuccess(response.request_id);
392
+ return { request_id: response, successData: successData };
393
+ }
394
+ catch (error) {
395
+ throw error;
396
+ }
397
+ });
398
+ }
399
+ getCompanyDetailsByLlpinOrCin({ cinOrLlpin, }) {
400
+ return __awaiter(this, void 0, void 0, function* () {
401
+ try {
402
+ const data = Object.assign(Object.assign({ version: this.idfyCompanySearch.version }, this.bodyTaskIdGroupId), { data: {
403
+ cin_llpin: cinOrLlpin,
404
+ } });
405
+ const response = yield this.makeAxiosRequest({
406
+ method: "post",
407
+ url: this.idfyCompanySearch.cinllpinUrl,
408
+ data,
409
+ headers: this.idfyCompanySearch.defaultHeader,
410
+ });
411
+ return { response: response };
412
+ }
413
+ catch (error) {
414
+ throw error;
415
+ }
416
+ });
417
+ }
418
+ }
419
+ exports.default = IdfyAPIWrapper;
202
420
  //# sourceMappingURL=idfy.js.map