From 3f0ff9875de535f30a3f513369d37724d2cddda9 Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Wed, 29 Jun 2016 21:25:36 +0700
Subject: [PATCH] getHarga dan getSaldo

---
 partner-bayarkilat.js | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

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);
-- 
1.9.0