Compare commits

..

4 Commits

Author SHA1 Message Date
ihsan 301696661d Merge branch 'develop' of https://github.com/mohamadihsan/topuponline into develop_v1.5.7 2025-03-03 13:59:31 +07:00
ihsan 9fa469fc67 change file rotate log time 2025-03-03 13:57:55 +07:00
lutfi 02fa5cb909 update 2025-01-24 18:12:26 +07:00
lutfi 3dfd2a50d4 update 2025-01-24 17:56:56 +07:00
3 changed files with 27 additions and 36 deletions
+9 -1
View File
@@ -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`
+16 -33
View File
@@ -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
View File
@@ -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",