Commit 23efb61cfb311e326fc1f69aeea24110240a38e8

Authored by Adhidarma Hadiwinoto
1 parent 05dcac7ed0
Exists in master

Log on balance on topupRequest

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

... ... @@ -95,13 +95,22 @@ function _topUpRequest(task, isAdvice) {
95 95 logger.info('Got XMLRPC response from partner for', {method: xmlrpcMethod, trx_id: task.trx_id, destination: task.destination, response: value});
96 96 matrix.last_topupRequest_ack = value;
97 97  
  98 + const balance = st24.extractBalanceFromMsg(value.MESSAGE, config.balance_pattern) || null;
  99 +
  100 + if (balance) {
  101 + logger.verbose('TOPUPREQUEST: Balance from supplier extracted', {
  102 + trxId: task.trx_id,
  103 + balance,
  104 + });
  105 + }
  106 +
98 107 report({
99 108 trx_id: task.trx_id,
100 109 rc: komodoRc(value[RESPONSECODE_TAG]) || '40',
101 110 message: 'topUpRequest: ' + stringify(value),
102 111 sn: (value.SN || '').replace(/;$/, '') || st24.extractSnFromMessage(value.MESSAGE, config.sn_pattern),
103 112 amount: value.PRICE || st24.extractPriceFromMsg(value.MESSAGE, config.amount_pattern),
104   - balance: st24.extractBalanceFromMsg(value.MESSAGE, config.balance_pattern),
  113 + balance,
105 114 raw: value,
106 115 misc: {
107 116 task: task