gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-android] 01/03: [wallet] Show KYC notice in transaction lis


From: gnunet
Subject: [taler-taler-android] 01/03: [wallet] Show KYC notice in transaction list, and don't render fees when zero
Date: Tue, 28 Nov 2023 18:33:00 +0100

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a commit to branch master
in repository taler-android.

commit 94ee3a2f114e0345ea7408aacc30e3da9545474c
Author: Iván Ávalos <avalos@disroot.org>
AuthorDate: Tue Nov 14 12:35:37 2023 -0600

    [wallet] Show KYC notice in transaction list, and don't render fees when 
zero
---
 .../wallet/payment/TransactionPaymentComposable.kt | 13 +++++++----
 .../wallet/refund/TransactionRefundComposable.kt   | 13 +++++++----
 .../wallet/transactions/TransactionAdapter.kt      | 27 ++++++++++++++++++----
 .../withdraw/TransactionWithdrawalComposable.kt    | 13 +++++++----
 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),

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]