Commit afef30b0ffdde179658c37a8f3fc69cf32cdee80

Authored by Nattapon Wongpaet
1 parent 3aa57883
Exists in master and in 1 other branch dev

fix bug detail log and add parameter dateCreate

ais-structure/src/modules/helper/connection.js
... ... @@ -5,6 +5,7 @@ var request = require('request');
5 5 var messageSOAP = require('../helper/messageSOAP.js');
6 6 var log = require('../helper/log.js');
7 7 var constants = require('../helper/constants.js');
  8 +var moment = require('moment');
8 9  
9 10 var connection = [];
10 11  
... ... @@ -64,6 +65,9 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) {
64 65  
65 66 log.log("Connect to D01")
66 67  
  68 + if(myMethod === constants.METHOD.POST)
  69 + obj.dateCreate = moment().format("YYYY-MM-DDTHH:mm:ss+0700");
  70 +
67 71 var service = cfg.service.D01;
68 72 var retry = service[myMethod+"_"+cmd+"_Retry"];
69 73 if(!retry)
... ... @@ -176,6 +180,7 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) {
176 180  
177 181  
178 182 } else if(params.method == constants.METHOD.POST) {
  183 +
179 184 params.body = JSON.stringify(params.body);
180 185  
181 186 var resultRes = await asyncRequest(params,objectData,funStats);
... ...
ais-structure/src/modules/membercard/postMembership.ctrl.js
... ... @@ -86,7 +86,6 @@ exports.postMembership = async function (req, res, next){
86 86 cardId : req.body.cardId
87 87 }
88 88 }
89   -
90 89 }
91 90  
92 91 if(typeof result.err === 'undefined'){
... ... @@ -171,6 +170,7 @@ async function getCustomerD01(req, data){
171 170 };
172 171  
173 172 const resultCustomer = await connection.requestJsonToD01(req, data.reqCustomer, data.cmd, data.method);
  173 + log.logDetail.addInput(req,d01, getMethod+"_"+sendCustomerCmd, constant.RESPONSE, resultCustomer, resultCustomer.response);
174 174 var resultObj = resultCustomer.response
175 175  
176 176 if(typeof resultCustomer.err === 'undefined'){
... ... @@ -206,6 +206,7 @@ async function postMemberCardD01(req, data){
206 206  
207 207  
208 208 const resultCustomer = await connection.requestJsonToD01(req,data.reqMembership, data.cmd, data.method, data.filter);
  209 + log.logDetail.addInput(req,d01, data.method+"_"+sendMemberCardCmd, constant.RESPONSE, resultCustomer, resultCustomer.response);
209 210 var resultObj = resultCustomer.response
210 211  
211 212 if(typeof resultCustomer.err === 'undefined'){
... ...