Commit f485865e4db9489a018551bfda22a2513393a46d

Authored by Adhidarma Hadiwinoto
1 parent bc34ddbedb
Exists in master and in 1 other branch dev

Fix terminalsWithLocation pakai terminalNameWIthoutIp

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

lib/partner-listener/routers/topup.js
... ... @@ -65,7 +65,8 @@ function pagePrerequisite(req, res, next) {
65 65 async function pageIndex(req, res) {
66 66 const { xid } = res.locals;
67 67  
68   - const terminalName = `${req.body.terminal_name || req.query.terminal_name}@${req.ip.replace(/^::ffff:/, '')}`;
  68 + const terminalNameWithoutIp = ((req.body.terminal_name || req.query.terminal_name) || '').trim();
  69 + const terminalName = `${terminalNameWithoutIp}@${req.ip.replace(/^::ffff:/, '')}`;
69 70  
70 71 const qs = {
71 72 terminal_name: terminalName,
... ... @@ -79,7 +80,7 @@ async function pageIndex(req, res) {
79 80 reverse_url: req.body.reverse_url || req.query.reverse_url || null,
80 81 };
81 82  
82   - if (terminalsWithLocation.indexOf(terminalName.toLowerCase()) >= 0) {
  83 + if (terminalsWithLocation.indexOf(terminalNameWithoutIp.toLowerCase()) >= 0) {
83 84 const location = req.body.location
84 85 || req.body.location_id
85 86 || req.query.location