Commit ad2d5e4d9294303e3a9695c47b895b7ec70b03be
1 parent
5a60c2c73f
Exists in
master
abaikan advice kadaluarsa
Showing 2 changed files with 13 additions and 5 deletions Side-by-side Diff
examples/kopnus/config.json
lib/partner.js
... | ... | @@ -155,11 +155,18 @@ function _topUpInquiry(task) { |
155 | 155 | } |
156 | 156 | |
157 | 157 | function advice(task) { |
158 | - if (config && advice_is_not_allowed) { | |
158 | + if (config && config.advice_is_not_allowed) { | |
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
162 | - if (config && advice_is_topuprequest) { | |
162 | + if (config && config.advice_max_age_ms) { | |
163 | + if (moment() - moment(task.created) > config.advice_max_age_ms) { | |
164 | + logger.verbose('Ignoring advice request because of expired task', {trx_id: task.trx_id, destination: task.destination, product: task.product, created: task.created, max_age: config.advice_max_age_ms}); | |
165 | + return; | |
166 | + } | |
167 | + } | |
168 | + | |
169 | + if (config && config.advice_is_topuprequest) { | |
163 | 170 | _topUpRequest(task, true); |
164 | 171 | } |
165 | 172 | else { |