aeremmiddleware 1.0.26 → 1.0.27

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 (36) hide show
  1. package/README.md +28 -28
  2. package/dist/Finance/Ingenico.types.d.ts +1 -0
  3. package/dist/Finance/ingenicoHtml.js +114 -114
  4. package/dist/Finance/ingenicoHtml.js.map +1 -1
  5. package/dist/Finance/novel.types.js +1 -1
  6. package/dist/Finance/novel.types.js.map +1 -1
  7. package/dist/Socials/Sms.types.js +1 -1
  8. package/dist/Socials/Sms.types.js.map +1 -1
  9. package/dist/Socials/Whatsapp.types.js +1 -1
  10. package/dist/Socials/Whatsapp.types.js.map +1 -1
  11. package/package.json +21 -21
  12. package/src/Finance/Ingenico.types.ts +22 -21
  13. package/src/Finance/auEncrypt.ts +32 -32
  14. package/src/Finance/auFinance.ts +115 -115
  15. package/src/Finance/crimeCheck.ts +212 -212
  16. package/src/Finance/crimecheck.types.ts +31 -31
  17. package/src/Finance/encrypt.ts +18 -18
  18. package/src/Finance/idfy.ts +542 -542
  19. package/src/Finance/index.ts +16 -16
  20. package/src/Finance/ingenico.ts +104 -104
  21. package/src/Finance/ingenicoHtml.ts +119 -119
  22. package/src/Finance/novel.ts +233 -233
  23. package/src/Finance/novel.types.ts +30 -30
  24. package/src/Finance/qbrik.ts +828 -828
  25. package/src/Finance/qbrik.types.ts +131 -131
  26. package/src/Finance/setu.ts +560 -560
  27. package/src/Finance/setu.types.ts +44 -44
  28. package/src/PushNotification/index.ts +5 -5
  29. package/src/PushNotification/pushNotificationFCM.ts +37 -37
  30. package/src/Socials/Sms.types.ts +9 -9
  31. package/src/Socials/SmsSender.ts +78 -78
  32. package/src/Socials/Whatsapp.types.ts +95 -95
  33. package/src/Socials/index.ts +6 -6
  34. package/src/Socials/whatsApp.ts +188 -188
  35. package/src/index.ts +9 -9
  36. package/tsconfig.json +111 -111
@@ -1,233 +1,233 @@
1
- import axios from "axios";
2
- import FormData from "form-data";
3
- import {
4
- CustomerDetails,
5
- StatusType,
6
- ContentType,
7
- Metadata,
8
- } from "./novel.types";
9
-
10
- class NovelApiWrapper {
11
- private authToken: string;
12
- private isStaging: boolean;
13
- private baseApiUrl: string;
14
- private uploadEndpoint = "upload";
15
- private downloadExcelEndpoint = "downloadFileAsExcel";
16
- private downloadJsonEndpoint = "downloadFile";
17
- private autoFetchEndpoint = "generateNetBankingRequest";
18
-
19
- constructor(isStaging: boolean) {
20
- this.isStaging = isStaging;
21
- this.baseApiUrl = this.isStaging
22
- ? "https://cartuat.com/api/"
23
- : "https://cartbi.com/api/";
24
- this.authToken = this.isStaging
25
- ? "API://ET3S5WMo+L3d4lmRF6mOTOM1cPj/TKzuq3JCAyJO2BWPtoVJZ9trpECeSxrzEk05"
26
- : "API://cJCwpFvaLS/qd7W8APrJt3tObcKQqZubh2/yoMHXsa4=";
27
- }
28
-
29
- async uploadDocument(
30
- file: Buffer,
31
- filename: string,
32
- metadata: Metadata,
33
- documentDetails: any[]
34
- ) {
35
- try {
36
- const form = new FormData();
37
-
38
- form.append("file", file, { filename });
39
-
40
- form.append("metadata", metadata);
41
-
42
- form.append("documentDetails", JSON.stringify(documentDetails));
43
-
44
- const headers = {
45
- ...form.getHeaders(),
46
- "auth-token": this.authToken,
47
- };
48
-
49
- const response = await axios.post(
50
- this.baseApiUrl + this.uploadEndpoint,
51
- form,
52
- {
53
- headers,
54
- }
55
- );
56
- if (response.status === 200) {
57
- console.log(response.data.docId, "Document uploaded successfully");
58
- } else {
59
- console.error("Failed to upload document");
60
- }
61
-
62
- return response.data;
63
- } catch (error: any) {
64
- return error.message;
65
- }
66
- }
67
- private async downloadAsExcel(docId: string): Promise<Buffer> {
68
- try {
69
- const headers = {
70
- "auth-token": this.authToken,
71
- "Content-Type": ContentType.TEXT,
72
- };
73
-
74
- const response = await axios.post(
75
- this.baseApiUrl + this.downloadExcelEndpoint,
76
- docId,
77
- { headers, responseType: "arraybuffer" }
78
- );
79
-
80
- if (response.status === 200) {
81
- console.log("File downloaded successfully");
82
- return Buffer.from(response.data, "binary");
83
- } else {
84
- console.error("Failed to download file");
85
- return Buffer.from([]);
86
- }
87
- } catch (error: any) {
88
- console.error("Error:", error.message);
89
- return Buffer.from([]);
90
- }
91
- }
92
-
93
- private async downloadAsJSON(docId: string): Promise<any> {
94
- try {
95
- const headers = {
96
- "auth-token": this.authToken,
97
- "Content-Type": ContentType.TEXT,
98
- };
99
-
100
- const response = await axios.post(
101
- this.baseApiUrl + this.downloadJsonEndpoint,
102
- docId,
103
- { headers }
104
- );
105
-
106
- if (response.data.error == false) {
107
- console.log("File downloaded successfully");
108
- return response.data;
109
- } else {
110
- console.error("Failed to download file");
111
- return null;
112
- }
113
- } catch (error: any) {
114
- console.error("Error:", error.message);
115
- return null;
116
- }
117
- }
118
- private async generateAutoFetchURL(obj: CustomerDetails): Promise<any> {
119
- try {
120
- const headers = {
121
- "auth-token": this.authToken,
122
- "Content-Type": ContentType.JSON,
123
- };
124
-
125
- const response = await axios.post(
126
- this.baseApiUrl + this.autoFetchEndpoint,
127
- obj,
128
- { headers }
129
- );
130
-
131
- if (response.status == 200) {
132
- console.log("File downloaded successfully");
133
- return response.data;
134
- } else {
135
- console.error("Failed to download file");
136
- return null;
137
- }
138
- } catch (error: any) {
139
- console.error("Error:", error.message);
140
- return null;
141
- }
142
- }
143
-
144
- async novelPatternCallback(status: StatusType) {
145
- return this.downloadAsJSON(status.docId);
146
- }
147
-
148
- async uploadBankStatement(
149
- file: Buffer,
150
- filename: string,
151
- metadata: any,
152
- documentDetails: any[]
153
- ): Promise<any> {
154
- return this.uploadDocument(file, filename, metadata, documentDetails);
155
- }
156
- async uploadItr(
157
- file: Buffer,
158
- filename: string,
159
- metadata: any,
160
- documentDetails: any[]
161
- ): Promise<any> {
162
- return this.uploadDocument(file, filename, metadata, documentDetails);
163
- }
164
- async uploadPnL(
165
- file: Buffer,
166
- filename: string,
167
- metadata: any,
168
- documentDetails: any[]
169
- ): Promise<any> {
170
- return this.uploadDocument(file, filename, metadata, documentDetails);
171
- }
172
- async uploadGSTr(
173
- file: Buffer,
174
- filename: string,
175
- metadata: any,
176
- documentDetails: any[]
177
- ): Promise<any> {
178
- return this.uploadDocument(file, filename, metadata, documentDetails);
179
- }
180
- async uploadGST3b(
181
- file: Buffer,
182
- filename: string,
183
- metadata: any,
184
- documentDetails: any[]
185
- ): Promise<any> {
186
- return this.uploadDocument(file, filename, metadata, documentDetails);
187
- }
188
-
189
- async downloadItrAsJson(docId: string): Promise<any> {
190
- return this.downloadAsJSON(docId);
191
- }
192
- async downloadBankStatementAsJson(docId: string): Promise<any> {
193
- return this.downloadAsJSON(docId);
194
- }
195
- async downloadPnLAsJson(docId: string): Promise<any> {
196
- return this.downloadAsJSON(docId);
197
- }
198
- async downloadGSTrAsJson(docId: string): Promise<any> {
199
- return this.downloadAsJSON(docId);
200
- }
201
- async downloadGst3bAsJson(docId: string): Promise<any> {
202
- return this.downloadAsJSON(docId);
203
- }
204
-
205
- async downloadItrAsExcel(docId: string): Promise<any> {
206
- return this.downloadAsExcel(docId);
207
- }
208
- async downloadBankStatementAsExcel(docId: string): Promise<any> {
209
- return this.downloadAsExcel(docId);
210
- }
211
- async downloadGst3bAsExcel(docId: string): Promise<any> {
212
- return this.downloadAsExcel(docId);
213
- }
214
- async downloadPnLAsExcel(docId: string): Promise<any> {
215
- return this.downloadAsExcel(docId);
216
- }
217
- async downloadGSTrAsExcel(docId: string): Promise<any> {
218
- return this.downloadAsExcel(docId);
219
- }
220
-
221
- async getGstrDetailsAutoFetch(obj: CustomerDetails): Promise<any> {
222
- return this.generateAutoFetchURL(obj);
223
- }
224
-
225
- async getItrvDetailsAutoFetch(obj: CustomerDetails): Promise<any> {
226
- return this.generateAutoFetchURL(obj);
227
- }
228
-
229
- async getBankDetailsAutoFetch(obj: CustomerDetails): Promise<any> {
230
- return this.generateAutoFetchURL(obj);
231
- }
232
- }
233
- export default NovelApiWrapper;
1
+ import axios from "axios";
2
+ import FormData from "form-data";
3
+ import {
4
+ CustomerDetails,
5
+ StatusType,
6
+ ContentType,
7
+ Metadata,
8
+ } from "./novel.types";
9
+
10
+ class NovelApiWrapper {
11
+ private authToken: string;
12
+ private isStaging: boolean;
13
+ private baseApiUrl: string;
14
+ private uploadEndpoint = "upload";
15
+ private downloadExcelEndpoint = "downloadFileAsExcel";
16
+ private downloadJsonEndpoint = "downloadFile";
17
+ private autoFetchEndpoint = "generateNetBankingRequest";
18
+
19
+ constructor(isStaging: boolean) {
20
+ this.isStaging = isStaging;
21
+ this.baseApiUrl = this.isStaging
22
+ ? "https://cartuat.com/api/"
23
+ : "https://cartbi.com/api/";
24
+ this.authToken = this.isStaging
25
+ ? "API://ET3S5WMo+L3d4lmRF6mOTOM1cPj/TKzuq3JCAyJO2BWPtoVJZ9trpECeSxrzEk05"
26
+ : "API://cJCwpFvaLS/qd7W8APrJt3tObcKQqZubh2/yoMHXsa4=";
27
+ }
28
+
29
+ async uploadDocument(
30
+ file: Buffer,
31
+ filename: string,
32
+ metadata: Metadata,
33
+ documentDetails: any[]
34
+ ) {
35
+ try {
36
+ const form = new FormData();
37
+
38
+ form.append("file", file, { filename });
39
+
40
+ form.append("metadata", metadata);
41
+
42
+ form.append("documentDetails", JSON.stringify(documentDetails));
43
+
44
+ const headers = {
45
+ ...form.getHeaders(),
46
+ "auth-token": this.authToken,
47
+ };
48
+
49
+ const response = await axios.post(
50
+ this.baseApiUrl + this.uploadEndpoint,
51
+ form,
52
+ {
53
+ headers,
54
+ }
55
+ );
56
+ if (response.status === 200) {
57
+ console.log(response.data.docId, "Document uploaded successfully");
58
+ } else {
59
+ console.error("Failed to upload document");
60
+ }
61
+
62
+ return response.data;
63
+ } catch (error: any) {
64
+ return error.message;
65
+ }
66
+ }
67
+ private async downloadAsExcel(docId: string): Promise<Buffer> {
68
+ try {
69
+ const headers = {
70
+ "auth-token": this.authToken,
71
+ "Content-Type": ContentType.TEXT,
72
+ };
73
+
74
+ const response = await axios.post(
75
+ this.baseApiUrl + this.downloadExcelEndpoint,
76
+ docId,
77
+ { headers, responseType: "arraybuffer" }
78
+ );
79
+
80
+ if (response.status === 200) {
81
+ console.log("File downloaded successfully");
82
+ return Buffer.from(response.data, "binary");
83
+ } else {
84
+ console.error("Failed to download file");
85
+ return Buffer.from([]);
86
+ }
87
+ } catch (error: any) {
88
+ console.error("Error:", error.message);
89
+ return Buffer.from([]);
90
+ }
91
+ }
92
+
93
+ private async downloadAsJSON(docId: string): Promise<any> {
94
+ try {
95
+ const headers = {
96
+ "auth-token": this.authToken,
97
+ "Content-Type": ContentType.TEXT,
98
+ };
99
+
100
+ const response = await axios.post(
101
+ this.baseApiUrl + this.downloadJsonEndpoint,
102
+ docId,
103
+ { headers }
104
+ );
105
+
106
+ if (response.data.error == false) {
107
+ console.log("File downloaded successfully");
108
+ return response.data;
109
+ } else {
110
+ console.error("Failed to download file");
111
+ return null;
112
+ }
113
+ } catch (error: any) {
114
+ console.error("Error:", error.message);
115
+ return null;
116
+ }
117
+ }
118
+ private async generateAutoFetchURL(obj: CustomerDetails): Promise<any> {
119
+ try {
120
+ const headers = {
121
+ "auth-token": this.authToken,
122
+ "Content-Type": ContentType.JSON,
123
+ };
124
+
125
+ const response = await axios.post(
126
+ this.baseApiUrl + this.autoFetchEndpoint,
127
+ obj,
128
+ { headers }
129
+ );
130
+
131
+ if (response.status == 200) {
132
+ console.log("File downloaded successfully");
133
+ return response.data;
134
+ } else {
135
+ console.error("Failed to download file");
136
+ return null;
137
+ }
138
+ } catch (error: any) {
139
+ console.error("Error:", error.message);
140
+ return null;
141
+ }
142
+ }
143
+
144
+ async novelPatternCallback(status: StatusType) {
145
+ return this.downloadAsJSON(status.docId);
146
+ }
147
+
148
+ async uploadBankStatement(
149
+ file: Buffer,
150
+ filename: string,
151
+ metadata: any,
152
+ documentDetails: any[]
153
+ ): Promise<any> {
154
+ return this.uploadDocument(file, filename, metadata, documentDetails);
155
+ }
156
+ async uploadItr(
157
+ file: Buffer,
158
+ filename: string,
159
+ metadata: any,
160
+ documentDetails: any[]
161
+ ): Promise<any> {
162
+ return this.uploadDocument(file, filename, metadata, documentDetails);
163
+ }
164
+ async uploadPnL(
165
+ file: Buffer,
166
+ filename: string,
167
+ metadata: any,
168
+ documentDetails: any[]
169
+ ): Promise<any> {
170
+ return this.uploadDocument(file, filename, metadata, documentDetails);
171
+ }
172
+ async uploadGSTr(
173
+ file: Buffer,
174
+ filename: string,
175
+ metadata: any,
176
+ documentDetails: any[]
177
+ ): Promise<any> {
178
+ return this.uploadDocument(file, filename, metadata, documentDetails);
179
+ }
180
+ async uploadGST3b(
181
+ file: Buffer,
182
+ filename: string,
183
+ metadata: any,
184
+ documentDetails: any[]
185
+ ): Promise<any> {
186
+ return this.uploadDocument(file, filename, metadata, documentDetails);
187
+ }
188
+
189
+ async downloadItrAsJson(docId: string): Promise<any> {
190
+ return this.downloadAsJSON(docId);
191
+ }
192
+ async downloadBankStatementAsJson(docId: string): Promise<any> {
193
+ return this.downloadAsJSON(docId);
194
+ }
195
+ async downloadPnLAsJson(docId: string): Promise<any> {
196
+ return this.downloadAsJSON(docId);
197
+ }
198
+ async downloadGSTrAsJson(docId: string): Promise<any> {
199
+ return this.downloadAsJSON(docId);
200
+ }
201
+ async downloadGst3bAsJson(docId: string): Promise<any> {
202
+ return this.downloadAsJSON(docId);
203
+ }
204
+
205
+ async downloadItrAsExcel(docId: string): Promise<any> {
206
+ return this.downloadAsExcel(docId);
207
+ }
208
+ async downloadBankStatementAsExcel(docId: string): Promise<any> {
209
+ return this.downloadAsExcel(docId);
210
+ }
211
+ async downloadGst3bAsExcel(docId: string): Promise<any> {
212
+ return this.downloadAsExcel(docId);
213
+ }
214
+ async downloadPnLAsExcel(docId: string): Promise<any> {
215
+ return this.downloadAsExcel(docId);
216
+ }
217
+ async downloadGSTrAsExcel(docId: string): Promise<any> {
218
+ return this.downloadAsExcel(docId);
219
+ }
220
+
221
+ async getGstrDetailsAutoFetch(obj: CustomerDetails): Promise<any> {
222
+ return this.generateAutoFetchURL(obj);
223
+ }
224
+
225
+ async getItrvDetailsAutoFetch(obj: CustomerDetails): Promise<any> {
226
+ return this.generateAutoFetchURL(obj);
227
+ }
228
+
229
+ async getBankDetailsAutoFetch(obj: CustomerDetails): Promise<any> {
230
+ return this.generateAutoFetchURL(obj);
231
+ }
232
+ }
233
+ export default NovelApiWrapper;
@@ -1,30 +1,30 @@
1
- export interface CustomerDetails {
2
- fileNo?: string;
3
- name?: string;
4
- contactNo: string;
5
- organizationName?: string;
6
- bank?: string;
7
- accountType: string;
8
- defaultScreen?: string;
9
- }
10
- export interface StatusType {
11
- docId: string;
12
- requestId: string;
13
- status: string;
14
- reportFileName: string;
15
- endTime: string;
16
- message: string;
17
- fileNo: string;
18
- }
19
- export interface Metadata {
20
- password?: string;
21
- bank: string;
22
- name?: string;
23
- productType?: string;
24
- }
25
-
26
- export enum ContentType {
27
- TEXT = "text/plain",
28
- FORM = "multipart/form-data",
29
- JSON = "application/json",
30
- }
1
+ export interface CustomerDetails {
2
+ fileNo?: string;
3
+ name?: string;
4
+ contactNo: string;
5
+ organizationName?: string;
6
+ bank?: string;
7
+ accountType: string;
8
+ defaultScreen?: string;
9
+ }
10
+ export interface StatusType {
11
+ docId: string;
12
+ requestId: string;
13
+ status: string;
14
+ reportFileName: string;
15
+ endTime: string;
16
+ message: string;
17
+ fileNo: string;
18
+ }
19
+ export interface Metadata {
20
+ password?: string;
21
+ bank: string;
22
+ name?: string;
23
+ productType?: string;
24
+ }
25
+
26
+ export enum ContentType {
27
+ TEXT = "text/plain",
28
+ FORM = "multipart/form-data",
29
+ JSON = "application/json",
30
+ }