} // Get Balance private void MakePayment() { AlertDialog.Builder confirmPayment = new AlertDialog.Builder(this); confirmPayment.SetTitle("Make Payment?"); confirmPayment.SetMessage(paymentMsg); confirmPayment.SetPositiveButton("Pay", async(sender, e) => { apiCall = new APIClass(); string apiUrl = "Transfers/" + myDetails.ID + "/" + merchantID + "/" + i004_trxn_amount.ToString() + "/" + referenceID + "/" + currency; json = await apiCall.CallAPI(apiUrl); textViewConsole.Text = json["status"].ToString(); GetBalance(); // Update balance }); confirmPayment.SetNegativeButton("Cancel", (sender, e) => { textViewConsole.Text = "Transaction aborted"; this.Recreate(); // Reset activity to try another payment }); Dialog payDialog = confirmPayment.Create(); payDialog.Show(); }
} // ParseReceipt private async void GetBalance() { apiCall = new APIClass(); // ToDo: Dynamically build string string apiUrl = "Accounts/" + myDetails.ID + "/" + myDetails.defaultCurrency ; json = await apiCall.CallAPI(apiUrl); balance = Convert.ToDouble(json["balance"].ToString()); textViewBalance.Text = "Available Balance: " + myDetails.defaultCurrency + balance.ToString(); if (balance <= 0.00) { buttonScan.Enabled = false; textViewConsole.Text = "Cannot make payment - not enough available funds"; } else { buttonScan.Enabled = true; } } // Get Balance