Compare View
Commits (4)
Changes
Showing 5 changed files Side-by-side Diff
lib/irs/reverse-report.js
... | ... | @@ -37,7 +37,10 @@ function processPartnerReport(qs) { |
37 | 37 | if (rc === '00') { |
38 | 38 | amount = Number(qs.hrg); |
39 | 39 | if (!amount) { |
40 | - amount = irs.getPriceFromMessage(qs.msg, config.partner.price_pattern); | |
40 | + amount = irs.getPriceFromMessage( | |
41 | + qs.msg, | |
42 | + config.partner.price_pattern || config.price_pattern | |
43 | + ) || null; | |
41 | 44 | } |
42 | 45 | } |
43 | 46 | |
... | ... | @@ -68,7 +71,7 @@ function create() { |
68 | 71 | res.end('OK'); |
69 | 72 | |
70 | 73 | const remote_ip = req.connection ? req.connection.remoteAddress : null; |
71 | - logger.verbose('REVERSE-REPORT: got report from partner', {url: req.url, remote_ip: remote_ip}); | |
74 | + logger.verbose('REVERSE-REPORT: got report from partner', {url: req.url, remote_ip: remote_ip, method: req.method}); | |
72 | 75 | |
73 | 76 | processPartnerReport(qs); |
74 | 77 | }).listen(config.reverse_report_port); |
lib/partner.js
... | ... | @@ -109,7 +109,10 @@ function _topUpRequest(task, isAdvice) { |
109 | 109 | rc: komodoRc(value[RESPONSECODE_TAG]) || '40', |
110 | 110 | message: 'topUpRequest: ' + stringify(value), |
111 | 111 | sn: (value.SN || '').replace(/;$/, '') || st24.extractSnFromMessage(value.MESSAGE, config.sn_pattern), |
112 | - amount: value.PRICE || st24.extractPriceFromMsg(value.MESSAGE, config.amount_pattern), | |
112 | + amount: value.PRICE || st24.extractPriceFromMsg( | |
113 | + value.MESSAGE, | |
114 | + config.partner.price_pattern || config.partner.amount_pattern || config.amount_pattern, | |
115 | + ), | |
113 | 116 | balance, |
114 | 117 | raw: value, |
115 | 118 | misc: { |
lib/reverse-report.js
... | ... | @@ -40,9 +40,18 @@ function create() { |
40 | 40 | rc: partner.komodoRc(value[partner.RESPONSECODE_TAG]) || '40', |
41 | 41 | //message: value.MESSAGE, |
42 | 42 | message: 'topUpReport: ' + stringify(value), |
43 | - sn: (value.SN || '').replace(/;+$/, '').replace(/#+$/, '') || st24.extractSnFromMessage(value.MESSAGE, config.sn_pattern), | |
44 | - amount: value.PRICE || st24.extractPriceFromMsg(value.MESSAGE, config.amount_pattern), | |
45 | - balance: st24.extractBalanceFromMsg(value.MESSAGE, config.balance_pattern), | |
43 | + sn: (value.SN || '').replace(/;+$/, '').replace(/#+$/, '') || st24.extractSnFromMessage( | |
44 | + value.MESSAGE, | |
45 | + config.partner.sn_pattern || config.sn_pattern, | |
46 | + ), | |
47 | + amount: value.PRICE || st24.extractPriceFromMsg( | |
48 | + value.MESSAGE, | |
49 | + config.partner.price_pattern || config.partner.amount_pattern || config.amount_pattern, | |
50 | + ), | |
51 | + balance: st24.extractBalanceFromMsg( | |
52 | + value.MESSAGE, | |
53 | + config.partner.balance_pattern || config.balance_pattern, | |
54 | + ), | |
46 | 55 | raw: value, |
47 | 56 | misc: { |
48 | 57 | } |
package-lock.json