-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
62 lines (53 loc) · 1.77 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const express = require("express");
const bodyParser = require("body-parser");
const sha512 = require("crypto-js/sha512");
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.post("/reverse-hash", (req, res) => {
console.log("Gopi ", req.body);
const key = req.body.key;
const txnid = req.body.txnid;
const amount = req.body.amount;
//const productinfo = req.body.productinfo;
// const firstname = req.body.firstname;
// const email = req.body.email;
// const udf1 = req.body.udf1;
// const udf2 = req.body.udf2;
// const udf3 = req.body.udf3;
// const udf4 = req.body.udf4;
// const udf5 = req.body.udf5;
const status = req.body.status;
//const salt = "eCwWELxi";
//const reverseHash = getReverseHash(salt, txnid, amount, productinfo, firstname, email, udf1, udf2, udf3, udf4, udf5, status);
if (status === "success") {
res.setHeader('Content-Type', 'text/plain');
res.send({
status: "success",
message: "Transaction successful",
data: {
key,
txnid,
amount,
// productinfo,
// firstname,
// email,
// udf1,
// udf2,
// udf3,
// udf4,
// udf5,
status,
},
});
} else {
res.setHeader('Content-Type', 'text/plain');
res.send({ status: "error", message:"Transaction Failed" });
}
});
// function getReverseHash(salt, txnid, amount, productinfo, firstname, email, udf1, udf2, udf3, udf4, udf5, status) {
// const data = [salt, status, "", "", "", "", udf5, udf4, udf3, udf2, udf1, email, firstname, productinfo, amount, txnid, key];
// const str = data.join("|");
// return sha512(str).toString();
// }
app.listen(8003, () => console.log("Server is running on port 8003"));