mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 09:06:27 +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({
|
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`
|
||||||
|
|||||||
@@ -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
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user