summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2023-07-04 11:03:41 -0600
committerIván Ávalos <avalos@disroot.org>2023-07-04 11:03:41 -0600
commit1f74a55a9ad72999d7f5421eaedb3898a62c9675 (patch)
tree854b21051f032153ac2468f7196ace985fdf7858
parent665fbef3beff0f6b1e2ee83699a15984fe2e400d (diff)
downloadtaler-android-dev/ivan-avalos/dd37.tar.gz
taler-android-dev/ivan-avalos/dd37.tar.bz2
taler-android-dev/ivan-avalos/dd37.zip
[wallet] Fully remove deprecated status fieldsdev/ivan-avalos/dd37
-rw-r--r--wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt32
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt40
3 files changed, 27 insertions, 47 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 19dd11d..e6a65d1 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt
@@ -40,7 +40,6 @@ import net.taler.wallet.backend.TalerErrorInfo
import net.taler.wallet.compose.TalerSurface
import net.taler.wallet.transactions.AmountType
import net.taler.wallet.transactions.ErrorTransactionButton
-import net.taler.wallet.transactions.PaymentStatus
import net.taler.wallet.transactions.TransactionAction
import net.taler.wallet.transactions.TransactionAction.Abort
import net.taler.wallet.transactions.TransactionAction.Retry
@@ -148,7 +147,6 @@ fun TransactionPaymentComposablePreview() {
fulfillmentUrl = "https://bank.demo.taler.net/",
products = listOf(),
),
- status = PaymentStatus.Paid,
amountRaw = Amount.fromString("TESTKUDOS", "42.1337"),
amountEffective = Amount.fromString("TESTKUDOS", "42.23"),
error = TalerErrorInfo(code = TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED),
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 dd46a92..958ba0c 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
@@ -36,7 +36,17 @@ import net.taler.common.exhaustive
import net.taler.common.toRelativeTime
import net.taler.wallet.R
import net.taler.wallet.transactions.TransactionAdapter.TransactionViewHolder
+import net.taler.wallet.transactions.TransactionMajorState.Aborted
+import net.taler.wallet.transactions.TransactionMajorState.Aborting
+import net.taler.wallet.transactions.TransactionMajorState.Deleted
+import net.taler.wallet.transactions.TransactionMajorState.Dialog
+import net.taler.wallet.transactions.TransactionMajorState.Done
+import net.taler.wallet.transactions.TransactionMajorState.Failed
+import net.taler.wallet.transactions.TransactionMajorState.None
import net.taler.wallet.transactions.TransactionMajorState.Pending
+import net.taler.wallet.transactions.TransactionMajorState.Suspended
+import net.taler.wallet.transactions.TransactionMajorState.SuspendedAborting
+import net.taler.wallet.transactions.TransactionMajorState.Unknown
internal class TransactionAdapter(
private val listener: OnTransactionClickListener
@@ -115,12 +125,24 @@ internal class TransactionAdapter(
extraInfoView.setText(R.string.withdraw_waiting_confirm)
extraInfoView.setTextColor(amountColor)
extraInfoView.visibility = VISIBLE
- } else if (transaction is TransactionPayment && transaction.status != PaymentStatus.Paid && transaction.status != PaymentStatus.Accepted) {
- extraInfoView.setText(if (transaction.status == PaymentStatus.Aborted) R.string.payment_aborted else R.string.payment_failed)
- extraInfoView.setTextColor(amountColor)
- extraInfoView.visibility = VISIBLE
} else {
- extraInfoView.visibility = GONE
+ when (transaction.txState.major) {
+ Aborted -> R.string.payment_aborted
+ Failed -> R.string.payment_failed
+ None -> null
+ Pending -> null
+ Done -> null
+ Aborting -> null
+ Suspended -> null
+ Dialog -> null
+ SuspendedAborting -> null
+ Deleted -> null
+ Unknown -> null
+ }?.let {
+ extraInfoView.setText(it)
+ } ?: {
+ extraInfoView.visibility = GONE
+ }
}
}
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
index cb917db..62e458b 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
@@ -120,30 +120,6 @@ sealed class Transaction {
}
@Serializable
-enum class ExtendedStatus {
- @SerialName("pending")
- Pending,
-
- @SerialName("done")
- Done,
-
- @SerialName("aborting")
- Aborting,
-
- @SerialName("aborted")
- Aborted,
-
- @SerialName("suspended")
- Suspended,
-
- @SerialName("failed")
- Failed,
-
- @SerialName("deleted")
- Deleted;
-}
-
-@Serializable
enum class TransactionAction {
// Common States
@SerialName("delete")
@@ -238,7 +214,6 @@ class TransactionPayment(
override val txState: TransactionState,
override val txActions: List<TransactionAction>,
val info: TransactionInfo,
- val status: PaymentStatus,
override val error: TalerErrorInfo? = null,
override val amountRaw: Amount,
override val amountEffective: Amount,
@@ -272,21 +247,6 @@ class TransactionInfo(
)
@Serializable
-enum class PaymentStatus {
- @SerialName("aborted")
- Aborted,
-
- @SerialName("failed")
- Failed,
-
- @SerialName("paid")
- Paid,
-
- @SerialName("accepted")
- Accepted
-}
-
-@Serializable
@SerialName("refund")
class TransactionRefund(
override val transactionId: String,