diff options
author | Torsten Grote <t@grobox.de> | 2020-04-13 15:29:29 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-04-13 15:29:29 -0300 |
commit | e6229b300ab59d3db0b628f3a0b0eea304f1921b (patch) | |
tree | 4258268211ee5c7abb9bc89f60cc91231d52f6cd /wallet/src | |
parent | 42079c0915194351bc417e2396712a11400049b3 (diff) | |
download | taler-android-e6229b300ab59d3db0b628f3a0b0eea304f1921b.tar.gz taler-android-e6229b300ab59d3db0b628f3a0b0eea304f1921b.tar.bz2 taler-android-e6229b300ab59d3db0b628f3a0b0eea304f1921b.zip |
[wallet] adapt to latest API breaking changes of wallet-core
Diffstat (limited to 'wallet/src')
3 files changed, 18 insertions, 25 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/history/HistoryAdapter.kt b/wallet/src/main/java/net/taler/wallet/history/HistoryAdapter.kt index ede55df..b9770fb 100644 --- a/wallet/src/main/java/net/taler/wallet/history/HistoryAdapter.kt +++ b/wallet/src/main/java/net/taler/wallet/history/HistoryAdapter.kt @@ -99,7 +99,7 @@ internal class HistoryAdapter( info.text = when (event) { is ExchangeAddedEvent -> cleanExchange(event.exchangeBaseUrl) is ExchangeUpdatedEvent -> cleanExchange(event.exchangeBaseUrl) - is ReserveBalanceUpdatedEvent -> event.amountReserveBalance.toString() + is ReserveBalanceUpdatedEvent -> event.reserveBalance.toString() is HistoryPaymentSentEvent -> event.orderShortInfo.summary is HistoryOrderAcceptedEvent -> event.orderShortInfo.summary is HistoryOrderRefusedEvent -> event.orderShortInfo.summary diff --git a/wallet/src/main/java/net/taler/wallet/history/HistoryEvent.kt b/wallet/src/main/java/net/taler/wallet/history/HistoryEvent.kt index 50a973f..af017ed 100644 --- a/wallet/src/main/java/net/taler/wallet/history/HistoryEvent.kt +++ b/wallet/src/main/java/net/taler/wallet/history/HistoryEvent.kt @@ -175,7 +175,6 @@ class ExchangeUpdatedEvent( @JsonTypeName("reserve-balance-updated") class ReserveBalanceUpdatedEvent( timestamp: Timestamp, - val newHistoryTransactions: List<ReserveTransaction>, /** * Condensed information about the reserve. */ @@ -183,12 +182,16 @@ class ReserveBalanceUpdatedEvent( /** * Amount currently left in the reserve. */ - val amountReserveBalance: Amount, + val reserveBalance: Amount, /** * Amount we expected to be in the reserve at that time, * considering ongoing withdrawals from that reserve. */ - val amountExpected: Amount + val reserveAwaitedAmount: Amount, + /** + * Amount that hasn't been withdrawn yet. + */ + val reserveUnclaimedAmount: Amount ) : HistoryEvent(timestamp) { override val title = R.string.history_event_reserve_balance_updated } @@ -204,7 +207,7 @@ class HistoryWithdrawnEvent( * Unique identifier for the withdrawal session, can be used to * query more detailed information from the wallet. */ - val withdrawSessionId: String, + val withdrawalGroupId: String, val withdrawalSource: WithdrawalSource, /** * Amount that has been subtracted from the reserve's balance diff --git a/wallet/src/test/java/net/taler/wallet/history/HistoryEventTest.kt b/wallet/src/test/java/net/taler/wallet/history/HistoryEventTest.kt index c9fda3c..fdba2e9 100644 --- a/wallet/src/test/java/net/taler/wallet/history/HistoryEventTest.kt +++ b/wallet/src/test/java/net/taler/wallet/history/HistoryEventTest.kt @@ -19,6 +19,7 @@ package net.taler.wallet.history import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.KotlinModule import com.fasterxml.jackson.module.kotlin.readValue +import net.taler.common.Amount import net.taler.wallet.history.RefreshReason.PAY import net.taler.wallet.history.ReserveType.MANUAL import org.junit.Assert.assertEquals @@ -36,7 +37,7 @@ class HistoryEventTest { proposalId = "EP5MH4R5C9RMNA06YS1QGEJ3EY682PY8R1SGRFRP74EV735N3ATG", orderId = "2019.364-01RAQ68DQ7AWR", merchantBaseUrl = "https://backend.demo.taler.net/public/instances/FSF/", - amount = "KUDOS:0.5", + amount = Amount.fromJSONString("KUDOS:0.5"), summary = "Essay: Foreword" ) @@ -96,22 +97,12 @@ class HistoryEventTest { val json = """{ "type": "reserve-balance-updated", "eventId": "reserve-balance-updated;K0H10Q6HB9WH0CKHQQMNH5C6GA7A9AR1E2XSS9G1KG3ZXMBVT26G", - "amountExpected": "TESTKUDOS:23", - "amountReserveBalance": "TESTKUDOS:10", + "reserveAwaitedAmount": "TESTKUDOS:23", + "reserveUnclaimedAmount": "TESTKUDOS:0.01", + "reserveBalance": "TESTKUDOS:10", "timestamp": { "t_ms": $timestamp }, - "newHistoryTransactions": [ - { - "amount": "TESTKUDOS:10", - "sender_account_url": "payto:\/\/x-taler-bank\/bank.test.taler.net\/894", - "timestamp": { - "t_ms": $timestamp - }, - "wire_reference": "00000000004TR", - "type": "DEPOSIT" - } - ], "reserveShortInfo": { "exchangeBaseUrl": "https:\/\/exchange.test.taler.net\/", "reserveCreationDetail": { @@ -123,10 +114,9 @@ class HistoryEventTest { val event: ReserveBalanceUpdatedEvent = mapper.readValue(json) assertEquals(timestamp, event.timestamp.ms) - assertEquals("TESTKUDOS:23", event.amountExpected) - assertEquals("TESTKUDOS:10", event.amountReserveBalance) - assertEquals(1, event.newHistoryTransactions.size) - assertTrue(event.newHistoryTransactions[0] is ReserveDepositTransaction) + assertEquals("TESTKUDOS:23", event.reserveAwaitedAmount) + assertEquals("TESTKUDOS:10", event.reserveBalance) + assertEquals("TESTKUDOS:0.01", event.reserveUnclaimedAmount) assertEquals(exchangeBaseUrl, event.reserveShortInfo.exchangeBaseUrl) } @@ -134,7 +124,7 @@ class HistoryEventTest { fun `test HistoryWithdrawnEvent`() { val json = """{ "type": "withdrawn", - "withdrawSessionId": "974FT7JDNR20EQKNR21G1HV9PB6T5AZHYHX9NHR51Q30ZK3T10S0", + "withdrawalGroupId": "974FT7JDNR20EQKNR21G1HV9PB6T5AZHYHX9NHR51Q30ZK3T10S0", "eventId": "withdrawn;974FT7JDNR20EQKNR21G1HV9PB6T5AZHYHX9NHR51Q30ZK3T10S0", "amountWithdrawnEffective": "TESTKUDOS:9.8", "amountWithdrawnRaw": "TESTKUDOS:10", @@ -151,7 +141,7 @@ class HistoryEventTest { assertEquals( "974FT7JDNR20EQKNR21G1HV9PB6T5AZHYHX9NHR51Q30ZK3T10S0", - event.withdrawSessionId + event.withdrawalGroupId ) assertEquals("TESTKUDOS:9.8", event.amountWithdrawnEffective) assertEquals("TESTKUDOS:10", event.amountWithdrawnRaw) |