diff --git a/app.js b/app.js index 4e89715..f14740f 100644 --- a/app.js +++ b/app.js @@ -398,6 +398,7 @@ app.post('/goapi/profile/assetDetail', require('./ccbs').assetDetail); app.post('/goapi/profile/churnscore/offerlist', require('./ccbs').churnScoreOfferList); app.get('/goapi/profile/external/customer/usageInfo/:type/:number', require('./ccbs').usageInfo); app.post('/v1/OSBCOM/BillingProfileInfo/UsageProfileInfoREST/getAccumulationUOMGroupList/', require('./ccbs').accumulationUOMGroupList); +app.post('/CCBSCommonInfo/MGCommonInfo/getPrimaryKeyListWithoutResourceType', require('./ccbs').getPrimaryKeyListWithoutResourceType); app.get('/api/callback', require('./line').callback); diff --git a/ccbs.js b/ccbs.js index a45a7d1..3041749 100644 --- a/ccbs.js +++ b/ccbs.js @@ -1,265 +1,314 @@ module.exports.assetDetail = async (req, res) => { - console.log('===== POST assetDetail =====') - console.log('url', req.originalUrl); - console.log('headers', req.headers); - console.log('query', req.query); - console.log('params', req.params); - console.log('body', req.body); + console.log('===== POST assetDetail =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', req.body); - let responseErr = { - "code" : "5000", - "msg" : "Error bind json to model" - } + let responseErr = { + "code": "5000", + "msg": "Error bind json to model" + } - let response = { - "code" : "500", - "msg" : "success.", - "outstandingBalance": 0, - "currentBillBalance": 1.61, - "dueDate": "21/11/2020", - "subStatus": { - "FullSusMsg": "No", - "status": "Active", - "detail": [{ - "reason": "(SYSREQ)System Request", - "since": "05/10/2018 17:54:36" - } - ] - }, - "assetRowId": "1-2CN6IWH0", - "serviceId": "0952543411", - "productLine": "True Mobile", - "startDate": "16/07/2015", - "assetLifetime": "5 years, 4 months, 9 days", - "preferredLanguage": "Thai", - "productType": "Postpay", - "currentBillCycle": "28/27", - "lastPPEffectiveDate": "28/10/2019", - "lastFullSuspension": "No", - "credit": { - "limit": 2500, - "available": 2459.5, - "defaultCredit": "1000", - "temporary": "0", - "permanent": "2500", - "expiryDate": "", - "status": "Permanent", - "totalObligation": 40.5 - }, - "discount": { - "discountList": [{ - "name": "CVG012", - "description": "True Smart Choice Discount 499", - "startDate": "05/10/2018", - "endDate": "06/10/2018" - } - ], - "discountIndicator": "Yes" - }, - "contract": { - "contractIndicator": "No", - "list": [{ - "propositionCode": "CVG000000000052", - "propositionDescription": "TrueSmartChoice Regu 4G No Limit", - "term": "12", - "fee": 0, - "startDate": "04/10/2019", - "expireDate": "05/10/2019", - "contractIndicator": "No", - "offerCode": "12534317", - "contractNumber": "-", - "offerInstanceId": "162918628", - "terminationDate": "" - },{ - "propositionCode": "CVG000000000052", - "propositionDescription": "TrueSmartChoice Regu 4G No Limit", - "term": "12", - "fee": 0, - "startDate": "04/10/2019", - "expireDate": "05/10/2019", - "contractIndicator": "No", - "offerCode": "12534317", - "contractNumber": "-", - "offerInstanceId": "162918628", - "terminationDate": "" - } - ] - }, - "installAddress": {} - } + let response = { + "code": "500", + "msg": "success.", + "outstandingBalance": 0, + "currentBillBalance": 1.61, + "dueDate": "21/11/2020", + "subStatus": { + "FullSusMsg": "No", + "status": "Active", + "detail": [{ + "reason": "(SYSREQ)System Request", + "since": "05/10/2018 17:54:36" + } + ] + }, + "assetRowId": "1-2CN6IWH0", + "serviceId": "0952543411", + "productLine": "True Mobile", + "startDate": "16/07/2015", + "assetLifetime": "5 years, 4 months, 9 days", + "preferredLanguage": "Thai", + "productType": "Postpay", + "currentBillCycle": "28/27", + "lastPPEffectiveDate": "28/10/2019", + "lastFullSuspension": "No", + "credit": { + "limit": 2500, + "available": 2459.5, + "defaultCredit": "1000", + "temporary": "0", + "permanent": "2500", + "expiryDate": "", + "status": "Permanent", + "totalObligation": 40.5 + }, + "discount": { + "discountList": [{ + "name": "CVG012", + "description": "True Smart Choice Discount 499", + "startDate": "05/10/2018", + "endDate": "06/10/2018" + } + ], + "discountIndicator": "Yes" + }, + "contract": { + "contractIndicator": "No", + "list": [{ + "propositionCode": "CVG000000000052", + "propositionDescription": "TrueSmartChoice Regu 4G No Limit", + "term": "12", + "fee": 0, + "startDate": "04/10/2019", + "expireDate": "05/10/2019", + "contractIndicator": "No", + "offerCode": "12534317", + "contractNumber": "-", + "offerInstanceId": "162918628", + "terminationDate": "" + }, { + "propositionCode": "CVG000000000052", + "propositionDescription": "TrueSmartChoice Regu 4G No Limit", + "term": "12", + "fee": 0, + "startDate": "04/10/2019", + "expireDate": "05/10/2019", + "contractIndicator": "No", + "offerCode": "12534317", + "contractNumber": "-", + "offerInstanceId": "162918628", + "terminationDate": "" + } + ] + }, + "installAddress": {} + } - res.status(200).send(response) + res.status(200).send(response) } module.exports.churnScoreOfferList = async (req, res) => { - console.log('===== POST churnScoreOfferList =====') - console.log('url', req.originalUrl); - console.log('headers', req.headers); - console.log('query', req.query); - console.log('params', req.params); - console.log('body', req.body); + console.log('===== POST churnScoreOfferList =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', req.body); - let responseErr = { - "code" : "404", - "message" : "Not found" - } + let responseErr = { + "code": "404", + "message": "Not found" + } - let response = { - "campTransID": "5c0a746b-ae69-447d-84b0-b0bdaa4b6add", - "campID": "0007", - "campCode": "PRPTOL000001", - "campName": "PRP TOL CAMPAIGN", - "callScript": "", - "offerList": [ - { - "productName": "True Online", - "offerCode": "VASUP121MOCJA01", - "offerName": "1000/500Mbps.", - "offerType": "VAS", - "offerTypeText": "VAS", - "offerDescTH": "VASUP121MOCJA01 : 1000/500Mbps.", - "offerDescEN": "VASUP121MOCJA01 : 1000/500Mbps.", - "serviceType": "85", - "autoAssign": "N", - "appointmentFlag": true - } - ] - } + let response = { + "campTransID": "5c0a746b-ae69-447d-84b0-b0bdaa4b6add", + "campID": "0007", + "campCode": "PRPTOL000001", + "campName": "PRP TOL CAMPAIGN", + "callScript": "", + "offerList": [ + { + "productName": "True Online", + "offerCode": "VASUP121MOCJA01", + "offerName": "1000/500Mbps.", + "offerType": "VAS", + "offerTypeText": "VAS", + "offerDescTH": "VASUP121MOCJA01 : 1000/500Mbps.", + "offerDescEN": "VASUP121MOCJA01 : 1000/500Mbps.", + "serviceType": "85", + "autoAssign": "N", + "appointmentFlag": true + } + ] + } - res.status(200).send(response) + res.status(200).send(response) } module.exports.usageInfo = async (req, res) => { - console.log('===== GET usageInfo =====') - console.log('url', req.originalUrl); - console.log('headers', req.headers); - console.log('query', req.query); - console.log('params', req.params); - console.log('body', req.body); + console.log('===== GET usageInfo =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', req.body); - let responseErr = { - "code" : "404", - "message" : "Not found" - } + let responseErr = { + "code": "404", + "message": "Not found" + } - let response = { - "trueId": { - "device": "WEB", - "lastAccess": "27/12/2018 04:51:12" - }, - "trueYou": { - "device": "WEB", - "lastAccess": "27/12/2018 04:25:42" - }, - "iService": { - "device": "IOS", - "lastAccess": "27/12/2018 04:31:22" - }, - "trueWallet": { - "device": "123", - "lastAccess": "123" - }, - "tdgError": false, - "TrueMoneyError": true - } + let response = { + "trueId": { + "device": "WEB", + "lastAccess": "27/12/2018 04:51:12" + }, + "trueYou": { + "device": "WEB", + "lastAccess": "27/12/2018 04:25:42" + }, + "iService": { + "device": "IOS", + "lastAccess": "27/12/2018 04:31:22" + }, + "trueWallet": { + "device": "123", + "lastAccess": "123" + }, + "tdgError": false, + "TrueMoneyError": true + } - res.status(200).send(response) + res.status(200).send(response) } module.exports.accumulationUOMGroupList = async (req, res) => { - console.log('===== POST accumulationUOMGroupList =====') - console.log('url', req.originalUrl); - console.log('headers', req.headers); - console.log('query', req.query); - console.log('params', req.params); - console.log('body', req.body); + console.log('===== POST accumulationUOMGroupList =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', req.body); - console.log(JSON.stringify(req.body)) + console.log(JSON.stringify(req.body)) - let responseErr = { - "errorCode" : "OSBbllngA00002", - "message" : "Error.", - } + let responseErr = { + "errorCode": "OSBbllngA00002", + "message": "Error.", + } - let response = { - "errorCode" : "OSBbllngA00001", - "message" : "Success.", - "uuid" : "ca517eac-b687-45f2-a921-c5138c44402e", - "backendResponseList" : { - "backendResponseInfoArray" : [ { - "apiName" : "getPrimaryKeyInfoByActiveAndBusinessLine", - "errorCode" : "OSBbllngA00001", - "message" : "Success.", - "system" : "OSB", - "url" : "http://172.19.188.21:8080/ESB_Get_CustomerPreferenceInfo/Interfaces/Proxy/CommonPreferenceInfoPS" - }, { - "apiName" : "getUnbilledCycleInfo", - "errorCode" : "OSBbllngA00001", - "message" : "Success.", - "system" : "OSB", - "url" : "http://172.19.188.21:8080/ESB_Get_FinancialManagementInfo/Interfaces/Proxy/BillingInfoPS" - }, { - "apiName" : "getRatedPerformanceIndicators3", - "errorCode" : "OSBbllngA00001", - "message" : "Success.", - "system" : "CCCSOA", - "url" : "http://172.19.136.104/RaterServiceWS/RaterServiceSI" - } ] - }, - "accumulationUOMGroupList" : { - "accumulationInfoArray" : [ { - "accumulatedCharge" : 135, - "accumulatedQuantity" : 191, - "accumulatedQuantityFormat" : "03:11:00", - "lastCallDate" : "2021-03-21T22:44:19.000+07:00", - "serviceType" : "Voice", - "system" : "CCBS", - "uomCode" : "M" - }, { - "accumulatedCharge" : 1013.5, - "accumulatedQuantity" : 223, - "accumulatedQuantityFormat" : null, - "lastCallDate" : "2021-03-22T08:06:29.000+07:00", - "serviceType" : "SMS", - "system" : "CCBS", - "uomCode" : "O" - }, { - "accumulatedCharge" : 546.4, - "accumulatedQuantity" : 223, - "accumulatedQuantityFormat" : null, - "lastCallDate" : "2021-03-22T08:06:29.000+07:00", - "serviceType" : "Video", - "system" : "CCBS", - "uomCode" : "O" - }, { - "accumulatedCharge" : 785.8, - "accumulatedQuantity" : 223, - "accumulatedQuantityFormat" : null, - "lastCallDate" : "2021-03-22T08:06:29.000+07:00", - "serviceType" : "Voice", - "system" : "CCBS", - "uomCode" : "O" - }, { - "accumulatedCharge" : 1251.9, - "accumulatedQuantity" : 258, - "accumulatedQuantityFormat" : null, - "lastCallDate" : "2021-03-22T08:06:29.000+07:00", - "serviceType" : "Video", - "system" : "CCBS", - "uomCode" : "M" - } ], - "size" : 2 - }, - "cycleInfo" : { - "code" : 13, - "month" : 4, - "year" : 2021 - }, - "maxLastCallDate" : "2021-03-22T08:06:29.000+07:00", - "rerateIndicator" : "N" - } + let response = { + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "ca517eac-b687-45f2-a921-c5138c44402e", + "backendResponseList": { + "backendResponseInfoArray": [{ + "apiName": "getPrimaryKeyInfoByActiveAndBusinessLine", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "system": "OSB", + "url": "http://172.19.188.21:8080/ESB_Get_CustomerPreferenceInfo/Interfaces/Proxy/CommonPreferenceInfoPS" + }, { + "apiName": "getUnbilledCycleInfo", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "system": "OSB", + "url": "http://172.19.188.21:8080/ESB_Get_FinancialManagementInfo/Interfaces/Proxy/BillingInfoPS" + }, { + "apiName": "getRatedPerformanceIndicators3", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "system": "CCCSOA", + "url": "http://172.19.136.104/RaterServiceWS/RaterServiceSI" + }] + }, + "accumulationUOMGroupList": { + "accumulationInfoArray": [{ + "accumulatedCharge": 135, + "accumulatedQuantity": 191, + "accumulatedQuantityFormat": "03:11:00", + "lastCallDate": "2021-03-21T22:44:19.000+07:00", + "serviceType": "Voice", + "system": "CCBS", + "uomCode": "M" + }, { + "accumulatedCharge": 1013.5, + "accumulatedQuantity": 223, + "accumulatedQuantityFormat": null, + "lastCallDate": "2021-03-22T08:06:29.000+07:00", + "serviceType": "SMS", + "system": "CCBS", + "uomCode": "O" + }, { + "accumulatedCharge": 546.4, + "accumulatedQuantity": 223, + "accumulatedQuantityFormat": null, + "lastCallDate": "2021-03-22T08:06:29.000+07:00", + "serviceType": "Video", + "system": "CCBS", + "uomCode": "O" + }, { + "accumulatedCharge": 785.8, + "accumulatedQuantity": 223, + "accumulatedQuantityFormat": null, + "lastCallDate": "2021-03-22T08:06:29.000+07:00", + "serviceType": "Voice", + "system": "CCBS", + "uomCode": "O" + }, { + "accumulatedCharge": 1251.9, + "accumulatedQuantity": 258, + "accumulatedQuantityFormat": null, + "lastCallDate": "2021-03-22T08:06:29.000+07:00", + "serviceType": "Video", + "system": "CCBS", + "uomCode": "M" + }], + "size": 2 + }, + "cycleInfo": { + "code": 13, + "month": 4, + "year": 2021 + }, + "maxLastCallDate": "2021-03-22T08:06:29.000+07:00", + "rerateIndicator": "N" + } - res.status(200).send(responseErr) + res.status(200).send(responseErr) } +module.exports.getPrimaryKeyListWithoutResourceType = async (req, res) => { + console.log('===== POST getPrimaryKeyListWithoutResourceType =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', req.body); + + let responseErr ={ + "getPrimaryKeyListWithoutResourceTypeResponse": { + "return": { + "uuid": "f9336125-be9e-4c37-80c4-ab97990100cf", + "errorCode": "OSBbllngA10001", + "message": "Error" + } + } + } + let response = { + "getPrimaryKeyListWithoutResourceTypeResponse": { + "return": { + "uuid": "f9336125-be9e-4c37-80c4-ab97990100cf", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "primaryKeyList": { + "primaryKeyInfoArray": [ + { + "accountId": "200093866", + "accountSubType": "RVT", + "agreementIdOfOU": "1392732", + "agreementIdOfRootOU": "", + "customerId": "213656", + "customerType": "I", + "ouId": "133066", + "primaryResourceType": "C", + "primaryResourceValue": "0968730341", + "productId": "1392733", + "productStatus": "A", + "rootOUId": "123", + "system": "CCBS" + } + ], + "size": "1" + } + } + } + } + + res.status(200).send(response) +} -- libgit2 0.21.2