Commit 86a5194e331f91f82a991d5bebef0f3ddd84022a

Authored by Adhidarma Hadiwinoto
1 parent 782845c5df
Exists in master

supplier price as amount

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

... ... @@ -8,15 +8,15 @@ const matrix = require('../matrix');
8 8  
9 9 var partner;
10 10  
11   -function init(_partner) {
  11 +function setPartner(_partner) {
12 12 partner = _partner;
13   -
14   - initMatrix();
15   -
16   - setInterval(pullTask, config.pull_interval_ms || 1000);
17 13 }
18 14  
19 15 function pullTask() {
  16 + if (!partner) {
  17 + return;
  18 + }
  19 +
20 20 let options = {
21 21 url: config.pull_url.task.replace('<CORE_APIKEY>', config.core_apikey),
22 22 qs: {
... ... @@ -80,7 +80,7 @@ function report(data) {
80 80 message: data.message,
81 81 handler: config.handler_name,
82 82 sn: data.sn,
83   - supplier_price: data.supplier_price
  83 + amount: data.amount
84 84 }
85 85 }
86 86  
... ... @@ -141,7 +141,10 @@ function getRemoteProduct(product) {
141 141 return remoteProduct || product;
142 142 }
143 143  
144   -exports.init = init;
  144 +initMatrix();
  145 +setInterval(pullTask, config.pull_interval_ms || 1000);
  146 +
  147 +exports.setPartner = setPartner;
145 148 exports.isPaused = isPaused;
146 149 exports.pause = pause;
147 150 exports.resume = resume;