diff --git a/lib/partner.js b/lib/partner.js index 4ec0c08..e5ceffa 100644 --- a/lib/partner.js +++ b/lib/partner.js @@ -7,6 +7,14 @@ const pull = require('komodo-sdk/gateway/pull'); function buy(task, xid) { logger.verbose('Got task from CORE', { xid, task }); const [remoteProduct, amount] = task.remote_product.split(/ *, */); + pull.report({ + trx_id: task.trx_id, + rc: '68', + message: { + xid, + msg: 'Waiting for result', + }, + }, xid); setTimeout( () => { @@ -16,16 +24,22 @@ function buy(task, xid) { pull.report({ trx_id: task.trx_id, rc: '68', - message: `PENDING karena nomor tujuan ${task.destination} diakhiri 0`, balance: config.supplier_ending_balance, - }); + message: { + xid, + msg: `PENDING karena nomor tujuan ${task.destination} diakhiri 0`, + }, + }, xid); } else if (destination % 2) { pull.report({ trx_id: task.trx_id, rc: '14', - message: `GAGAL karena nomor tujuan ${task.destination} adalah nomor ganjil`, balance: config.supplier_ending_balance, - }); + message: { + xid, + msg: `GAGAL karena nomor tujuan ${task.destination} adalah nomor ganjil`, + }, + }, xid); } else { pull.report({ trx_id: task.trx_id, @@ -33,9 +47,12 @@ function buy(task, xid) { sn: moment().format('YYYYMMDDHHmmssSSS'), amount, remote_product: remoteProduct, - message: `BERHASIL karena nomor tujuan ${task.destination} adalah nomor genap`, balance: config.supplier_ending_balance, - }); + message: { + xid, + msg: `BERHASIL karena nomor tujuan ${task.destination} adalah nomor genap`, + }, + }, xid); } }, (config.max_result_timeout_ms || 2000) * Math.random(),