aeremmiddleware 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Finance/Ingenico.types.d.ts +21 -0
- package/dist/Finance/Ingenico.types.js +3 -0
- package/dist/Finance/Ingenico.types.js.map +1 -0
- package/dist/Finance/crimeCheck.d.ts +16 -0
- package/dist/Finance/crimeCheck.js +137 -0
- package/dist/Finance/crimeCheck.js.map +1 -0
- package/dist/Finance/crimecheck.types.d.ts +30 -0
- package/dist/Finance/crimecheck.types.js +3 -0
- package/dist/Finance/crimecheck.types.js.map +1 -0
- package/dist/Finance/encrypt.d.ts +1 -0
- package/dist/Finance/encrypt.js +20 -0
- package/dist/Finance/encrypt.js.map +1 -0
- package/dist/Finance/idfy.d.ts +63 -35
- package/dist/Finance/idfy.js +411 -201
- package/dist/Finance/idfy.js.map +1 -1
- package/dist/Finance/index.d.ts +6 -4
- package/dist/Finance/index.js +12 -10
- package/dist/Finance/index.js.map +1 -1
- package/dist/Finance/ingenico.d.ts +13 -0
- package/dist/Finance/ingenico.js +122 -0
- package/dist/Finance/ingenico.js.map +1 -0
- package/dist/Finance/ingenicoHtml.d.ts +2 -0
- package/dist/Finance/ingenicoHtml.js +122 -0
- package/dist/Finance/ingenicoHtml.js.map +1 -0
- package/dist/Finance/novel.d.ts +35 -0
- package/dist/Finance/novel.js +222 -0
- package/dist/Finance/novel.js.map +1 -0
- package/dist/Finance/novel.types.d.ts +23 -0
- package/dist/Finance/novel.types.js +10 -0
- package/dist/Finance/novel.types.js.map +1 -0
- package/dist/Maps/index.js +1 -1
- package/dist/Socials/Sms.types.d.ts +8 -0
- package/dist/Socials/Sms.types.js +9 -0
- package/dist/Socials/Sms.types.js.map +1 -0
- package/dist/Socials/SmsSender.d.ts +17 -0
- package/dist/Socials/SmsSender.js +74 -0
- package/dist/Socials/SmsSender.js.map +1 -0
- package/dist/Socials/Whatsapp.types.d.ts +93 -97
- package/dist/Socials/Whatsapp.types.js +8 -8
- package/dist/Socials/Whatsapp.types.js.map +1 -1
- package/dist/Socials/index.d.ts +6 -4
- package/dist/Socials/index.js +12 -10
- package/dist/Socials/index.js.map +1 -1
- package/dist/Socials/whatsApp.d.ts +23 -0
- package/dist/Socials/whatsApp.js +169 -0
- package/dist/Socials/whatsApp.js.map +1 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.js +8 -8
- package/package.json +1 -1
- package/src/Finance/Ingenico.types.ts +3 -0
- package/src/Finance/crimeCheck.ts +135 -0
- package/src/Finance/crimecheck.types.ts +31 -0
- package/src/Finance/idfy.ts +12 -6
- package/src/Finance/ingenico.ts +36 -136
- package/src/Finance/ingenicoHtml.ts +119 -0
- package/src/Socials/SmsSender.ts +20 -21
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import axios, { AxiosResponse } from "axios";
|
|
2
|
+
import { companyDetails, individualDetails } from "./crimecheck.types";
|
|
3
|
+
|
|
4
|
+
class CrimeSearchAPIWrapper {
|
|
5
|
+
private apiKey: string;
|
|
6
|
+
private baseUrl: string = "https://crime.getupforchange.com/api/";
|
|
7
|
+
private statusCheckEndpoint = "v3/status";
|
|
8
|
+
private addReportEndpoint = "v3/addReport";
|
|
9
|
+
private downloadAsJsonEndpoint = "v3/downloadJsonReport/";
|
|
10
|
+
private downloadAsPdfEndpoint = "v3/downloadReport/";
|
|
11
|
+
|
|
12
|
+
constructor(apiKey: string) {
|
|
13
|
+
this.apiKey = apiKey;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async checkApiStatus(): Promise<void> {
|
|
17
|
+
try {
|
|
18
|
+
const response: AxiosResponse = await axios.get(
|
|
19
|
+
this.baseUrl + this.statusCheckEndpoint,
|
|
20
|
+
{
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: this.apiKey,
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
console.log(response.data);
|
|
28
|
+
return response.data;
|
|
29
|
+
} catch (error: any) {
|
|
30
|
+
console.error(error);
|
|
31
|
+
return error.message;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async addCompanyReport(companyDetails: companyDetails): Promise<void> {
|
|
35
|
+
const bodyFormData = new FormData();
|
|
36
|
+
if (companyDetails) {
|
|
37
|
+
bodyFormData.append("companyName", companyDetails.companyName);
|
|
38
|
+
try {
|
|
39
|
+
const response: AxiosResponse = await axios.post(
|
|
40
|
+
this.baseUrl + this.addReportEndpoint,
|
|
41
|
+
companyDetails,
|
|
42
|
+
{
|
|
43
|
+
auth: {
|
|
44
|
+
username: this.apiKey,
|
|
45
|
+
password: "",
|
|
46
|
+
},
|
|
47
|
+
headers: {
|
|
48
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
console.log(response.data);
|
|
54
|
+
return response.data;
|
|
55
|
+
} catch (error: any) {
|
|
56
|
+
console.error(error);
|
|
57
|
+
return error.message;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async addIndividualReport(
|
|
63
|
+
individualDetails: individualDetails
|
|
64
|
+
): Promise<void> {
|
|
65
|
+
const bodyFormData = new FormData();
|
|
66
|
+
if (individualDetails.name) {
|
|
67
|
+
bodyFormData.append("name", individualDetails.name);
|
|
68
|
+
try {
|
|
69
|
+
const response: AxiosResponse = await axios.post(
|
|
70
|
+
this.baseUrl + this.addReportEndpoint,
|
|
71
|
+
individualDetails,
|
|
72
|
+
{
|
|
73
|
+
auth: {
|
|
74
|
+
username: this.apiKey,
|
|
75
|
+
password: "",
|
|
76
|
+
},
|
|
77
|
+
headers: {
|
|
78
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
console.log(response.data);
|
|
84
|
+
return response.data;
|
|
85
|
+
} catch (error: any) {
|
|
86
|
+
console.error(error);
|
|
87
|
+
return error.message;
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
console.log("invalid input");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async downloadAsJSON(reqId: string): Promise<any> {
|
|
95
|
+
try {
|
|
96
|
+
const response: AxiosResponse = await axios.get(
|
|
97
|
+
this.baseUrl + this.downloadAsJsonEndpoint + `${reqId}/${this.apiKey}`
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (response.data) {
|
|
101
|
+
console.log("File downloaded successfully");
|
|
102
|
+
console.log(response.data);
|
|
103
|
+
return response.data;
|
|
104
|
+
} else {
|
|
105
|
+
console.error("Failed to download file");
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
} catch (error: any) {
|
|
109
|
+
console.error("Error:", error.message);
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async downloadAsPDF(reqId: string): Promise<any> {
|
|
115
|
+
try {
|
|
116
|
+
const response: AxiosResponse = await axios.get(
|
|
117
|
+
this.baseUrl + this.downloadAsPdfEndpoint + `${reqId}/${this.apiKey}`
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
if (response.data) {
|
|
121
|
+
console.log("File downloaded successfully");
|
|
122
|
+
console.log(response.data);
|
|
123
|
+
return response.data;
|
|
124
|
+
} else {
|
|
125
|
+
console.error("Failed to download file");
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
} catch (error: any) {
|
|
129
|
+
console.error("Error:", error.message);
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export default CrimeSearchAPIWrapper;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface companyDetails {
|
|
2
|
+
companyName: string;
|
|
3
|
+
companyType?: string;
|
|
4
|
+
companyAddress?: string;
|
|
5
|
+
directors?: string;
|
|
6
|
+
clientRefNo?: string;
|
|
7
|
+
reportMode?: string;
|
|
8
|
+
priority?: string;
|
|
9
|
+
callbackUrl?: string;
|
|
10
|
+
cinNumber?: string;
|
|
11
|
+
gstNumber?: string;
|
|
12
|
+
reqTag?: string;
|
|
13
|
+
ticketSize?: string;
|
|
14
|
+
crimewatch?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface individualDetails {
|
|
18
|
+
name: string;
|
|
19
|
+
fatherName?: string;
|
|
20
|
+
address?: string;
|
|
21
|
+
address2?: string;
|
|
22
|
+
dob?: string;
|
|
23
|
+
panNumber?: string;
|
|
24
|
+
clientRefNo?: string;
|
|
25
|
+
reportMode?: string;
|
|
26
|
+
priority?: string;
|
|
27
|
+
callbackUrl?: string;
|
|
28
|
+
reqTag?: string;
|
|
29
|
+
ticketSize?: string;
|
|
30
|
+
crimewatch?: string;
|
|
31
|
+
}
|
package/src/Finance/idfy.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
|
-
|
|
2
|
+
interface ObjectTypes {
|
|
3
|
+
IDFY_TASK_ID: string;
|
|
4
|
+
IDFY_GROUP_ID: string;
|
|
5
|
+
IDFY_ACCOUNT_ID: string;
|
|
6
|
+
IDFY_API_KEY: string;
|
|
7
|
+
IDFY_COMPANY_SEARCH_API_KEY: string;
|
|
8
|
+
}
|
|
3
9
|
export default class IdfyAPIWrapper {
|
|
4
10
|
private bodyTaskIdGroupId = {
|
|
5
11
|
task_id: "",
|
|
@@ -59,7 +65,7 @@ export default class IdfyAPIWrapper {
|
|
|
59
65
|
IDFY_ACCOUNT_ID,
|
|
60
66
|
IDFY_API_KEY,
|
|
61
67
|
IDFY_COMPANY_SEARCH_API_KEY,
|
|
62
|
-
}) {
|
|
68
|
+
}: ObjectTypes) {
|
|
63
69
|
this.bodyTaskIdGroupId.task_id = IDFY_TASK_ID;
|
|
64
70
|
this.bodyTaskIdGroupId.group_id = IDFY_GROUP_ID;
|
|
65
71
|
this.defaultHeaderIdfyApi["account-id"] = IDFY_ACCOUNT_ID;
|
|
@@ -156,7 +162,7 @@ export default class IdfyAPIWrapper {
|
|
|
156
162
|
private async pingTaskUntilSuccess(requestId: string): Promise<any> {
|
|
157
163
|
try {
|
|
158
164
|
let res: any = null;
|
|
159
|
-
const checkTaskAfter1sec = (requestId) => {
|
|
165
|
+
const checkTaskAfter1sec = (requestId: any) => {
|
|
160
166
|
return new Promise<any>((resolve, reject) => {
|
|
161
167
|
try {
|
|
162
168
|
setTimeout(async () => {
|
|
@@ -190,7 +196,7 @@ export default class IdfyAPIWrapper {
|
|
|
190
196
|
try {
|
|
191
197
|
console.log(" ## requestId ", requestId);
|
|
192
198
|
let res: any = null;
|
|
193
|
-
const checkTaskAfter1sec = (requestId) => {
|
|
199
|
+
const checkTaskAfter1sec = (requestId: string) => {
|
|
194
200
|
return new Promise<any>((resolve, reject) => {
|
|
195
201
|
try {
|
|
196
202
|
setTimeout(async () => {
|
|
@@ -231,13 +237,13 @@ export default class IdfyAPIWrapper {
|
|
|
231
237
|
data
|
|
232
238
|
);
|
|
233
239
|
return response;
|
|
234
|
-
} catch (error) {
|
|
240
|
+
} catch (error: any) {
|
|
235
241
|
if (error?.response?.data?.error) {
|
|
236
242
|
const errorObj = this.idfyError[error?.response?.data?.error];
|
|
237
243
|
if (errorObj)
|
|
238
244
|
throw {
|
|
239
245
|
...this.standardErrorThrowFormat,
|
|
240
|
-
message: [
|
|
246
|
+
message: this.idfyError[errorKey],
|
|
241
247
|
};
|
|
242
248
|
}
|
|
243
249
|
|
package/src/Finance/ingenico.ts
CHANGED
|
@@ -1,160 +1,60 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { MandateDataType } from "./Ingenico.types";
|
|
2
3
|
import { createSHA512Hash } from "./encrypt";
|
|
4
|
+
import { createHash } from "crypto";
|
|
5
|
+
import { mandateHtml } from "./ingenicoHtml";
|
|
3
6
|
|
|
4
7
|
class IngenicoApiWrapper {
|
|
5
8
|
private verificationUrl = "https://www.paynimo.com/api/paynimoV2.req";
|
|
6
|
-
private salt = "
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
private salt = "";
|
|
10
|
+
|
|
11
|
+
constructor(salt: string) {
|
|
12
|
+
this.salt = salt;
|
|
13
|
+
}
|
|
14
|
+
async startMandate(mandateData: MandateDataType): Promise<any> {
|
|
15
|
+
const hashingData = {
|
|
16
|
+
merchantId: mandateData.merchantId,
|
|
17
|
+
txnId: mandateData.txnId,
|
|
18
|
+
totalamount: mandateData.totalamount,
|
|
19
|
+
accountNo: mandateData.accountNo,
|
|
20
|
+
consumerId: mandateData.consumerId,
|
|
21
|
+
consumerMobileNo: mandateData.consumerMobileNo,
|
|
22
|
+
consumerEmailId: mandateData.consumerEmailId,
|
|
23
|
+
debitStartDate: mandateData.debitStartDate,
|
|
24
|
+
debitEndDate: mandateData.debitEndDate,
|
|
25
|
+
maxAmount: mandateData.maxAmount,
|
|
26
|
+
amountType: mandateData.amountType,
|
|
27
|
+
frequency: mandateData.frequency,
|
|
22
28
|
cardNumber: "",
|
|
23
29
|
expMonth: "",
|
|
24
30
|
expYear: "",
|
|
25
31
|
cvvCode: "",
|
|
26
32
|
};
|
|
27
33
|
|
|
28
|
-
const tokenId = createSHA512Hash(
|
|
29
|
-
|
|
30
|
-
return `<!DOCTYPE html>
|
|
31
|
-
<html>
|
|
32
|
-
<head>
|
|
33
|
-
<title>Checkout Demo</title>
|
|
34
|
-
<meta name="viewport" content="user-scalable=no, width=device-width,
|
|
35
|
-
initial-scale=1" / />
|
|
36
|
-
<script
|
|
37
|
-
src="https://www.paynimo.com/paynimocheckout/client/lib/jquery.min.js"
|
|
38
|
-
type="text/javascript"
|
|
39
|
-
></script>
|
|
40
|
-
</head>
|
|
41
|
-
|
|
42
|
-
<body>
|
|
43
|
-
<button id="btnSubmit">Register Now</button>
|
|
44
|
-
|
|
45
|
-
<script
|
|
46
|
-
type="text/javascript"
|
|
47
|
-
src="https://www.paynimo.com/paynimocheckout/server/lib/checkout.js"
|
|
48
|
-
></script>
|
|
49
|
-
|
|
50
|
-
<script type="text/javascript">
|
|
51
|
-
$(document).ready(function () {
|
|
52
|
-
function handleResponse(res) {
|
|
53
|
-
if (
|
|
54
|
-
typeof res != "undefined" &&
|
|
55
|
-
typeof res.paymentMethod != "undefined" &&
|
|
56
|
-
typeof res.paymentMethod.paymentTransaction != "undefined" &&
|
|
57
|
-
typeof res.paymentMethod.paymentTransaction.statusCode !=
|
|
58
|
-
"undefined" &&
|
|
59
|
-
res.paymentMethod.paymentTransaction.statusCode == "0300"
|
|
60
|
-
) {
|
|
61
|
-
// success block
|
|
62
|
-
console.log("success block",res);
|
|
63
|
-
} else if (
|
|
64
|
-
typeof res != "undefined" &&
|
|
65
|
-
typeof res.paymentMethod != "undefined" &&
|
|
66
|
-
typeof res.paymentMethod.paymentTransaction != "undefined" &&
|
|
67
|
-
typeof res.paymentMethod.paymentTransaction.statusCode !=
|
|
68
|
-
"undefined" &&
|
|
69
|
-
res.paymentMethod.paymentTransaction.statusCode == "0398"
|
|
70
|
-
) {
|
|
71
|
-
// initiated block
|
|
72
|
-
console.log("initiate block",res);
|
|
73
|
-
} else {
|
|
74
|
-
// error block
|
|
75
|
-
console.log("error block",res);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
$(document)
|
|
80
|
-
.off("click", "#btnSubmit")
|
|
81
|
-
.on("click", "#btnSubmit", function (e) {
|
|
82
|
-
e.preventDefault();
|
|
83
|
-
|
|
84
|
-
var reqJson = {
|
|
85
|
-
features: {
|
|
86
|
-
enableAbortResponse: true,
|
|
87
|
-
enableNewWindowFlow: true, //for hybrid applications please disable this by passing false
|
|
88
|
-
enableExpressPay: true,
|
|
89
|
-
enableMerTxnDetails: true,
|
|
90
|
-
siDetailsAtMerchantEnd: true,
|
|
91
|
-
enableSI: true,
|
|
92
|
-
},
|
|
93
|
-
consumerData: {
|
|
94
|
-
deviceId: "WEBSH2",
|
|
95
|
-
token:"${tokenId}",
|
|
96
|
-
returnUrl:
|
|
97
|
-
"https://aerem.co/", //merchant response page URL
|
|
98
|
-
responseHandler: handleResponse,
|
|
99
|
-
paymentMode: "netBanking",
|
|
100
|
-
merchantLogoUrl:
|
|
101
|
-
"https://www.paynimo.com/CompanyDocs/company-logo-vertical.png", //provided merchant logo will be displayed
|
|
102
|
-
merchantId: "T656995",
|
|
103
|
-
currency: "INR",
|
|
104
|
-
consumerId: "c964635", //Your unique consumer identifier to register a eMandate/eNACH
|
|
105
|
-
consumerMobileNo: "8823809696",
|
|
106
|
-
consumerEmailId: "saransh2196@gmail.com",
|
|
107
|
-
txnId: "16949471459696", //Unique merchant transaction ID
|
|
108
|
-
|
|
109
|
-
items: [
|
|
110
|
-
{
|
|
111
|
-
itemId: "FIRST",
|
|
112
|
-
amount: "2",
|
|
113
|
-
comAmt: "0",
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
customStyle: {
|
|
117
|
-
PRIMARY_COLOR_CODE: "#45beaa", //merchant primary color code
|
|
118
|
-
SECONDARY_COLOR_CODE: "#FFFFFF", //provide merchant's suitable color code
|
|
119
|
-
BUTTON_COLOR_CODE_1: "#2d8c8c", //merchant's button background color code
|
|
120
|
-
BUTTON_COLOR_CODE_2: "#FFFFFF", //provide merchant's suitable color code for button text
|
|
121
|
-
},
|
|
122
|
-
accountNo: "203209528180", //Pass this if accountNo is captured at merchant side for eMandate/eNACH
|
|
123
|
-
|
|
124
|
-
ifscCode: "SBIN0000441", //Pass this if ifscCode is captured at merchant side.
|
|
125
|
-
accountType: "Saving", //Required for eNACH registration this is mandatory field
|
|
126
|
-
debitStartDate: "29-09-2023",
|
|
127
|
-
debitEndDate: "10-05-2025",
|
|
128
|
-
maxAmount: "20000",
|
|
129
|
-
amountType: "M",
|
|
130
|
-
frequency: "ADHO",
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
$.pnCheckout(reqJson);
|
|
135
|
-
if (reqJson.features.enableNewWindowFlow) {
|
|
136
|
-
pnCheckoutShared.openNewWindow();
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
</script>
|
|
141
|
-
</body>
|
|
142
|
-
</html>
|
|
143
|
-
|
|
144
|
-
`;
|
|
34
|
+
const tokenId = createSHA512Hash(hashingData, this.salt);
|
|
35
|
+
return mandateHtml(mandateData, tokenId);
|
|
145
36
|
}
|
|
146
37
|
|
|
147
|
-
|
|
148
|
-
"
|
|
38
|
+
private hashString(input: string): string {
|
|
39
|
+
const hash = createHash("sha512");
|
|
40
|
+
|
|
41
|
+
return hash.update(input).digest("hex");
|
|
42
|
+
}
|
|
149
43
|
|
|
150
44
|
async dualVerification(inputString: any): Promise<any> {
|
|
45
|
+
const originalHash = this.hashString(inputString);
|
|
46
|
+
console.log("originalhash", originalHash);
|
|
151
47
|
const dataArray = inputString.split("|");
|
|
152
48
|
dataArray[dataArray.length - 1] = this.salt;
|
|
153
49
|
const modifiedString = dataArray.join("|");
|
|
50
|
+
const modifiedHash = this.hashString(modifiedString);
|
|
51
|
+
console.log("modifiedhash", modifiedHash);
|
|
154
52
|
|
|
155
|
-
if (
|
|
53
|
+
if (originalHash === modifiedHash) {
|
|
54
|
+
console.log("true");
|
|
156
55
|
return true;
|
|
157
56
|
} else {
|
|
57
|
+
console.log("faalse");
|
|
158
58
|
return false;
|
|
159
59
|
}
|
|
160
60
|
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { MandateDataType } from "./Ingenico.types";
|
|
2
|
+
|
|
3
|
+
export const mandateHtml = (mandateData: MandateDataType, tokenId: string) => {
|
|
4
|
+
return `<!DOCTYPE html>
|
|
5
|
+
<html>
|
|
6
|
+
<head>
|
|
7
|
+
<title>Checkout Demo</title>
|
|
8
|
+
<meta name="viewport" content="user-scalable=no, width=device-width,
|
|
9
|
+
initial-scale=1" / />
|
|
10
|
+
<script
|
|
11
|
+
src="https://www.paynimo.com/paynimocheckout/client/lib/jquery.min.js"
|
|
12
|
+
type="text/javascript"
|
|
13
|
+
></script>
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
<button id="btnSubmit">Register Now</button>
|
|
18
|
+
|
|
19
|
+
<script
|
|
20
|
+
type="text/javascript"
|
|
21
|
+
src="https://www.paynimo.com/paynimocheckout/server/lib/checkout.js"
|
|
22
|
+
></script>
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript">
|
|
25
|
+
$(document).ready(function () {
|
|
26
|
+
function handleResponse(res) {
|
|
27
|
+
if (
|
|
28
|
+
typeof res != "undefined" &&
|
|
29
|
+
typeof res.paymentMethod != "undefined" &&
|
|
30
|
+
typeof res.paymentMethod.paymentTransaction != "undefined" &&
|
|
31
|
+
typeof res.paymentMethod.paymentTransaction.statusCode !=
|
|
32
|
+
"undefined" &&
|
|
33
|
+
res.paymentMethod.paymentTransaction.statusCode == "0300"
|
|
34
|
+
) {
|
|
35
|
+
// success block
|
|
36
|
+
console.log("success block",res);
|
|
37
|
+
} else if (
|
|
38
|
+
typeof res != "undefined" &&
|
|
39
|
+
typeof res.paymentMethod != "undefined" &&
|
|
40
|
+
typeof res.paymentMethod.paymentTransaction != "undefined" &&
|
|
41
|
+
typeof res.paymentMethod.paymentTransaction.statusCode !=
|
|
42
|
+
"undefined" &&
|
|
43
|
+
res.paymentMethod.paymentTransaction.statusCode == "0398"
|
|
44
|
+
) {
|
|
45
|
+
// initiated block
|
|
46
|
+
console.log("initiate block",res);
|
|
47
|
+
} else {
|
|
48
|
+
// error block
|
|
49
|
+
console.log("error block",res);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
$(document)
|
|
54
|
+
.off("click", "#btnSubmit")
|
|
55
|
+
.on("click", "#btnSubmit", function (e) {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
|
|
58
|
+
var reqJson = {
|
|
59
|
+
features: {
|
|
60
|
+
enableAbortResponse: true,
|
|
61
|
+
enableNewWindowFlow: true, //for hybrid applications please disable this by passing false
|
|
62
|
+
enableExpressPay: true,
|
|
63
|
+
enableMerTxnDetails: true,
|
|
64
|
+
siDetailsAtMerchantEnd: true,
|
|
65
|
+
enableSI: true,
|
|
66
|
+
},
|
|
67
|
+
consumerData: {
|
|
68
|
+
deviceId: "WEBSH2",
|
|
69
|
+
token:"${tokenId}",
|
|
70
|
+
returnUrl:
|
|
71
|
+
"https://aerem.co/", //merchant response page URL
|
|
72
|
+
responseHandler: handleResponse,
|
|
73
|
+
paymentMode: "${mandateData.paymentMode}",
|
|
74
|
+
merchantLogoUrl:
|
|
75
|
+
"https://www.paynimo.com/CompanyDocs/company-logo-vertical.png",
|
|
76
|
+
merchantId: "${mandateData.merchantId}",
|
|
77
|
+
currency: "INR",
|
|
78
|
+
consumerId: "${mandateData.consumerId}",
|
|
79
|
+
consumerMobileNo: "${mandateData.consumerMobileNo}",
|
|
80
|
+
consumerEmailId: "${mandateData.consumerEmailId}",
|
|
81
|
+
txnId: "${mandateData.txnId}",
|
|
82
|
+
|
|
83
|
+
items: [
|
|
84
|
+
{
|
|
85
|
+
itemId: "FIRST",
|
|
86
|
+
amount: "${mandateData.totalamount}",
|
|
87
|
+
comAmt: "0",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
customStyle: {
|
|
91
|
+
PRIMARY_COLOR_CODE: "#45beaa",
|
|
92
|
+
SECONDARY_COLOR_CODE: "#FFFFFF",
|
|
93
|
+
BUTTON_COLOR_CODE_1: "#2d8c8c",
|
|
94
|
+
BUTTON_COLOR_CODE_2: "#FFFFFF",
|
|
95
|
+
},
|
|
96
|
+
accountNo: "${mandateData.accountNo}", //Pass this if accountNo is captured at merchant side for eMandate/eNACH
|
|
97
|
+
|
|
98
|
+
ifscCode: "${mandateData.ifscCode}", //Pass this if ifscCode is captured at merchant side.
|
|
99
|
+
accountType: "${mandateData.accountType}", //Required for eNACH registration this is mandatory field
|
|
100
|
+
debitStartDate: "${mandateData.debitStartDate}",
|
|
101
|
+
debitEndDate: "${mandateData.debitEndDate}",
|
|
102
|
+
maxAmount: "${mandateData.maxAmount}",
|
|
103
|
+
amountType: "${mandateData.amountType}",
|
|
104
|
+
frequency: "${mandateData.frequency}",
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
$.pnCheckout(reqJson);
|
|
109
|
+
if (reqJson.features.enableNewWindowFlow) {
|
|
110
|
+
pnCheckoutShared.openNewWindow();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
</script>
|
|
115
|
+
</body>
|
|
116
|
+
</html>
|
|
117
|
+
|
|
118
|
+
`;
|
|
119
|
+
};
|
package/src/Socials/SmsSender.ts
CHANGED
|
@@ -21,7 +21,7 @@ class SmsSender {
|
|
|
21
21
|
this.provider = provider;
|
|
22
22
|
|
|
23
23
|
if (this.provider === Provider.EXOTEL) {
|
|
24
|
-
this.smsUrl = `https://${exotelApiKey}:${exotelToken}@api.exotel.com/v1/Accounts/${exotelSid}/Sms/send`;
|
|
24
|
+
this.smsUrl = `https://${this.exotelApiKey}:${this.exotelToken}@api.exotel.com/v1/Accounts/${this.exotelSid}/Sms/send`;
|
|
25
25
|
} else if (this.provider === Provider.GUPSHUP) {
|
|
26
26
|
// Define the URL for Gupshup API
|
|
27
27
|
// this.gupshupApiUrl = ...;
|
|
@@ -29,25 +29,27 @@ class SmsSender {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
private async sendOtpMessage(messageData: DemoBody): Promise<boolean> {
|
|
32
|
+
if (messageData.To && messageData.Body) {
|
|
33
|
+
if (messageData.Body.length != 6) {
|
|
34
|
+
throw new Error("Please enter 6 digit number");
|
|
35
|
+
}
|
|
36
|
+
} else throw new Error("All input data not found");
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if(messageData.Body.length != 6){
|
|
36
|
-
throw new Error("Please enter 6 digit number")
|
|
37
|
-
}
|
|
38
|
-
} else throw new Error("All input data not found")
|
|
38
|
+
const bodyFormData = new FormData();
|
|
39
39
|
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const smsTemplateMsg="Your OTP for AEREMS login is %d. This %d will expire in 10 minutes."
|
|
40
|
+
const smsTemplateMsg =
|
|
41
|
+
"Your OTP for AEREMS login is %d. This %d will expire in 10 minutes.";
|
|
43
42
|
|
|
44
|
-
bodyFormData.append("To",messageData.To)
|
|
45
|
-
bodyFormData.append("From","AEREM")
|
|
46
|
-
bodyFormData.append(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
bodyFormData.append("
|
|
43
|
+
bodyFormData.append("To", messageData.To);
|
|
44
|
+
bodyFormData.append("From", "AEREM");
|
|
45
|
+
bodyFormData.append(
|
|
46
|
+
"Body",
|
|
47
|
+
smsTemplateMsg.replace(/%d/g, messageData.Body)
|
|
48
|
+
);
|
|
49
|
+
bodyFormData.append("EncodingType", "plain");
|
|
50
|
+
bodyFormData.append("DltEntityId", "1301164059765333889");
|
|
51
|
+
bodyFormData.append("DltTemplateId", "1307164663997173809");
|
|
52
|
+
bodyFormData.append("SmsType", "transactional");
|
|
51
53
|
|
|
52
54
|
try {
|
|
53
55
|
let config = {
|
|
@@ -63,7 +65,6 @@ class SmsSender {
|
|
|
63
65
|
|
|
64
66
|
await axios.request(config);
|
|
65
67
|
return true;
|
|
66
|
-
|
|
67
68
|
} catch (error) {
|
|
68
69
|
console.error("Error sending sms:", error);
|
|
69
70
|
return false;
|
|
@@ -71,9 +72,7 @@ class SmsSender {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
async sendOtpSms(obj: DemoBody): Promise<boolean> {
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
return this.sendOtpMessage(obj);
|
|
76
76
|
}
|
|
77
|
-
|
|
78
77
|
}
|
|
79
78
|
export default SmsSender;
|