mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 21:26:28 +00:00
update
This commit is contained in:
@@ -75,24 +75,52 @@ const cardHistory = async (req, res) => {
|
||||
let istopup;
|
||||
let terminalName;
|
||||
let history = [];
|
||||
let indexHistory = 0;
|
||||
let checkReskaFormat;
|
||||
let checkKCIFormat;
|
||||
for (let index = 0; index < data.length; index++) {
|
||||
element = data[index];
|
||||
date = moment(new Date((parseInt(element.slice(0, 8), 16) + 946684800) * 1000)).format("YYYY-MM-DD HH:mm:ss");
|
||||
nominal = parseInt(element.slice(8, 16), 16);
|
||||
mid = element.slice(16, 20);
|
||||
tid = element.slice(20, 24);
|
||||
istopup = parseInt(element.slice(24, 26), 16) == 0 ? "Topup" : "Deduct";
|
||||
|
||||
// get terminal name
|
||||
terminalName = await model.getPartnerPartialMIDTID(mid, tid);
|
||||
terminalName = terminalName ? terminalName.merchant_name : "";
|
||||
if (element != "00000000000000000000000000000000") {
|
||||
|
||||
date = moment(
|
||||
new Date((parseInt(element.slice(0, 8), 16) + 946684800) * 1000)
|
||||
).format("YYYY-MM-DD HH:mm:ss");
|
||||
nominal = parseInt(element.slice(8, 16), 16);
|
||||
mid = element.slice(16, 20);
|
||||
tid = element.slice(20, 24);
|
||||
|
||||
history[index] = {
|
||||
date: date,
|
||||
nominal: nominal,
|
||||
terminal_name: terminalName,
|
||||
transaction_type: istopup,
|
||||
};
|
||||
checkReskaFormat = element.slice(16, 22);
|
||||
checkKCIFormat = element.slice(26, 28);
|
||||
|
||||
if (checkReskaFormat == "000000") {
|
||||
istopup = "Deduct";
|
||||
|
||||
// get terminal name
|
||||
terminalName = "PARKIR RESKA";
|
||||
} else if (checkKCIFormat == "00") {
|
||||
istopup = parseInt(element.slice(24, 26), 16) == 0 ? "Topup" : "Deduct";
|
||||
|
||||
// get terminal name
|
||||
terminalName = await model.getPartnerPartialMIDTID(mid, tid);
|
||||
terminalName = terminalName ? terminalName.merchant_name : "";
|
||||
} else {
|
||||
istopup = parseInt(element.slice(24, 26), 16) == 0 ? "Topup" : "Deduct";
|
||||
|
||||
// get terminal name
|
||||
terminalName = await model.getPartnerPartialMIDTID(mid, tid);
|
||||
terminalName = terminalName ? terminalName.merchant_name : "";
|
||||
}
|
||||
|
||||
history[indexHistory] = {
|
||||
date: date,
|
||||
nominal: nominal,
|
||||
terminal_name: terminalName,
|
||||
transaction_type: istopup,
|
||||
};
|
||||
|
||||
indexHistory++;
|
||||
}
|
||||
}
|
||||
|
||||
result = {
|
||||
|
||||
Reference in New Issue
Block a user