Compare commits

...

2 Commits

Author SHA1 Message Date
ihsan d51325cd81 update version info 2025-01-16 15:13:31 +07:00
ihsan 99ebab8591 bug fixed autocomplete transaction 2025-01-16 15:12:30 +07:00
3 changed files with 46 additions and 37 deletions
@@ -181,7 +181,7 @@ const updateAllTransaction = async (
); );
// update reservation and load balance transaction // update reservation and load balance transaction
await model.updateReservationAndLoadingBalance( const update = await model.updateReservationAndLoadingBalance(
reservationNumber, reservationNumber,
data, data,
dataLoadingBalanceDetail, dataLoadingBalanceDetail,
@@ -189,32 +189,37 @@ const updateAllTransaction = async (
flag flag
); );
// log debug if (update) {
winston.logger.debug(`${uniqueCode} inserting log for card history...`); // log debug
winston.logger.debug(`${uniqueCode} inserting log for card history...`);
// log card history // log card history
await model.createLoadBalanceLog({ await model.createLoadBalanceLog({
i_log_name: 21, i_log_name: 21,
d_log: dataLoadingBalance.d_load_balance, d_log: dataLoadingBalance.d_load_balance,
c_card_number: cardNumber, c_card_number: cardNumber,
c_source: 'CMS', c_source: 'CMS',
c_location: getPartner ? getPartner.partner_name : null, c_location: getPartner ? getPartner.partner_name : null,
m_balance_before: parseInt(dataLoadingBalance.m_balance), m_balance_before: parseInt(dataLoadingBalance.m_balance),
m_amount: parseInt(dataLoadingBalance.i_topup_amount), m_amount: parseInt(dataLoadingBalance.i_topup_amount),
m_balance_after: parseInt(balance), m_balance_after: parseInt(balance),
j_new_data: { data: data, detail: dataLoadingBalanceDetail }, j_new_data: { data: data, detail: dataLoadingBalanceDetail },
j_old_data: null, j_old_data: null,
c_note: `LOAD BALANCE ${dataLoadingBalance.i_topup_amount} FROM ${getPartner ? getPartner.partner_name : null c_note: `LOAD BALANCE ${dataLoadingBalance.i_topup_amount} FROM ${
getPartner ? getPartner.partner_name : null
} SUCCESSFULLY`, } SUCCESSFULLY`,
c_status: 'S', c_status: 'S',
d_created: now, d_created: now,
i_create: null, i_create: null,
c_create_username: 'HSM', c_create_username: 'HSM',
c_create_fullname: 'HARDWARE SECURE MODULE', c_create_fullname: 'HARDWARE SECURE MODULE',
c_category: 'T', c_category: 'T',
}); });
return true; return true;
} else {
return false;
}
} else { } else {
// insert new load balance transaction by data on card and update data reservation // insert new load balance transaction by data on card and update data reservation
@@ -985,7 +990,7 @@ const loadingBalanceRequest = async (req, res) => {
if ( if (
amountTopup > parseInt(getMaxAmountOnTheCard.c_value) || amountTopup > parseInt(getMaxAmountOnTheCard.c_value) ||
parseInt(balance) + amountTopup > parseInt(balance) + amountTopup >
parseInt(getMaxAmountOnTheCard.c_value) parseInt(getMaxAmountOnTheCard.c_value)
) { ) {
amountTopup = amountTopup =
amountTopup - parseInt(rsv.i_reservation_amount); amountTopup - parseInt(rsv.i_reservation_amount);
@@ -1098,7 +1103,7 @@ const loadingBalanceRequest = async (req, res) => {
if ( if (
amountTopup > parseInt(getMaxAmountOnTheCard.c_value) || amountTopup > parseInt(getMaxAmountOnTheCard.c_value) ||
parseInt(balance) + amountTopup > parseInt(balance) + amountTopup >
parseInt(getMaxAmountOnTheCard.c_value) parseInt(getMaxAmountOnTheCard.c_value)
) { ) {
amountTopup = amountTopup =
amountTopup - parseInt(rsv.i_reservation_amount); amountTopup - parseInt(rsv.i_reservation_amount);
@@ -1557,7 +1562,10 @@ const loadingBalanceInsert = async (req, param) => {
req.partner_id_token, req.partner_id_token,
loadBalanceNoSequence + 1 loadBalanceNoSequence + 1
); );
console.log('Masuk kondisi !loadBalanceNoSequence', loadBalanceNoSequence); console.log(
'Masuk kondisi !loadBalanceNoSequence',
loadBalanceNoSequence
);
} }
// Percobaan 1 // Percobaan 1
@@ -2071,8 +2079,9 @@ const loadingBalanceUpdate = async (param) => {
m_balance_after: parseInt(balance) + parseInt(amount), m_balance_after: parseInt(balance) + parseInt(amount),
j_new_data: { data: dataLoadBalance, detail: detailLoadBalance }, j_new_data: { data: dataLoadBalance, detail: detailLoadBalance },
j_old_data: null, j_old_data: null,
c_note: `LOAD BALANCE ${amount} FROM ${getPartner ? getPartner.partner_name : null c_note: `LOAD BALANCE ${amount} FROM ${
} SUCCESSFULLY`, getPartner ? getPartner.partner_name : null
} SUCCESSFULLY`,
c_status: 'S', c_status: 'S',
d_created: now, d_created: now,
i_create: null, i_create: null,
@@ -698,7 +698,7 @@ const updateReservationAndLoadingBalance = async (
.whereIn('c_reservation_no', reservationNumber); .whereIn('c_reservation_no', reservationNumber);
}) })
.then(() => { .then(() => {
winston.logger.debug(`${reservationNumber} commit transaction`); // winston.logger.debug(`${reservationNumber} commit transaction`);
trx.commit(); trx.commit();
}) })
.catch((error) => { .catch((error) => {
@@ -710,18 +710,18 @@ const updateReservationAndLoadingBalance = async (
}); });
}) })
.then((result) => { .then((result) => {
winston.logger.debug( // winston.logger.debug(
`${reservationNumber} result success ${JSON.stringify(result)}}` // `${reservationNumber} result success ${JSON.stringify(result)}}`
); // );
// console.log(result); // console.log(result);
return result.rowCount; return true;
}) })
.catch((error) => { .catch((error) => {
winston.logger.debug( winston.logger.debug(
`${reservationNumber} result error: ${error.message}` `${reservationNumber} result error: ${error.message}`
); );
// console.log(error.message); // console.log(error.message);
return error.message; return false;
}); });
}; };
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "topuponline", "name": "topuponline",
"version": "1.5.5", "version": "1.5.6",
"description": "update logic set sequence load balance number to handle max loop issue", "description": "bug fixed autocomplete transactions",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "nodemon index", "start": "nodemon index",