SHARE
TWEET

nanya dik

a guest Apr 26th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const detailTrx = (syslog, amount, callback) => {
  2.     connection.query('SELECT * FROM `f_trx_logheader` WHERE `SYSLOGNO`=? AND `TRXVALUE`=? ', [syslog, amount], function (err, results) {
  3.         if (err) {
  4.             console.log(err);
  5.         } else {
  6.             if (results.length == 0) {
  7.                 return {
  8.                     'resultCode': '1',
  9.                     'resultDesc': 'Data tidak ditemukan',
  10.                     'messageType': 'WARNING',
  11.                     'timeStamp': date
  12.                 }
  13.             } else {
  14.                 if (results[0].REFUNDTRX != 0 || results[0].LASTSTATE != 0) {
  15.                     return {
  16.                         'resultCode': '2',
  17.                         'resultDesc': 'Transaksi tidak bisa direfund',
  18.                         'messageType': 'WARNING',
  19.                         'timeStamp': date
  20.                     }
  21.                 } else {
  22.                     return callback(err, results)
  23.                 }
  24.             }
  25.         }
  26.     });
  27. }
  28.  
  29.  
  30. app.post('/refund', jwtVerifer({ secret: secret }), function (req, res) {
  31.     const { syslog, amount } = req.body;
  32.      let detail = detailTrx(syslog, amount, (err, results) => {
  33.         // kalau di console bisa muncul
  34.         // console.log(detail)
  35.  
  36.         // kalau return ngga muncul
  37.         return results
  38.     })
  39.    
  40.     res.send(detail)
  41. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top