mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 11:06:28 +00:00
update
This commit is contained in:
@@ -1461,6 +1461,38 @@ const validateReplacement = async (req, res) => {
|
||||
|
||||
last_balance = dataCardReplacement.i_last_balance;
|
||||
if (last_balance == null) {
|
||||
if (is_warranty == true) {
|
||||
let result = {};
|
||||
const baseUrl = 'http://127.0.0.1:3000'
|
||||
const payload = {
|
||||
card_number: card.c_card_no,
|
||||
};
|
||||
const response = await axios.post(baseUrl + '/api/pos/test', payload);
|
||||
if (!response.data.code == undefined || response.data.data.status == false) {
|
||||
result = {
|
||||
code: '415',
|
||||
message: 'Last Balance not updated.',
|
||||
data: {
|
||||
status: false,
|
||||
detail: {}
|
||||
},
|
||||
};
|
||||
winston.logger.info(
|
||||
`${uniqueCode} [ FAILED HIT - card_number : ${card.c_card_no} ]: ${response.data.message}`
|
||||
);
|
||||
return res.status(200).json(result);
|
||||
}
|
||||
last_balance = response.data.data.detail.last_balance;
|
||||
let dataReplacementUpdate = {
|
||||
i_last_balance: last_balance
|
||||
};
|
||||
// update card_replacement
|
||||
await model.updateReplacementByCardNumebr(card.c_card_no, dataReplacementUpdate);
|
||||
// log debug
|
||||
winston.logger.info(
|
||||
`${uniqueCode} [ GET LAST BALANCE CTS ${card.c_card_no} ]: ${last_balance}`
|
||||
);
|
||||
}
|
||||
result = {
|
||||
code: '415',
|
||||
message: 'Last Balance not updated.',
|
||||
|
||||
Reference in New Issue
Block a user