Commit 2114c2b2e0c8020e91d124e06c1b2187c68b9b76

Authored by Nattapon W
1 parent 880cbf89
Exists in develop

update mockup ssb vcom

Showing 3 changed files with 53 additions and 5 deletions   Show diff stats
app.js
... ... @@ -329,7 +329,9 @@ app.post('/ssb/profile/historyPackage', require('./ssb').queryHistoryPackage);
329 329 app.post('/ssb/profile/currentPackage', require('./ssb').queryCurrentPackage);
330 330 app.post('/ssb/package/apply', require('./ssb').applyPack);
331 331 app.post('/ssb/package/subscriber', require('./ssb').deletePackage); //
332   -app.post('/ssb/transform', require('./ssb').createNewRegistration); //
  332 +app.post('/ssb/transform', require('./ssb').createNewRegistration);
  333 +
  334 +app.post('/v1.0/ais/users', require('./vcom').userRegisterAndRegisterDevice);
333 335  
334 336 app.post('/verifyReceipt', require('./apple').verifyReceipt); //
335 337  
... ...
ssb.js
... ... @@ -190,7 +190,7 @@ module.exports.createNewRegistration = async (req, res) => {
190 190 console.log('body', JSON.stringify(req.body));
191 191  
192 192 let response = {
193   - "resultCode": "50000",
  193 + "resultCode": "20000",
194 194 "developerMessage": "Success",
195 195 "data": {
196 196 "ExecuteServiceResponse": {
... ... @@ -215,7 +215,6 @@ module.exports.createNewRegistration = async (req, res) => {
215 215 }
216 216 }
217 217 }
218   -
219   -
220   - res.status(500).send(response)
  218 +
  219 + res.status(200).send(response)
221 220 }
222 221 \ No newline at end of file
... ...
vcom.js 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +module.exports.userRegisterAndRegisterDevice = async (req, res) => {
  2 + console.log('===== POST userRegisterAndRegisterDevice =====')
  3 + console.log('url', req.originalUrl);
  4 + console.log('headers', req.headers);
  5 + console.log('query', req.query);
  6 + console.log('params', req.params);
  7 + console.log('body', JSON.stringify(req.body));
  8 +
  9 + let response, response1, responseErr
  10 + if(req.body.action == 'registerAisUser') {
  11 + response = {
  12 + "message": "Please check email you have registered and click validation link attached in the email.",
  13 + "code": "1",
  14 + "data": {
  15 + "userId": 10002912
  16 + }
  17 + }
  18 +
  19 + response1 = {
  20 + "message": "The account has already existed.",
  21 + "code": "1",
  22 + "data": {
  23 + "userId": 10002911
  24 + }
  25 + }
  26 +
  27 + responseErr = {
  28 + "message": "Failed",
  29 + "code": "0",
  30 + "data": "Failed"
  31 + }
  32 + return res.status(200).send(response)
  33 + } else {
  34 + response = {
  35 + "code": "1",
  36 + "message": "Add device successful",
  37 + "data": "Add device successful"
  38 + }
  39 +
  40 + responseErr = {
  41 + "message": "IMEI error, IMEI length must be 15 strings",
  42 + "code": "50001",
  43 + "data": "IMEI error, IMEI length must be 15 strings"
  44 + }
  45 + return res.status(200).send(response)
  46 + }
  47 +}
0 48 \ No newline at end of file
... ...