update comment log debug

This commit is contained in:
2023-09-25 11:30:59 +07:00
parent dab14b66c4
commit ae74b4c1bd
5 changed files with 505 additions and 509 deletions
@@ -451,9 +451,9 @@ const loadingBalanceRequest = async (req, res) => {
}
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking production card number or not...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking production card number or not...`
// );
// jika settingan untuk server adalah production
if (process.env.SERVER_FOR == 'production') {
@@ -501,9 +501,9 @@ const loadingBalanceRequest = async (req, res) => {
let month = moment().format('M');
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking partner...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking partner...`
// );
// get partner, merchant, terminal from tid
let getPartner = await model.getPartner(mid, tid);
@@ -551,9 +551,9 @@ const loadingBalanceRequest = async (req, res) => {
// jika settingan pengecekkan nomor kartu dengan card product CMS aktif
if (checkByCardProductStatusValue == 'A') {
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking card number...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking card number...`
// );
// check card number request dengan list card number yang terdaftar di CMS
let checkCardNumber = await model.checkCardNumber(card_number);
@@ -578,9 +578,9 @@ const loadingBalanceRequest = async (req, res) => {
}
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking flag on the card and the server...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking flag on the card and the server...`
// );
// check last flag untuk nomor kartu dan uid yang di request di sistem CMS
let checkFlag = await model.checkFlag(card_number, uid.toUpperCase());
@@ -592,9 +592,9 @@ const loadingBalanceRequest = async (req, res) => {
}
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking reservation pending...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking reservation pending...`
// );
// get total reservation pending
let getReservationPending = await model.getReservationPendingV2(
@@ -604,9 +604,9 @@ const loadingBalanceRequest = async (req, res) => {
);
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking fraud transaction...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking fraud transaction...`
// );
// cek disini apakah sebelumnya topup
let cardHistory = await model.checkCardHistory(card_number);
@@ -669,9 +669,9 @@ const loadingBalanceRequest = async (req, res) => {
await model.getReservationPendingWithFlagCounter(card_number, now, flag);
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking reservation pending with flag...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking reservation pending with flag...`
// );
// get total reservation pending
// let getReservationPendingWithFlag =
// await model.getReservationPendingWithFlag(card_number, now);
@@ -696,9 +696,9 @@ const loadingBalanceRequest = async (req, res) => {
});
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: updating reservation and load balance transaction...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: updating reservation and load balance transaction...`
// );
// update
let insertUpdate = await updateAllTransaction(
@@ -716,9 +716,9 @@ const loadingBalanceRequest = async (req, res) => {
if (insertUpdate) {
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSINGE LOADING-BALANCE-REQUEST ]: updating flag to server...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSINGE LOADING-BALANCE-REQUEST ]: updating flag to server...`
// );
// update flag from Server
await model.updateFlag(
@@ -769,9 +769,9 @@ const loadingBalanceRequest = async (req, res) => {
// await model.updateFlag(now, card_number, uid.toUpperCase(), balance, flag);
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking reservation pending...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking reservation pending...`
// );
// reget total reservation pending
getReservationPending = await model.getReservationPendingV2(
@@ -829,14 +829,14 @@ const loadingBalanceRequest = async (req, res) => {
}
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking the card number in list fraud transaction or not...XXXXXXXXXXXXXXXXXXXX`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking the card number in list fraud transaction or not...XXXXXXXXXXXXXXXXXXXX`
// );
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking total topup amount...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking total topup amount...`
// );
// check total amount topup
if (parseInt(amountTopup) <= 0) {
@@ -857,9 +857,9 @@ const loadingBalanceRequest = async (req, res) => {
}
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking BI regulation status...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking BI regulation status...`
// );
// get BI regulation status
let getBIRegulationStatus = await model.getBIRegulationStatus();
@@ -906,9 +906,9 @@ const loadingBalanceRequest = async (req, res) => {
}
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking max balance on the card...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking max balance on the card...`
// );
// get max saldo on the card
let getMaxAmountOnTheCard = await model.getMaxAmountOnTheCard();
@@ -1007,9 +1007,9 @@ const loadingBalanceRequest = async (req, res) => {
}
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking max topup per month...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: checking max topup per month...`
// );
// get accumulated balance in this month
let accumulatedBalance = 0;
@@ -1121,9 +1121,9 @@ const loadingBalanceRequest = async (req, res) => {
}
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: updating status reservation to in progress...${reservationNumberTemp}, ${now}, ${flag}`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-REQUEST ]: updating status reservation to in progress...${reservationNumberTemp}, ${now}, ${flag}`
// );
// update status to in progress
let updateStatusReservation = await model.updateStatusReservation(
@@ -1246,9 +1246,9 @@ const loadingBalanceInsert = async (req, param) => {
}
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking reservation status...`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking reservation status...`
// );
// check reservation status
for (let index = 0; index < reservation_number.length; index++) {
@@ -1307,9 +1307,9 @@ const loadingBalanceInsert = async (req, param) => {
}
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking last log history...`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking last log history...`
// );
// get last history by card number
let lastHistory = await model.getLastHistory(card_number);
@@ -1318,17 +1318,17 @@ const loadingBalanceInsert = async (req, param) => {
// if last history card is topup (21 = log name id for topup)
if (lastHistory.i_log_name == 21 && lastHistory.c_source == 'CMS') {
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: inserting fraud transaction...`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: inserting fraud transaction...`
// );
// insert reservation transaction to fraud table
await model.insertFraudTransaction(reservation_number);
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: suspending reservation...`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: suspending reservation...`
// );
// update reservation with suspend status
await model.suspendReservation(reservation_number, now);
@@ -1351,9 +1351,9 @@ const loadingBalanceInsert = async (req, param) => {
}
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking fraud transaction...`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking fraud transaction...`
// );
// get data fraud by card number and status fraud is not closed
let fraudTransaction = await model.getFraudTransaction(card_number);
@@ -1366,9 +1366,9 @@ const loadingBalanceInsert = async (req, param) => {
}
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking reservation pending...`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking reservation pending...`
// );
// get total reservation pending without fraud
let getReservationPending = await model.getReservationPendingWithoutFraud(
@@ -1395,9 +1395,9 @@ const loadingBalanceInsert = async (req, param) => {
}
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking total topup amount...`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking total topup amount...`
// );
// check total topup and request topup
let amountTopup = 0;
@@ -1428,9 +1428,9 @@ const loadingBalanceInsert = async (req, param) => {
let loadBalanceNoSequence = req.load_balance_number_sequence;
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: getting loading balance sequence...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: getting loading balance sequence...`
// );
if (!loadBalanceNoSequence) {
// get loading balance
@@ -1452,9 +1452,9 @@ const loadingBalanceInsert = async (req, param) => {
}
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: generating load balance number...`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: generating load balance number...`
// );
loadBalanceNumber = await generateLoadBalanceNumber(
getPartner,
@@ -1471,9 +1471,9 @@ const loadingBalanceInsert = async (req, param) => {
}
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: load balance number is ${loadBalanceNumber}.`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: load balance number is ${loadBalanceNumber}.`
// );
if (maxLoop > maxLoopParameter) {
// create log
@@ -1533,9 +1533,9 @@ const loadingBalanceInsert = async (req, param) => {
};
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: getting reservation detail...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: getting reservation detail...`
// );
let detail = [];
reservation_number = [];
@@ -1601,14 +1601,14 @@ const loadingBalanceInsert = async (req, param) => {
// check data load balance by reservation_number exist or not
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking load balance transaction has been exists or not...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: checking load balance transaction has been exists or not...`
// );
// log warn
winston.logger.warn(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: inserting load balance transaction...`
);
// winston.logger.warn(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: inserting load balance transaction...`
// );
// insert transaction
let insertLoadingBalance = await model.insertLoadingBalance(
@@ -1726,9 +1726,9 @@ const loadingBalanceUpdate = async (param) => {
let today = moment().format('YYYY-MM-DD');
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-UPDATE ]: checking partner...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-UPDATE ]: checking partner...`
// );
// get partner, merchant, terminal from tid
let getPartner = await model.getPartner(mid, tid);
@@ -1763,9 +1763,9 @@ const loadingBalanceUpdate = async (param) => {
};
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-UPDATE ]: updating load balance transaction...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-UPDATE ]: updating load balance transaction...`
// );
// update transaction
await model.updateLoadingBalance(
@@ -1780,9 +1780,9 @@ const loadingBalanceUpdate = async (param) => {
);
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-UPDATE ]: inserting load balance transaction history ${loadBalanceNumber}...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-UPDATE ]: inserting load balance transaction history ${loadBalanceNumber}...`
// );
let findDataLoadBalance = await model.findLoadBalance(loadBalanceNumber);
let dataLoadBalance = {};
@@ -1866,9 +1866,9 @@ const loadingBalanceUpdate = async (param) => {
if (!write_status) {
// log debug
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-UPDATE ]: inserting log for card history...`
);
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-UPDATE ]: inserting log for card history...`
// );
// log card history
await model.createLoadBalanceLog({