mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 17:26:28 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 301696661d | |||
| 9fa469fc67 | |||
| 02fa5cb909 | |||
| 3dfd2a50d4 |
@@ -27,7 +27,13 @@ var logger;
|
||||
const fileRotateTransport = new winston.transports.DailyRotateFile({
|
||||
filename: `application/logs/%DATE%-onlinetopup.log`,
|
||||
datePattern: "YYYY-MM-DD",
|
||||
maxFiles: "90d",
|
||||
maxFiles: "60d",
|
||||
});
|
||||
|
||||
const fileRotateTransportDebug = new winston.transports.DailyRotateFile({
|
||||
filename: `application/logs/debug/%DATE%-onlinetopup.log`,
|
||||
datePattern: "YYYY-MM-DD",
|
||||
maxFiles: "30d",
|
||||
});
|
||||
//
|
||||
// If we're not in production then log to the `console` with the format:
|
||||
@@ -54,6 +60,7 @@ if (
|
||||
defaultMeta: { service: "topuponline-service" },
|
||||
transports: [
|
||||
fileRotateTransport,
|
||||
fileRotateTransportDebug,
|
||||
//
|
||||
// - Write all logs with importance level of `error` or less to `error.log`
|
||||
// - Write all logs with importance level of `info` or less to `onlinetopup.log`
|
||||
@@ -84,6 +91,7 @@ if (
|
||||
defaultMeta: { service: "topuponline-service" },
|
||||
transports: [
|
||||
fileRotateTransport,
|
||||
fileRotateTransportDebug,
|
||||
//
|
||||
// - Write all logs with importance level of `error` or less to `error.log`
|
||||
// - Write all logs with importance level of `info` or less to `onlinetopup.log`
|
||||
|
||||
@@ -245,40 +245,22 @@ const validateBlacklist = async (card_number, uniqueCode) => {
|
||||
//CHECK LAST BALANCE CTR
|
||||
const checkLastBalanceCTS = async (card_number, uniqueCode, req) => {
|
||||
let result = {};
|
||||
|
||||
let auth = req.header('Authorization');
|
||||
token_api = auth.replace('Bearer ', '');
|
||||
|
||||
const protocol = req.protocol;
|
||||
const host = req.headers.host;
|
||||
const current_url = protocol+'://'+host;
|
||||
|
||||
let config = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token_api
|
||||
},
|
||||
};
|
||||
const dataPost = { 'card_number': card_number }
|
||||
const url = current_url + `/api/pos/card-lastbalance`;
|
||||
const resp = await axios.post(url, dataPost, config);
|
||||
//LOG-INFO
|
||||
winston.logger.info(
|
||||
`${uniqueCode} [ card_number ]: ${JSON.stringify(card_number)}`
|
||||
);
|
||||
|
||||
if(resp.data.data == undefined || resp.data.data.detail.last_balance == undefined) {
|
||||
result = {
|
||||
code: '446',
|
||||
message: 'Card number not exist in CTS to get last balance',
|
||||
data: {
|
||||
status: false,
|
||||
detail: {
|
||||
last_balance: last_balance
|
||||
}
|
||||
}
|
||||
};
|
||||
//LOG-INFO
|
||||
winston.logger.info(
|
||||
`${uniqueCode} [ RESPONSE GET LAST-BALANCE FROM CTS ]: ${JSON.stringify(result)}`
|
||||
);
|
||||
return result;
|
||||
let last_balance = 0;
|
||||
let getLastBalanceFromCardHistory = await model.getLastBalanceFromCardHistory(card_number);
|
||||
|
||||
//LOG-INFO
|
||||
winston.logger.info(
|
||||
`${uniqueCode} [ getLastBalanceFromCardHistory ]: ${JSON.stringify(getLastBalanceFromCardHistory)}`
|
||||
);
|
||||
|
||||
if (getLastBalanceFromCardHistory) {
|
||||
last_balance = getLastBalanceFromCardHistory.m_balance_after;
|
||||
}
|
||||
|
||||
result = {
|
||||
@@ -287,7 +269,7 @@ const checkLastBalanceCTS = async (card_number, uniqueCode, req) => {
|
||||
data: {
|
||||
status: true,
|
||||
detail: {
|
||||
last_balance: resp.data.data.detail.last_balance
|
||||
last_balance: last_balance
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -297,6 +279,7 @@ const checkLastBalanceCTS = async (card_number, uniqueCode, req) => {
|
||||
`${uniqueCode} [ RESPONSE GET LAST-BALANCE FROM CTS ]: ${JSON.stringify(result)}`
|
||||
);
|
||||
return result;
|
||||
|
||||
};
|
||||
|
||||
//VALIDATE CARD PRODUCT
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "topuponline",
|
||||
"version": "1.5.6",
|
||||
"description": "bug fixed autocomplete transactions",
|
||||
"version": "1.5.7",
|
||||
"description": "change file rotate log from 90 days to 60 days",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "nodemon index",
|
||||
|
||||
Reference in New Issue
Block a user