diff --git a/partner-bayarkilat.js b/partner-bayarkilat.js index 7606664..af60718 100644 --- a/partner-bayarkilat.js +++ b/partner-bayarkilat.js @@ -88,6 +88,26 @@ function getSn(response) { } } +function getHarga(response) { + try { + var harga = response.xml.amount[0]; + return harga; + } + catch (err) { + return; + } +} + +function getSaldo(response) { + try { + var saldo = response.xml.saldo[0]; + return saldo; + } + catch (err) { + return; + } +} + function parseResponse(body, task) { xml2jsParser(body, function(err, response) { if (err) { @@ -111,11 +131,9 @@ function parseResponse(body, task) { var responseCode; var message; - var saldo; try { responseCode = response.xml.response_code[0]; - saldo = response.xml.saldo[0]; message = response.xml.response_message[0]; } catch(errGetParam) { @@ -158,6 +176,12 @@ function parseResponse(body, task) { } } + var harga = getHarga(response); + if (harga) { + st24message = st24message + '. Harga ' + harga; + } + + var saldo = getSaldo(response); if (saldo) { st24message = st24message + '. Saldo ' + saldo; aaa.updateBalance(saldo);