diff options
author | Torsten Grote <t@grobox.de> | 2020-07-30 17:05:05 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-07-30 17:05:05 -0300 |
commit | 3ceaeb30c2eb1566f5580923c4965d7c23bd7806 (patch) | |
tree | 5c157a5b318684be39d6b6e137790fbf2b2ae8f3 /wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt | |
parent | 8815105bf2462787885214a12af927d484226f21 (diff) | |
download | taler-android-3ceaeb30c2eb1566f5580923c4965d7c23bd7806.tar.gz taler-android-3ceaeb30c2eb1566f5580923c4965d7c23bd7806.tar.bz2 taler-android-3ceaeb30c2eb1566f5580923c4965d7c23bd7806.zip |
[wallet] upgrade payment flow to new API
Diffstat (limited to 'wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt b/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt index c6351ee..2427afb 100644 --- a/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt +++ b/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt @@ -26,6 +26,8 @@ import net.taler.common.Amount import net.taler.common.ContractTerms import net.taler.wallet.TAG import net.taler.wallet.backend.WalletBackendApi +import net.taler.wallet.payment.PayStatus.AlreadyPaid +import net.taler.wallet.payment.PayStatus.InsufficientBalance import net.taler.wallet.payment.PreparePayResponse.AlreadyConfirmedResponse import net.taler.wallet.payment.PreparePayResponse.InsufficientBalanceResponse import net.taler.wallet.payment.PreparePayResponse.PaymentPossibleResponse @@ -40,7 +42,8 @@ sealed class PayStatus { data class Prepared( val contractTerms: ContractTerms, val proposalId: String, - val totalFees: Amount + val amountRaw: Amount, + val amountEffective: Amount ) : PayStatus() data class InsufficientBalance(val contractTerms: ContractTerms) : PayStatus() @@ -74,9 +77,9 @@ class PaymentManager( val response: PreparePayResponse = mapper.readValue(result.toString()) Log.e(TAG, "PreparePayResponse $response") mPayStatus.value = when (response) { - is PaymentPossibleResponse -> TODO() - is InsufficientBalanceResponse -> TODO() - is AlreadyConfirmedResponse -> TODO() + is PaymentPossibleResponse -> response.toPayStatusPrepared() + is InsufficientBalanceResponse -> InsufficientBalance(response.contractTerms) + is AlreadyConfirmedResponse -> AlreadyPaid } } } |