mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 10:46:28 +00:00
update
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# document error code saved on error_code file in docs folder
|
||||
|
||||
# online topup log transaction saved on application/logs folder.
|
||||
## In DEVELOPMENT environment, debugging log, online topup log, and error log will be active.
|
||||
## In PRODUCTION environment, online topup log and error log will be active.
|
||||
# debugging log contains log all validation checks step by step, request data from client, error log, and response data to client
|
||||
# online topup log contains request data from client, error log, and response data to client
|
||||
# error log contains only error system or error service
|
||||
@@ -57,8 +57,7 @@ const loadingBalanceRequest = async (req, res) => {
|
||||
uniqueCode = await helper.getUniqueCode();
|
||||
|
||||
// param
|
||||
let { mid, tid, card_number, uid, balance, balance_before, flag } =
|
||||
req.body;
|
||||
let { mid, tid, card_number, uid, balance, flag } = req.body;
|
||||
|
||||
// log info
|
||||
winston.logger.info(
|
||||
@@ -171,11 +170,22 @@ const loadingBalanceRequest = async (req, res) => {
|
||||
mid,
|
||||
tid,
|
||||
balance,
|
||||
balance_before,
|
||||
uniqueCode
|
||||
);
|
||||
|
||||
if (insertUpdate) {
|
||||
// log debug
|
||||
winston.logger.debug(`${uniqueCode} updating flag to server...`);
|
||||
|
||||
// update flag from Server
|
||||
await model.updateFlag(
|
||||
now,
|
||||
card_number,
|
||||
uid.toUpperCase(),
|
||||
balance,
|
||||
flag
|
||||
);
|
||||
|
||||
result = {
|
||||
code: "01",
|
||||
message: "your card number has been cleared successfully",
|
||||
@@ -421,7 +431,6 @@ const loadingBalance = async (req, res) => {
|
||||
write_status,
|
||||
uid,
|
||||
balance,
|
||||
balance_before,
|
||||
flag,
|
||||
unique_code,
|
||||
} = req.body;
|
||||
@@ -620,6 +629,7 @@ const loadingBalance = async (req, res) => {
|
||||
c_tid: getPartner ? getPartner.tid : null,
|
||||
c_card_number: card_number,
|
||||
i_topup_amount: amount,
|
||||
m_balance: balance,
|
||||
c_return_sap: null,
|
||||
i_load_balance_no_seq: loadBalanceNoSequence,
|
||||
c_idm: uid,
|
||||
@@ -726,7 +736,7 @@ const loadingBalance = async (req, res) => {
|
||||
c_card_number: card_number,
|
||||
c_source: "CMS - HSM",
|
||||
c_location: null,
|
||||
m_balance_before: balance_before,
|
||||
m_balance_before: balance - amount > 0 ? balance - amount : 0,
|
||||
m_amount: amount,
|
||||
m_balance_after: balance,
|
||||
j_new_data: { data: data, detail: detail },
|
||||
@@ -859,7 +869,6 @@ const updateReservationAndLoadingBalance = async (
|
||||
mid,
|
||||
tid,
|
||||
balance,
|
||||
balance_before,
|
||||
uniqueCode
|
||||
) => {
|
||||
try {
|
||||
@@ -955,6 +964,7 @@ const updateReservationAndLoadingBalance = async (
|
||||
c_tid: getPartner ? getPartner.tid : null,
|
||||
c_card_number: dataReservation.c_card_number,
|
||||
i_topup_amount: dataLoadingBalance.i_topup_amount,
|
||||
m_balance: dataLoadingBalance.m_balance,
|
||||
c_return_sap: null,
|
||||
i_load_balance_no_seq: loadBalanceNoSequence,
|
||||
c_status: "A",
|
||||
@@ -996,7 +1006,7 @@ const updateReservationAndLoadingBalance = async (
|
||||
c_card_number: dataReservation.c_card_number,
|
||||
c_source: "CMS - HSM",
|
||||
c_location: null,
|
||||
m_balance_before: balance_before,
|
||||
m_balance_before: dataLoadingBalance.m_balance,
|
||||
m_amount: dataLoadingBalance.i_topup_amount,
|
||||
m_balance_after: balance,
|
||||
j_new_data: { data: data, detail: dataLoadingBalanceDetail },
|
||||
|
||||
@@ -179,8 +179,6 @@ const reservation = async (req, res) => {
|
||||
getAccumulationBalanceInThisMonthFromCardHistory.accumulation_balance;
|
||||
}
|
||||
|
||||
console.log("accumulatedBalance: " + accumulatedBalance);
|
||||
|
||||
// validate max topup per month
|
||||
const getMaxTopupPerMonth = await model.getMaxTopupPerMonth();
|
||||
if (getMaxTopupPerMonth.c_value) {
|
||||
|
||||
@@ -199,7 +199,7 @@ const getReservationWithFlag = (cardNumber, time) => {
|
||||
let result = knex("trx.t_d_reservation_balance")
|
||||
.count("* as total_reservation")
|
||||
.where("c_card_number", cardNumber)
|
||||
.where("c_status", "P")
|
||||
.whereIn("c_status", ["P", "I"])
|
||||
.where("d_expired", ">=", time)
|
||||
.whereNotNull("c_flag")
|
||||
.first();
|
||||
|
||||
Reference in New Issue
Block a user