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({ const fileRotateTransport = new winston.transports.DailyRotateFile({
filename: `application/logs/%DATE%-onlinetopup.log`, filename: `application/logs/%DATE%-onlinetopup.log`,
datePattern: "YYYY-MM-DD", 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: // If we're not in production then log to the `console` with the format:
@@ -54,6 +60,7 @@ if (
defaultMeta: { service: "topuponline-service" }, defaultMeta: { service: "topuponline-service" },
transports: [ transports: [
fileRotateTransport, fileRotateTransport,
fileRotateTransportDebug,
// //
// - Write all logs with importance level of `error` or less to `error.log` // - 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` // - Write all logs with importance level of `info` or less to `onlinetopup.log`
@@ -84,6 +91,7 @@ if (
defaultMeta: { service: "topuponline-service" }, defaultMeta: { service: "topuponline-service" },
transports: [ transports: [
fileRotateTransport, fileRotateTransport,
fileRotateTransportDebug,
// //
// - Write all logs with importance level of `error` or less to `error.log` // - 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` // - 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 //CHECK LAST BALANCE CTR
const checkLastBalanceCTS = async (card_number, uniqueCode, req) => { const checkLastBalanceCTS = async (card_number, uniqueCode, req) => {
let result = {}; let result = {};
let auth = req.header('Authorization');
token_api = auth.replace('Bearer ', '');
const protocol = req.protocol; //LOG-INFO
const host = req.headers.host; winston.logger.info(
const current_url = protocol+'://'+host; `${uniqueCode} [ card_number ]: ${JSON.stringify(card_number)}`
);
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);
if(resp.data.data == undefined || resp.data.data.detail.last_balance == undefined) { let last_balance = 0;
result = { let getLastBalanceFromCardHistory = await model.getLastBalanceFromCardHistory(card_number);
code: '446',
message: 'Card number not exist in CTS to get last balance', //LOG-INFO
data: { winston.logger.info(
status: false, `${uniqueCode} [ getLastBalanceFromCardHistory ]: ${JSON.stringify(getLastBalanceFromCardHistory)}`
detail: { );
last_balance: last_balance
} if (getLastBalanceFromCardHistory) {
} last_balance = getLastBalanceFromCardHistory.m_balance_after;
};
//LOG-INFO
winston.logger.info(
`${uniqueCode} [ RESPONSE GET LAST-BALANCE FROM CTS ]: ${JSON.stringify(result)}`
);
return result;
} }
result = { result = {
@@ -287,7 +269,7 @@ const checkLastBalanceCTS = async (card_number, uniqueCode, req) => {
data: { data: {
status: true, status: true,
detail: { 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)}` `${uniqueCode} [ RESPONSE GET LAST-BALANCE FROM CTS ]: ${JSON.stringify(result)}`
); );
return result; return result;
}; };
//VALIDATE CARD PRODUCT //VALIDATE CARD PRODUCT
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "topuponline", "name": "topuponline",
"version": "1.5.6", "version": "1.5.7",
"description": "bug fixed autocomplete transactions", "description": "change file rotate log from 90 days to 60 days",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "nodemon index", "start": "nodemon index",