Guest User

Untitled

a guest
Nov 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. { type: 'ISV',
  2. code: 'IncompleteSignature',
  3. message: 'The request signature does not conform to lazada standards',
  4. request_id: '0be6e79215428302067761224' }
  5.  
  6. var sha256 = require('js-sha256');
  7.  
  8.  
  9. module.exports = function(app, Request){
  10.  
  11. app.get('/', function(req,res){
  12.  
  13. var access_token = "myToken";
  14. var app_key = "myAppKey";
  15. var order_id = "36835322434";
  16. var sign_method = "sha256";
  17. var timestamp = new Date().timestamp;
  18.  
  19. var concatenatedString = "/order/items/getaccess_token"+access_token
  20. +"app_key"+app_key
  21. +"order_id"+order_id
  22. +"sign_method"+sign_method
  23. +"timestamp"+new Date().getTime();
  24.  
  25.  
  26. var hash = sha256.hmac.create("myAppSecret");
  27. hash.update(concatenatedString);
  28.  
  29. var httpRequestLink = "http://api.lazada.co.th/rest/order/items/get?access_token="+access_token
  30. +"&app_key="+app_key
  31. +"&order_id="+order_id
  32. +"&sign_method="+sign_method
  33. +"&timestamp="+new Date().getTime()
  34. +"&sign="+hash.hex();
  35.  
  36. Request.get(httpRequestLink, (error, response, body) => {
  37. if(error) {
  38. return console.log(error);
  39. }
  40. console.log(JSON.parse(body));
  41. });
  42.  
  43. });
  44.  
  45. }
Add Comment
Please, Sign In to add comment