summaryrefslogtreecommitdiff
path: root/wallet/src/main/java/net/taler
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2023-11-14 12:35:37 -0600
committerTorsten Grote <t@grobox.de>2023-11-28 13:54:39 -0300
commit94ee3a2f114e0345ea7408aacc30e3da9545474c (patch)
tree127d5d74e30e2d9378ed6876a18515a660cac60e /wallet/src/main/java/net/taler
parent15242d194f2cfe06cd0dbf38d1b9b278550ab2bf (diff)
downloadtaler-android-94ee3a2f114e0345ea7408aacc30e3da9545474c.tar.gz
taler-android-94ee3a2f114e0345ea7408aacc30e3da9545474c.tar.bz2
taler-android-94ee3a2f114e0345ea7408aacc30e3da9545474c.zip
[wallet] Show KYC notice in transaction list, and don't render fees when zero
Diffstat (limited to 'wallet/src/main/java/net/taler')
-rw-r--r--wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt13
-rw-r--r--wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt13
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt27
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt13
4 files changed, 46 insertions, 20 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt b/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt
index c08bc76..7de16b6 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt
@@ -83,11 +83,14 @@ fun TransactionPaymentComposable(
amount = t.amountRaw,
amountType = AmountType.Neutral,
)
- TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
- amount = t.amountEffective - t.amountRaw,
- amountType = AmountType.Negative,
- )
+ val fee = t.amountEffective - t.amountRaw
+ if (!fee.isZero()) {
+ TransactionAmountComposable(
+ label = stringResource(id = R.string.withdraw_fees),
+ amount = fee,
+ amountType = AmountType.Negative,
+ )
+ }
if (t.posConfirmation != null) {
TransactionInfoComposable(
label = stringResource(id = R.string.payment_confirmation_code),
diff --git a/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt b/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt
index ac5e2da..82dceb5 100644
--- a/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt
@@ -79,11 +79,14 @@ fun TransactionRefundComposable(
amount = t.amountRaw,
amountType = AmountType.Neutral,
)
- TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
- amount = t.amountRaw - t.amountEffective,
- amountType = AmountType.Negative,
- )
+ val fee = t.amountRaw - t.amountEffective
+ if (!fee.isZero()) {
+ TransactionAmountComposable(
+ label = stringResource(id = R.string.withdraw_fees),
+ amount = fee,
+ amountType = AmountType.Negative,
+ )
+ }
TransactionInfoComposable(
label = stringResource(id = R.string.transaction_order),
info = t.paymentInfo?.summary ?: "",
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
index 18480e1..c9ae889 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
@@ -39,6 +39,8 @@ import net.taler.wallet.transactions.TransactionAdapter.TransactionViewHolder
import net.taler.wallet.transactions.TransactionMajorState.Aborted
import net.taler.wallet.transactions.TransactionMajorState.Failed
import net.taler.wallet.transactions.TransactionMajorState.Pending
+import net.taler.wallet.transactions.TransactionMinorState.BankConfirmTransfer
+import net.taler.wallet.transactions.TransactionMinorState.KycRequired
internal class TransactionAdapter(
private val listener: OnTransactionClickListener,
@@ -112,6 +114,14 @@ internal class TransactionAdapter(
private fun bindExtraInfo(transaction: Transaction) {
when {
+ // Goes first so it always shows errors when present
+ transaction.error != null -> {
+ extraInfoView.text =
+ context.getString(R.string.payment_error, transaction.error!!.userFacingMsg)
+ extraInfoView.setTextColor(red)
+ extraInfoView.visibility = VISIBLE
+ }
+
transaction.txState.major == Aborted -> {
extraInfoView.setText(R.string.payment_aborted)
extraInfoView.setTextColor(red)
@@ -124,11 +134,18 @@ internal class TransactionAdapter(
extraInfoView.visibility = VISIBLE
}
- transaction.error != null -> {
- extraInfoView.text =
- context.getString(R.string.payment_error, transaction.error!!.userFacingMsg)
- extraInfoView.setTextColor(red)
- extraInfoView.visibility = VISIBLE
+ transaction.txState.major == Pending -> when (transaction.txState.minor) {
+ BankConfirmTransfer -> {
+ extraInfoView.setText(R.string.withdraw_waiting_confirm)
+ extraInfoView.setTextColor(amountColor)
+ extraInfoView.visibility = VISIBLE
+ }
+ KycRequired -> {
+ extraInfoView.setText(R.string.transaction_action_kyc)
+ extraInfoView.setTextColor(amountColor)
+ extraInfoView.visibility = VISIBLE
+ }
+ else -> extraInfoView.visibility = GONE
}
transaction is TransactionWithdrawal && !transaction.confirmed -> {
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt b/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt
index 79cfc5e..378e283 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt
@@ -86,11 +86,14 @@ fun TransactionWithdrawalComposable(
amount = t.amountRaw,
amountType = AmountType.Neutral,
)
- TransactionAmountComposable(
- label = stringResource(id = R.string.withdraw_fees),
- amount = t.amountRaw - t.amountEffective,
- amountType = AmountType.Negative,
- )
+ val fee = t.amountRaw - t.amountEffective
+ if (!fee.isZero()) {
+ TransactionAmountComposable(
+ label = stringResource(id = R.string.withdraw_fees),
+ amount = fee,
+ amountType = AmountType.Negative,
+ )
+ }
TransactionInfoComposable(
label = stringResource(id = R.string.withdraw_exchange),
info = cleanExchange(t.exchangeBaseUrl),