mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 23:36:28 +00:00
update payment recon
This commit is contained in:
@@ -73,8 +73,6 @@ const validate = (method) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
const paymentRecon = async (req, res) => {
|
||||
try {
|
||||
// generate unique code
|
||||
@@ -213,6 +211,48 @@ const paymentRecon = async (req, res) => {
|
||||
return res.status(200).json(result);
|
||||
}
|
||||
|
||||
// check reservation status
|
||||
let checkReservationCanceledStatus =
|
||||
await model.checkReservationCanceledStatus(reservation_number);
|
||||
if (checkReservationCanceledStatus) {
|
||||
result = {
|
||||
code: "431",
|
||||
message: "transaction has been canceled",
|
||||
data: {
|
||||
payment_recon_no: PaymentReconNumber,
|
||||
recon_date: moment().format("YYYY-MM-DD HH:mm:ss"),
|
||||
},
|
||||
};
|
||||
|
||||
// log debug
|
||||
winston.logger.debug(
|
||||
`${uniqueCode} inserting payment recon transaction...`
|
||||
);
|
||||
|
||||
// insert payment recon transaction
|
||||
await model.insertPaymentReconTransaction(
|
||||
date,
|
||||
moment().format("YYYY-MM-DD HH:mm:ss"),
|
||||
getPartner.partner_code,
|
||||
PaymentReconNumber,
|
||||
bank_ref,
|
||||
reservation_number,
|
||||
amount,
|
||||
"F",
|
||||
"FAILED",
|
||||
result.code,
|
||||
result.message.toUpperCase(),
|
||||
result.data
|
||||
);
|
||||
|
||||
// log warn
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} RESPONSE payment recon: ${JSON.stringify(result)}`
|
||||
);
|
||||
|
||||
return res.status(200).json(result);
|
||||
}
|
||||
|
||||
// check ref no and amount
|
||||
let check = await model.checkReservationNumberAndAmount(reservation_number);
|
||||
if (!check) {
|
||||
|
||||
Reference in New Issue
Block a user