[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-android] branch master updated: [cashier] API change
From: |
gnunet |
Subject: |
[taler-taler-android] branch master updated: [cashier] API change |
Date: |
Thu, 03 Sep 2020 19:27:53 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository taler-android.
The following commit(s) were added to refs/heads/master by this push:
new 4572a3d [cashier] API change
4572a3d is described below
commit 4572a3d5fc5ae5f3bbeaa8836fb919dcec0483e0
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Thu Sep 3 22:57:39 2020 +0530
[cashier] API change
---
cashier/src/main/java/net/taler/cashier/MainViewModel.kt | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
b/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
index 2fd53a3..2cce8cd 100644
--- a/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
+++ b/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
@@ -64,19 +64,20 @@ class MainViewModel(private val app: Application) :
AndroidViewModel(app) {
fun getBalance() = viewModelScope.launch(Dispatchers.IO) {
check(configManager.hasConfig()) { "No config to get balance" }
val config = configManager.config
- val url = "${config.bankUrl}/accounts/${config.username}/balance"
+ val url = "${config.bankUrl}/accounts/${config.username}"
Log.d(TAG, "Checking balance at $url")
val result = when (val response = makeJsonGetRequest(url, config)) {
is HttpJsonResult.Success -> {
try {
- val balance = response.json.getString("amount")
+ val balanceObj = response.json.getJSONObject("balance");
+ val balanceAmount = balanceObj.getString("amount")
val positive = when (val creditDebitIndicator =
- response.json.getString("credit_debit_indicator")) {
+ balanceObj.getString("credit_debit_indicator")) {
"credit" -> true
"debit" -> false
else -> throw AmountParserException("Unexpected
credit_debit_indicator: $creditDebitIndicator")
}
- BalanceResult.Success(SignedAmount(positive,
Amount.fromJSONString(balance)))
+ BalanceResult.Success(SignedAmount(positive,
Amount.fromJSONString(balanceAmount)))
} catch (e: Exception) {
Log.e(TAG, "Error parsing balance", e)
BalanceResult.Error("Invalid
amount:\n${response.json.toString(2)}")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-taler-android] branch master updated: [cashier] API change,
gnunet <=