diff --git a/app.js b/app.js index daa9ff7..0ac2dd4 100644 --- a/app.js +++ b/app.js @@ -442,7 +442,10 @@ app.get('/v1/product/loyaltyProgramProdSpec/pointDetail.json', require('./point' app.post('/sendSMS', require('./sms').sendSMS); +app.post('/api/v1/cst/wallets/checkWallet', require('./bot_gateway').checkWallet); +app.get('/api/v2/Account/:accountId/Destinations', require('./magellan').getAccountDestination); +app.get('/api/v2/Account/:accountId/Things', require('./magellan').getAccountThings); app.get('/api/random/leader', function (req, res) { const months = ["เกมส์", "โน๊ต setup", "โน๊ต วัศรุต", "แบงค์", "มอส", "ปิ๊ค", "เต้นพอไม่ต้องตื่น", "เปา", "นัท", "kik", "new", "ann","na", "boky", "eve", "miki", "pla", "sugar"]; diff --git a/bot_gateway.js b/bot_gateway.js new file mode 100644 index 0000000..2326a72 --- /dev/null +++ b/bot_gateway.js @@ -0,0 +1,32 @@ +module.exports.checkWallet = async (req, res) => { + console.log('===== POST checkWallet =====') + 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 = ` + // OK + // SUCCESS + // 1502000283578 + // ` + + let response = { + "resultCode": 20000, + "resultDescription": "Success", + "data": { + "amount": "15.23", + "address": "dtfghvqi3h4tw87g8u9iq2", + "chain": "BSC", + "token": "USDT" + } + } + + let responseErr = { + "resultCode": 40401, + "resultDescription": "Data not found" + } + + res.status(200).send(response) +} \ No newline at end of file diff --git a/loadtest.js b/loadtest.js index e929dfb..0ec9cf9 100644 --- a/loadtest.js +++ b/loadtest.js @@ -53,9 +53,9 @@ function statusCallback(error, result, latency) { // }; const options = { - url: 'http://localhost:9011/api/v1/register/scanDevice/TpZ3EgSQ', + url: 'http://10.1.2.136:9201/api/v1/register/scanDevice/TpZ3EgSQ', maxRequests: 1000, - requestsPerSecond: 100, + requestsPerSecond: 30, headers : { "Content-Type":"application/json", "x-transaction-id":"NI5smn3wWpoPX1ma2jbPiE8hK4QcDqHR1582013702233", diff --git a/magellan.js b/magellan.js new file mode 100644 index 0000000..3369215 --- /dev/null +++ b/magellan.js @@ -0,0 +1,140 @@ +module.exports.getAccountDestination = async (req, res) => { + console.log('===== GET getAccountDestination =====') + 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 = { + "DestinationInfo": [ + { + "DestinationId": "61236752144b7900018138c4", + "AccountId": "60e6e33ae5f6facdc31b5a6d", + "DestinationName": "destination", + "DestinationUrl": "http://routeapi.quasar.svc.cluster.local/services/destination", + "DestinationStatus": "Enabled", + "Mode": "Raw", + "PickOutSensor": [], + "EventType": [ + "Report", + "Desire", + "Connection" + ], + "CustomHeaders": { + "x-ais-AccountKey": "60e6e33ae5f6facdc31b5a6d" + }, + "Things": [ + "60e80fdd252ddf0001b25180", + "611b93e7af8b3f0001e0acc7" + ], + "QueueStorageStatus": "Disabled", + "LastQueueStorageStatusTimestamp": "0001-01-01T06:43:00+06:43", + "ErrorCount": 0, + "CustomProperties": { + "ForwardDetail": { + "ThingId": true, + "ThingName": true, + "ThingToken": true, + "ThingIdentifier": true, + "IMEI": true, + "ThingCustomDetails": true + } + }, + "Authentications": { + "AuthenType": "NONE" + }, + "CreatedDatetime": "2021-07-09T15:55:17+07:00", + "LastUpdatedTimestamp": "2021-08-20T21:25:19+07:00" + }, + { + "DestinationId": "61166341144b7900017e5630", + "AccountId": "60e6e33ae5f6facdc31b5a6d", + "DestinationName": "cdddddddddddddddddddddddddddddddd", + "DestinationUrl": "https://mg-iot.siamimo.com/provisioningmessagesharingapis/index.html", + "DestinationStatus": "Enabled", + "Mode": "Raw", + "PickOutSensor": [], + "EventType": [ + "NONE" + ], + "CustomHeaders": {}, + "Things": [ + "611a21caaf8b3f0001dd63f4" + ], + "QueueStorageStatus": "Disabled", + "LastQueueStorageStatusTimestamp": "0001-01-01T06:43:00+06:43", + "ErrorCount": 0, + "CustomProperties": { + "ForwardDetail": { + "ThingId": true, + "ThingName": true, + "ThingToken": true, + "ThingIdentifier": true, + "IMEI": true, + "ThingCustomDetails": true + } + }, + "Authentications": { + "AuthenType": "NONE" + }, + "CreatedDatetime": "2021-08-13T19:19:13+07:00", + "LastUpdatedTimestamp": "2021-08-13T23:22:13+07:00" + } + ], + "@Metadata": { + "CurrentPage": 1, + "TotalPages": 18, + "Top": 10, + "TotalCount": 172, + "HasPrevious": false, + "HasNext": true + }, + "OperationStatus": { + "Code": "20000", + "DeveloperMessage": "The requested operation was successfully." + } + } + + res.status(200).send(response) +} + +module.exports.getAccountThings = async (req, res) => { + console.log('===== GET getAccountThings =====') + 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 = { + "ThingInfo": [ + { + "ThingId": "60e80fdd252ddf0001b25180", + "ThingName": "xNubula." + }, + { + "ThingId": "611b93e7af8b3f0001e0acc7", + "ThingName": "xNubula.2" + }, + { + "ThingId": "611a21caaf8b3f0001dd63f4", + "ThingName": "xName 01" + } + ], + "@Metadata": { + "CurrentPage": 1, + "TotalPages": 1, + "Top": 10, + "TotalCount": 3, + "HasPrevious": false, + "HasNext": false + }, + "OperationStatus": { + "Code": "20000", + "DeveloperMessage": "The requested operation was successfully." + } + } + + res.status(200).send(response) +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..7b08122 --- /dev/null +++ b/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + "math" +) + +func findRoots(a, b, c float64) (float64, float64) { + + x1 := ((-b) + math.Sqrt(math.Pow(b, 2)-(4*a*c)))/(2*a) + x2 := ((-b) - math.Sqrt(math.Pow(b, 2)-(4*a*c)))/(2*a) + + return x1, x2 +} + +func main() { + x1, x2 := findRoots(2, 10, 8) + fmt.Printf("Roots: %f, %f", x1, x2) +} diff --git a/postpay_true.js b/postpay_true.js index 004ab6b..c97925d 100644 --- a/postpay_true.js +++ b/postpay_true.js @@ -124,9 +124,9 @@ module.exports.getAccountCustomerInfo = async (req, res) => { "withholdingTaxIndicator": "N", "name": { "branchCode": "", - "nameType": "B", - "firstName": "", - "lastName": "", + "nameType": "I", + "firstName": "ทดสอบ", + "lastName": "นามสกุล", "organizationName": "มหาวิทยาลัยหอการค้าไทย", "branchName": "", "middleName": "", @@ -227,9 +227,9 @@ module.exports.getAccountCustomerInfo = async (req, res) => { }, "name": { "branchCode": "", - "nameType": "B", - "firstName": "", - "lastName": "", + "nameType": "I", + "firstName": "ทดสอบ", + "lastName": "นามสกุล", "organizationName": "มหาวิทยาลัยหอการค้าไทย", "branchName": "", "middleName": "", @@ -2002,7 +2002,7 @@ module.exports.getProductHistoryList = async (req, res) => { "reasonDescription": "Default Request for restore from suspension from Reg CL", "lastActivityDate": "2018-11-07T07:15:02.000+07:00", "reasonCode": "DEFRS", - "status": "NONE" + "status": "PSUS" }, "linkPrevProductId": "", "barringByRequestReasonCode": "DDSC", @@ -2079,7 +2079,61 @@ module.exports.getProductHistoryList = async (req, res) => { } } - res.status(200).send(response) + let response1 = { + "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":"" + }, + "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":"" + }, + "linkNextProductId":"", + "effectiveDate":"2017-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" + } + } + ] + }, + "calculatedPageSize":"2", + "errorCode":"OSBbllngA00001", + "message":"Success.", + "uuid":"84943fc3-00c2-424b-a432-23860fcc7ad3" + } + } +} + + res.status(200).send(response1) } module.exports.getPaymentList = async (req, res) => { diff --git a/sms.js b/sms.js index 5c29255..31b29c8 100644 --- a/sms.js +++ b/sms.js @@ -22,5 +22,5 @@ module.exports.sendSMS = async (req, res) => { res.set('Content-type', 'text/plain') - // res.status(200).send(response) + res.status(200).send(response) } \ No newline at end of file diff --git a/ssb.js b/ssb.js index 02e9501..fb58a76 100644 --- a/ssb.js +++ b/ssb.js @@ -360,6 +360,9 @@ module.exports.createNewRegistration = async (req, res) => { { "Name": "returnMessage", "Value": "Error Order Creation: EB0183 : SIM Serial No. : 2014143597539 status can not register" + }, { + "Name": "mobileNo", + "Value": "0911234567" } ] } -- libgit2 0.21.2