Commit 3d923a578cff63b28d4fc7060fe4638bd7f4727b

Authored by Adhidarma Hadiwinoto
1 parent a6d1ac75b7
Exists in master

hapus 0 depan refnum

Showing 1 changed file with 5 additions and 4 deletions Side-by-side Diff

partner-masterpulsa-voucher.js
... ... @@ -23,7 +23,7 @@ function callbackReportWrapper(requestId, rc, message) {
23 23 logger.warn('Exception on callbackReportWrapper: ' + err);
24 24 }
25 25 }
26   -
  26 +
27 27 if (rc != '00' && rc != '68') {
28 28 try {
29 29 var key = dupcheckKey(config.globals.gateway_name, task);
... ... @@ -71,7 +71,7 @@ function dupcheckKey(gatewayName, task) {
71 71  
72 72 function topupRequest(task, retry) {
73 73 var key = dupcheckKey(config.globals.gateway_name, task);
74   -
  74 +
75 75 redisClient.get(key, function(err, data) {
76 76 if (err) {
77 77 callbackReportWrapper(task.requestId, '40', 'Gagal cek anti transaksi duplikat (redis error)');
... ... @@ -141,10 +141,11 @@ function parsePaymentResponse(message) {
141 141 }
142 142  
143 143 function rehashRefnum(refnum) {
144   - var hashed = refnum;
  144 + var hashed = refnum.replace(/^0+/, '');
  145 +
145 146 try {
146 147 hashed = hashed.replace(/A/g, '1').replace(/B/g, '2').replace(/C/g, '3').replace(/D/g, '4').replace(/E/g, '5').replace(/F/g, '6');
147   - hashed = hashed.substring(0, 15);
  148 + hashed = hashed.substring(0, 20);
148 149 }
149 150 catch(err) {
150 151 logger.warn('Gagal rehashRefnum: ' + err);