Commit 4334f5ca888f4108468a50fcb28cb3552f34882d

Authored by Adhidarma Hadiwinoto
1 parent 3d923a578c
Exists in master

sn real

Showing 2 changed files with 17 additions and 1 deletions Side-by-side Diff

1 1 node_modules/
2 2 logs/log*
  3 +config.ini*
  4 +log.txt
  5 +run.sh
partner-masterpulsa-voucher.js
... ... @@ -133,6 +133,13 @@ function parsePaymentResponse(message) {
133 133 voucherid: data[i++],
134 134 nominal: data[i++]
135 135 }
  136 +
  137 + try {
  138 + retval.sn = data[9];
  139 + }
  140 + catch(err) {
  141 + retval.sn = retval.refnum;
  142 + }
136 143 }
137 144  
138 145 retval.raw = message;
... ... @@ -155,7 +162,13 @@ function rehashRefnum(refnum) {
155 162 }
156 163  
157 164 function reportPaymentSuccess(task, response) {
158   - var sn = rehashRefnum(response.refnum);
  165 + var sn = '';
  166 + if (response.sn) {
  167 + sn = response.sn;
  168 + } else {
  169 + sn = rehashRefnum(response.refnum);
  170 + }
  171 +
159 172 var message = 'SN=' + sn + '; ' + response.raw;
160 173  
161 174 logger.info('Report payment success to ST24', {task: task, response: response});