diff --git a/app.js b/app.js index a4e74d3..daa9ff7 100644 --- a/app.js +++ b/app.js @@ -277,7 +277,7 @@ app.post('/api/shop-cdns/upload', (req, res) => { }); var multipart = require('connect-multiparty'); -const { sortedUniq, result, reject } = require('lodash'); +const { sortedUniq, result, reject, flatMap } = require('lodash'); var multipartMiddleware = multipart({ uploadDir: './img' }); app.post('/api/shop-cdns/upload2', multipartMiddleware, async (req, res) => { @@ -380,6 +380,7 @@ app.post('/v1/MVP/enq/getMobileOfferInventory/', require('./true').getMobileOffe app.post('/v1/get_AccountStatusHistoryList/', require('./true').getAccountStatusHistoryList); app.post('/MGContractInfo/MGContractInfo/getContractHistoryList', require('./true').getContractHistoryList); app.post('/v1/get_ProductInfo/', require('./true').getProductInfo); +app.post('/broadband/mb_service/crm_api.php', require('./true').getProfile); app.post('/api/v1/LG-API/notifySubscription', require('./lg').notifySubscription); @@ -437,6 +438,8 @@ app.post('/CCPGW_ServiceWeb/Services/QueryCDR', express.text({type:"*/*"}), requ app.get('/api/callback', require('./line').callback); +app.get('/v1/product/loyaltyProgramProdSpec/pointDetail.json', require('./point').getPointDetail); + app.post('/sendSMS', require('./sms').sendSMS); @@ -608,4 +611,28 @@ q.on('success', function (result, job) { app.listen(port, () => console.log('app listening on port ' + port + '!')) -//test \ No newline at end of file +//test + +test = () => { + z = 0 + j = 1 + k = 0 + while (!(j > 10)) { + z = z + 1 + k = 1 + while(!(k > 10)) { + k = k + 1 + z = z + 1 + } + j = j + 1 + } + let a = "ABCDab" + console.log(typeof a == 'string') + if(typeof a == 'string') { + console.log(a.toLowerCase()) + } + console.log(a) + console.log(z) +} + +test() \ No newline at end of file diff --git a/ccbs.js b/ccbs.js index 6ba9ad7..a12234a 100644 --- a/ccbs.js +++ b/ccbs.js @@ -88,7 +88,58 @@ module.exports.assetDetail = async (req, res) => { "installAddress": {} } - res.status(200).send(response) + let response2 = { + "outstandingBalance": 0, + "currentBillBalance": 0, + "dueDate": "", + "subStatus": { + "FullSusMsg": "", + "status": "Suspend", + "detail": [{ + "reason": "", + "since": "" + } + ] + }, + "assetRowId": "1-KSBE3U", + "serviceId": "9102000070", + "productLine": "True Online", + "startDate": "15/02/2017", + "assetLifetime": "4 years, 11 months, 12 days", + "preferredLanguage": "Thai-North (เหนือ)", + "productType": "DOCSIS", + "currentBillCycle": "", + "credit": { + "limit": 0, + "available": 0, + "defaultCredit": "", + "temporary": "", + "permanent": "", + "expiryDate": "", + "status": "", + "totalObligation": 0 + }, + "discount": { + "discountList": [], + "discountIndicator": "-" + }, + "contract": { + "contractIndicator": "-", + "list": [] + }, + "installAddress": { + "country": "Thailand", + "postalCode": "10400", + "province": "กรุงเทพมหานคร", + "street": "ถ.ดินแดง", + "house": "89", + "khet": "ดินแดง", + "khwang": "ดินแดง" + }, + "rvip": "" +} + + res.status(200).send(response2) } module.exports.churnScoreOfferList = async (req, res) => { diff --git a/int.js b/int.js index 8700909..f6f6aed 100644 --- a/int.js +++ b/int.js @@ -1210,14 +1210,14 @@ module.exports.getPayChannel = async (req, res) => { "creditCardNo": "", "recurringFrequencyValue": "", "bankBranchName": "", - "bankAccountNo": "", - "bankName": "", + "bankAccountNo": "493121123", + "bankName": "ABC", "creditCardType": "", "payChannelStatus": "O", "paymentType": "N", "customerId": "187374", "ddApprovalDate": "", - "bankCode": "", + "bankCode": "4931202119912309", "creditCardExpirationDate": "", "recurringAmount": "", "paymentCategory": "POST", @@ -1228,9 +1228,12 @@ module.exports.getPayChannel = async (req, res) => { "payChannelNo": "200078606", "bankBranchNo": "", "billingArrangementNo": "1", - "paymentMethod": "CA", + "paymentMethod": "DD", "openDate": "2019-03-27T00:00:00.000+07:00" }, + // payChannelInfo.BankAccountNo + // paymentMethod.BankCode = payChannelInfo.BankCode + // paymentMethod.BankName = payChannelInfo.BankName "message": "Success.", "uuid": "c8f2d372-1ba2-49d7-9c8a-830a44af9977" } diff --git a/intx.js b/intx.js index c67eb0f..786766c 100644 --- a/intx.js +++ b/intx.js @@ -2276,5 +2276,5 @@ module.exports.getAccountInfo = async (req, res) => { } - res.status(200).send(response1) + res.status(200).send(response) } \ No newline at end of file diff --git a/loadtest.js b/loadtest.js index 273a08c..e929dfb 100644 --- a/loadtest.js +++ b/loadtest.js @@ -53,22 +53,16 @@ function statusCallback(error, result, latency) { // }; const options = { - url: 'http://127.0.0.1:4000/point/v1/deleteCustomer', - maxRequests: 2, - requestsPerSecond: 2, + url: 'http://localhost:9011/api/v1/register/scanDevice/TpZ3EgSQ', + maxRequests: 1000, + requestsPerSecond: 100, headers : { "Content-Type":"application/json", - "x-app-id":"partnerId=30163; ptsAppKeyName=PICO|Browser|1.0.0", - "x-transaction-id":"SACF-300519siwkxkw7du", - "accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxLCJuYW1lIjoidGVzdG5hbWUiLCJsYXN0bmFtZSI6InRlc3RsYXNuYW1lIiwiZW1haWwiOiJ0ZXN0QGdtYWlsLmNvbSIsInVzZXJuYW1lIjoiQURtaW4xMjM0IiwiaWF0IjoxNTk3MTE4MjM5fQ.PbZphEffSy6nBPhDzFneE1LtMWy6YpRumo8sjacjAEs", - "X-Tid":"NI5smn3wWpoPX1ma2jbPiE8hK4QcDqHR1582013702233" - }, - method: "POST", - body : { - "enterpriseId": "ent0002", - "userIdType": "0", - "userIdData": "2020-P2-3000111@email_password" + "x-transaction-id":"NI5smn3wWpoPX1ma2jbPiE8hK4QcDqHR1582013702233", + "x-req-timestamp":"NI5smn3wWpoPX1ma2jbPiE8hK4QcDqHR1582013702233" }, + method: "GET", + body : null, contentType : "application/json", statusCallback: statusCallback }; diff --git a/point.js b/point.js new file mode 100644 index 0000000..5d27d8f --- /dev/null +++ b/point.js @@ -0,0 +1,14 @@ +module.exports.getPointDetail = async (req, res) => { + console.log('===== GET pointDetail =====') + console.log('url', req.originalUrl); + console.log('headers', req.headers); + console.log('query', req.query); + console.log('params', req.params); + + let response = `{"resultCode":"20000","resultDescription":"Success","resultData":null} +` + + res.set('content-type', 'application/json') + + res.send(response) +} \ No newline at end of file diff --git a/postpay_true.js b/postpay_true.js index d540e8b..004ab6b 100644 --- a/postpay_true.js +++ b/postpay_true.js @@ -1768,7 +1768,7 @@ module.exports.getLastInvoiceList = async (req, res) => { } } - res.status(200).send(response) + res.status(200).send(response1) } module.exports.getLastDocumentList = async (req, res) => { @@ -2353,94 +2353,94 @@ module.exports.getBalanceList = async (req, res) => { "errorCode": "OSBbllngA00001", "balanceList": { "size": "1", - "balanceInfoArray": [ - { + "balanceInfoArray": [{ "account": { - "minDueDateIndicator": "N", + "minDueDateIndicator": "Y", "accountCollection": { "status": "NONE" }, "classify": "R", - "maxDueDateIndicator": "N", + "maxDueDateIndicator": "Y", "accountSubType": { - "code": "RES", - "description": "Individual - Residential" + "code": "FIN", + "description": "RF-Individual" }, + "dueDate": "2021-11-05T00:00:00.000+07:00", "ben": { - "consolidateIndicator": "Y", + "consolidateIndicator": "N", "billLanguage": "TH", - "ben": "200078606", - "bcBanId": "700046423", - "billMedia": "S", + "ben": "200080855", + "bcBanId": "700040506", + "billMedia": "E", "status": { "code": "O", "description": "Open" } }, - "comingDueDateIndicator": "N", - "ouId": "115614", + "billStatement": { + "previousBalanceAmount": "6735.44", + "currentBillBalanceAmount": "6735.44", + "totalOverDueAmount": "961.93" + }, + "comingDueDateIndicator": "Y", + "ouId": "99199", "delinquent": "", "contact": { - "homePhone": "0924971811", - "language": "TH", - "preferredContactNo": "0909230076" + "email": "-", + "homePhone": "0939580049", + "language": "TH" }, - "agreementId": "1344349", - "customerId": "187374", + "agreementId": "1287101", + "customerId": "171436", "creditLimit": { - "creditClass": "X", - "creditLimitReasonCode": "CREQ", - "personalCreditLimit": "0", + "creditClass": "A", + "creditLimitReasonCode": "G111", + "personalCreditLimit": "1000", "temporaryCreditLimit": "0", - "obligationCalculationFormula": "Formula 3" + "obligationCalculationFormula": "Formula 1" }, "company": { - "code": "TI", - "description": "True Internet Corporation Company Limited" + "code": "RF", + "description": "True Move H Universal Communication Co., Ltd" }, - "arBalance": "0", + "arBalance": "6735.44", "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": "-" + "zipCode": "10700", + "city": "กรุงเทพมหานคร", + "addressType": "B", + "district": "บางพลัด", + "addressLine1": "77 - ", + "houseNo": "77", + "addressLine2": " - ถ.จรัญสนิทวงศ์", + "addressLine3": " บางอ้อ * บางพลัด", + "addressLine4": "กรุงเทพมหานคร 10700", + "subDistrict": "บางอ้อ", + "sinceDate": "2019-06-25T11:41:45.000+07:00", + "building": "-", + "moo": "-", + "street": "ถ.จรัญสนิทวงศ์" }, "creditStatus": { "status": "NONE" }, - "accountId": "200078606", + "accountId": "200080855", "statusDescription": "Active", "collectionStatus": { - "lastActivityDate": "2021-12-30T00:00:00.000+07:00", "status": "NONE" }, "withholdingTaxIndicator": "N", "name": { "nameType": "I", - "firstName": "สัปปะรด", - "lastName": "ผลไม้", + "firstName": "หมีช่า", + "lastName": "ชูก้า", "title": "คุณ" }, - "openDate": "2019-03-27T00:00:00.000+07:00", + "openDate": "2019-06-25T11:41:45.000+07:00", "branchNo": "00000", - "convergenceCode": "4PPremium", - "taxId": "7175358721530", + "taxId": "7041771944118", "dcbAmount": "0.00", "interestWaivingIndicator": "N", - "debtAge": "0" + "debtAge": "748" }, "customer": { "creditLimitIndicator": "N", @@ -2448,8 +2448,8 @@ module.exports.getBalanceList = async (req, res) => { "creditClass": "X", "timeInBusiness": "0101 ", "occupation": "N", - "totalProduct": "3", - "birthDate": "1994-07-08T00:00:00.000+07:00", + "totalProduct": "1", + "birthDate": "1996-11-16T00:00:00.000+07:00", "lastActivityReasonCode": "CREQ", "customerType": { "code": "I", @@ -2457,7 +2457,7 @@ module.exports.getBalanceList = async (req, res) => { }, "lastActivityCode": "NEW_ACCOUNT", "nationality": "THA", - "certificateNumber": "7175358721530", + "certificateNumber": "7041771944118", "contactLanguage": "TH", "largeCustomerIndicator": "N", "billCycleInfo": { @@ -2468,12 +2468,12 @@ module.exports.getBalanceList = async (req, res) => { }, "changeCycleIndicator": "N" }, - "customerId": "187374", - "certificateExpirationDate": "2024-07-07T00:00:00.000+07:00", + "customerId": "171436", + "certificateExpirationDate": "2020-11-07T00:00:00.000+07:00", "offerCurrency": "THB", - "effectiveDate": "2019-03-27T09:41:19.000+07:00", + "effectiveDate": "2019-06-25T11:41:45.000+07:00", "certificateType": "I", - "registerDate": "2019-03-27T00:00:00.000+07:00", + "registerDate": "2019-06-25T00:00:00.000+07:00", "customerGrading": "NON-TOP" }, "invoiceSummary": { @@ -2481,13 +2481,13 @@ module.exports.getBalanceList = async (req, res) => { "collectionFeeAmount": "0.00", "penaltyFeeAmount": "0.00", "dcbPurchaseAmount": "0.00", - "overdueAmount": "0.00" + "overdueAmount": "6735.44" } } ] }, "message": "Success.", - "uuid": "5d51bb2f-af98-4007-82f8-04665052d886" + "uuid": "eb97d941-58a7-4d9b-99ed-aba6b972e032" } } } diff --git a/sms.js b/sms.js index ec5ef81..5c29255 100644 --- a/sms.js +++ b/sms.js @@ -4,13 +4,15 @@ module.exports.sendSMS = async (req, res) => { console.log('headers', req.headers); console.log('query', req.query); console.log('params', req.params); + console.log('body', req.body); - let response = ` - OK - SUCCESS - 1502000283578 - ` + // let response = ` + // OK + // SUCCESS + // 1502000283578 + // ` + let response = `{"resultCode":"20000","developerMessage":"success","SMID":"2000020227"}` let responseErr = ` ERR @@ -18,5 +20,7 @@ module.exports.sendSMS = async (req, res) => { ` - res.send(response) + res.set('Content-type', 'text/plain') + + // res.status(200).send(response) } \ No newline at end of file diff --git a/true.js b/true.js index a2d95db..724ffc7 100644 --- a/true.js +++ b/true.js @@ -376,8 +376,73 @@ module.exports.getContractHistoryList = async (req, res) => { } } } + + let response1 = { + "getContractHistoryListResponse": { + "return": { + "uuid": "7b62ffd5-94b8-46ef-8872-2f47485c3243", + "errorCode": "OSBbllngA00001", + "message": "Success.", + "totalSize": "2", + "contractList": { + "contractInfoArray": [ + { + "contractStartDate": "2020-06-19T00:00:00.000+07:00", + "fee": "0", + "contractNumber": "-", + "remark": "-", + "generateChargeYesNo": "N", + "terminationDate": "", + "offerServiceLevel": "C", + "contractExpirationDate": "2021-06-19T18:37:28.000+07:00", + "offerInstanceId": "1079488", + "offerCode": "1080359", + "proposition": { + "code": "CVG000000000027", + "description": "True Smart Choice (Premium)" + }, + "contractGroupCode": "CT_CVG", + "contractGroupDescriptionThai": "แคมเปญบริการทรูมูฟเอชแบบรายเดือนพร้อมบริการร่วมทรูออนไลน์/ทรูวิชั่นส์", + "contractGroupDescriptionEng": "Special Campaign for TrueMove H Postpay service with True Online/True Visions", + "term": "12", + "effectiveDate": "2020-06-19T18:37:33.000+07:00", + "agreementSocSequence": "1079488", + "parentSocSequence": null, + "socType": "U" + }, + { + "contractStartDate": "2020-06-12T00:00:00.000+07:00", + "fee": "0", + "contractNumber": "-", + "remark": "-", + "generateChargeYesNo": "N", + "terminationDate": "", + "offerServiceLevel": "C", + "contractExpirationDate": "2099-01-01T00:00:00.000+07:00", + "offerInstanceId": "1074179", + "offerCode": "11929712", + "proposition": { + "code": "CVG000000000038", + "description": "True Smart Choice (4PLite-FreeSim)" + }, + "contractGroupCode": "CT_CVG", + "contractGroupDescriptionThai": "แคมเปญบริการทรูมูฟเอชแบบรายเดือนพร้อมบริการร่วมทรูออนไลน์/ทรูวิชั่นส์", + "contractGroupDescriptionEng": "Special Campaign for TrueMove H Postpay service with True Online/True Visions", + "term": "0", + "effectiveDate": "2020-06-12T12:18:55.000+07:00", + "agreementSocSequence": "1074179", + "parentSocSequence": null, + "socType": "U" + } + ], + "size": "2" + }, + "calculatedPageSize": "100" + } + } + } - res.status(200).send(response) + res.status(200).send(response1) } module.exports.getProductInfo = async (req, res) => { @@ -540,4 +605,45 @@ module.exports.getProductInfo = async (req, res) => { res.status(200).send(response) +} + +module.exports.getProfile = async (req, res) => { + console.log('===== POST getProfile =====') + 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 response = { + "Resultcode": "0", + "Description": "SUCCESS", + "Customer_Detail": { + "Cusid": "44718311", + "Login": "9605000001", + "Assetnum": "9605000001", + "Domain": "fiberhome", + "Status": "active", + "Ban": "11026322", + "Package_Name": "Fiber to the Home 100M/10M adv. payment 6 Mo (Q22015)", + "Priceplan_Name": "Fiber to the Home 100M/10M adv. payment 6 Mo (Q22015)", + "Priceplan_Speed": "100M/10M", + "Code_Name": "PMSFT29-100", + "Shuffle_Speed": "", + "Vas_Speed": "", + "Radius_Speed": "", + "Credit_Remain": "Unlimited", + "Create_Date": "2016-03-08 15:41:25", + "Lastaccess_Date": "2016-03-08 15:41:25", + "Expire_Date": "", + "Remove_Date": "", + "BBCaller_ID": "", + "Authen_By": "BB_CallerID", + "Max_Download": "Max speed not found", + "Max_Upload": "Max speed not found" + }, + "Description_th": "" + } + + res.status(200).send(response) } \ No newline at end of file -- libgit2 0.21.2