diff --git a/ais-structure/src/modules/customer/customer.route.js b/ais-structure/src/modules/customer/customer.route.js index fd6af1b..28ef46c 100644 --- a/ais-structure/src/modules/customer/customer.route.js +++ b/ais-structure/src/modules/customer/customer.route.js @@ -6,7 +6,7 @@ module.exports = function (app) { customerCtrl.customer ); - app.post('/cmf/v2/customer/:userType/:userData.json', + app.post('/cmf/v2/customer/customerId.json', postCustomerCtrl.postCustomer ); }; diff --git a/ais-structure/src/modules/customer/postCustomer.ctrl.js b/ais-structure/src/modules/customer/postCustomer.ctrl.js index 758e27e..bb43d0f 100644 --- a/ais-structure/src/modules/customer/postCustomer.ctrl.js +++ b/ais-structure/src/modules/customer/postCustomer.ctrl.js @@ -16,8 +16,6 @@ exports.postCustomer = async function (req, res, next){ var response = responseMsg.error(req,getCmd,40300); }else { - - var objectData = { customerId : req.body.user.userData+"@"+req.body.user.userType, userIdData : req.body.user.userData, @@ -37,7 +35,7 @@ exports.postCustomer = async function (req, res, next){ if(typeof result.err === 'undefined'){ // console.log(result.response.body); - + var resultObj = JSON.parse(result.response.body); // (req,cmd,data,result) @@ -47,8 +45,8 @@ exports.postCustomer = async function (req, res, next){ resultObj.resultCode = "50000"; } - - var response = responseMsg.direct(req,getCmd,resultObj); + + var response = responseMsg.direct(req,getCmd,resultObj,{customerId:objectData.customerId}); } diff --git a/ais-structure/src/modules/helper/responseMsg.js b/ais-structure/src/modules/helper/responseMsg.js index c767689..36e8663 100644 --- a/ais-structure/src/modules/helper/responseMsg.js +++ b/ais-structure/src/modules/helper/responseMsg.js @@ -36,15 +36,21 @@ responseMsg.success = function (req,cmd,data){ return response; }; -responseMsg.direct = function (req,cmd,data) +responseMsg.direct = function (req,cmd,result,data) { var response = { - resultCode : data.resultCode, - developerMessage : data.resultDescription + resultCode : result.resultCode, + developerMessage : result.resultDescription }; - if(data.resultCode == "20000") + + + if(result.resultCode == "20000") + { stats.sendResponse(req.method,cmd,"Success"); + if(data) + response = Object.assign(response,data); + } else stats.sendResponse(req.method,cmd,"Error"); -- libgit2 0.21.2