aeremmiddleware 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # README #
2
+
3
+ This README would normally document whatever steps are necessary to get your application up and running.
4
+
5
+ ### What is this repository for? ###
6
+
7
+ * Quick summary
8
+ * Version
9
+ * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
10
+
11
+ ### How do I get set up? ###
12
+
13
+ * Summary of set up
14
+ * Configuration
15
+ * Dependencies
16
+ * Database configuration
17
+ * How to run tests
18
+ * Deployment instructions
19
+
20
+ ### Contribution guidelines ###
21
+
22
+ * Writing tests
23
+ * Code review
24
+ * Other guidelines
25
+
26
+ ### Who do I talk to? ###
27
+
28
+ * Repo owner or admin
29
+ * Other community or team contact
@@ -1,35 +1,35 @@
1
- export default class IdfyAPIWrapper {
2
- private bodyTaskIdGroupId;
3
- private defaultHeaderIdfyApi;
4
- private baseUrl;
5
- private gstVerificationEndPoint;
6
- private panIndividualVerificationEndPoint;
7
- private cinCompanyVerificationEndPoint;
8
- private taskUrl;
9
- private syncIndividualAadharScanInfoEndpoint;
10
- private syncIndividualPANScanInfoEndpoint;
11
- private syncIndividualLiveFaceLivenessEndpoint;
12
- constructor();
13
- private makeRequest;
14
- private getTask;
15
- private pingTaskUntilSuccess;
16
- getCompanyGstInfo({ gstNo }: {
17
- gstNo: string;
18
- }): Promise<any>;
19
- getCompanyCINInfo({ cinNo }: {
20
- cinNo: string;
21
- }): Promise<any>;
22
- getIndividualPANInfo({ panNo }: {
23
- panNo: string;
24
- }): Promise<any>;
25
- getSyncIndividualAadharScanInfo({ frontScanBase64, backScanBase64 }: {
26
- frontScanBase64: string;
27
- backScanBase64: string;
28
- }): Promise<any>;
29
- getSyncIndividualPANScanInfo({ frontScanBase64 }: {
30
- frontScanBase64: string;
31
- }): Promise<any>;
32
- getSyncIndividualLivenessSelfyScanInfo({ faceScanBase64 }: {
33
- faceScanBase64: string;
34
- }): Promise<any>;
35
- }
1
+ export default class IdfyAPIWrapper {
2
+ private bodyTaskIdGroupId;
3
+ private defaultHeaderIdfyApi;
4
+ private baseUrl;
5
+ private gstVerificationEndPoint;
6
+ private panIndividualVerificationEndPoint;
7
+ private cinCompanyVerificationEndPoint;
8
+ private taskUrl;
9
+ private syncIndividualAadharScanInfoEndpoint;
10
+ private syncIndividualPANScanInfoEndpoint;
11
+ private syncIndividualLiveFaceLivenessEndpoint;
12
+ constructor();
13
+ private makeRequest;
14
+ private getTask;
15
+ private pingTaskUntilSuccess;
16
+ getCompanyGstInfo({ gstNo }: {
17
+ gstNo: string;
18
+ }): Promise<any>;
19
+ getCompanyCINInfo({ cinNo }: {
20
+ cinNo: string;
21
+ }): Promise<any>;
22
+ getIndividualPANInfo({ panNo }: {
23
+ panNo: string;
24
+ }): Promise<any>;
25
+ getSyncIndividualAadharScanInfo({ frontScanBase64, backScanBase64 }: {
26
+ frontScanBase64: string;
27
+ backScanBase64: string;
28
+ }): Promise<any>;
29
+ getSyncIndividualPANScanInfo({ frontScanBase64 }: {
30
+ frontScanBase64: string;
31
+ }): Promise<any>;
32
+ getSyncIndividualLivenessSelfyScanInfo({ faceScanBase64 }: {
33
+ faceScanBase64: string;
34
+ }): Promise<any>;
35
+ }
@@ -1,202 +1,202 @@
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() {
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;
202
202
  //# sourceMappingURL=idfy.js.map
@@ -1,4 +1,4 @@
1
- import IdfyAPIWrapper from './idfy';
2
- export declare const finance: {
3
- idFy: typeof IdfyAPIWrapper;
4
- };
1
+ import IdfyAPIWrapper from './idfy';
2
+ export declare const finance: {
3
+ idFy: typeof IdfyAPIWrapper;
4
+ };
@@ -1,11 +1,11 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.finance = void 0;
7
- const idfy_1 = __importDefault(require("./idfy"));
8
- exports.finance = {
9
- idFy: idfy_1.default
10
- };
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.finance = void 0;
7
+ const idfy_1 = __importDefault(require("./idfy"));
8
+ exports.finance = {
9
+ idFy: idfy_1.default
10
+ };
11
11
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";
1
+ "use strict";
2
2
  //# sourceMappingURL=index.js.map