From e45082dc3e4315138d9142ab59755c8d8833b540 Mon Sep 17 00:00:00 2001 From: Nattapon Wongpaet Date: Tue, 8 Sep 2020 09:58:41 +0700 Subject: [PATCH] update mockup --- admd.js | 45 ++++++++++++++++++++++++++++++++++----------- app.js | 35 ++++++++++++++++++++++++++--------- app2.js | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ apple.js | 8 ++++---- d01.js | 2 +- loadtest.js | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ micro_point.js | 18 ++++++++++++++++++ nafa.js | 4 ++-- package-lock.json | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + privilege.js | 15 +++++++++++++++ random.js | 1 + ssb.js | 8 ++++---- 13 files changed, 465 insertions(+), 31 deletions(-) create mode 100644 app2.js create mode 100644 loadtest.js create mode 100644 micro_point.js create mode 100644 privilege.js create mode 100644 random.js diff --git a/admd.js b/admd.js index d476a5f..eb5db51 100644 --- a/admd.js +++ b/admd.js @@ -26,20 +26,20 @@ module.exports.oauthToken = async (req, res) => { response = {error : 'invalid_grant'} } else { - // response = { - // "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzcmYuYWlzLmNvLnRoL3NjZiIsInN1YiI6InRva2VuX2F1dGhlbnRpY2F0aW9uX2NvZGUiLCJhdWQiOiJMdGFOa1d2K0MvcnMzbk8vVis3RFhLUkRmRk9wRkJNeUVrY0ROSXA5Z0ovdWhNK0RBenVoUlE9PSIsImV4cCI6MTU5MDgzMzM1MiwiaWF0IjoxNTkwNzQ2OTUyLCJqdGkiOiIxRnVaSTdvbW5jZDlrTTE2Vm9FQkJyIiwicGlkIjoiWHUwb082bWRJYkowcE43QWp1dEtNNUFpK3Y4ckliTTF1YVFIWjRwNzkwTT0iLCJjbGllbnQiOiJNekF4Tnprc1FWSldVbEJNUVZSR1QxSk5mRUp5YjNkelpYSjhNUzR3TGpBPSIsInNzaWQiOiI3NDdHU1M1Rk1rSnFjVTQ1S1VpTXd4IiwidWlkIjoiNjYxNTcwMDEyMDE2NjA3IiwiYXV0Ijp7InR5cGUiOiJlbWFpbF9wYXNzd29yZCIsImFjdGlvbiI6ImxvZ2luIn0sImlhbCI6IjEuMSJ9.6U4gC1geC-gp_CiTrQ9Ti470Fn8VbWENI94Oh-ZAOJw", - // "token_type": "bearer", - // "expires_in": 86400, - // "refresh_token": "N3ZGS2o5TjhSRkFsbGZWWVdFdzUxNTkwNzQ2OTUx747GSS5FMkJqcU45KUiMws", - // "id_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InVreE8xSDFmQXkifQ.eyJpc3MiOiJzcmYuYWlzLmNvLnRoL3NjZiIsInN1YiI6ImlkVG9rZW4iLCJhdWQiOiJMdGFOa1d2K0MvcnMzbk8vVis3RFhLUkRmRk9wRkJNeUVrY0ROSXA5Z0ovdWhNK0RBenVoUlE9PSIsImV4cCI6MTU5MDgzMzM1MSwiaWF0IjoxNTkwNzQ2OTUxLCJqdGkiOiJlenBuWGF2Nm55cTVGZGZ2TFJlaW9qIiwiYXV0Ijp7InR5cGUiOiJlbWFpbF9wYXNzd29yZCIsImFjdGlvbiI6ImxvZ2luIn0sIm5vbmNlIjoiU1JGUC0yMDA1MjlFS081OFBnMDRWQiIsImluZm8iOnsiZmlyc3RuYW1lIjoidGVzdGJyb2tlciIsImxhc3RuYW1lIjoidGVzdGJyb2tlciIsInVzZXJuYW1lIjoidGVzdGJyb2tlckBnbWFpbC5jb20iLCJhY2NvdW50Q2F0ZWdvcnkiOiJyZXNpZGVudGlhbCJ9fQ.gFOf3_vuE_K4KEDZLYoXqma6pL6B_HdA0SWpaErvI-s1ng3rH6PXtEy8-7H5c2W9Co10kWEXcXuMXBHTFqRLu9WBNU1v2MGV90wBJ5ujAW_YdaY1H5D0HMthQVPEt6Bda2gHk_TVqol-YQRBbRNNhNQaxb5PSpZxv9dTJ7B4zzM", - // "refresh_token_expires_in": 86400 - // } - response = { - resultCode: "50103", - resultDescription: 'admd something error' + "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzcmYuYWlzLmNvLnRoL3NjZiIsInN1YiI6InRva2VuX2F1dGhlbnRpY2F0aW9uX2NvZGUiLCJhdWQiOiJMdGFOa1d2K0MvcnMzbk8vVis3RFhLUkRmRk9wRkJNeUVrY0ROSXA5Z0ovdWhNK0RBenVoUlE9PSIsImV4cCI6MTU5MDgzMzM1MiwiaWF0IjoxNTkwNzQ2OTUyLCJqdGkiOiIxRnVaSTdvbW5jZDlrTTE2Vm9FQkJyIiwicGlkIjoiWHUwb082bWRJYkowcE43QWp1dEtNNUFpK3Y4ckliTTF1YVFIWjRwNzkwTT0iLCJjbGllbnQiOiJNekF4Tnprc1FWSldVbEJNUVZSR1QxSk5mRUp5YjNkelpYSjhNUzR3TGpBPSIsInNzaWQiOiI3NDdHU1M1Rk1rSnFjVTQ1S1VpTXd4IiwidWlkIjoiNjYxNTcwMDEyMDE2NjA3IiwiYXV0Ijp7InR5cGUiOiJlbWFpbF9wYXNzd29yZCIsImFjdGlvbiI6ImxvZ2luIn0sImlhbCI6IjEuMSJ9.6U4gC1geC-gp_CiTrQ9Ti470Fn8VbWENI94Oh-ZAOJw", + "token_type": "bearer", + "expires_in": 86400, + "refresh_token": "N3ZGS2o5TjhSRkFsbGZWWVdFdzUxNTkwNzQ2OTUx747GSS5FMkJqcU45KUiMws", + "id_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InVreE8xSDFmQXkifQ.eyJpc3MiOiJzcmYuYWlzLmNvLnRoL3NjZiIsInN1YiI6ImlkVG9rZW4iLCJhdWQiOiJMdGFOa1d2K0MvcnMzbk8vVis3RFhLUkRmRk9wRkJNeUVrY0ROSXA5Z0ovdWhNK0RBenVoUlE9PSIsImV4cCI6MTU5MDgzMzM1MSwiaWF0IjoxNTkwNzQ2OTUxLCJqdGkiOiJlenBuWGF2Nm55cTVGZGZ2TFJlaW9qIiwiYXV0Ijp7InR5cGUiOiJlbWFpbF9wYXNzd29yZCIsImFjdGlvbiI6ImxvZ2luIn0sIm5vbmNlIjoiU1JGUC0yMDA1MjlFS081OFBnMDRWQiIsImluZm8iOnsiZmlyc3RuYW1lIjoidGVzdGJyb2tlciIsImxhc3RuYW1lIjoidGVzdGJyb2tlciIsInVzZXJuYW1lIjoidGVzdGJyb2tlckBnbWFpbC5jb20iLCJhY2NvdW50Q2F0ZWdvcnkiOiJyZXNpZGVudGlhbCJ9fQ.gFOf3_vuE_K4KEDZLYoXqma6pL6B_HdA0SWpaErvI-s1ng3rH6PXtEy8-7H5c2W9Co10kWEXcXuMXBHTFqRLu9WBNU1v2MGV90wBJ5ujAW_YdaY1H5D0HMthQVPEt6Bda2gHk_TVqol-YQRBbRNNhNQaxb5PSpZxv9dTJ7B4zzM", + "refresh_token_expires_in": 86400 } + // response = { + // resultCode: "50103", + // resultDescription: 'admd something error' + // } + // response = {error : 'invalid_grant'} } @@ -58,4 +58,27 @@ module.exports.logout = async (req, res) => { let response = {"state":"logout"} res.send(response) +} + +module.exports.validateToken = async (req, res) => { + console.log('===== POST validateToken =====') + 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 = {"resultCode":"20000","developerMessage":"success"} + // let response = { + // "resultCode": "40401", + // "developerMessage": "data_not_found", + // "stackTrace": [{ + // "node": "kms", + // "ret": "0", + // "resultCode": "40101", + // "developerMessage": "Access denied" + // }] + // } + + res.send(response) } \ No newline at end of file diff --git a/app.js b/app.js index 554a212..1ef1f28 100644 --- a/app.js +++ b/app.js @@ -384,18 +384,35 @@ app.delete('/api/v1/address_type', require('./d01').deleteAddressType); app.post('/auth/v3.1/oauth/token', require('./admd').oauthToken); app.post('/auth/v3.1/logout', require('./admd').logout); +app.post('/validate/token', require('./admd').validateToken); + +app.post('/point/v1/deleteCustomer', require('./micro_point').deleteCustomer); +app.post('/privilege/v1/history/delete', require('./privilege').deleteCustomer); app.post('/v1/MVP/enq/getMobileOfferInventory/', require('./true').getMobileOfferInventory); -app.post('/api/v1/mpay/billingonbehalf/partialRefundVolume.json', function (req, res) { - // res.send({ - // // refundVolumeV2Response : { - // result: "SUCCESS", - // resultDescription: "60713000154960518477", - // endUserIdentifier: "66873381009", - // networkType: "prepaid" - // // } - // }) + app.get('/api/random/leader', function (req, res) { + const months = ["เกมส์", "โน๊ต setup", "โน๊ต วัศรุต", "แบงค์", "มอส", "ปิ๊ค", "เต้นพอไม่ต้องตื่น", "เปา", "นัท", "kik", "new", "ann","na", "boky", "eve", "miki", "pla", "sugar"]; + // const months = [ "ann"]; + + + let object={} + for(var i=0; i<100; i++) { + const random = Math.floor(Math.random() * months.length); + // console.log(random, months[random]); + if(object[months[random]]) { + object[months[random]] = object[months[random]] + 1; + } else { + object[months[random]] = 1 + } + } + + + console.log(object); + + res.send(object); }) + + app.listen(port, () => console.log('app listening on port ' + port + '!')) \ No newline at end of file diff --git a/app2.js b/app2.js new file mode 100644 index 0000000..ce7c6d6 --- /dev/null +++ b/app2.js @@ -0,0 +1,104 @@ +const express = require('express') +const app = express() + +app.post('/api/v2/aaf/eligibleService.json', function (req, res) { + res.send({ + resultCode:"20000", + developerMessage:"Success" + }) + }) + // app.post('/api/v2/aaf/eligibleService.json', function (req, res) { + // res.send({ + // resultCode: "40401", + // developerMessage: "Data Not Found", + // } + // ) + // }) + + app.post('/api/v1/mpay/billingonbehalf/reserveAndChargeVolume.json', function (req, res) { + res.send({ + "resultCode": "20000", + "resultDescription": "Success", + "resultData": [ + ] + } + ) + }) + + app.post('/api/v1/phx-inventory/jboss/inquiryCashStock', function (req, res) { + res.send({ + "resultCode": "20000", + "resultDescription": "Success", + "resultData": [ + ] + } + ) + }) + + app.get('/api/v1/phx-inventory/jboss/inquiryCashStock', function (req, res) { + res.send({ + "resultCode": "20000", + "resultDescription": "Success", + "resultData": [ + ] + }) + }) + + // app.post('/api/v1/mpay/billingonbehalf/reserveAndChargeVolume.json', function (req, res) { + // res.send({ + // resultCode : "40400", + // developerMessage : "Url not found", + // userMessage:null, + // moreInfo: "http://smaf.pantry.ais/errors/12345", + // refundVolumeV2Response : { + // result:null, + // resultDescription:null, + // endUserIdentify:null, + // networkType:null + // } + // }) + // }) + + // app.post('/api/v1/mpay/billingonbehalf/reserveAndChargeVolume.json', function (req, res) { + // res.send({ + // developerMessage : null, + // userMessage: null, + // resultCode : null, + // moreInfo: null, + // reserveAndChargeVolumeResponse : { + // result: "SVC1300", + // resultDescription: "UNKNOW_MSISDN", + // endUserIdentifier: "66873381009", + // networkType: null + // } + // } + // ) + // }) + + app.post('/api/v3/outRedirect/', function (req, res) { + res.send({ + ret_code: "SUCCESS", + ret_msg: "SUCCESS" + }) + }) + // app.post('/api/v3/outRedirect/', function (req, res) { + // res.send({ + // sub_msg: "40401", + // sub_code: "APP_ID_NOT_EXIST", + // ret_msg: "APP 信息检查失败", + // ret_code: "FAIL" + // }) + // }) + + app.post('/api/v1/mpay/billingonbehalf/partialRefundVolume.json', function (req, res) { + res.send({ + // refundVolumeV2Response : { + result: "SUCCESS", + resultDescription: "60713000154960518477", + endUserIdentifier: "66873381009", + networkType: "prepaid" + // } + }) + }) + +app.listen(3002); \ No newline at end of file diff --git a/apple.js b/apple.js index e68e524..eea5ab6 100644 --- a/apple.js +++ b/apple.js @@ -33,7 +33,7 @@ module.exports.verifyReceipt = async (req, res) => { "expires_date_ms":"1594702522000", "purchase_date_ms":"1594702222000", "is_upgraded":null, - "product_id":"NG_PLAY_PREMIUM_APPLE_TV_Corp_99Months", + "product_id":"AllEnglishMonthly", "purchase_date":"2020-07-14 04:50:22 Etc/GMT", "web_order_line_item_id":"1000000054018869" },{ @@ -57,7 +57,7 @@ module.exports.verifyReceipt = async (req, res) => { "expires_date_ms":"1594702522000", "purchase_date_ms":"1594702222000", "is_upgraded":null, - "product_id":"NG_PLAY_PREMIUM_APPLE_TV_Corp_99Months", + "product_id":"AllEnglishMonthly", "purchase_date":"2020-07-14 04:50:22 Etc/GMT", "web_order_line_item_id":"1000000054018869" },{ @@ -81,7 +81,7 @@ module.exports.verifyReceipt = async (req, res) => { "expires_date_ms":"1594702522000", "purchase_date_ms":"1594702222000", "is_upgraded":null, - "product_id":"NG_PLAY_PREMIUM_APPLE_TV_Corp_99Months", + "product_id":"AllEnglishMonthly", "purchase_date":"2020-07-14 04:50:22 Etc/GMT", "web_order_line_item_id":"1000000054018869" },{ @@ -105,7 +105,7 @@ module.exports.verifyReceipt = async (req, res) => { "expires_date_ms":"1594702522000", "purchase_date_ms":"1594702222000", "is_upgraded":null, - "product_id":"NG_PLAY_PREMIUM_APPLE_TV_Corp_99Months", + "product_id":"AllEnglishMonthly", "purchase_date":"2020-07-14 04:50:22 Etc/GMT", "web_order_line_item_id":"1000000054018869" } diff --git a/d01.js b/d01.js index e020c51..bef46ad 100644 --- a/d01.js +++ b/d01.js @@ -37,7 +37,7 @@ module.exports.getCustomer = async (req, res) => { let response = { "resultCode": "20000", "resultDescription": "Success", - "resultData": null + "resultData": data } res.send(response) diff --git a/loadtest.js b/loadtest.js new file mode 100644 index 0000000..02b17d0 --- /dev/null +++ b/loadtest.js @@ -0,0 +1,61 @@ +const loadtest = require('loadtest'); + +function statusCallback(error, result, latency) { + console.log('Current latency %j, result %j, error %j', latency, result, error); + console.log('----'); + if(result) { + console.log('Request elapsed milliseconds: ', result.requestElapsed); + console.log('Request index: ', result.requestIndex); + console.log('Request loadtest() instance index: ', result.instanceIndex); + } +} + +const options = { + url: 'http://127.0.0.1:5001/api/v3/mpay/billingonbehalf/reserveAndChargeVolume.json', + maxRequests: 10000, + requestsPerSecond: 100, + headers : { + "Content-Type":"application/json", + "x-app":"partnerId=30163; ptsAppKeyName=PICO|Browser|1.0.0", + "x-tid":"SACF-300519siwkxkw7du", + "X-Public-Id":"sgltest7@corp.ais900dev.org", + "X-Private-Id":"NI5smn3wWpoPX1ma2jbPiE8hK4QcDqHR1582013702233" + }, + method: "POST", + body : { + "endUserIdentifier":"66932019877", + "volume":"0", + "out_trade_no":"nw424bc0bb690c73518a762a2d1a339d7f_COINS12000_20190219095515", + "subject":"Purchased 12000 coins.", + "pay_time":"2020-03-24 20:20:20", + "device_id":"90c73518a762a2d1a339d7f", + "buyer_pay_fee":"Paid by user", + "coupon_fee":"20", + "terminal_type":"IOS", + "billingText":"test", + "parameters":{ + "amount":"0", + "serviceNumber":"35000900022", + "serviceType":"Download", + "transactionID":"50609152601999918991", + "currency":"THB", + "taxDev":"0", + "productCode":"Purchased 12000 coins that can be spent on weapons.", + "productInfo":"COINS12000", + "merchantContact":"MerchantContactTest", + "cct":"0", + "expireDate":"20200523142045", + "senderName":"Huawei" + } + }, + contentType : "application/json", + statusCallback: statusCallback +}; + +loadtest.loadTest(options, function(error) { + if (error) { + return console.error('Got an error: %s', error); + } + console.log('Tests run successfully'); +}); + diff --git a/micro_point.js b/micro_point.js new file mode 100644 index 0000000..301f96e --- /dev/null +++ b/micro_point.js @@ -0,0 +1,18 @@ +module.exports.deleteCustomer = async (req, res) => { + console.log('===== POST deleleMicroCustomer =====') + 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 = { + resultCode: "50000", + resultDescription: "Success", + matchedDN: "", + diagnosticMessage: "", + rowCount: "1" + } + + // res.status(200).send(response) +} diff --git a/nafa.js b/nafa.js index 20970a3..1f08813 100644 --- a/nafa.js +++ b/nafa.js @@ -11,7 +11,7 @@ module.exports.packagePayment = async (req, res) => { "resultMessage": "Success", "data": { "statusCode": "003", - "statusDescription": "Purchase package success" + "statusDescription": "This mobile number already redeem this free package." } } @@ -37,5 +37,5 @@ module.exports.cancelPackage = async (req, res) => { } - // res.status(200).send(response) + res.status(200).send(response) } diff --git a/package-lock.json b/package-lock.json index 6bbdbb1..f218f78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,19 @@ "xpath.js": "~1.1.0" } }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "agentkeepalive": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-2.2.0.tgz", + "integrity": "sha1-xdG9SxKQCPEWPyNvhuX66iAm4u8=" + }, "ajv": { "version": "6.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", @@ -1193,6 +1206,15 @@ "delayed-stream": "~1.0.0" } }, + "confinode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/confinode/-/confinode-2.1.1.tgz", + "integrity": "sha512-u5u0ZHpYMnVWtelxjalNtLvL+SdP7B/7s0JTFUIkyvqqIf67DAvy6SKaE6WZiwbufLPk+6zJKsh5SdpbtbFi9g==", + "requires": { + "quick-lru": "^5.0.0", + "yaml": "^1.7.2" + } + }, "connect-multiparty": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/connect-multiparty/-/connect-multiparty-2.2.0.tgz", @@ -1249,6 +1271,15 @@ "vary": "^1" } }, + "d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -1332,6 +1363,48 @@ "resolved": "https://registry.npmjs.org/envconf/-/envconf-0.0.4.tgz", "integrity": "sha1-hWda+6I3xD+Y3i1GrcDlMqTc9Is=" }, + "es5-ext": { + "version": "0.10.53", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz", + "integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==", + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.3", + "next-tick": "~1.0.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "requires": { + "es6-promise": "^4.0.3" + } + }, + "es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -1379,6 +1452,21 @@ "vary": "~1.1.2" } }, + "ext": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", + "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==", + "requires": { + "type": "^2.0.0" + }, + "dependencies": { + "type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/type/-/type-2.1.0.tgz", + "integrity": "sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA==" + } + } + }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -1504,6 +1592,30 @@ "sshpk": "^1.7.0" } }, + "https-proxy-agent": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -1620,11 +1732,30 @@ "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.1.tgz", "integrity": "sha512-l3hLhffs9zqoDe8zjmb/mAN4B8VT3L56EUvKNqLFVs9YlFA+zx7ke1DO8STAdDyYNkeSo1nKmjuvQeI12So8Xw==" }, + "loadtest": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/loadtest/-/loadtest-5.0.4.tgz", + "integrity": "sha512-aurXBsrQ39SGmt+V4uMf96ijrKN/hXJkFuGThWAUvDwr1tva5rhBdro5FYzzBWjJRXoM6zcuvVcVCCrVu1UzfA==", + "requires": { + "agentkeepalive": "^2.0.3", + "confinode": "^2.1.1", + "https-proxy-agent": "^2.2.1", + "log": "1.4.*", + "stdio": "^0.2.3", + "testing": "^1.1.1", + "websocket": "^1.0.28" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, + "log": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/log/-/log-1.4.0.tgz", + "integrity": "sha1-S6HYkP3iSbAx3KA7w36q8yVlbxw=" + }, "md5.js": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", @@ -1806,11 +1937,21 @@ "repl.history": "^0.1.4" } }, + "nan": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", + "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==" + }, "negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" + }, "node-json-config": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/node-json-config/-/node-json-config-0.0.5.tgz", @@ -1883,6 +2024,11 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" + }, "random-bytes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", @@ -2087,11 +2233,24 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, + "stdio": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/stdio/-/stdio-0.2.7.tgz", + "integrity": "sha1-ocV9oQ/hz6oMO/aDydB0PRtmCDk=" + }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" }, + "testing": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/testing/-/testing-1.1.2.tgz", + "integrity": "sha512-+wHrDL29KsI3NQtgGmgdZ/MaUZhnVePbt5ZfiMn6ntDpv/kMWfdiBrg/lJqntor9H8+zQYxvfPLVowPPs1nVEg==", + "requires": { + "log": "1.4.0" + } + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -2129,6 +2288,11 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, + "type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -2138,6 +2302,14 @@ "mime-types": "~2.1.24" } }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, "uid-safe": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", @@ -2257,6 +2429,18 @@ "extsprintf": "^1.2.0" } }, + "websocket": { + "version": "1.0.31", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.31.tgz", + "integrity": "sha512-VAouplvGKPiKFDTeCCO65vYHsyay8DqoBSlzIO3fayrfOgU94lQN5a1uWVnFrMLceTJw/+fQXR5PGbUVRaHshQ==", + "requires": { + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "nan": "^2.14.0", + "typedarray-to-buffer": "^3.1.5", + "yaeti": "^0.0.6" + } + }, "wns": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/wns/-/wns-0.5.4.tgz", @@ -2292,6 +2476,16 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", "integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + }, + "yaml": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz", + "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==" } } } diff --git a/package.json b/package.json index d5ffbcb..07c555a 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "express": "^4.17.1", "http": "0.0.0", "jstoxml": "^1.6.5", + "loadtest": "^5.0.4", "lodash": "^4.17.15", "mongodb": "^3.5.8", "mongoose": "^5.9.18", diff --git a/privilege.js b/privilege.js new file mode 100644 index 0000000..742d248 --- /dev/null +++ b/privilege.js @@ -0,0 +1,15 @@ +module.exports.deleteCustomer = async (req, res) => { + console.log('===== POST delelePrivilegeCustomer =====') + 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 = { + resultCode: "20000", + resultDescription: "Success" + } + + res.status(200).send(response) +} diff --git a/random.js b/random.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/random.js @@ -0,0 +1 @@ + diff --git a/ssb.js b/ssb.js index a49a395..e20fe74 100644 --- a/ssb.js +++ b/ssb.js @@ -106,7 +106,7 @@ module.exports.queryCurrentPackage = async (req, res) => { "promotionName": "M NBA Free Trial 1M 199Baht Monthly", "packageNameEN":"xxxxxxxxx", "packageNameTH":"xxxxxxxxx", - "promotionCode": "7400110", + "promotionCode": "P2007229612", "startDate": "2018-05-31 14:23:03", "endDate": "2018-05-31 14:23:03", "integrationName":"INS_3G 1000B 60Days Net 4Mbps SWifi UL1", @@ -151,12 +151,12 @@ module.exports.deletePackage = async (req, res) => { console.log('body', req.body); let response = { - "resultCode": "50000", - "developerMessage": "System error", + "resultCode": "SSBPKG-009010202", + "developerMessage": "TUXEDO Error", "ussdMessage": "Please wait for confirmation SMS shortly.", "responseMessage": "Thank you, your package has been deleted." } - res.status(200).send(response) + res.status(500).send(response) } -- libgit2 0.21.2