Compare commits

..

40 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
ihsan 92b72dbe7a update log debug 2025-01-16 13:05:13 +07:00
WildanFahri d2e1ff2274 Merge branch 'wildan' of https://github.com/mohamadihsan/topuponline into develop_v1.5.5 2025-01-15 11:43:31 +07:00
WildanFahri 5c67284a51 update logging updateReservationAndLoadingBalance 2025-01-15 11:40:32 +07:00
ihsan b4d700e27d check log 2025-01-15 11:39:28 +07:00
ihsan d18b91edda update 2025-01-15 11:27:47 +07:00
WildanFahri 3b97844c64 Merge branch 'wildan' of https://github.com/mohamadihsan/topuponline into develop_v1.5.5 2025-01-14 19:58:19 +07:00
WildanFahri 1ce4424494 check log insert t_d_load_balance_history 2025-01-14 19:57:37 +07:00
ihsan 6c5e472c4b bug fixed 2025-01-14 19:46:02 +07:00
ihsan 57d7f260d0 add log 2025-01-14 19:25:21 +07:00
ihsan 2834265206 update 2025-01-13 19:34:34 +07:00
ihsan 40ddf02c51 update 2025-01-13 19:29:10 +07:00
WildanFahri ba20dce4d1 add log updateReservationAndLoadingBalance 2025-01-13 19:23:33 +07:00
WildanFahri aec06cb481 add log updateReservationAndLoadingBalance 2025-01-13 18:05:27 +07:00
WildanFahri 7434464106 update 2025-01-07 16:39:51 +07:00
ihsan 01d95ae783 bug fixed 2025-01-07 07:16:06 +07:00
ihsan d690cb2c0b update 2025-01-07 06:43:29 +07:00
ihsan 88f82281dc bug fixed 2025-01-06 17:33:25 +07:00
ihsan 2e5d76d97d bug fixed 2025-01-06 17:27:25 +07:00
ihsan fc9c1a4b73 add description new version 2025-01-06 17:04:24 +07:00
ihsan 7d4ff6c8b3 update version 2025-01-06 17:03:17 +07:00
WildanFahri 8bda43d2b2 update topup6 2025-01-06 16:54:11 +07:00
lutfi 36139073d4 Merge branch 'develop_v1.5.4' of https://github.com/mohamadihsan/topuponline 2025-01-01 14:57:00 +07:00
lutfi 3c8fc4d81d update cash in 2025-01-01 14:52:36 +07:00
ihsan 22ce0b611a add version 2024-12-25 23:19:23 +07:00
ihsan 785e1f2542 add version 2024-12-25 23:18:14 +07:00
ihsan a6c6146933 update 2024-11-05 21:05:25 +07:00
lutfi 0113e6dbb1 update d_disburse 2024-10-25 05:39:27 +07:00
lutfi 8d2f4bcda2 update 2024-10-17 16:12:12 +07:00
lutfi 9aa3428620 update 2024-10-17 15:37:25 +07:00
lutfi e8c73abf2e update 2024-10-17 14:39:05 +07:00
lutfi 6275d8cf86 update 2024-10-17 14:32:46 +07:00
lutfi 8af96b9a5f update 2024-10-17 14:30:20 +07:00
lutfi d9f3516d56 update 2024-10-17 14:29:11 +07:00
lutfi b7dec2613f Merge branch 'develop' of https://github.com/mohamadihsan/topuponline into develop 2024-10-17 14:06:07 +07:00
lutfi d540308d2d update 2024-10-17 12:14:47 +07:00
ihsan 9708f81242 remove validation card production or development 2024-10-16 18:03:22 +07:00
ihsan 35c9fe205c Merge remote-tracking branch 'origin/develop_v1.5.2' into develop 2024-10-11 16:38:51 +07:00
ihsan b206b50968 update card history 2024-10-11 16:38:05 +07:00
11 changed files with 2135 additions and 1903 deletions
@@ -161,6 +161,47 @@ const getLoadBalanceNumberSequence = async (req, res, next) => {
} }
next(); next();
}; };
const getLoadBalanceNumberSequence2 = async (req) => {
// set default load_balance_number_sequence dari partner apapun is null
let load_balance_number_sequence = null;
// cek jika redis is connect
let isRedisReady = await redisClient.isReady;
// jika tidak connect
if (isRedisReady) {
// jika connect maka cari sequence dari reservation number sesuai partner yg merequest
// format value nya harusnya seperti ini = { date: '2023-01-01', sequence: 1 }
// data req.partner_id_token di dapat dari authenticateToken di jwt middleware
let getValue = await redisClient.GET(
'load_balance_number_sequence_' + req.partner_id_token
);
if (getValue) {
// parsing data menjadi json format
let parsedValue = JSON.parse(getValue);
// cek apakah tanggal sequence yang di redis sama dengan hari ini atau bukan
if (parsedValue.date == moment().format('YYYY-MM-DD')) {
// jika tanggal nya sama dengan hari ini maka ambil sequence untuk reservation number yang di generate dari redis
load_balance_number_sequence = parseInt(parsedValue.sequence);
// langsung update sequence walaupun transaksi insert nya belum selesai
// impact menggunakan redis, untuk nomor sequence bisa saja ada yg loncat karena bisa saja ada transaksi insert reservation yang gagal
let setValue = {
date: moment().format('YYYY-MM-DD'),
sequence: parseInt(parsedValue.sequence) + 1,
};
await redisClient.SET(
`load_balance_number_sequence_${req.partner_id_token}`,
JSON.stringify(setValue)
);
}
}
}
return load_balance_number_sequence;
// next();
};
const setLoadBalanceNumberSequence = async (partner_id, sequence) => { const setLoadBalanceNumberSequence = async (partner_id, sequence) => {
// cek jika redis is connect // cek jika redis is connect
@@ -188,4 +229,5 @@ module.exports = {
setReservationNumberSequence, setReservationNumberSequence,
getLoadBalanceNumberSequence, getLoadBalanceNumberSequence,
setLoadBalanceNumberSequence, setLoadBalanceNumberSequence,
getLoadBalanceNumberSequence2,
}; };
@@ -262,6 +262,12 @@ const _generateCashIn = async (uniqueCode) => {
item.c_invoice_no item.c_invoice_no
); );
winston.logger.info(
`SCHEDULER-FB70-${uniqueCode} cashIn reserv ${code} DATA : ${JSON.stringify(
reserv
)}`
);
//TOTAL AMOUNT CASH-IN //TOTAL AMOUNT CASH-IN
let cashInAmount = 0; let cashInAmount = 0;
for (const itemCI of reserv) { for (const itemCI of reserv) {
@@ -269,6 +275,12 @@ const _generateCashIn = async (uniqueCode) => {
} }
dataCahsIn.i_amount = cashInAmount; dataCahsIn.i_amount = cashInAmount;
winston.logger.info(
`SCHEDULER-FB70-${uniqueCode} cashInAmount ${code} DATA : ${JSON.stringify(
cashInAmount
)}`
);
if(cashInAmount > 0) { if(cashInAmount > 0) {
//INSERT CASH-IN //INSERT CASH-IN
const cashIn = await model.insertCashIn(trx, dataCahsIn); const cashIn = await model.insertCashIn(trx, dataCahsIn);
+5 -3
View File
@@ -299,9 +299,11 @@ const getReserve = async (trx, code, date, invoice) => {
.where('tdpr.c_status', '=', 'S') .where('tdpr.c_status', '=', 'S')
.whereNotNull('tdi.c_return_sap') .whereNotNull('tdi.c_return_sap')
.whereNotNull('tdrb.c_load_balance_no') .whereNotNull('tdrb.c_load_balance_no')
.whereRaw( .whereNull('tdrb.c_cash_in_no')
`tdrb.c_reservation_no in (SELECT c_reservation_no FROM payment.t_d_payment_recon where c_status = 'S' ) AND tdrb.c_reservation_no NOT IN (SELECT c_reservation_no FROM payment.t_d_cash_in_detail WHERE b_reversal IS NOT TRUE)` // .whereRaw(
); // `tdrb.c_reservation_no in (SELECT c_reservation_no FROM payment.t_d_payment_recon where c_status = 'S' ) AND tdrb.c_reservation_no NOT IN (SELECT c_reservation_no FROM payment.t_d_cash_in_detail WHERE b_reversal IS NOT TRUE)`
// );
return res; return res;
}; };
@@ -91,8 +91,8 @@ const cardHistory = async (req, res) => {
new Date((parseInt(element.slice(0, 8), 16) + 946684800) * 1000) new Date((parseInt(element.slice(0, 8), 16) + 946684800) * 1000)
).format('YYYY-MM-DD HH:mm:ss'); ).format('YYYY-MM-DD HH:mm:ss');
nominal = parseInt(element.slice(8, 16), 16); nominal = parseInt(element.slice(8, 16), 16);
mid = element.slice(16, 20); mid = element.slice(16, 20).toUpperCase();
tid = element.slice(20, 24); tid = element.slice(20, 24).toUpperCase();
// blok yang menandakan konten untuk reska // blok yang menandakan konten untuk reska
checkReskaFormat = element.slice(14, 20); checkReskaFormat = element.slice(14, 20);
@@ -198,6 +198,14 @@ const history = async (req, res) => {
// param // param
let { mid, tid, card_number, start_date, end_date } = req.body; let { mid, tid, card_number, start_date, end_date } = req.body;
if (mid) {
mid = mid.toUpperCase();
}
if (tid) {
tid = tid.toUpperCase();
}
// log info // log info
winston.logger.info( winston.logger.info(
`${uniqueCode} [ REQUEST CARD-HISTORY-FROM-CMS ]: ${JSON.stringify( `${uniqueCode} [ REQUEST CARD-HISTORY-FROM-CMS ]: ${JSON.stringify(
@@ -6,6 +6,7 @@ const _sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const moment = require('moment'); const moment = require('moment');
const { const {
setLoadBalanceNumberSequence, setLoadBalanceNumberSequence,
getLoadBalanceNumberSequence2,
} = require('../../middlewares/redis.middleware'); } = require('../../middlewares/redis.middleware');
moment.locale('id'); moment.locale('id');
@@ -68,8 +69,9 @@ const generateLoadBalanceNumber = async (data, date, counter) => {
// insert to temp load balance number // insert to temp load balance number
let insert = await model.insertLoadBalanceNumber(loadBalanceNumber); let insert = await model.insertLoadBalanceNumber(loadBalanceNumber);
// console.log("DEBUGING insert", insert)
if (insert.rowCount < 1) { if (insert.rowCount < 1) {
loadBalanceNumber = 'XX'; loadBalanceNumber = 'DUPLICATE';
} }
return loadBalanceNumber; return loadBalanceNumber;
}; };
@@ -179,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,
@@ -187,33 +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 ${ c_note: `LOAD BALANCE ${dataLoadingBalance.i_topup_amount} FROM ${
getPartner ? getPartner.partner_name : null 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
@@ -264,7 +270,7 @@ const updateAllTransaction = async (
loadBalanceNoSequence loadBalanceNoSequence
); );
if (newLoadBalanceNumber != 'XX') { if (newLoadBalanceNumber != 'DUPLICATE') {
// set sequence to redis // set sequence to redis
// await setLoadBalanceNumberSequence( // await setLoadBalanceNumberSequence(
// req.partner_id_token, // req.partner_id_token,
@@ -287,7 +293,7 @@ const updateAllTransaction = async (
} }
maxLoop++; maxLoop++;
} while (newLoadBalanceNumber == 'XX'); } while (newLoadBalanceNumber == 'DUPLICATE');
let dataLoadBalance = { let dataLoadBalance = {
c_load_balance_no: newLoadBalanceNumber, c_load_balance_no: newLoadBalanceNumber,
@@ -458,7 +464,7 @@ const loadingBalanceRequest = async (req, res) => {
let cardBlacklist = await model.getCardBlacklist(card_number); let cardBlacklist = await model.getCardBlacklist(card_number);
if (cardBlacklist) { if (cardBlacklist) {
if(cardBlacklist.c_status == 'B') { if (cardBlacklist.c_status == 'B') {
result = { result = {
code: '445', code: '445',
message: 'Card is Blacklisted', message: 'Card is Blacklisted',
@@ -474,44 +480,44 @@ const loadingBalanceRequest = async (req, res) => {
// ); // );
// jika settingan untuk server adalah production // jika settingan untuk server adalah production
if (process.env.SERVER_FOR == 'production') { // if (process.env.SERVER_FOR == 'production') {
// jika settingan production maka nomor kartu yang di request harus berawalan angka 1, jika bukan angka 1 maka ditolak // // jika settingan production maka nomor kartu yang di request harus berawalan angka 1, jika bukan angka 1 maka ditolak
if (card_number.substring(0, 1) != '1') { // if (card_number.substring(0, 1) != '1') {
result = { // result = {
code: '400', // code: '400',
message: "It's not production card number.", // message: "It's not production card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST ]: ${JSON.stringify( // `${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST ]: ${JSON.stringify(
result // result
)}` // )}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} else { // } else {
// jika settingan bukan production, bisa development atau local maka jika ada nomor kartu berawalan angka 1 maka ditolak // // jika settingan bukan production, bisa development atau local maka jika ada nomor kartu berawalan angka 1 maka ditolak
if (card_number.substring(0, 1) == '1') { // if (card_number.substring(0, 1) == '1') {
result = { // result = {
code: '400', // code: '400',
message: // message:
"It's production card number. Please use the development card number.", // "It's production card number. Please use the development card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST ]: ${JSON.stringify( // `${uniqueCode} [ RESPONSE LOADING-BALANCE-REQUEST ]: ${JSON.stringify(
result // result
)}` // )}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} // }
// time // time
let now = moment().format('YYYY-MM-DD HH:mm:ss'); let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -1470,8 +1476,81 @@ const loadingBalanceInsert = async (req, param) => {
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: getting loading balance sequence...` // `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: getting loading balance sequence...`
// ); // );
// Pindah ke bawah (nested if condition)
// if (!loadBalanceNoSequence) {
// // get loading balance
// getLoadBalanceSequence = await model.getLoadBalanceSequence(
// getPartner,
// today
// );
// loadBalanceNoSequence = getLoadBalanceSequence
// ? parseInt(getLoadBalanceSequence.i_load_balance_no_seq) + 1
// : 1;
// }
let maxLoop = 0;
// do {
// // await _sleep(helper.randomNumberInt());
// console.log("DEBUGING loadBalanceNoSequence", loadBalanceNoSequence)
// if (maxLoop > 0) {
// loadBalanceNoSequence++;
// }
// // set sequence to redis
// await setLoadBalanceNumberSequence(
// req.partner_id_token,
// loadBalanceNoSequence
// );
// // log warn
// // winston.logger.warn(
// // `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: generating load balance number...`
// // );
// loadBalanceNumber = await generateLoadBalanceNumber(
// getPartner,
// moment(today).format('YYMMDD'),
// loadBalanceNoSequence
// );
// // if (loadBalanceNumber != 'XX') {
// // set sequence to redis
// // await setLoadBalanceNumberSequence(
// // req.partner_id_token,
// // loadBalanceNoSequence
// // );
// // }
// // log warn
// winston.logger.debug(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: load balance number sequence is ${loadBalanceNoSequence}.`
// );
// if (maxLoop > maxLoopParameter) {
// // create log
// winston.logger.error(
// `${uniqueCode} [ RESPONSE LOADING-BALANCE-INSERT ]: 500 internal server error. Server is busy. please try again`
// );
// return {
// code: '500',
// message:
// process.env.NODE_ENV != 'production'
// ? '500 internal server error (max loop) - backend server.'
// : '500 internal server error (max loop) - backend server.',
// data: {},
// };
// }
// maxLoop++;
// } while (loadBalanceNumber == 'XX');
//================== Start nested if condition ====================
loadBalanceNoSequence = await getLoadBalanceNumberSequence2(req);
console.log('DEBUGING loadBalanceNoSequence START', loadBalanceNoSequence);
if (!loadBalanceNoSequence) { if (!loadBalanceNoSequence) {
// get loading balance
getLoadBalanceSequence = await model.getLoadBalanceSequence( getLoadBalanceSequence = await model.getLoadBalanceSequence(
getPartner, getPartner,
today today
@@ -1479,65 +1558,130 @@ const loadingBalanceInsert = async (req, param) => {
loadBalanceNoSequence = getLoadBalanceSequence loadBalanceNoSequence = getLoadBalanceSequence
? parseInt(getLoadBalanceSequence.i_load_balance_no_seq) + 1 ? parseInt(getLoadBalanceSequence.i_load_balance_no_seq) + 1
: 1; : 1;
}
let maxLoop = 0;
do {
// await _sleep(helper.randomNumberInt());
if (maxLoop > 0) {
loadBalanceNoSequence++;
}
// set sequence to redis
await setLoadBalanceNumberSequence( await setLoadBalanceNumberSequence(
req.partner_id_token, req.partner_id_token,
loadBalanceNoSequence + 1
);
console.log(
'Masuk kondisi !loadBalanceNoSequence',
loadBalanceNoSequence loadBalanceNoSequence
); );
}
// log warn // Percobaan 1
// winston.logger.warn( loadBalanceNumber = await generateLoadBalanceNumber(
// `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: generating load balance number...` getPartner,
// ); moment(today).format('YYMMDD'),
loadBalanceNoSequence
);
// log warn
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT Percobaan 1 ]: load balance number sequence is ${loadBalanceNoSequence}.`
);
console.log('DEBUGING loadBalanceNumber PERCOBAAN 1', loadBalanceNumber);
if (loadBalanceNumber == 'DUPLICATE') {
loadBalanceNoSequence = await getLoadBalanceNumberSequence2(req);
console.log(
'DEBUGING loadBalanceNoSequence PERCOBAAN 2',
loadBalanceNoSequence
);
// Percobaan 2
loadBalanceNumber = await generateLoadBalanceNumber( loadBalanceNumber = await generateLoadBalanceNumber(
getPartner, getPartner,
moment(today).format('YYMMDD'), moment(today).format('YYMMDD'),
loadBalanceNoSequence loadBalanceNoSequence
); );
// if (loadBalanceNumber != 'XX') {
// set sequence to redis
// await setLoadBalanceNumberSequence(
// req.partner_id_token,
// loadBalanceNoSequence
// );
// }
// log warn // log warn
winston.logger.debug( winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: load balance number sequence is ${loadBalanceNoSequence}.` `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT Percobaan 2 ]: load balance number sequence is ${loadBalanceNoSequence}.`
); );
console.log('DEBUGING loadBalanceNumber PERCOBAAN 2', loadBalanceNumber);
if (maxLoop > maxLoopParameter) { if (loadBalanceNumber == 'DUPLICATE') {
// create log loadBalanceNoSequence = await getLoadBalanceNumberSequence2(req);
winston.logger.error( console.log(
`${uniqueCode} [ RESPONSE LOADING-BALANCE-INSERT ]: 500 internal server error. Server is busy. please try again` 'DEBUGING loadBalanceNoSequence PERCOBAAN 3',
loadBalanceNoSequence
); );
// Percobaan 3
loadBalanceNumber = await generateLoadBalanceNumber(
getPartner,
moment(today).format('YYMMDD'),
loadBalanceNoSequence
);
// log warn
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT Percobaan 3 ]: load balance number sequence is ${loadBalanceNoSequence}.`
);
console.log(
'DEBUGING loadBalanceNumber PERCOBAAN 3',
loadBalanceNumber
);
if (loadBalanceNumber == 'DUPLICATE') {
loadBalanceNoSequence = await getLoadBalanceNumberSequence2(req);
console.log(
'DEBUGING loadBalanceNoSequence PERCOBAAN 4',
loadBalanceNoSequence
);
// Percobaan 4
loadBalanceNumber = await generateLoadBalanceNumber(
getPartner,
moment(today).format('YYMMDD'),
loadBalanceNoSequence
);
// log warn
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT Percobaan 4 ]: load balance number sequence is ${loadBalanceNoSequence}.`
);
console.log(
'DEBUGING loadBalanceNumber PERCOBAAN 4',
loadBalanceNumber
);
if (loadBalanceNumber == 'DUPLICATE') {
loadBalanceNoSequence = await getLoadBalanceNumberSequence2(req);
console.log(
'DEBUGING loadBalanceNoSequence PERCOBAAN 5',
loadBalanceNoSequence
);
// Percobaan 5
loadBalanceNumber = await generateLoadBalanceNumber(
getPartner,
moment(today).format('YYMMDD'),
loadBalanceNoSequence
);
// log warn
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT Percobaan 5 ]: load balance number sequence is ${loadBalanceNoSequence}.`
);
console.log(
'DEBUGING loadBalanceNumber PERCOBAAN 5',
loadBalanceNumber
);
if (loadBalanceNumber == 'DUPLICATE') {
// log warn
winston.logger.debug(
`${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: load balance number sequence is ${loadBalanceNoSequence}.`
);
// create log
winston.logger.error(
`${uniqueCode} [ RESPONSE LOADING-BALANCE-INSERT ]: 505 internal server error. Server is busy. please try again`
);
return { return {
code: '500', code: '505',
message: message:
process.env.NODE_ENV != 'production' process.env.NODE_ENV != 'production'
? '500 internal server error (max loop) - backend server.' ? '505 internal server error (max loop) - backend server.'
: '500 internal server error (max loop) - backend server.', : '505 Server is busy. please try again.',
data: {}, data: {},
}; };
}
}
}
} }
}
maxLoop++; //================== End nested if condition ====================
} while (loadBalanceNumber == 'XX');
let data = { let data = {
c_load_balance_no: loadBalanceNumber, c_load_balance_no: loadBalanceNumber,
d_load_balance: now, d_load_balance: now,
@@ -1681,7 +1825,6 @@ const loadingBalanceInsert = async (req, param) => {
// balance // balance
// )} [FLAG] : ${JSON.stringify(flag)}` // )} [FLAG] : ${JSON.stringify(flag)}`
// ); // );
if (insertLoadingBalance > 0) { if (insertLoadingBalance > 0) {
result = { result = {
code: '00', code: '00',
@@ -1,4 +1,5 @@
const knex = require('../../../infrastructure/database/knex'); const knex = require('../../../infrastructure/database/knex');
const winston = require('../../helpers/winston.logger');
// CHECK CARD NUMBER // CHECK CARD NUMBER
const checkCardNumber = (cardNumber) => { const checkCardNumber = (cardNumber) => {
@@ -304,7 +305,7 @@ const insertLoadingBalance = async (
let loadDetail = []; let loadDetail = [];
detail.forEach((element) => { detail.forEach((element) => {
loadDetail.push({ loadDetail.push({
i_load_balance: id, i_load_balance: id.i_load_balance,
i_reservation_balance: element.i_reservation_balance, i_reservation_balance: element.i_reservation_balance,
c_reservation_no: element.c_reservation_no, c_reservation_no: element.c_reservation_no,
i_amount: element.i_amount, i_amount: element.i_amount,
@@ -336,7 +337,7 @@ const insertLoadingBalance = async (
let loadDetail = []; let loadDetail = [];
detail.forEach((element) => { detail.forEach((element) => {
loadDetail.push({ loadDetail.push({
i_load_balance: id, i_load_balance: id.i_load_balance,
i_reservation_balance: element.i_reservation_balance, i_reservation_balance: element.i_reservation_balance,
c_reservation_no: element.c_reservation_no, c_reservation_no: element.c_reservation_no,
i_amount: element.i_amount, i_amount: element.i_amount,
@@ -499,7 +500,7 @@ const insertLoadingBalanceHistoryOnly = async (
let loadDetail = []; let loadDetail = [];
detail.forEach((element) => { detail.forEach((element) => {
loadDetail.push({ loadDetail.push({
i_load_balance: id, i_load_balance: id.i_load_balance,
i_reservation_balance: element.i_reservation_balance, i_reservation_balance: element.i_reservation_balance,
c_reservation_no: element.c_reservation_no, c_reservation_no: element.c_reservation_no,
i_amount: element.i_amount, i_amount: element.i_amount,
@@ -623,17 +624,34 @@ const updateReservationAndLoadingBalance = async (
.where('c_load_balance_no', data.c_load_balance_no) .where('c_load_balance_no', data.c_load_balance_no)
.then(() => { .then(() => {
// insert load balance history // insert load balance history
// winston.logger.debug(
// `${reservationNumber} proses insert t_d_load_balance_history updateReservationAndLoadingBalance`
// );
return knex('trx.t_d_load_balance_history') return knex('trx.t_d_load_balance_history')
.transacting(trx) .transacting(trx)
.returning('i_load_balance') .returning('i_load_balance')
.insert(data); .insert(data);
}) })
.then((history) => { .then((history) => {
// winston.logger.debug(
// `${JSON.stringify(history)} history t_d_load_balance_history_detail`
// );
// winston.logger.debug(
// `${JSON.stringify(
// history[0]
// )} id t_d_load_balance_history_detail before parseint`
// );
let id = history[0]; let id = history[0];
// winston.logger.debug(
// `${id} id t_d_load_balance_history_detail id only`
// );
// winston.logger.debug(
// `${id.i_load_balance} id t_d_load_balance_history_detail id.i_load_balance`
// );
let loadDetail = []; let loadDetail = [];
detail.forEach((element) => { detail.forEach((element) => {
loadDetail.push({ loadDetail.push({
i_load_balance: id, i_load_balance: id.i_load_balance,
i_reservation_balance: element.i_reservation_balance, i_reservation_balance: element.i_reservation_balance,
c_reservation_no: element.c_reservation_no, c_reservation_no: element.c_reservation_no,
i_amount: element.i_amount, i_amount: element.i_amount,
@@ -648,6 +666,11 @@ const updateReservationAndLoadingBalance = async (
}); });
}); });
// winston.logger.debug(
// `${reservationNumber} proses insert t_d_load_balance_history_detail updateReservationAndLoadingBalance: ${JSON.stringify(
// loadDetail
// )}`
// );
// insert detail load balance // insert detail load balance
return knex('trx.t_d_load_balance_history_detail') return knex('trx.t_d_load_balance_history_detail')
.transacting(trx) .transacting(trx)
@@ -655,6 +678,9 @@ const updateReservationAndLoadingBalance = async (
}) })
.then(() => { .then(() => {
// update reservation // update reservation
// winston.logger.debug(
// `${reservationNumber} proses update t_d_reservation_balance updateReservationAndLoadingBalance`
// );
return knex('trx.t_d_reservation_balance') return knex('trx.t_d_reservation_balance')
.transacting(trx) .transacting(trx)
.update({ .update({
@@ -671,16 +697,31 @@ const updateReservationAndLoadingBalance = async (
}) })
.whereIn('c_reservation_no', reservationNumber); .whereIn('c_reservation_no', reservationNumber);
}) })
.then(trx.commit) .then(() => {
.catch(trx.rollback); // winston.logger.debug(`${reservationNumber} commit transaction`);
trx.commit();
})
.catch((error) => {
winston.logger.debug(
`${reservationNumber} rollback transaction: ${error.message}`
);
trx.rollback(); // Rollback transaction
// throw error; // Rethrow error to outer catch
});
}) })
.then((result) => { .then((result) => {
// winston.logger.debug(
// `${reservationNumber} result success ${JSON.stringify(result)}}`
// );
// console.log(result); // console.log(result);
return result.rowCount; return true;
}) })
.catch((error) => { .catch((error) => {
winston.logger.debug(
`${reservationNumber} result error: ${error.message}`
);
// console.log(error.message); // console.log(error.message);
return error.message; return false;
}); });
}; };
@@ -1021,7 +1062,7 @@ const updateReservationAndInsertLoadingBalance = async (
let loadDetail = []; let loadDetail = [];
detailLoadBalance.forEach((element) => { detailLoadBalance.forEach((element) => {
loadDetail.push({ loadDetail.push({
i_load_balance: id, i_load_balance: id.i_load_balance,
i_reservation_balance: element.i_reservation_balance, i_reservation_balance: element.i_reservation_balance,
c_reservation_no: element.c_reservation_no, c_reservation_no: element.c_reservation_no,
i_amount: element.i_reservation_amount, i_amount: element.i_reservation_amount,
@@ -10,11 +10,20 @@ const validate = (method) => {
switch (method) { switch (method) {
case 'callbackOy': case 'callbackOy':
return [ return [
body('partner_trx_id').not().isEmpty().withMessage('Partner Trx Id is required'), body('partner_trx_id')
.not()
.isEmpty()
.withMessage('Partner Trx Id is required'),
body('trx_id').not().isEmpty().withMessage('Trx Id is required'), body('trx_id').not().isEmpty().withMessage('Trx Id is required'),
body('amount').not().isEmpty().withMessage('Amount is required'), body('amount').not().isEmpty().withMessage('Amount is required'),
body('recipient_bank').not().isEmpty().withMessage('Recipient Bank is required'), body('recipient_bank')
body('recipient_account').not().isEmpty().withMessage('Recipient Account is required'), .not()
.isEmpty()
.withMessage('Recipient Bank is required'),
body('recipient_account')
.not()
.isEmpty()
.withMessage('Recipient Account is required'),
]; ];
default: default:
break; break;
@@ -29,7 +38,18 @@ const callbackOy = async (req, res) => {
let result = {}; let result = {};
// param // param
let { status, amount, recipient_name, recipient_bank, recipient_account, trx_id, partner_trx_id, timestamp, created_date, last_updated_date } = req.body; let {
status,
amount,
recipient_name,
recipient_bank,
recipient_account,
trx_id,
partner_trx_id,
timestamp,
created_date,
last_updated_date,
} = req.body;
// log info // log info
winston.logger.info( winston.logger.info(
@@ -59,9 +79,15 @@ const callbackOy = async (req, res) => {
`${uniqueCode} [ RESPONSE REFUND-KMT ]: ${JSON.stringify(result)}` `${uniqueCode} [ RESPONSE REFUND-KMT ]: ${JSON.stringify(result)}`
); );
let recipient_bank_code = recipient_bank.toLowerCase(); let recipient_bank_code = recipient_bank.toUpperCase();
// check trx_id yang di request match // check trx_id yang di request match
let checkRequest = await model.checkRedeem(partner_trx_id, trx_id, amount, recipient_bank_code, recipient_account); let checkRequest = await model.checkRedeem(
partner_trx_id,
trx_id,
amount,
recipient_bank_code,
recipient_account
);
if (!checkRequest) { if (!checkRequest) {
result = { result = {
@@ -89,7 +115,7 @@ const callbackOy = async (req, res) => {
`${uniqueCode} [ checkRequest ]: ${JSON.stringify(checkRequest)}` `${uniqueCode} [ checkRequest ]: ${JSON.stringify(checkRequest)}`
); );
if(status.code != '000') { if (status.code != '000') {
result = { result = {
code: '400', code: '400',
message: status.message, message: status.message,
@@ -103,42 +129,53 @@ const callbackOy = async (req, res) => {
}; };
} }
const unixTimeZero = Date.parse(last_updated_date); const date_reimbursement = moment(last_updated_date, 'DD-MM-YYYY HH:mm:ss').format(
const date_reimbursement = moment(unixTimeZero).format("YYYY-MM-DD HH:mm:ss") 'YYYY-MM-DD HH:mm:ss'
);
winston.logger.warn(
`${uniqueCode} [ log date_reimbusement ]: ${JSON.stringify(date_reimbursement)}`
);
//Update Card Replacement //Update Card Replacement
await model.updateReplacementComplete(checkRequest.i_card_replacement, checkRequest.c_request_no, date_reimbursement); await model.updateReplacementComplete(
checkRequest.i_card_replacement,
checkRequest.c_request_no,
date_reimbursement
);
/*
//Notif Email //Notif Email
let urlCMS = ''; let urlCMS = '';
if (process.env.SERVER_FOR == 'production') { if (process.env.SERVER_FOR == 'production') {
urlCMS = 'https://cms.kci.id'; urlCMS = 'https://cms.kci.id';
} else if(process.env.SERVER_FOR == 'development') { } else if (process.env.SERVER_FOR == 'development') {
urlCMS = 'http://10.20.14.18'; urlCMS = 'http://10.20.14.69';
} else { } else {
urlCMS = 'http://localhost:8000'; urlCMS = 'http://localhost:8000';
} }
let axios = require('axios'); let axios = require('axios');
const url = urlCMS + '/api/redeem/notifemail' const url = urlCMS + '/api/redeem/notifemail';
console.log('urlCMS', url) console.log('urlCMS', url);
// let resp = await axios.post(url, body, config); // let resp = await axios.post(url, body, config);
const responseMail = await axios({ const responseMail = await axios({
method: 'post', method: 'post',
url: url, url: url,
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
}, },
data: { data: {
i_card_replacement: checkRequest.i_card_replacement?.trim(), i_card_replacement: checkRequest.i_card_replacement?.trim(),
c_request_no: checkRequest.c_request_no?.trim(), c_request_no: checkRequest.c_request_no?.trim(),
c_card_no: checkRequest.c_card_no?.trim(), c_card_no: checkRequest.c_card_no?.trim(),
status: 'complete' status: 'complete',
} },
}); });
console.log('urlCMS', url) */
// console.log('urlCMS', url)
result = { result = {
code: '00', code: '00',
@@ -149,7 +186,7 @@ const callbackOy = async (req, res) => {
amount: amount, amount: amount,
recipient_bank: recipient_bank, recipient_bank: recipient_bank,
recipient_account: recipient_account, recipient_account: recipient_account,
last_updated_date: last_updated_date last_updated_date: last_updated_date,
}, },
}; };
@@ -178,5 +215,5 @@ const callbackOy = async (req, res) => {
module.exports = { module.exports = {
validate, validate,
callbackOy callbackOy,
}; };
@@ -32,6 +32,13 @@ const updateReplacementComplete = (i_replacement, request_no, date_disburse) =>
let result = knex("trx.t_d_card_replacement") let result = knex("trx.t_d_card_replacement")
.where("i_card_replacement", i_replacement) .where("i_card_replacement", i_replacement)
.where("c_request_no", request_no) .where("c_request_no", request_no)
// .update({
// c_status: "A",
// c_status_name: "COMPLETED",
// d_disburse: date_disburse,
// c_response_code: "000",
// c_response_message: "Success"
// });
.update({ .update({
c_status: "A", c_status: "A",
c_status_name: "COMPLETED", c_status_name: "COMPLETED",
@@ -162,42 +162,42 @@ const checkReservation = async (req, res) => {
} }
// jika settingan diperuntukan untuk production // jika settingan diperuntukan untuk production
if (process.env.SERVER_FOR == 'production') { // if (process.env.SERVER_FOR == 'production') {
// kartu yang di request bukan kartu production maka akan di tolak // // kartu yang di request bukan kartu production maka akan di tolak
if (card_number.substring(0, 1) != '1') { // if (card_number.substring(0, 1) != '1') {
result = { // result = {
code: '400', // code: '400',
message: "It's not production card number.", // message: "It's not production card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
// winston.logger.warn( // // winston.logger.warn(
// `${uniqueCode} [ RESPONSE RESERVATION-CHECK ]: ${JSON.stringify( // // `${uniqueCode} [ RESPONSE RESERVATION-CHECK ]: ${JSON.stringify(
// result // // result
// )}` // // )}`
// ); // // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} else { // } else {
// jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak // // jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak
if (card_number.substring(0, 1) == '1') { // if (card_number.substring(0, 1) == '1') {
result = { // result = {
code: '400', // code: '400',
message: // message:
"It's production card number. Please use the development card number.", // "It's production card number. Please use the development card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
// winston.logger.warn( // // winston.logger.warn(
// `${uniqueCode} [ RESPONSE RESERVATION-CHECK ]: ${JSON.stringify( // // `${uniqueCode} [ RESPONSE RESERVATION-CHECK ]: ${JSON.stringify(
// result // // result
// )}` // // )}`
// ); // // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} // }
// log debug // log debug
// proses pengecekkan data partner berdasarkan mid dan tid yang di request, apakah terdaftar di sistem CMS atau tidak // proses pengecekkan data partner berdasarkan mid dan tid yang di request, apakah terdaftar di sistem CMS atau tidak
@@ -368,44 +368,44 @@ const reservationValidate = async (req, res) => {
} }
// jika settingan diperuntukan untuk production // jika settingan diperuntukan untuk production
if (process.env.SERVER_FOR == 'production') { // if (process.env.SERVER_FOR == 'production') {
// kartu yang di request bukan kartu production maka akan di tolak // // kartu yang di request bukan kartu production maka akan di tolak
if (card_number.substring(0, 1) != '1') { // if (card_number.substring(0, 1) != '1') {
result = { // result = {
code: '400', // code: '400',
message: "It's not production card number.", // message: "It's not production card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE RESERVATION-VALIDATE ]: ${JSON.stringify( // `${uniqueCode} [ RESPONSE RESERVATION-VALIDATE ]: ${JSON.stringify(
result // result
)}` // )}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} else { // } else {
// jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak // // jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak
if (card_number.substring(0, 1) == '1') { // if (card_number.substring(0, 1) == '1') {
result = { // result = {
code: '400', // code: '400',
message: // message:
"It's production card number. Please use the development card number.", // "It's production card number. Please use the development card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE RESERVATION-VALIDATE ]: ${JSON.stringify( // `${uniqueCode} [ RESPONSE RESERVATION-VALIDATE ]: ${JSON.stringify(
result // result
)}` // )}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} // }
// time // time
let now = moment().format('YYYY-MM-DD HH:mm:ss'); let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -813,44 +813,44 @@ const reservationValidateV2 = async (req, res) => {
// ); // );
// jika settingan diperuntukan untuk production // jika settingan diperuntukan untuk production
if (process.env.SERVER_FOR == 'production') { // if (process.env.SERVER_FOR == 'production') {
// kartu yang di request bukan kartu production maka akan di tolak // // kartu yang di request bukan kartu production maka akan di tolak
if (card_number.substring(0, 1) != '1') { // if (card_number.substring(0, 1) != '1') {
result = { // result = {
code: '400', // code: '400',
message: "It's not production card number.", // message: "It's not production card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE RESERVATION-VALIDATE-V2 ]: ${JSON.stringify( // `${uniqueCode} [ RESPONSE RESERVATION-VALIDATE-V2 ]: ${JSON.stringify(
result // result
)}` // )}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} else { // } else {
// jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak // // jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak
if (card_number.substring(0, 1) == '1') { // if (card_number.substring(0, 1) == '1') {
result = { // result = {
code: '400', // code: '400',
message: // message:
"It's production card number. Please use the development card number.", // "It's production card number. Please use the development card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE RESERVATION-VALIDATE-V2 ]: ${JSON.stringify( // `${uniqueCode} [ RESPONSE RESERVATION-VALIDATE-V2 ]: ${JSON.stringify(
result // result
)}` // )}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} // }
// time // time
let now = moment().format('YYYY-MM-DD HH:mm:ss'); let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -1307,40 +1307,40 @@ const reservation = async (req, res) => {
} }
// jika settingan diperuntukan untuk production // jika settingan diperuntukan untuk production
if (process.env.SERVER_FOR == 'production') { // if (process.env.SERVER_FOR == 'production') {
// kartu yang di request bukan kartu production maka akan di tolak // // kartu yang di request bukan kartu production maka akan di tolak
if (card_number.substring(0, 1) != '1') { // if (card_number.substring(0, 1) != '1') {
result = { // result = {
code: '400', // code: '400',
message: "It's not production card number.", // message: "It's not production card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE RESERVATION ]: ${JSON.stringify(result)}` // `${uniqueCode} [ RESPONSE RESERVATION ]: ${JSON.stringify(result)}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} else { // } else {
// jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak // // jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak
if (card_number.substring(0, 1) == '1') { // if (card_number.substring(0, 1) == '1') {
result = { // result = {
code: '400', // code: '400',
message: // message:
"It's production card number. Please use the development card number.", // "It's production card number. Please use the development card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE RESERVATION ]: ${JSON.stringify(result)}` // `${uniqueCode} [ RESPONSE RESERVATION ]: ${JSON.stringify(result)}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} // }
// time // time
let now = moment().format('YYYY-MM-DD HH:mm:ss'); let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -2122,40 +2122,40 @@ const reservationV2 = async (req, res) => {
// ); // );
// jika settingan diperuntukan untuk production // jika settingan diperuntukan untuk production
if (process.env.SERVER_FOR == 'production') { // if (process.env.SERVER_FOR == 'production') {
// kartu yang di request bukan kartu production maka akan di tolak // // kartu yang di request bukan kartu production maka akan di tolak
if (card_number.substring(0, 1) != '1') { // if (card_number.substring(0, 1) != '1') {
result = { // result = {
code: '400', // code: '400',
message: "It's not production card number.", // message: "It's not production card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE RESERVATION-V2 ]: ${JSON.stringify(result)}` // `${uniqueCode} [ RESPONSE RESERVATION-V2 ]: ${JSON.stringify(result)}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} else { // } else {
// jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak // // jika settingan bukan diperuntukan untuk production, bisa development atau local atau yang lainnya dan kemudian kartu yang di request merupakan kartu production maka akan di tolak
if (card_number.substring(0, 1) == '1') { // if (card_number.substring(0, 1) == '1') {
result = { // result = {
code: '400', // code: '400',
message: // message:
"It's production card number. Please use the development card number.", // "It's production card number. Please use the development card number.",
data: {}, // data: {},
}; // };
// log warn // // log warn
winston.logger.warn( // winston.logger.warn(
`${uniqueCode} [ RESPONSE RESERVATION-V2 ]: ${JSON.stringify(result)}` // `${uniqueCode} [ RESPONSE RESERVATION-V2 ]: ${JSON.stringify(result)}`
); // );
return res.status(200).json(result); // return res.status(200).json(result);
} // }
} // }
// time // time
let now = moment().format('YYYY-MM-DD HH:mm:ss'); let now = moment().format('YYYY-MM-DD HH:mm:ss');
@@ -2653,6 +2653,8 @@ const reservationV2 = async (req, res) => {
// `${uniqueCode} [ PROCESSING RESERVATION-V2 ] inserting reservation transaction...` // `${uniqueCode} [ PROCESSING RESERVATION-V2 ] inserting reservation transaction...`
// ); // );
// (belum) ada issue disini, jadi ada case reservation number nya sama, terus error query harusnya ada handle response message nya, yg sekarang malah masuk ke blok reservation saved successfully.
// insert transaction // insert transaction
let insert = await model.insertReservation(data); let insert = await model.insertReservation(data);
+1522 -1584
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -1,7 +1,7 @@
{ {
"name": "topuponline", "name": "topuponline",
"version": "1.0.0", "version": "1.5.6",
"description": "", "description": "bug fixed autocomplete transactions",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "nodemon index", "start": "nodemon index",
@@ -22,7 +22,7 @@
}, },
"homepage": "https://github.com/mohamadihsan/topuponline#readme", "homepage": "https://github.com/mohamadihsan/topuponline#readme",
"dependencies": { "dependencies": {
"axios": "^0.27.2", "axios": "^1.7.7",
"bcrypt": "^5.0.1", "bcrypt": "^5.0.1",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"check-internet-connected": "^2.0.6", "check-internet-connected": "^2.0.6",
@@ -32,8 +32,8 @@
"express": "^4.17.1", "express": "^4.17.1",
"express-validator": "^6.10.0", "express-validator": "^6.10.0",
"express-winston": "^4.2.0", "express-winston": "^4.2.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^9.0.2",
"knex": "^0.95.4", "knex": "^3.1.0",
"moment": "^2.29.3", "moment": "^2.29.3",
"node-cron": "^3.0.1", "node-cron": "^3.0.1",
"pg": "^8.6.0", "pg": "^8.6.0",
@@ -41,12 +41,12 @@
"prom-client": "^14.2.0", "prom-client": "^14.2.0",
"redis": "^4.6.5", "redis": "^4.6.5",
"response-time": "^2.3.2", "response-time": "^2.3.2",
"sticky-session": "^1.1.2", "sticky-session": "^0.1.0",
"winston": "^3.7.2", "winston": "^3.7.2",
"winston-daily-rotate-file": "^4.7.1", "winston-daily-rotate-file": "^4.7.1",
"winston-loki": "^6.0.6", "winston-loki": "^6.0.6",
"ws": "^8.5.0", "ws": "^8.5.0",
"xml2js": "^0.4.23" "xml2js": "^0.6.2"
}, },
"devDependencies": { "devDependencies": {
"jest": "^29.0.2", "jest": "^29.0.2",