diff --git a/app.js b/app.js index 58dd802..019e322 100644 --- a/app.js +++ b/app.js @@ -396,14 +396,35 @@ app.post('/MGOfferInfo/NativeOfferInfo/getCurrentSpendingLimitList', require('./ app.post('/MGOfferInfo/NativeOfferInfo/getCurrentCreditLimitAtSubList', require('./int').getCurrentCreditLimitAtSubList); app.post('/MGOfferInfo/NativeOfferInfo/getCurrentSplitChargeInfo', require('./int').getCurrentSplitChargeInfo); app.post('/v1/get_BillImage/', require('./int').getBillImage); +app.post('/v1/OSB/get_AdjustmentSummaryAmount/', require('./int').getAdjustmentSummaryAmount); +app.post('/v1/OSB/get_AdjustmentHistoryList/', require('./int').getAdjustmentHistoryList); +app.post('/GatheringBillingInfo/GatheringBillingInfo/getTDSList', require('./int').getTdsList); +app.post('/v1/get_FinalChargeInfo/', require('./int').getFinalChargeInfo); //postpay +app.get('/v1/get_PayChannelInfo/:ban', require('./int').getPayChannel); app.get('/MGCCBSInvoiceInfo/MGCCBSInvoiceInfo/getAllCCBSInvoiceList/:ban/:pageSize/:pageNo', require('./intx').getAllCCBSInvoiceList); app.get('/FinancialTransaction/MGPaymentInfo/getPaymentList/:ban/:pageSize/:pageNo', require('./intx').getPaymentList); +app.post('/MGContractInfo/MGContractInfo/getCurrentContractList', require('./intx').getCurrentContractList); +app.post('/MGCustomerInfo/MGCustomerInfo/getAccountInfo', require('./intx').getAccountInfo); + +app.post('/v1/get_AccountCustomerInfo/', require('./postpay_true').getAccountCustomerInfo); //postpay +app.get('/v1/get_LastInvoiceList/:accountId/:pageSize', require('./postpay_true').getLastInvoiceList); //postpay +app.post('/v1/OSB/get_LastDocumentList/', require('./postpay_true').getLastDocumentList); //postpay +app.post('/v1/get_CreditLimitInfo/', require('./postpay_true').getCreditLimitInfo); //postpay +app.get('/MGBillingInfo/MGBillingInfo/getBillMediaInfo/:accountId/', require('./postpay_true').getBillMediaInfo); //postpay +app.post('/MGProductInfo/MGProductHistoryInfo/getProductHistoryList', require('./postpay_true').getProductHistoryList); //postpay +app.get('/v1/get_PaymentList/:accountId/:pageSize/:pageNumber/', require('./postpay_true').getPaymentList); //postpay +app.get('/v1/get_BillingAddress/:ban', require('./postpay_true').getBillingAddress); //postpay +app.post('/MCS/enquiry/subscriptioninfo/', require('./postpay_true').getDCBStatus); //postpay +app.post('/AggregateBillingInfo/MGBalanceInfo/getBalanceList', require('./postpay_true').getBalanceList); //postpay +app.post('/APIConnector/services/EnterpriseIntegration', express.text({type:"*/*"}), require('./postpay_true').sumCollectionAmount); //postpay app.post('/SBMWSREALCCP3G15/DoServiceFromXML', express.text({type:"*/*"}), require('./sbm').getCheckBalance_SBMWSREALCCP); app.post('/SBMWSREAL3G15/DoServiceFromXML', express.text({type:"*/*"}), require('./sbm').getCheckBalance_SBMWSREAL); app.post('/SBMWSDataIRPos/DoServiceFromXML', express.text({type:"*/*"}), require('./sbm').getCheckBalanceIR); +app.post('/CCPGW_ServiceWeb/Services/QueryUserProfile', express.text({type:"*/*"}), require('./ccp').userProfile); +app.post('/CCPGW_ServiceWeb/Services/QryBalanceList', express.text({type:"*/*"}), require('./ccp').balance); app.get('/api/callback', require('./line').callback); diff --git a/ccbs.js b/ccbs.js index 092457f..32eae1a 100644 --- a/ccbs.js +++ b/ccbs.js @@ -14,7 +14,7 @@ module.exports.assetDetail = async (req, res) => { let response = { "code": "0", "msg": "success.", - "outstandingBalance": 0, + "outstandingBalance": 1, "currentBillBalance": 1.61, "dueDate": "21/11/2020", "subStatus": { @@ -62,7 +62,7 @@ module.exports.assetDetail = async (req, res) => { "propositionCode": "CVG000000000052", "propositionDescription": "TrueSmartChoice Regu 4G No Limit", "term": "12", - "fee": 0, + "fee": 123, "startDate": "04/10/2019", "expireDate": "10/08/2021", "contractIndicator": "No", @@ -74,7 +74,7 @@ module.exports.assetDetail = async (req, res) => { "propositionCode": "CVG000000000052", "propositionDescription": "TrueSmartChoice Regu 4G No Limit", "term": "12", - "fee": 0, + "fee": "xxxx", "startDate": "04/10/2019", "expireDate": "05/10/2022", "contractIndicator": "No", diff --git a/ccp.js b/ccp.js new file mode 100644 index 0000000..a7ccebc --- /dev/null +++ b/ccp.js @@ -0,0 +1,185 @@ +module.exports.userProfile = async (req, res) => { + console.log('===== POST userProfile =====') + 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 response = ` + + + + + + TRUCRM + 0001 + 8f11f2a5-99be-4a19-b662-b75d9ae76fba + GWTRUCRM000121081714S200863DC9 + + + 0 + success + + + 66877157090 + 2018-03-13 + 2018-03-13 07-21-11 + 1 + + + 66877157090 +
Real Move|
+ 1 + A + PreRB + PreRB + R18NSB123 + 520002071474784 + 18031300000043669279 + + + R18NSB123 + R18NSB123 + 2018-03-13 07-21-11 + 2018-03-13 07-21-11 + + + + + + A + 00000000000000 + + + Calling_Bonus + 2 + 0 + 2018-03-13 07-21-06 + 2050-12-31 07-21-06 + 0 + + + Main Balance + 0 + 278.165 + 2018-03-13 00-00-00 + 2021-10-05 17-48-08 + 0 + + + 2021-10-04 + 2021-11-03 + 2021-11-18 + 2117-03-12 + 0 + 0 + 42 + 20 + 50000000 + Y +
+ +
+
+
+
+ ` + + res.status(200).send(response) +} + +module.exports.balance = async (req, res) => { + console.log('===== POST balance =====') + 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 response = ` + + + + + + TRUCRM + 0001 + 8f11f2a5-99be-4a19-b662-b75d9ae76fba + GWTRUCRM000121081714S100863E5F + + + 0 + success + + + + + Calling_Bonus + 8667338666 + 2 + 0 + 2018-03-13 07-21-06 + 2050-12-31 07-21-06 + 2018-12-27 17-29-19 + 0 + Baht + + + Main Balance + 8667320378 + 0 + 278.165 + 2018-03-13 00-00-00 + 2021-10-05 17-48-08 + 2021-05-25 20-10-01 + 0 + Baht + + + DB_OC_V_TVS + 8667320378 + 0 + 10248252 + 2018-03-13 00-00-00 + 2021-10-05 17-48-08 + 2021-05-25 20-10-01 + 0 + mb + + + VB_OC_IPK_IDD_ASIAN + 8667320378 + 0 + 3600 + 2018-03-13 00-00-00 + 2021-10-05 17-48-08 + 2021-05-25 20-10-01 + 0 + hr + + + AAAA + 8667320378 + 0 + 125 + 2018-03-13 00-00-00 + 2021-10-05 17-48-08 + 2021-05-25 20-10-01 + 0 + umit + + + + + + + + ` + + res.status(200).send(response) +} \ No newline at end of file diff --git a/int.js b/int.js index 795b76b..b088d29 100644 --- a/int.js +++ b/int.js @@ -592,3 +592,499 @@ module.exports.getBillImage = async (req, res) => { res.status(200).send(response) } + +module.exports.getAdjustmentSummaryAmount = async (req, res) => { + console.log('===== POST getAdjustmentSummaryAmount =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', JSON.stringify(req.body)); + + let responseErr = { + "getAdjustmentSummaryAmountResponse": { + "return": { + "errorCode": "OSBbllngA10001", + "message": "Error.", + "uuid": "e6717ec3-944b-4221-8825-3d32cf84bf35" + } + } + } + + let response = { + "getAdjustmentSummaryAmountResponse": { + "return": { + "adjustmentSummaryAmountInfo": { + "taxAmount": "31.45", + "adjustmentAmount": "449.25" + }, + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "e6717ec3-944b-4221-8825-3d32cf84bf35" + } + } + } + + res.status(200).send(response) +} + +module.exports.getAdjustmentHistoryList = async (req, res) => { + console.log('===== POST getAdjustmentHistoryList =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', JSON.stringify(req.body)); + + let responseErr = { + "getAdjustmentHistoryListResponse": { + "return": { + "errorCode": "OSBbllngA10001", + "message": "Error.", + "uuid": "e6717ec3-944b-4221-8825-3d32cf84bf35" + } + } + } + + let response = { + "getAdjustmentHistoryListResponse": { + "return": { + "totalSize": "7", + "adjustmentList": { + "size": "7", + "adjustmentInfoArray": [ + { + "adjustmentAllocationList": { + "size": "1", + "adjustmentAllocationInfoArray": [ + { + "invoiceId": "1513968231", + "invoiceNo": "010320211051308907", + "allocatedCreditAmount": "480.7" + } + ] + }, + "totalAmount": "480.7", + "amount": "449.25", + "creditDate": "2021-04-08T00:00:00.000+07:00", + "creditId": "775866320", + "creditLevelCode": "DEB", + "reversalReason": "", + "creditReason": "CRMG01", + "creditNoteNo": "CA-RM-2104036728", + "taxAmount": "31.45", + "userId": "2-372544013733:01028828", + "memoText": "Wanidchaya Srihata" + }, + { + "adjustmentAllocationList": { + "size": "1", + "adjustmentAllocationInfoArray": [ + { + "invoiceId": "1490481280", + "invoiceNo": "010220211039639824", + "allocatedCreditAmount": "640.93" + } + ] + }, + "totalAmount": "640.93", + "amount": "599", + "creditDate": "2021-04-08T00:00:00.000+07:00", + "creditId": "776485485", + "creditLevelCode": "DEB", + "reversalReason": "", + "creditReason": "CRMG01", + "creditNoteNo": "CA-RM-2104036727", + "taxAmount": "41.93", + "userId": "2-372544013733:01028828", + "memoText": "Wanidchaya Srihata" + }, + { + "adjustmentAllocationList": { + "size": "1", + "adjustmentAllocationInfoArray": [ + { + "invoiceId": "1467304418", + "invoiceNo": "010120211027964113", + "allocatedCreditAmount": "640.93" + } + ] + }, + "totalAmount": "640.93", + "amount": "599", + "creditDate": "2021-04-08T00:00:00.000+07:00", + "creditId": "776579004", + "creditLevelCode": "DEB", + "reversalReason": "", + "creditReason": "CRMG01", + "creditNoteNo": "CA-RM-2104036726", + "taxAmount": "41.93", + "userId": "2-372544013733:01028828", + "memoText": "Wanidchaya Srihata" + }, + { + "adjustmentAllocationList": { + "size": "1", + "adjustmentAllocationInfoArray": [ + { + "invoiceId": "1443542918", + "invoiceNo": "011220201016331633", + "allocatedCreditAmount": "640.93" + } + ] + }, + "totalAmount": "640.93", + "amount": "599", + "creditDate": "2021-04-08T00:00:00.000+07:00", + "creditId": "776485484", + "creditLevelCode": "DEB", + "reversalReason": "", + "creditReason": "CRMG01", + "creditNoteNo": "CA-RM-2104036725", + "taxAmount": "41.93", + "userId": "2-372544013733:01028828", + "memoText": "Wanidchaya Srihata" + }, + { + "adjustmentAllocationList": { + "size": "1", + "adjustmentAllocationInfoArray": [ + { + "invoiceId": "1420401161", + "invoiceNo": "011120201004647268", + "allocatedCreditAmount": "640.93" + } + ] + }, + "totalAmount": "640.93", + "amount": "599", + "creditDate": "2021-04-08T00:00:00.000+07:00", + "creditId": "775891146", + "creditLevelCode": "DEB", + "reversalReason": "", + "creditReason": "CRMG01", + "creditNoteNo": "CA-RM-2104036724", + "taxAmount": "41.93", + "userId": "2-372544013733:01028828", + "memoText": "Wanidchaya Srihata" + }, + { + "adjustmentAllocationList": { + "size": "1", + "adjustmentAllocationInfoArray": [ + { + "invoiceId": "1397327056", + "invoiceNo": "011020201093071353", + "allocatedCreditAmount": "400.58" + } + ] + }, + "totalAmount": "400.58", + "amount": "374.37", + "creditDate": "2021-04-08T00:00:00.000+07:00", + "creditId": "776579003", + "creditLevelCode": "DEB", + "reversalReason": "", + "creditReason": "CRMG01", + "creditNoteNo": "CA-RM-2104036723", + "taxAmount": "26.21", + "userId": "2-372544013733:01028828", + "memoText": "Wanidchaya Srihata" + }, + { + "adjustmentAllocationList": { + "size": "2", + "adjustmentAllocationInfoArray": [ + { + "invoiceId": "43535305", + "invoiceNo": "9082014105646265", + "allocatedCreditAmount": "13.66" + }, + { + "invoiceId": "0", + "invoiceNo": "UNAPPLIED", + "allocatedCreditAmount": "0" + } + ] + }, + "totalAmount": "13.66", + "amount": "12.77", + "creditDate": "2014-10-22T00:00:00.000+07:00", + "creditId": "56014584", + "creditLevelCode": "DEB", + "reversalReason": "", + "creditReason": "ECH001", + "creditNoteNo": "CA-RM-1410019455", + "taxAmount": "0.89", + "userId": "417926", + "memoText": "ADJ_SOC_4G_Error" + } + ] + }, + "calculatedPageSize": "100", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "a4af56a7-9c80-4dc3-b31f-5ff93ba0277a" + } + } + } + + res.status(200).send(response) +} + +module.exports.getTdsList = async (req, res) => { + console.log('===== POST getTdsList =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', JSON.stringify(req.body)); + + let responseErr = { + "errorCode": "INT10002", + "message": "Error.", + } + + let response = { + "uuid": "6487362b-b489-4d32-b345-afd094c64643", + "errorCode": "INT00001", + "message": "Success.", + "backendResponseList": { + "size": 5, + "backendResponseInfoArray": [ + { + "apiName": "getTDSPrimaryKeyList", + "errorCode": "INT00001", + "message": "Success. [uuid=13d8b65c-1544-4925-9fe6-bc3b33bdf355, correlatedId=a2c574b0-2189-4d2d-ae64-069cf38c88f5, primResourceValue=0971310696]", + "system": "INTX", + "url": "http://apigw.intx.true.th/CCBSCommonInfo/CCBSCommonInfo/getTDSPrimaryKeyList" + }, + { + "apiName": "OSB-GETACCOUNTINFO", + "errorCode": "OSBbllngA00001", + "message": "Success. [uuid=ae8340e1-18f0-43f4-a6a2-3c8fde30ab19, correlatedId=a2c574b0-2189-4d2d-ae64-069cf38c88f5, accountId=269208142]", + "system": "OSB", + "url": "http://apigw.intx.true.th/MGCustomerInfo/MGCustomerInfo/getAccountInfo" + }, + { + "apiName": "OSB-GETOPENINVOICELIST", + "errorCode": "OSBbllngA00001", + "message": "Success. [uuid=269718da-b006-40d3-a943-71759b333c4f, correlatedId=a2c574b0-2189-4d2d-ae64-069cf38c88f5, accountId=269208142]", + "system": "OSB", + "url": "http://apigw.intx.true.th/MGCCBSInvoiceInfo/MGCCBSInvoiceInfo/getOpenInvoiceList/269208142/100/1/a2c574b0-2189-4d2d-ae64-069cf38c88f5" + }, + { + "apiName": "OSB-GETPRODUCTINFO", + "errorCode": "OSBbllngA00001", + "message": "Success. [uuid=f4c305f7-a071-49a3-a327-e043578aa0bc, correlatedId=a2c574b0-2189-4d2d-ae64-069cf38c88f5, subscriberId=118001855]", + "system": "OSB", + "url": "http://apigw.intx.true.th/MGProductInfo/MGProductInfo/getProductInfo" + }, + { + "apiName": "getCurrentContractList", + "errorCode": "INT00001", + "message": "Success. [uuid=0648b363-cfa8-4d4a-84f2-079f21224744, correlatedId=a2c574b0-2189-4d2d-ae64-069cf38c88f5, agreementId=86217634]", + "system": "INTX", + "url": "http://apigw.intx.true.th/MGContractInfo/NativeContractInfo/getCurrentContractListBySearchList" + } + ] + }, + "tdsList": { + "size": 1, + "tdsInfoArray": [ + { + "account": { + "accountId": 269208142, + "arBalance": 9510.0 + }, + "subscriber": { + "subscriberId": 118001855, + "subscriberType": "TH" + }, + "invoiceList": { + "size": 1, + "invoiceInfoArray": [ + { + "invoiceId": 1471215586, + "baNo": 269208142, + "invoiceBcBanId": null, + "billSequenceNo": -1, + "invoiceNo": "AR1471215586", + "invoiceType": "IMCG", + "invoiceStatus": "O", + "coverageEndDate": null, + "coverageStartDate": null, + "dueDate": "2021-01-17T00:00:00.000+07:00", + "billAmount": 9510.0, + "unpaidAmount": 9510.0, + "discountAmount": 0.0, + "billTaxAmount": 0.0, + "vatRate": 0.0, + "invoiceCycle": { + "code": 25, + "month": 1, + "year": 2021 + } + } + ] + } + } + ] + }, + "contractSummary": { + "totalFee": 0.0, + "agreementId": 86217634 + } + } + + res.status(201).send(response) +} + +module.exports.getFinalChargeInfo = async (req, res) => { + console.log('===== POST getTdsList =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', JSON.stringify(req.body)); + + let responseErr = { + "errorCode": "OSBbllngA10002", + "message": "Error.", + } + + let response = { + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "3901b80c-10fa-4455-8242-6fb07fbb11c5", + "backendResponseList": { + "backendResponseInfoArray": [{ + "apiName": "getPrimaryKeyInfoByActiveAndBusinessLine", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "system": "OSB", + "url": "http://172.19.188.21:8080/ESB_Get_CustomerPreferenceInfo/Interfaces/Proxy/CommonPreferenceInfoPS" + }, { + "apiName": "validate-finalbill-resource", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "system": "CCB-BDV-CM", + "url": "http://billsim.true.th/billsimulator/finalbill/validate/resource/" + }, { + "apiName": "calculate-finalbill-resource", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "system": "CCB-BDV-CM", + "url": "http://billsim.true.th/billsimulator/finalbill/resource/" + }, { + "apiName": "l9GetCreditLimitWithPerformanceIndicators", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "system": "CCCSOA", + "url": "http://172.19.136.104/BillingServiceIntegration/BalanceService" + }, { + "apiName": "getAccountCustomerPreferenceList", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "system": "OSB", + "url": "http://172.19.188.21:8080/ESB_Get_CustomerPreferenceInfo/Interfaces/Proxy/CustomerPreferenceInfoPS" + }], + "size": 5 + }, + "accountId": 253213439, + "accountSplitParam": null, + "accountSplitParamForSplitPCN": null, + "allowedFinalChargeIndicator": "Y", + "arBalance": 11759.3, + "arBalanceSplitPCN": null, + "billSIMNetAmount": 901.55, + "billSIMValidationIndicator": "Y", + "convergenceIndicator": null, + "creditAvailable": -7359.30, + "creditLimit": 4400.0, + "creditLimitForSplitPCN": null, + "creditLimitWaiver": "N", + "creditLimitWaiverExpDate": "1960-01-01T00:00:00.000+07:00", + "defaultCreditLimit": 1000.0, + "discount": 12, + "minPayCancel": 12660.85, + "minPayCancelCalculationInfo": { + "fieldInfoArray": [{ + "name": "billSIMNetAmount", + "value": "901.55" + }, { + "name": "totalObligation", + "value": "11759.30" + }] + }, + "minpay": 11759.30, + "minpayCreditLimit": 8239.3, + "pendingRCOC": 0, + "proratedRC": 901.55, + "splitPCN": null, + "totalObligation": 11759.3, + "totalObligationForSplitPCN": null, + "unbilledUsage": 0 + } + + res.status(200).send(response) +} + +module.exports.getPayChannel = async (req, res) => { + console.log('===== GET getPayChannel =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + console.log('body', JSON.stringify(req.body)); + + let responseErr = { + "getPayChannelInfoResponse": { + "return": { + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "c8f2d372-1ba2-49d7-9c8a-830a44af9977" + } + } + } + + let response = { + "getPayChannelInfoResponse": { + "return": { + "errorCode": "OSBbllngA00001", + "payChannelInfo": { + "statusDate": "2019-03-27T00:00:00.000+07:00", + "billingArrangementId": "200078606", + "recurringFrequency": "", + "creditCardNo": "", + "recurringFrequencyValue": "", + "bankBranchName": "", + "bankAccountNo": "", + "bankName": "", + "creditCardType": "", + "payChannelStatus": "O", + "paymentType": "N", + "customerId": "187374", + "ddApprovalDate": "", + "bankCode": "", + "creditCardExpirationDate": "", + "recurringAmount": "", + "paymentCategory": "POST", + "paymentMeansOwnerDetails": "คุณ สัปปะรด ผลไม้", + "businessEntityId": "0", + "paymentMethodDesc": "Cash Payment", + "bankAccountType": "", + "payChannelNo": "200078606", + "bankBranchNo": "", + "billingArrangementNo": "1", + "paymentMethod": "CA", + "openDate": "2019-03-27T00:00:00.000+07:00" + }, + "message": "Success.", + "uuid": "c8f2d372-1ba2-49d7-9c8a-830a44af9977" + } + } + } + + res.status(200).send(response) +} \ No newline at end of file diff --git a/intx.js b/intx.js index 0460276..620f69d 100644 --- a/intx.js +++ b/intx.js @@ -30,7 +30,7 @@ module.exports.getAllCCBSInvoiceList = async (req, res) => { "dueDate": "2021-06-03T00:00:00.000+07:00", "orderIdGroup": "", "vatRate": "0.00", - "converageEndDate": "2021-06-09T00:00:00.000+07:00", + "converageEndDate1": "2021-06-09T00:00:00.000+07:00", "discountAmount": "-2000", "invoiceTFaxAmount": "76.93", "invoiceAmount": "1099", @@ -44,7 +44,7 @@ module.exports.getAllCCBSInvoiceList = async (req, res) => { }, "billAmount": "4703.72", "invoiceType": "BILL", - "converageStartDate": "2021-05-10T00:00:00.000+07:00", + "converageStartDate1": "2021-05-10T00:00:00.000+07:00", "currency": "THB", "billSequenceNo": "13522", "invoiceNo": "070520211000425014", @@ -1841,4 +1841,233 @@ module.exports.getPaymentList = async (req, res) => { } res.status(200).send(response) +} + +module.exports.getCurrentContractList = async (req, res) => { + console.log('===== GET getCurrentContractList =====') + 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 = { + "getCurrentContractListResponse": { + "return": { + "uuid": "ed41f948-565c-4900-a94d-ee63100e2fa4", + "errorCode": "OSBbllngA10001", + "message": "error." + } + } + } + + let response = { + "getCurrentContractListResponse":{ + "return":{ + "uuid":"b6cbfdb6-3e49-456a-b48d-c9ec84a067ab", + "errorCode":"OSBbllngA00001", + "message":"Success.", + "contractList":{ + "contractInfoArray":[ + { + "terminationDate":"2021-11-11T00:00:00.000+07:00", + "offerServiceLevel":"C", + "contractExpirationDate":"2021-11-11T00:00:00.000+07:00", + "offerInstanceId":"1669289", + "contractStartDate":"2020-11-11T00:00:00.000+07:00", + "offerCode":"14060327", + "fee":"0", + "proposition":{ + "code":"RMVC00000001586", + "description":"SH_Campus_iPad Air 3 64GB 256GB_d3000_a1605_c12" + }, + "contractGroupCode":null, + "contractGroupDescriptionThai":null, + "contractGroupDescriptionEng":null, + "contractNumber":"0830011853", + "remark":"TEST Update Fee=0 for overdue customer after penalty charged on 11/11/2020", + "term":"12", + "effectiveDate":"2020-11-11T10:46:09.000+07:00" + }, + { + "terminationDate":"2021-12-04T00:00:00.000+07:00", + "offerServiceLevel":"C", + "contractExpirationDate":"2021-12-04T00:00:00.000+07:00", + "offerInstanceId":"1685138", + "contractStartDate":"2020-12-04T00:00:00.000+07:00", + "offerCode":"15001717", + "fee":"5090", + "proposition":{ + "code":"RMV000000003554", + "description":"MG_S_4G Value_TS Tab 4G M1_Adv1000_Disc5090_C12_AT" + }, + "contractGroupCode":null, + "contractGroupDescriptionThai":null, + "contractGroupDescriptionEng":null, + "contractNumber":"0830011853", + "remark":"Add Contract", + "term":"12", + "effectiveDate":"2020-12-04T10:11:13.000+07:00" + } + ], + "size":"2" + } + } + } + } + + res.status(200).send(response) +} + +module.exports.getAccountInfo = async (req, res) => { + console.log('===== GET getAccountInfo =====') + 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 = { + "getAccountInfoResponse": { + "return": { + "uuid": "ed41f948-565c-4900-a94d-ee63100e2fa4", + "errorCode": "OSBbllngA10001", + "message": "error." + } + } + } + + let response = { + "getAccountInfoResponse": { + "return": { + "uuid": "c521b8c0-e810-4467-b3ca-e1be3e274a1a", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "account": { + "accountCollection": { + "collectionIndicator": null, + "suspensionReason": null, + "fullSuspensionIndicator": null, + "punishmentLevels": null, + "startDate": null, + "status": "NONE", + "collectionTreatmentIndicator": "N" + }, + "classify": "R", + "accountSubType": { + "code": "RES", + "description": "Individual - Residential" + }, + "ben": { + "consolidateIndicator": "Y", + "billLanguage": "TH", + "ben": "200078606", + "bcBanId": "700046423", + "billMedia": "S", + "status": { + "code": "O", + "description": "Open" + } + }, + "legacyBan": null, + "exernalId": null, + "ouId": "115614", + "delinquent": "", + "contact": { + "preferredContactNo": "0909230076", + "officePhone": null, + "homePhone": "0924971811", + "language": "TH", + "privatePhone": null, + "fax": null, + "email": null + }, + "agreementId": "1344349", + "customerId": "187374", + "creditLimit": { + "creditClass": "X", + "creditLimitReasonCode": "CREQ", + "personalCreditLimit": "0.0", + "creditLimitExpirationDate": null, + "temporaryCreditLimit": "0.0", + "obligationCalculationFormula": "Formula 3" + }, + "company": { + "code": "TI", + "description": "True Internet Corporation Company Limited" + }, + "arBalance": "28471.34", + "accountPriority": null, + "address": { + "country": null, + "zipCode": "50200", + "roomNo": "-", + "city": "เชียงใหม่", + "addressType": "I", + "moo": "1", + "soi": "-", + "building": "UNI LOFT CHAINGMAI D", + "sinceDate": null, + "street": "-", + "district": "เมืองเชียงใหม่", + "addressLine1": "137 * 1 * - *", + "houseNo": "137", + "addressLine2": "* UNI LOFT CHAINGMAI D * - * - * -", + "addressLine3": "* สุเทพ * เมืองเชียงใหม่", + "addressLine4": "เชียงใหม่ 50200", + "floor": "-", + "subDistrict": "สุเทพ" + }, + "parentBan": null, + "initiationReason": null, + "creditStatus": { + "reasonDescription": null, + "lastActivityDate": null, + "reasonCode": null, + "status": "NONE" + }, + "convergenceCode": "4PPremium", + "accountId": "200078606", + "statusDescription": "Active", + "collectionStatus": { + "reasonDescription": null, + "lastActivityDate": null, + "reasonCode": null, + "status": "NONE" + }, + "taxId": "7175358721530", + "withholdingTaxUpdateDate": null, + "withholdingTaxIndicator": "N", + "name": { + "branchCode": null, + "nameType": "I", + "firstName": "สัปปะรด", + "lastName": "ผลไม้", + "organizationName": null, + "branchName": null, + "middleName": null, + "storeId": null, + "tilte": "คุณ" + }, + "openDate": "2019-03-27T00:00:00.000+07:00", + "branchNo": "00000", + "partnerCode": null, + "businessLine": null, + "penaltyPayment": { + "creditCardType": null, + "creditCardNumber": null, + "creditCardName": null, + "creditCardExpirationDate": null, + "bankCode": null, + "bankBranchNumber": null, + "bankAccountNumber": null, + "penaltyPaymentType": "ASCENDLOAN" + }, + "interestWaivingIndicator": "N" + } + } + } + } + + res.status(200).send(response) } \ No newline at end of file diff --git a/logic1.js b/logic1.js new file mode 100644 index 0000000..17ea164 --- /dev/null +++ b/logic1.js @@ -0,0 +1,305 @@ + + + +test = { + "getAccountCustomerInfoResponse": { + "return": { + "withholdingTaxRate": "3", + "errorCode": "OSBbllngA00001", + "type": "ax21:AccountCustomerInfoResponse", + "message": "Success.", + "uuid": "4b8541d3-e6b4-44c3-8291-8688e5dc72cc", + "account": { + "accountCollection": { + "collectionIndicator": "", + "suspensionReason": "", + "fullSuspensionIndicator": "", + "punishmentLevels": "", + "startDate": { + "nil": true + }, + "status": "NONE" + }, + "classify": "R", + "accountSubType": { + "code": "EVP", + "description": "Enterprise VIP" + }, + "ben": { + "consolidateIndicator": "N", + "billLanguage": "TH", + "ben": "10000787", + "bcBanId": "1465", + "billMedia": "P", + "status": { + "code": "O", + "description": "Open" + } + }, + "type": "ax24:AccountInfo", + "legacyBan": "", + "exernalId": "", + "ouId": "1282", + "delinquent": "", + "contact": { + "preferredContactNo": "*", + "officePhone": "", + "homePhone": "023345678", + "language": "TH", + "privatePhone": "", + "fax": "", + "email": "" + }, + "agreementId": "1820", + "customerId": "2456", + "creditLimit": { + "creditClass": "BV", + "creditLimitReasonCode": "CREQ", + "personalCreditLimit": "1000.0", + "creditLimitExpirationDate": { + "nil": true + }, + "temporaryCreditLimit": "0.0", + "obligationCalculationFormula": "Formula 2" + }, + "company": { + "code": "RF", + "description": "True Move H Universal Communication Co., Ltd" + }, + "arBalance": "853.86", + "accountPriority": "", + "address": { + "country": "", + "zipCode": "10540", + "roomNo": "", + "city": "สมุทรปราการ", + "addressType": "B", + "moo": "", + "soi": "", + "building": "", + "street": "บางพลีน้อย", + "district": "บางพลี", + "addressLine1": "13 * *", + "houseNo": "13", + "addressLine2": "* * * * บางพลีน้อย", + "addressLine3": "* บางปลา * บางพลี", + "addressLine4": "สมุทรปราการ 10540", + "floor": "", + "subDistrict": "บางปลา" + }, + "parentBan": { + "nil": true + }, + "initiationReason": { + "nil": true + }, + "creditStatus": { + "reasonDescription": "", + "lastActivityDate": { + "nil": true + }, + "reasonCode": "", + "status": "NONE" + }, + "convergenceCode": "", + "accountId": "10000787", + "statusDescription": "Active", + "collectionStatus": { + "reasonDescription": "", + "lastActivityDate": null, + "reasonCode": "", + "status": "NONE" + }, + "taxId": "", + "withholdingTaxUpdateDate": { + "nil": true + }, + "withholdingTaxIndicator": "N", + "name": { + "branchCode": "", + "nameType": "B", + "firstName": "", + "lastName": "", + "organizationName": "มหาวิทยาลัยหอการค้าไทย", + "branchName": "", + "middleName": "", + "storeId": "", + "tilte": "" + }, + "openDate": "2013-03-02T11:32:16.000+07:00", + "branchNo": "" + }, + "customer": { + "creditLimitIndicator": "N", + "income": "", + "timeInBusiness": "1311", + "occupation": "", + "type": "ax24:CustomerInfo", + "customerType": { + "code": "C", + "description": "Corporate" + }, + "exernalId": "", + "lastActivityCode": "NEW_ACCOUNT", + "contactLanguage": "TH", + "educationLevel": "", + "contact": { + "preferredContactNo": "", + "officePhone": "", + "homePhone": "023345678", + "language": "TH", + "privatePhone": "", + "fax": "", + "email": "" + }, + "customerId": "2456", + "trueCardGrading": { + "nil": true + }, + "certificateExpirationDate": "2014-12-31", + "marketingChannel": "", + "offerCurrency": "THB", + "expirationDate": { + "nil": true + }, + "registerDate": "2013-03-02T11:32:13.000+07:00", + "creditClass": "BX", + "address": { + "country": "", + "zipCode": "10540", + "roomNo": "", + "city": "สมุทรปราการ", + "addressType": "B", + "moo": "", + "soi": "", + "building": "", + "sinceDate": "2013-03-02T11:32:13+07:00", + "street": "บางพลีน้อย", + "district": "บางพลี", + "addressLine1": "13 * *", + "houseNo": "13", + "addressLine2": "* * * * บางพลีน้อย", + "addressLine3": "* บางปลา * บางพลี", + "addressLine4": "สมุทรปราการ 10540", + "floor": "", + "subDistrict": "บางปลา" + }, + "totalProduct": "1", + "personal": { + "gender": "", + "accommodation": { + "nil": true + }, + "maritalStatus": "" + }, + "birthDate": "1987-11-30", + "lastActivityReasonCode": "CREQ", + "nationality": "", + "certificateNumber": "337/2515", + "largeCustomerIndicator": "N", + "periodOfWork": { + "nil": true + }, + "billCycleInfo": { + "changeCycleRequestStatus": "N", + "newBillCycle": { + "nil": true + }, + "changeCycleReqeustDate": { + "nil": true + }, + "billCycle": { + "code": "2", + "description": "Monthly Cycle close on the 1" + }, + "changeCycleIndicator": "N" + }, + "dealer": { + "code": "90225773", + "description": "คุณจรรจิรา จรรยาลิขิต" + }, + "name": { + "branchCode": "", + "nameType": "B", + "firstName": "", + "lastName": "", + "organizationName": "มหาวิทยาลัยหอการค้าไทย", + "branchName": "", + "middleName": "", + "storeId": "", + "tilte": "" + }, + "customerGrading": "TOP", + "taxExemptionIndicator": "N", + "job": "", + "effectiveDate": "2013-03-02T11:32:16.000+07:00", + "certificateType": "O" + } + } + } + } + + +creditDate = getAccountCustomerInfoResponse.return.account.creditStatus.lastActivityDate // string +collectDate = getAccountCustomerInfoResponse.return.account.collectionStatus.lastActivityDate // string +creditStatus = getAccountCustomerInfoResponse.return.account.creditStatus.status // string +collectStatus = getAccountCustomerInfoResponse.return.account.collectionStatus.status // string + +if("NONE".equals(creditStatus) && "NONE".equals(collectStatus)){ + if(CheckNullUtil.chkStringNotNull(creditDate) && CheckNullUtil.chkStringNotNull(collectDate)){ + banStatusUpdated = compareDate("yyyy-MM-dd'T'HH:mm:ss.SSS",creditDate,collectDate); + }else{ + if(CheckNullUtil.chkStringNotNull(creditDate)){ + banStatusUpdated = creditDate; + }else if(CheckNullUtil.chkStringNotNull(collectDate)){ + banStatusUpdated = collectDate; + }else{ + banStatusUpdated = accountMResult.getOpenDate(); + } + } +}else if("NONE".equals(creditStatus)&&"PSUS".equals(collectStatus)){ + banStatusUpdated = collectionStatusBean.getLastActivityDateStr(); +}else if("NONE".equals(creditStatus)&&"SUS".equals(collectStatus)){ + banStatusUpdated = collectionStatusBean.getLastActivityDateStr(); +}else if("NONE".equals(creditStatus)&&"CAN".equals(collectStatus)){ + banStatusUpdated = collectionStatusBean.getLastActivityDateStr(); +}else if("PSUS".equals(creditStatus)&&"NONE".equals(collectStatus)){ + banStatusUpdated = creditStatusBean.getLastActivityDateStr(); +}else if("PSUS".equals(creditStatus)&&"PSUS".equals(collectStatus)){ + banStatusUpdated = compareDate("yyyy-MM-dd'T'HH:mm:ss.SSS",creditDate,collectDate); +}else if("PSUS".equals(creditStatus)&&"SUS".equals(collectStatus)){ + banStatusUpdated = collectionStatusBean.getLastActivityDateStr(); +}else if("PSUS".equals(creditStatus)&&"CAN".equals(collectStatus)){ + banStatusUpdated = collectionStatusBean.getLastActivityDateStr(); +} + + + +private String compareDate(String format,String dateStr1,String dateStr2) throws ParseException { + String result = null; + SimpleDateFormat sdf = new SimpleDateFormat(format); + Date date1 = sdf.parse(dateStr1.substring(0,dateStr1.indexOf('+'))); + Date date2 = sdf.parse(dateStr2.substring(0,dateStr2.indexOf('+'))); + if (date1.after(date2)) { + result = dateStr1; + } + if (date1.before(date2)) { + result = dateStr2; + } + if (date1.equals(date2)) { + result = dateStr1; + } + return result; + } + + + ----------------------------------------------------------------------------------------------------------------------------------- + + + if (jsoncreditStatus.get("lastActivityDate").toString().equals("{\"nil\":true}") + ||jsoncreditStatus.get("lastActivityDate").toString().equals("")) { + tmpBanStatus.setCreditLimitDate(""); + } + else { + tmpBanStatus.setCreditLimitDate(sdf2.format(sdf.parse(jsoncreditStatus.get("lastActivityDate").toString()))); + } \ No newline at end of file diff --git a/logic3.js b/logic3.js new file mode 100644 index 0000000..367709d --- /dev/null +++ b/logic3.js @@ -0,0 +1,372 @@ + + +ResultList = Envelope.Body.getProductHistoryListResponse.return.productHistoryList + +for(result in ResultList) { + + StatusCode = result.subscriberStatusHistoryInfoArray.status.statusCode + Activity = result.subscriberStatusHistoryInfoArray.status.lastActivityPathId + StatusReasonCode = result.subscriberStatusHistoryInfoArray.status.statusReasonCode + StatusReasonDescription = result.subscriberStatusHistoryInfoArray.status.statusReasonDescription + Since = result.subscriberStatusHistoryInfoArray.effectiveDate + PreviousSubscriber = result.subscriberStatusHistoryInfoArray.linkPrevProductId + NextSubscriber = result.subscriberStatusHistoryInfoArray.linkNextProductId + CreditLimitStatus = result.subscriberStatusHistoryInfoArray.creditStatus.status + CreditReasonCode = result.subscriberStatusHistoryInfoArray.creditStatus.reasonCode + CreditReasonDescription = result.subscriberStatusHistoryInfoArray.creditStatus.reasonDescription + CreditLimitActivityDate = result.subscriberStatusHistoryInfoArray.creditStatus.lastActivityDate + CollectionStatus = result.subscriberStatusHistoryInfoArray.collectionStatus.status + CollectionReasonCode = result.subscriberStatusHistoryInfoArray.collectionStatus.reasonCode + CollectionReasonDescription = result.subscriberStatusHistoryInfoArray.collectionStatus.reasonDescription + CollectionActivityDate = result.subscriberStatusHistoryInfoArray.collectionStatus.lastActivityDate + BarringStatus = result.subscriberStatusHistoryInfoArray.barringByRequestIndicator + BarringActivityDate = result.subscriberStatusHistoryInfoArray.barringByRequestActivityDate + BarringByRequestReasonCode = result.subscriberStatusHistoryInfoArray.barringByRequestReasonCode + BarringByRequestReasonDescription = result.subscriberStatusHistoryInfoArray.barringByRequestReasonDescription + CreditLimitAtSubStatus = result.subscriberStatusHistoryInfoArray.creditLimitAtSubStatus.status + CreditLimitAtSubActivityDate = result.subscriberStatusHistoryInfoArray.creditLimitAtSubStatus.lastActivityDate + CreditLimitAtSubReason = result.subscriberStatusHistoryInfoArray.creditLimitAtSubStatus.reasonDescription + + + if( null != statusReasonCode ) + Reason = StatusReasonCode+" : "+StatusReasonDescription + + + if( null != CreditReasonCode ) + CreditLimitReason = CreditReasonCode+" : "+CreditReasonDescription + + if(null != CollectionReasonCode) + CollectionReason = CollectionReasonCode+" : "+CollectionReasonDescription + + if(null != temp.getBarringByRequestReasonCode) // tid kah temp khue a rai??? + BarringReason = BarringByRequestReasonCode+" : "+BarringByRequestReasonDescription + + if (null != Since ) + Since = Since + + if (null!= CollectionActivityDate ) + CollectionActivityDate = CollectionActivityDate + + if (null != CreditLimitActivityDate ) + CreditLimitActivityDate = CreditLimitActivityDate + + if (null != CreditLimitAtSubActivityDate ) + CreditLimitAtSubActivityDate = CreditLimitAtSubActivityDate + + if ( null != BarringActivityDate ) + BarringActivityDate = BarringActivityDate + + + if("A" == StatusCode){ + + if("CAN" == CollectionStatus() || "CAN" == CreditLimitStatus || "CAN" == CreditLimitAtSubStatus){ // CollectionStatus() un nee khue fn a rai??? + Status = "Cancelled" + + }else if("SUS" == CollectionStatus || "SUS" == CreditLimitStatus || "SUS" == CreditLimitAtSubStatus ){ + Status = "Full Suspend" + + }else if("PSUS" == CollectionStatus || "PSUS" == CreditLimitStatus || "PSUS" == CreditLimitAtSubStatus || "Y" == BarringStatus){ + Status = "Soft Suspend" + + }else{ + Status = "Active" + } + + }else{ + // mapping + // NONE null + // CAN Cancelled + // RES Restore + // SUS Full Suspend + // PSUS Soft Suspend + // C Cancelled + // T Terminate + // S Full Suspend + // U Suspend-Collection + // D Suspend-Collection + // L Collection + // Y Soft Suspend + String mappedStatus = mapping(StatusCode) // see Mapping 5 --> yang mai hen wa chai tong nai + + if("CAN" == CollectionStatus || "CAN" == CreditLimitStatus || "CAN" == CreditLimitAtSubStatus){ + Status = "Cancelled" + + }else if("SUS" == CollectionStatus || "SUS" == CreditLimitStatus || "SUS" == CreditLimitAtSubStatus){ + Status = "Full Suspend" + + }else if("PSUS" == CollectionStatus || "PSUS" == CreditLimitStatus || "PSUS" == CreditLimitAtSubStatus || "Y" == BarringStatus ){ + Status = "Soft Suspend" + + }else { + Status = "Active" + } + + } + + mappedCreditLimitStatus = mapping(CreditLimitStatus) // see Mapping 5 + CreditLimitStatus = mappedCreditLimitStatus + + mappedCollectionStatus = mapping(CollectionStatus) // see Mapping 5 + CollectionStatus = mappedCollectionStatus + + mappedBarringStatus = mapping(BarringStatus) // see Mapping 5 + BarringStatus = mappedBarringStatus + + mappedCreditLimitAtSubStatus = mapping(CreditLimitAtSubStatus) // see Mapping 5 + CreditLimitAtSubStatus = mappedCreditLimitAtSubStatus + + check = false; + arrayTmp = [] + + if ( "Soft Suspend" == BarringStatus ) { + arrayTmp.add([BarringActivityDate, BarringStatus+" Since: "+BarringActivityDate+ "("+BarringReason+")"]) + check = true; + } + + if ( null != CreditLimitStatus ) { + arrayTmp.add([CreditLimitActivityDate, CreditLimitStatus+" Since: "+CreditLimitActivityDate+"("+CreditLimitReason+")"]) + check = true; + } + + if ( null != CollectionStatus ) { + arrayTmp.add([CollectionActivityDate, CollectionStatus+" Since: "+CollectionActivityDate+ "("+CollectionReason+")"]) + check = true; + } + + if ( "NONE" != CreditLimitAtSubStatus && null != CreditLimitAtSubStatus ) { + + message = CreditLimitAtSubStatus+ " Since: "+CreditLimitAtSubActivityDate+"("+CreditLimitAtSubReason+")" + + // arrayTmp.add([CreditLimitAtSubActivityDate, CreditLimitAtSubStatus+ " Since: "+CreditLimitAtSubActivityDate+"("+CreditLimitAtSubReason+")"]) + // check = true; + } + + if (check) { + if ( "A" != StatusCode ) { + arrayTmp.add([Since, Status + " Since: "+Since+"("+Reason+")"]) + } + } else { + if ( null != Status ) { + arrayTmp.add([Since, Status+ " Since: "+Since+"("+Reason+")"]) + } + } + +// arrayTmp = [ +// ["10/01/1995", "Soft Suspend Since :10/01/1995(reason)"], +// ["10/01/1995", "Soft Suspend Since :10/01/1995(reason)"] +// ] + + if (arrayTmp.size() > 0) { + + StringBuilder subStatusBuilder = new StringBuilder(); + + subStatusBuilder.append(temp.getStatus()) // value temp ?? + subStatusBuilder.append("\n") + + sort(arrayTmp) // reang jak mak pai noi or noi pai mak + + for (String[] sTmp : arrayTmp) { + subStatusBuilder.append(sTmp[1]) + subStatusBuilder.append("\n") + } + + SubStatus = subStatusBuilder.toString()); + + SubStatus = `$getStatus + Restore Since: 09/01/1995($CollectionReason) + Cancelled Since: 10/01/1995($Reason) + Soft Suspend Since: 11/01/1995(reason)` + + } +} + + +$getStatus +Restore Since: 09/01/1995($CollectionReason) +Cancelled Since: 10/01/1995($Reason) +Soft Suspend Since: 11/01/1995(reason) + + // * --------------------------------------------------------------------------------------------------------------- * // + + + + + + +ResultList = /getProductHistoryListResponse/return/productHistoryList/subscriberStatusHistoryInfoArray + +for (r in ResultList) { + + StatusCode = r.status.statusCode + Activity = r.status.lastActivityPathId + StatusReasonCode = r.status.statusReasonCode + StatusReasonDescription = r.status.statusReasonDescription + Since = r.effectiveDate + PreviousSubscriber = r.linkPrevProductId + NextSubscriber = r.linkNextProductId + CreditLimitStatus = r.creditStatus.status + CreditReasonCode = r.creditStatus.reasonCode + CreditReasonDescription = r.creditStatus.reasonDescription + CreditLimitActivityDate = r.creditStatus.lastActivityDate + CollectionStatus = r.collectionStatus.status + CollectionReasonCode = r.collectionStatus.reasonCode + CollectionReasonDescription = r.collectionStatus.reasonDescription + CollectionActivityDate = r.collectionStatus.lastActivityDate + BarringStatus = r.barringByRequestIndicator + BarringActivityDate = r.barringByRequestActivityDate + BarringByRequestReasonCode = r.barringByRequestReasonCode + BarringByRequestReasonDescription = r.barringByRequestReasonDescription + CreditLimitAtSubStatus = r.creditLimitAtSubStatus.status + CreditLimitAtSubActivityDate = r.creditLimitAtSubStatus.lastActivityDate + CreditLimitAtSubReason = r.creditLimitAtSubStatus.reasonDescription + + if( null != statusReasonCode ) + Reason = StatusReasonCode+" : "+StatusReasonDescription + //eg. Reason = 'RSP5 : Restore Subs - Found' + + + if( null != CreditReasonCode ) + CreditLimitReason = CreditReasonCode+" : "+CreditReasonDescription + + if(null != CollectionReasonCode) + CollectionReason = CollectionReasonCode+" : "+CollectionReasonDescription + + if(null != BarringByRequestReasonCode) + BarringReason = BarringByRequestReasonCode+" : "+BarringByRequestReasonDescription + + + if (null != Since ) + Since = Since + + if (null!= CollectionActivityDate ) + CollectionActivityDate = CollectionActivityDate + + if (null != CreditLimitActivityDate ) + CreditLimitActivityDate = CreditLimitActivityDate + + if (null != CreditLimitAtSubActivityDate ) + CreditLimitAtSubActivityDate = CreditLimitAtSubActivityDate + + if ( null != BarringActivityDate ) + BarringActivityDate = BarringActivityDate + + if("A" == StatusCode){ + + if("CAN" == CollectionStatus || "CAN" == CreditLimitStatus || "CAN" == CreditLimitAtSubStatus){ + Status = "Cancelled" + }else if("SUS" == CollectionStatus || "SUS" == CreditLimitStatus || "SUS" == CreditLimitAtSubStatus ){ + Status = "Full Suspend" + + }else if("PSUS" == CollectionStatus || "PSUS" == CreditLimitStatus || "PSUS" == CreditLimitAtSubStatus || "Y" == BarringStatus){ + Status = "Soft Suspend" + + }else{ + Status = "Active" + } + +} else { + String mappedStatus = mapping(StatusCode) // see Mapping 5 + + // # Mapping 5 + // # NONE null + // # CAN Cancelled + // # RES Restore + // # SUS Full Suspend + // # PSUS Soft Suspend + // # C Cancelled + // # T Terminate + // # S Full Suspend + // # U Suspend-Collection + // # D Suspend-Collection + // # L Collection + // # Y Soft Suspend + + if (mappedStatus != null) { + + Status = mappedStatus + + } else { + if("CAN" == CollectionStatus || "CAN" == CreditLimitStatus || "CAN" == CreditLimitAtSubStatus){ + Status = "Cancelled" + + }else if("SUS" == CollectionStatus || "SUS" == CreditLimitStatus || "SUS" == CreditLimitAtSubStatus){ + Status = "Full Suspend" + + }else if("PSUS" == CollectionStatus || "PSUS" == CreditLimitStatus || "PSUS" == CreditLimitAtSubStatus || "Y" == BarringStatus ){ + Status = "Soft Suspend" + + }else { + Status = null + } + } + } + +// # Mapping 5 +// # NONE null +// # CAN Cancelled +// # RES Restore +// # SUS Full Suspend +// # PSUS Soft Suspend +// # C Cancelled +// # T Terminate +// # S Full Suspend +// # U Suspend-Collection +// # D Suspend-Collection +// # L Collection +// # Y Soft Suspend + + mappedCreditLimitStatus = mapping(CreditLimitStatus) // see Mapping 5 + CreditLimitStatus = mappedCreditLimitStatus + + mappedCollectionStatus = mapping(CollectionStatus) // see Mapping 5 + CollectionStatus = mappedCollectionStatus + + mappedBarringStatus = mapping(BarringStatus) // see Mapping 5 + BarringStatus = mappedBarringStatus + + mappedCreditLimitAtSubStatus = mapping(CreditLimitAtSubStatus) // see Mapping 5 + CreditLimitAtSubStatus = mappedCreditLimitAtSubStatus + + check = false; + arrayTmp = new Array(); + + if ( "Soft Suspend" == BarringStatus ) { + arrayTmp.add(BarringStatus+" Since: "+BarringActivityDate+ "("+BarringReason+")") + // arrayTmp.add(new String[]{BarringActivityDate, BarringStatus+" Since: "+BarringActivityDate+ "("+BarringReason+")"}) + check = true; + } + + if ( null != CreditLimitStatus ) { + arrayTmp.add(CreditLimitStatus+" Since: "+CreditLimitActivityDate+"("+CreditLimitReason+")") + // arrayTmp.add(new String[]{CreditLimitActivityDate, CreditLimitStatus+" Since: "+CreditLimitActivityDate+"("+CreditLimitReason+")"}) + check = true; + } + + if ( null != CollectionStatus ) { + arrayTmp.add(CollectionStatus+" Since: "+CollectionActivityDate+ "("+CollectionReason+")") + // arrayTmp.add(new String[]{CollectionActivityDate, CollectionStatus+" Since: "+CollectionActivityDate+ "("+CollectionReason+")"}) + check = true; + } + + if ( "NONE" != CreditLimitAtSubStatus && null != CreditLimitAtSubStatus ) { + arrayTmp.add(CreditLimitAtSubStatus+ " Since: "+CreditLimitAtSubActivityDate+"("+CreditLimitAtSubReason+")") + // arrayTmp.add(new String[]{CreditLimitAtSubActivityDate, CreditLimitAtSubStatus+ " Since: "+CreditLimitAtSubActivityDate+"("+CreditLimitAtSubReason+")"}) + check = true; + } + + if (check) { + if ( "A" != StatusCode ) { + arrayTmp.add(Status + " Since: "+Since+"("+Reason+")") + } + } + else { + if ( null != Status ) { + arrayTmp.add(Status+ " Since: "+Since+"("Reason+")") + } + } + + if (arrayTmp.size() > 0) { + fn_sort(arrayTmp) // Sort ตามวันที่(parameter หลัง Since: xxx) มาก ไป น้อย ให้เอาเฉพาะวันที่ที่มากที่สุด + SubStatus = arrayTmp[0] // ตัวแรก(index)ของ arrayTmp + } +} \ No newline at end of file diff --git a/postpay_true.js b/postpay_true.js new file mode 100644 index 0000000..f2cf7f8 --- /dev/null +++ b/postpay_true.js @@ -0,0 +1,1254 @@ +module.exports.getAccountCustomerInfo = async (req, res) => { + console.log('===== POST getAccountCustomerInfo =====') + 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 response = { + "getAccountCustomerInfoResponse": { + "return": { + "withholdingTaxRate": "3", + "errorCode": "OSBbllngA00001", + "type": "ax21:AccountCustomerInfoResponse", + "message": "Success.", + "uuid": "4b8541d3-e6b4-44c3-8291-8688e5dc72cc", + "account": { + "accountCollection": { + "collectionIndicator": "", + "suspensionReason": "", + "fullSuspensionIndicator": "", + "punishmentLevels": "", + "startDate": { + "nil": true + }, + "status": "NONE" + }, + "classify": "R", + "accountSubType": { + "code": "EVP", + "description": "Enterprise VIP" + }, + "ben": { + "consolidateIndicator": "N", + "billLanguage": "TH", + "ben": "10000787", + "bcBanId": "1465", + "billMedia": "P", + "status": { + "code": "O", + "description": "Open" + } + }, + "type": "ax24:AccountInfo", + "legacyBan": "", + "exernalId": "", + "ouId": "1282", + "delinquent": "", + "contact": { + "preferredContactNo": "*", + "officePhone": "", + "homePhone": "023345678", + "language": "TH", + "privatePhone": "", + "fax": "", + "email": "" + }, + "agreementId": "1820", + "customerId": "2456", + "creditLimit": { + "creditClass": "BV", + "creditLimitReasonCode": "CREQ", + "personalCreditLimit": "1000.0", + "creditLimitExpirationDate": { + "nil": true + }, + "temporaryCreditLimit": "0.0", + "obligationCalculationFormula": "Formula 2" + }, + "company": { + "code": "RF", + "description": "True Move H Universal Communication Co., Ltd" + }, + "arBalance": "853.86", + "accountPriority": "", + "address": { + "country": "", + "zipCode": "10540", + "roomNo": "", + "city": "สมุทรปราการ", + "addressType": "B", + "moo": "", + "soi": "", + "building": "", + "street": "บางพลีน้อย", + "district": "บางพลี", + "addressLine1": "13 * *", + "houseNo": "13", + "addressLine2": "* * * * บางพลีน้อย", + "addressLine3": "* บางปลา * บางพลี", + "addressLine4": "สมุทรปราการ 10540", + "floor": "", + "subDistrict": "บางปลา" + }, + "parentBan": { + "nil": true + }, + "initiationReason": { + "nil": true + }, + "creditStatus": { + "reasonDescription": "", + "lastActivityDate": { + "nil": true + }, + "reasonCode": "", + "status": "NONE" + }, + "convergenceCode": "", + "accountId": "10000787", + "statusDescription": "Active", + "collectionStatus": { + "reasonDescription": "", + "lastActivityDate": { + "nil": true + }, + "reasonCode": "", + "status": "NONE" + }, + "taxId": "", + "withholdingTaxUpdateDate": { + "nil": true + }, + "withholdingTaxIndicator": "N", + "name": { + "branchCode": "", + "nameType": "B", + "firstName": "", + "lastName": "", + "organizationName": "มหาวิทยาลัยหอการค้าไทย", + "branchName": "", + "middleName": "", + "storeId": "", + "tilte": "" + }, + "openDate": "2013-03-02T11:32:16.000+07:00", + "branchNo": "" + }, + "customer": { + "creditLimitIndicator": "N", + "income": "", + "timeInBusiness": "1311", + "occupation": "", + "type": "ax24:CustomerInfo", + "customerType": { + "code": "C", + "description": "Corporate" + }, + "exernalId": "", + "lastActivityCode": "NEW_ACCOUNT", + "contactLanguage": "TH", + "educationLevel": "", + "contact": { + "preferredContactNo": "", + "officePhone": "", + "homePhone": "023345678", + "language": "TH", + "privatePhone": "", + "fax": "", + "email": "" + }, + "customerId": "2456", + "trueCardGrading": { + "nil": true + }, + "certificateExpirationDate": "2014-12-31", + "marketingChannel": "", + "offerCurrency": "THB", + "expirationDate": { + "nil": true + }, + "registerDate": "2013-03-02T11:32:13.000+07:00", + "creditClass": "BX", + "address": { + "country": "", + "zipCode": "10540", + "roomNo": "", + "city": "สมุทรปราการ", + "addressType": "B", + "moo": "", + "soi": "", + "building": "", + "sinceDate": "2013-03-02T11:32:13+07:00", + "street": "บางพลีน้อย", + "district": "บางพลี", + "addressLine1": "13 * *", + "houseNo": "13", + "addressLine2": "* * * * บางพลีน้อย", + "addressLine3": "* บางปลา * บางพลี", + "addressLine4": "สมุทรปราการ 10540", + "floor": "", + "subDistrict": "บางปลา" + }, + "totalProduct": "1", + "personal": { + "gender": "", + "accommodation": { + "nil": true + }, + "maritalStatus": "" + }, + "birthDate": "1987-11-30", + "lastActivityReasonCode": "CREQ", + "nationality": "", + "certificateNumber": "337/2515", + "largeCustomerIndicator": "N", + "periodOfWork": { + "nil": true + }, + "billCycleInfo": { + "changeCycleRequestStatus": "N", + "newBillCycle": { + "nil": true + }, + "changeCycleReqeustDate": { + "nil": true + }, + "billCycle": { + "code": "2", + "description": "Monthly Cycle close on the 1" + }, + "changeCycleIndicator": "N" + }, + "dealer": { + "code": "90225773", + "description": "คุณจรรจิรา จรรยาลิขิต" + }, + "name": { + "branchCode": "", + "nameType": "B", + "firstName": "", + "lastName": "", + "organizationName": "มหาวิทยาลัยหอการค้าไทย", + "branchName": "", + "middleName": "", + "storeId": "", + "tilte": "" + }, + "customerGrading": "TOP", + "taxExemptionIndicator": "N", + "job": "", + "effectiveDate": "2013-03-02T11:32:16.000+07:00", + "certificateType": "O" + } + } + } + } + + res.status(200).send(response) +} + +module.exports.getLastInvoiceList = async (req, res) => { + console.log('===== GET getLastInvoiceList =====') + 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 response = { + "getLastInvoiceListResponse": { + "return": { + "invoiceList": { + "size": "4", + "invoiceInfoArray": [ + { + "discountTaxAmount": "0", + "adjustmentNetAmount": "0", + "availableAdjustmentNetAmount": "699", + "invoiceBcBanId": "813", + "dueDate": "2013-06-26T00:00:00.000+07:00", + "vatRate": "0.00", + "converageEndDate": "2013-06-01T00:00:00.000+07:00", + "discountAmount": "0", + "invoiceTaxAmount": "48.93", + "invoiceAmount": "699", + "invoiceStatusChangeDate": "2013-06-12T00:00:00.000+07:00", + "paymentAmount": "0", + "baNo": "10000449", + "billTaxAmount": "293.58", + "billingDocumentType": { + "code": "BL", + "description": "Bill" + }, + "billAmount": "4487.58", + "invoiceType": "BILL", + "converageStartDate": "2013-05-02T00:00:00.000+07:00", + "currency": "THB", + "billSequenceNo": "293", + "invoiceNo": "140620130200002104", + "originalBalanceAmount": "747.93", + "customerManagerBaNo": "10000449", + "invoiceCreationDate": "2013-06-12T00:00:00.000+07:00", + "unpaidNetAmount": "699", + "availableAdjustmentAmount": "992.58", + "discountNetAmount": "0", + "billDate": "2013-06-03T00:00:00.000+07:00", + "disputeNetAmount": "0.00", + "creditTaxAmount": "0", + "accountId": "10000449", + "billProductType": "", + "billingDocumentStatus": { + "code": "N", + "description": "Confirmed" + }, + "unpaidAmount": "747.93", + "restrictionAmount": "0", + "disputeTaxAmount": "0.00", + "invoiceCycle": { + "code": "2", + "month": "6", + "year": "2013" + }, + "convergenceInvoiceNo": "140620130200002104", + "coveredAmount": "0", + "invoiceId": "8627", + "performanceIndStatus": "", + "unpaidTaxAmount": "48.93", + "invoiceStatus": "O", + "adjustmentAmount": "0", + "restrictionTaxAmount": "0" + }, + { + "discountTaxAmount": "0", + "adjustmentNetAmount": "0", + "availableAdjustmentNetAmount": "699", + "invoiceBcBanId": "813", + "dueDate": "2013-06-05T00:00:00.000+07:00", + "vatRate": "0.00", + "converageEndDate": "2013-05-01T00:00:00.000+07:00", + "discountAmount": "0", + "invoiceTaxAmount": "48.93", + "invoiceAmount": "699", + "invoiceStatusChangeDate": "2013-05-12T00:00:00.000+07:00", + "paymentAmount": "0", + "baNo": "10000449", + "billTaxAmount": "293.58", + "billingDocumentType": { + "code": "BL", + "description": "Bill" + }, + "billAmount": "4487.58", + "invoiceType": "BILL", + "converageStartDate": "2013-04-02T00:00:00.000+07:00", + "currency": "THB", + "billSequenceNo": "292", + "invoiceNo": "140520130200001097", + "originalBalanceAmount": "747.93", + "customerManagerBaNo": "10000449", + "invoiceCreationDate": "2013-05-12T00:00:00.000+07:00", + "unpaidNetAmount": "699", + "availableAdjustmentAmount": "992.58", + "discountNetAmount": "0", + "billDate": "2013-05-13T00:00:00.000+07:00", + "disputeNetAmount": "0.00", + "creditTaxAmount": "0", + "accountId": "10000449", + "billProductType": "", + "billingDocumentStatus": { + "code": "N", + "description": "Confirmed" + }, + "unpaidAmount": "747.93", + "restrictionAmount": "0", + "disputeTaxAmount": "0.00", + "invoiceCycle": { + "code": "2", + "month": "5", + "year": "2013" + }, + "convergenceInvoiceNo": "140520130200001097", + "coveredAmount": "0", + "invoiceId": "20448", + "performanceIndStatus": "", + "unpaidTaxAmount": "48.93", + "invoiceStatus": "O", + "adjustmentAmount": "0", + "restrictionTaxAmount": "0" + }, + { + "discountTaxAmount": "0", + "adjustmentNetAmount": "0", + "availableAdjustmentNetAmount": "0.00", + "invoiceBcBanId": "813", + "dueDate": "2013-04-26T00:00:00.000+07:00", + "vatRate": "0.00", + "converageEndDate": "", + "discountAmount": "0", + "invoiceTaxAmount": "0", + "invoiceAmount": "0", + "invoiceStatusChangeDate": "2013-04-02T00:00:00.000+07:00", + "paymentAmount": "0", + "baNo": "10000449", + "billTaxAmount": "0", + "billingDocumentType": { + "code": "BL", + "description": "Bill" + }, + "billAmount": "0.00", + "invoiceType": "CN", + "converageStartDate": "", + "currency": "THB", + "billSequenceNo": "291", + "invoiceNo": "140420130200000419", + "originalBalanceAmount": "0", + "customerManagerBaNo": "10000449", + "invoiceCreationDate": "2013-04-02T00:00:00.000+07:00", + "unpaidNetAmount": "0", + "availableAdjustmentAmount": "0.00", + "discountNetAmount": "0", + "billDate": "2013-04-03T00:00:00.000+07:00", + "disputeNetAmount": "0.00", + "creditTaxAmount": "0", + "accountId": "10000449", + "billProductType": "", + "billingDocumentStatus": { + "code": "N", + "description": "Confirmed" + }, + "unpaidAmount": "0", + "restrictionAmount": "0.00", + "disputeTaxAmount": "0.00", + "invoiceCycle": { + "code": "2", + "month": "4", + "year": "2013" + }, + "convergenceInvoiceNo": "140420130200000419", + "coveredAmount": "0", + "invoiceId": "3145", + "performanceIndStatus": "", + "unpaidTaxAmount": "0", + "invoiceStatus": "F", + "adjustmentAmount": "0", + "restrictionTaxAmount": "0.00" + }, + { + "discountTaxAmount": "0", + "adjustmentNetAmount": "0", + "availableAdjustmentNetAmount": "0.00", + "invoiceBcBanId": "813", + "dueDate": "2013-03-26T00:00:00.000+07:00", + "vatRate": "0.00", + "converageEndDate": "", + "discountAmount": "0", + "invoiceTaxAmount": "0", + "invoiceAmount": "0", + "invoiceStatusChangeDate": "2013-03-02T00:00:00.000+07:00", + "paymentAmount": "0", + "baNo": "10000449", + "billTaxAmount": "0", + "billingDocumentType": { + "code": "BL", + "description": "Bill" + }, + "billAmount": "0.00", + "invoiceType": "CN", + "converageStartDate": "", + "currency": "THB", + "billSequenceNo": "290", + "invoiceNo": "140320130200000071", + "originalBalanceAmount": "0", + "customerManagerBaNo": "10000449", + "invoiceCreationDate": "2013-03-02T00:00:00.000+07:00", + "unpaidNetAmount": "0", + "availableAdjustmentAmount": "0.00", + "discountNetAmount": "0", + "billDate": "2013-03-03T00:00:00.000+07:00", + "disputeNetAmount": "0.00", + "creditTaxAmount": "0", + "accountId": "10000449", + "billProductType": "", + "billingDocumentStatus": { + "code": "N", + "description": "Confirmed" + }, + "unpaidAmount": "0", + "restrictionAmount": "0.00", + "disputeTaxAmount": "0.00", + "invoiceCycle": { + "code": "2", + "month": "3", + "year": "2013" + }, + "convergenceInvoiceNo": "140320130200000071", + "coveredAmount": "0", + "invoiceId": "629", + "performanceIndStatus": "", + "unpaidTaxAmount": "0", + "invoiceStatus": "F", + "adjustmentAmount": "0", + "restrictionTaxAmount": "0.00" + } + ] + }, + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "530dbd96-bada-4fcd-85d0-a829ba1347d7" + } + } + } + + res.status(200).send(response) +} + +module.exports.getLastDocumentList = async (req, res) => { + console.log('===== POST getLastDocumentList =====') + 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 response = { + "getLastDocumentListResponse": { + "return": { + "invoiceList": { + "size": "1", + "invoiceInfoArray": [ + { + "discountTaxAmount": "0.00", + "adjustmentNetAmount": "0.00", + "availableAdjustmentNetAmount": "0.00", + "invoiceBcBanId": "", + "dueDate": "", + "vatRate": "0.00", + "converageEndDate": "", + "discountAmount": "0.00", + "invoiceTaxAmount": "0.00", + "invoiceAmount": "0.00", + "invoiceStatusChangeDate": "", + "paymentAmount": "0", + "baNo": "", + "billTaxAmount": "0.00", + "billingDocumentType": { + "code": "BL", + "description": "Bill" + }, + "billAmount": "0.00", + "invoiceType": "", + "converageStartDate": "", + "currency": "THB", + "billSequenceNo": "", + "invoiceNo": "", + "originalBalanceAmount": "0.00", + "customerManagerBaNo": "", + "invoiceCreationDate": "", + "unpaidNetAmount": "0.00", + "availableAdjustmentAmount": "0.00", + "discountNetAmount": "0.00", + "billDate": "2021-07-30T00:00:00.000+07:00", + "disputeNetAmount": "0.00", + "creditTaxAmount": "0.00", + "accountId": "200112081", + "billProductType": "DR", + "billingDocumentStatus": { + "code": "C", + "description": "Calculated" + }, + "unpaidAmount": "0.00", + "restrictionAmount": "0.00", + "disputeTaxAmount": "0.00", + "invoiceCycle": { + "code": "", + "month": "", + "year": "" + }, + "convergenceInvoiceNo": "010720212800390921", + "coveredAmount": "0.00", + "invoiceId": "", + "performanceIndStatus": "CH", + "unpaidTaxAmount": "0", + "invoiceStatus": "", + "adjustmentAmount": "0", + "restrictionTaxAmount": "0.00" + } + ] + }, + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "56281a17-157d-4a4a-994d-c5e814b860e4" + } + } + } + + res.status(200).send(response) +} + +module.exports.getLastDocumentList = async (req, res) => { + console.log('===== POST getLastDocumentList =====') + 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 response = { + "getLastDocumentListResponse": { + "return": { + "invoiceList": { + "size": "1", + "invoiceInfoArray": [ + { + "discountTaxAmount": "0.00", + "adjustmentNetAmount": "0.00", + "availableAdjustmentNetAmount": "0.00", + "invoiceBcBanId": "", + "dueDate": "", + "vatRate": "0.00", + "converageEndDate": "", + "discountAmount": "0.00", + "invoiceTaxAmount": "0.00", + "invoiceAmount": "0.00", + "invoiceStatusChangeDate": "", + "paymentAmount": "0", + "baNo": "", + "billTaxAmount": "0.00", + "billingDocumentType": { + "code": "BL", + "description": "Bill" + }, + "billAmount": "0.00", + "invoiceType": "", + "converageStartDate": "", + "currency": "THB", + "billSequenceNo": "", + "invoiceNo": "", + "originalBalanceAmount": "0.00", + "customerManagerBaNo": "", + "invoiceCreationDate": "", + "unpaidNetAmount": "0.00", + "availableAdjustmentAmount": "0.00", + "discountNetAmount": "0.00", + "billDate": "2021-07-30T00:00:00.000+07:00", + "disputeNetAmount": "0.00", + "creditTaxAmount": "0.00", + "accountId": "200112081", + "billProductType": "DR", + "billingDocumentStatus": { + "code": "C", + "description": "Calculated" + }, + "unpaidAmount": "0.00", + "restrictionAmount": "0.00", + "disputeTaxAmount": "0.00", + "invoiceCycle": { + "code": "", + "month": "", + "year": "" + }, + "convergenceInvoiceNo": "010720212800390921", + "coveredAmount": "0.00", + "invoiceId": "", + "performanceIndStatus": "CH", + "unpaidTaxAmount": "0", + "invoiceStatus": "", + "adjustmentAmount": "0", + "restrictionTaxAmount": "0.00" + } + ] + }, + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "56281a17-157d-4a4a-994d-c5e814b860e4" + } + } + } + + res.status(200).send(response) +} + +module.exports.getCreditLimitInfo = async (req, res) => { + console.log('===== POST getCreditLimitInfo =====') + 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 response = { + "getCreditLimitInfoResponse": { + "return": { + "currentSpendingLimitList": { + "size": "0" + }, + "futureCreditLimitAtSubList": { + "size": "0" + }, + "currentCreditLimitAtSubList": { + "size": "0" + }, + "futureSpendingLimitList": { + "size": "0" + }, + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "da63fabc-cfe0-4233-a9fe-7dcf922ffb0f", + "creditLimitInfo": { + "accountId": "200112081", + "creditClass": "F", + "personalCreditLimit": "400", + "customerId": "334580", + "creditLimit": "400", + "defaultCreditLimit": "1", + "obligationFormula": "Formula 1", + "temporaryCreditLimit": "0" + } + } + } + } + + res.status(200).send(response) +} + +module.exports.getBillMediaInfo = async (req, res) => { + console.log('===== GET getBillMediaInfo =====') + 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 response = { + "getBillMediaInfoResponse": { + "return": { + "billMediaInfo": { + "billMediaCode": "S", + "billMediaDescription": "SMS", + "billMediaValue": "0911111111" + }, + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "a06924ed-f8b1-4778-97aa-cf3a0d47b094" + } + } + } + + res.status(200).send(response) +} + +module.exports.getProductHistoryList = async (req, res) => { + console.log('===== POST getProductHistoryList =====') + 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 response = { + "getProductHistoryListResponse": { + "return": { + "totalSize": "59", + "productHistoryList": { + "size": "2", + "subscriberStatusHistoryInfoArray": [ + { + "barringByRequestActivityDate": "2016-09-01T17:25:03.000+07:00", + "barringByRequestIndicator": "N", + "collectionStatus": { + "reasonDescription": "Default Request for restore from suspension from Reg CL", + "lastActivityDate": "2018-11-07T07:15:02.000+07:00", + "reasonCode": "DEFRS", + "status": "NONE" + }, + "linkPrevProductId": "", + "barringByRequestReasonCode": "DDSC", + "creditLimitAtSubStatus": { + "reasonDescription": "", + "lastActivityDate": "", + "reasonCode": "", + "status": "NONE" + }, + "subscriberId": "1111841", + "barringByRequestReasonDescription": "Delete Additional Offer", + "creditStatus": { + "reasonDescription": "Restore from Suspension request from Credit Limit Collection", + "lastActivityDate": "2017-07-30T12:23:44.000+07:00", + "reasonCode": "MONRS", + "status": "NONE" + }, + "linkNextProductId": "", + "effectiveDate": "2018-11-07T07:15:02.000+07:00", + "status": { + "statusDate": "2016-09-01T17:32:41.000+07:00", + "statusLastActivity": "16", + "statusDescription": "Active", + "statusReasonDescription": "Restore Subs - Found", + "statusReasonCode": "RSP5", + "lastActivityPathId": "78", + "statusCode": "A" + } + }, + { + "barringByRequestActivityDate": "2016-09-01T17:25:03.000+07:00", + "barringByRequestIndicator": "N", + "collectionStatus": { + "reasonDescription": "Default Request for restore from suspension from Reg CL", + "lastActivityDate": "2018-08-14T19:29:43.000+07:00", + "reasonCode": "DEFRS", + "status": "NONE" + }, + "linkPrevProductId": "", + "barringByRequestReasonCode": "DDSC", + "creditLimitAtSubStatus": { + "reasonDescription": "", + "lastActivityDate": "", + "reasonCode": "", + "status": "NONE" + }, + "subscriberId": "1111841", + "barringByRequestReasonDescription": "Delete Additional Offer", + "creditStatus": { + "reasonDescription": "Restore from Suspension request from Credit Limit Collection", + "lastActivityDate": "2017-07-30T12:23:44.000+07:00", + "reasonCode": "MONRS", + "status": "NONE" + }, + "linkNextProductId": "", + "effectiveDate": "2018-08-14T19:29:43.000+07:00", + "status": { + "statusDate": "2016-09-01T17:32:41.000+07:00", + "statusLastActivity": "16", + "statusDescription": "Active", + "statusReasonDescription": "Restore Subs - Found", + "statusReasonCode": "RSP5", + "lastActivityPathId": "78", + "statusCode": "A" + } + } + ] + }, + "calculatedPageSize": "2", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "84943fc3-00c2-424b-a432-23860fcc7ad3" + } + } + } + + res.status(200).send(response) +} + +module.exports.getPaymentList = async (req, res) => { + console.log('===== GET getPaymentList =====') + 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 response = { + "getPaymentListResponse": { + "return": { + "totalSize": "131", + "calculatedPageSize": "1", + "errorCode": "OSBbllngA00001", + "type": "ax28:PaymentListResponse", + "message": "Success.", + "uuid": "1271b6ef-54e6-472c-867f-36dad1a97781", + "paymentList": { + "size": "1", + "type": "ax211:PaymentList", + "paymentInfoArray": [ + { + "billSeqNo": "7645", + "activityIndicator": "P", + "originalConvertedAmount": "1000", + "authorizationId": "485021", + "defaultWhtAmount": "0", + "creditCardType": "", + "postingDate": "2016-07-11T00:00:00.000+07:00", + "paymentId": "163939558", + "ucWhtAmount": "", + "periodKey": "30", + "operatorId": "100", + "paymentSourceDesc": "True Money - Echannels", + "paymentSourceRTIndicator": "N", + "rcWhtRate": "", + "companyCode": "TI", + "rcWhtAmount": "", + "reversalTransId": "", + "rctExtractInd": "", + "transactionId": "1523941276", + "vatAmount": "65.42", + "convInvNumber": "", + "creditCardNumber": "", + "defaultWhtRate": "0", + "ocWhtAmount": "", + "paymentMethod": "CA", + "designation": { + "code": "", + "description": "" + }, + "paymentSubMethod": "CA", + "whtAmount": "0", + "accountTimestamp": "2017101207465982860", + "be": "0", + "whtRate": "0", + "creditAllocationList": { + "creditAllocationInfoArray": [ + { + "invoiceId": "359694883", + "invoiceNo": "6060812200372" + }, + { + "invoiceId": "359731321", + "invoiceNo": "6070812400386" + } + ], + "size": "2" + }, + "ocWhtRate": "", + "ucWhtRate": "", + "creditId": "175519470", + "creditCardExpDate": "122100", + "printRtIndicator": "Y", + "lastActStatusDate": "2016-09-27T00:00:00.000+07:00", + "checkNo": "", + "bankAccountNumber": "", + "currency": "THB", + "reasonCode": "", + "actualAmt": "1000", + "receiptTaxId": "ACEWL7452502", + "bankCode": "", + "partitionId": "7", + "paymentSourceId": "TMNO", + "valueDate": "2016-07-11T00:00:00.000+07:00", + "userId": "TM03", + "originalAccount": "203479997", + "paymentSourceType": "O", + "originalAmount": "1000", + "activityType": "", + "memoText": "", + "directDebitVoucher": "38193159" + } + ] + } + } + } + } + + res.status(200).send(response) +} + +module.exports.sumCollectionAmount = async (req, res) => { + console.log('===== POST sumCollectionAmount =====') + 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 response = ` + + + + 0 + Success + ea1ca9a9-fee1-47ce-8e7d-f1b45ee1cade + 0.0 + 0.0 + + + +` + + res.status(200).send(response) +} + +module.exports.getBillingAddress = async (req, res) => { + console.log('===== GET getBillingAddress =====') + 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 response = { + "getBillingInfoResponse": { + "return": { + "errorCode": "OSBbllngA00001", + "message": "Success.", + "uuid": "61ba9f6c-0b3c-4861-a82a-d252f0b23e63", + "billing": { + "billingArrangementInfo": { + "statusDate": "2019-03-27T00:00:00.000+07:00", + "consolidateBillInd": "Y", + "lastUpdateDate": "2019-03-27T10:15:45.000+07:00", + "businessEntityId": "0", + "externalId": "", + "bcBanID": "700046423", + "billingArrangementStatus": "O", + "itemizedTaxIndicator": "Y", + "billFormat": "S", + "splitParam": "", + "billProductionIndicator": "Y", + "billLang": "TH", + "bcEffectiveDate": "2019-03-27T10:15:43.000+07:00", + "openDate": "2019-03-27T00:00:00.000+07:00", + "billProductionFrequency": "1" + }, + "eTaxInfo": { + "notificationList": "", + "mobileNumberList": "", + "emailList": "", + "mediaValue": { + "code": "O", + "description": "Other" + } + }, + "address": { + "country": "", + "zipCode": "50200", + "roomNo": "-", + "city": "เชียงใหม่", + "addressType": "I", + "moo": "1", + "soi": "-", + "building": "UNI LOFT CHAINGMAI D", + "street": "-", + "district": "เมืองเชียงใหม่", + "addressLine1": "137 * 1 * - *", + "houseNo": "137", + "addressLine2": "* UNI LOFT CHAINGMAI D * - * - * -", + "timeAtAddress": "0101", + "addressLine3": "* สุเทพ * เมืองเชียงใหม่", + "addressLine4": "เชียงใหม่ 50200", + "floor": "-", + "subDistrict": "สุเทพ" + }, + "contact": { + "preferredContactNo": "", + "officePhone": "", + "homePhone": "0924971811", + "language": "", + "privatePhone": "", + "fax": "", + "email": "" + }, + "name": { + "branchCode": "", + "nameType": "I", + "firstName": "สัปปะรด", + "lastName": "ผลไม้", + "organizationName": "", + "branchName": "", + "middleName": "", + "storeId": "", + "tilte": "คุณ" + }, + "personal": { + "gender": "F", + "accommodation": "", + "maritalStatus": "" + } + } + } + } +} + + res.status(200).send(response) +} + +module.exports.getDCBStatus = async (req, res) => { + console.log('===== POST getDCBStatus =====') + 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 response = { + "code": 200, + "description": "Success", + "request_transaction_id": "CCBS_ON0023222046_14355965", + "mcs_transaction_id": "292a1e4176f440608c9cec23dfe01eb1", + "result": { + "subscriber_type": "POS", + "register_datetime": "2020-11-11T23:47:12", + "statuschange_datetime": "2020-11-11T23:47:12", + "cancel_datetime": null, + "msisdn": "66892143263", + "service_no": "66892143263", + "ref_type": "MSISDN", + "subscriber_id": "7766714", + "certificate_id": "3100201309134", + "company": "RM", + "status": "ACTIVE", + "cancel_reason": "", + "kyc": true, + "merchants": null + } + } + + res.status(200).send(response) +} + +module.exports.getBalanceList = async (req, res) => { + console.log('===== POST getBalanceList =====') + 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 response = { + "getBalanceListResponse": { + "return": { + "totalSize": "1", + "calculatedPageSize": "100", + "errorCode": "OSBbllngA00001", + "balanceList": { + "size": "1", + "balanceInfoArray": [ + { + "account": { + "minDueDateIndicator": "N", + "accountCollection": { + "status": "NONE" + }, + "classify": "R", + "maxDueDateIndicator": "N", + "accountSubType": { + "code": "RES", + "description": "Individual - Residential" + }, + "ben": { + "consolidateIndicator": "Y", + "billLanguage": "TH", + "ben": "200078606", + "bcBanId": "700046423", + "billMedia": "S", + "status": { + "code": "O", + "description": "Open" + } + }, + "comingDueDateIndicator": "N", + "ouId": "115614", + "delinquent": "", + "contact": { + "homePhone": "0924971811", + "language": "TH", + "preferredContactNo": "0909230076" + }, + "agreementId": "1344349", + "customerId": "187374", + "creditLimit": { + "creditClass": "X", + "creditLimitReasonCode": "CREQ", + "personalCreditLimit": "0", + "temporaryCreditLimit": "0", + "obligationCalculationFormula": "Formula 3" + }, + "company": { + "code": "TI", + "description": "True Internet Corporation Company Limited" + }, + "arBalance": "0", + "address": { + "zipCode": "50200", + "city": "เชียงใหม่", + "addressType": "I", + "district": "เมืองเชียงใหม่", + "addressLine1": "137 * 1 * - *", + "houseNo": "137", + "addressLine2": "* UNI LOFT CHAINGMAI D * - * - * -", + "addressLine3": "* สุเทพ * เมืองเชียงใหม่", + "addressLine4": "เชียงใหม่ 50200", + "subDistrict": "สุเทพ", + "sinceDate": "2019-03-27T00:00:00.000+07:00", + "building": "UNI LOFT CHAINGMAI D", + "floor": "-", + "moo": "1", + "roomNo": "-", + "soi": "-", + "street": "-" + }, + "creditStatus": { + "status": "NONE" + }, + "accountId": "200078606", + "statusDescription": "Active", + "collectionStatus": { + "lastActivityDate": "2021-12-30T00:00:00.000+07:00", + "status": "NONE" + }, + "withholdingTaxIndicator": "N", + "name": { + "nameType": "I", + "firstName": "สัปปะรด", + "lastName": "ผลไม้", + "title": "คุณ" + }, + "openDate": "2019-03-27T00:00:00.000+07:00", + "branchNo": "00000", + "convergenceCode": "4PPremium", + "taxId": "7175358721530", + "dcbAmount": "0.00", + "interestWaivingIndicator": "N", + "debtAge": "0" + }, + "customer": { + "creditLimitIndicator": "N", + "income": "0", + "creditClass": "X", + "timeInBusiness": "0101 ", + "occupation": "N", + "totalProduct": "3", + "birthDate": "1994-07-08T00:00:00.000+07:00", + "lastActivityReasonCode": "CREQ", + "customerType": { + "code": "I", + "description": "Individual" + }, + "lastActivityCode": "NEW_ACCOUNT", + "nationality": "THA", + "certificateNumber": "7175358721530", + "contactLanguage": "TH", + "largeCustomerIndicator": "N", + "billCycleInfo": { + "changeCycleRequestStatus": "N", + "billCycle": { + "code": "10", + "description": "Monthly Cycle close on the 9" + }, + "changeCycleIndicator": "N" + }, + "customerId": "187374", + "certificateExpirationDate": "2024-07-07T00:00:00.000+07:00", + "offerCurrency": "THB", + "effectiveDate": "2019-03-27T09:41:19.000+07:00", + "certificateType": "I", + "registerDate": "2019-03-27T00:00:00.000+07:00", + "customerGrading": "NON-TOP" + }, + "invoiceSummary": { + "interestFeeAmount": "0.00", + "collectionFeeAmount": "0.00", + "penaltyFeeAmount": "0.00", + "dcbPurchaseAmount": "0.00", + "overdueAmount": "0.00" + } + } + ] + }, + "message": "Success.", + "uuid": "5d51bb2f-af98-4007-82f8-04665052d886" + } + } +} + + res.status(200).send(response) +} \ No newline at end of file -- libgit2 0.21.2