aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainViewModel.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/JsonDialogFragment.kt (renamed from wallet/src/main/java/net/taler/wallet/history/JsonDialogFragment.kt)2
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/ReserveTransaction.kt (renamed from wallet/src/main/java/net/taler/wallet/history/ReserveTransaction.kt)2
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/Transaction.kt (renamed from wallet/src/main/java/net/taler/wallet/history/HistoryEvent.kt)132
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt (renamed from wallet/src/main/java/net/taler/wallet/history/HistoryAdapter.kt)112
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt (renamed from wallet/src/main/java/net/taler/wallet/history/HistoryEventFragment.kt)30
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionManager.kt (renamed from wallet/src/main/java/net/taler/wallet/history/HistoryManager.kt)50
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt (renamed from wallet/src/main/java/net/taler/wallet/history/HistoryFragment.kt)73
-rw-r--r--wallet/src/main/res/drawable/transaction_payment_aborted.xml (renamed from wallet/src/main/res/drawable/history_payment_aborted.xml)0
-rw-r--r--wallet/src/main/res/drawable/transaction_refresh.xml (renamed from wallet/src/main/res/drawable/history_refresh.xml)0
-rw-r--r--wallet/src/main/res/drawable/transaction_refund.xml (renamed from wallet/src/main/res/drawable/history_refund.xml)0
-rw-r--r--wallet/src/main/res/drawable/transaction_tip_accepted.xml (renamed from wallet/src/main/res/drawable/history_tip_accepted.xml)0
-rw-r--r--wallet/src/main/res/drawable/transaction_tip_declined.xml (renamed from wallet/src/main/res/drawable/history_tip_declined.xml)0
-rw-r--r--wallet/src/main/res/drawable/transaction_withdrawal.xml (renamed from wallet/src/main/res/drawable/history_withdrawn.xml)0
-rw-r--r--wallet/src/main/res/layout/fragment_event_paid.xml30
-rw-r--r--wallet/src/main/res/layout/fragment_event_withdraw.xml12
-rw-r--r--wallet/src/main/res/layout/fragment_transactions.xml (renamed from wallet/src/main/res/layout/fragment_show_history.xml)8
-rw-r--r--wallet/src/main/res/layout/transaction_in.xml (renamed from wallet/src/main/res/layout/history_receive.xml)6
-rw-r--r--wallet/src/main/res/layout/transaction_out.xml (renamed from wallet/src/main/res/layout/history_payment.xml)4
-rw-r--r--wallet/src/main/res/layout/transaction_row.xml (renamed from wallet/src/main/res/layout/history_row.xml)4
-rw-r--r--wallet/src/main/res/menu/fragment_main.xml (renamed from wallet/src/main/res/menu/balance.xml)0
-rw-r--r--wallet/src/main/res/menu/transactions.xml (renamed from wallet/src/main/res/menu/history.xml)11
-rw-r--r--wallet/src/main/res/menu/transactions_detail.xml (renamed from wallet/src/main/res/menu/history_event.xml)2
-rw-r--r--wallet/src/main/res/navigation/nav_graph.xml21
-rw-r--r--wallet/src/main/res/values/strings.xml74
-rw-r--r--wallet/src/main/res/values/styles.xml8
-rw-r--r--wallet/src/main/res/xml/settings_main.xml2
-rw-r--r--wallet/src/test/java/net/taler/wallet/transactions/ReserveTransactionTest.kt (renamed from wallet/src/test/java/net/taler/wallet/history/ReserveTransactionTest.kt)2
-rw-r--r--wallet/src/test/java/net/taler/wallet/transactions/TransactionTest.kt (renamed from wallet/src/test/java/net/taler/wallet/history/HistoryEventTest.kt)120
30 files changed, 339 insertions, 374 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/MainFragment.kt b/wallet/src/main/java/net/taler/wallet/MainFragment.kt
index f587aca..2145596 100644
--- a/wallet/src/main/java/net/taler/wallet/MainFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/MainFragment.kt
@@ -88,7 +88,7 @@ class MainFragment : Fragment(), BalanceClickListener {
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- inflater.inflate(R.menu.balance, menu)
+ inflater.inflate(R.menu.fragment_main, menu)
super.onCreateOptionsMenu(menu, inflater)
}
@@ -117,7 +117,7 @@ class MainFragment : Fragment(), BalanceClickListener {
}
override fun onBalanceClick(currency: String) {
- findNavController().navigate(R.id.walletHistory)
+ findNavController().navigate(R.id.nav_transactions)
}
}
diff --git a/wallet/src/main/java/net/taler/wallet/MainViewModel.kt b/wallet/src/main/java/net/taler/wallet/MainViewModel.kt
index e5f385a..c1662c8 100644
--- a/wallet/src/main/java/net/taler/wallet/MainViewModel.kt
+++ b/wallet/src/main/java/net/taler/wallet/MainViewModel.kt
@@ -28,7 +28,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule
import net.taler.common.Amount
import net.taler.wallet.backend.WalletBackendApi
-import net.taler.wallet.history.HistoryManager
+import net.taler.wallet.transactions.TransactionManager
import net.taler.wallet.payment.PaymentManager
import net.taler.wallet.pending.PendingOperationsManager
import net.taler.wallet.refund.RefundManager
@@ -66,7 +66,7 @@ class MainViewModel(val app: Application) : AndroidViewModel(app) {
val withdrawManager = WithdrawManager(walletBackendApi)
val paymentManager = PaymentManager(walletBackendApi, mapper)
val pendingOperationsManager = PendingOperationsManager(walletBackendApi)
- val historyManager = HistoryManager(walletBackendApi, mapper)
+ val transactionManager = TransactionManager(walletBackendApi, mapper)
val refundManager = RefundManager(walletBackendApi)
override fun onCleared() {
diff --git a/wallet/src/main/java/net/taler/wallet/history/JsonDialogFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/JsonDialogFragment.kt
index 5421db3..4139da8 100644
--- a/wallet/src/main/java/net/taler/wallet/history/JsonDialogFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/JsonDialogFragment.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.history
+package net.taler.wallet.transactions
import android.os.Bundle
import android.view.LayoutInflater
diff --git a/wallet/src/main/java/net/taler/wallet/history/ReserveTransaction.kt b/wallet/src/main/java/net/taler/wallet/transactions/ReserveTransaction.kt
index 6c8fdaa..e497e9a 100644
--- a/wallet/src/main/java/net/taler/wallet/history/ReserveTransaction.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/ReserveTransaction.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.history
+package net.taler.wallet.transactions
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonSubTypes
diff --git a/wallet/src/main/java/net/taler/wallet/history/HistoryEvent.kt b/wallet/src/main/java/net/taler/wallet/transactions/Transaction.kt
index af017ed..5fcabe7 100644
--- a/wallet/src/main/java/net/taler/wallet/history/HistoryEvent.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/Transaction.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.history
+package net.taler.wallet.transactions
import androidx.annotation.DrawableRes
import androidx.annotation.LayoutRes
@@ -93,13 +93,13 @@ class ReserveShortInfo(
val reserveCreationDetail: ReserveCreationDetail
)
-typealias History = ArrayList<HistoryEvent>
+typealias Transactions = ArrayList<Transaction>
@JsonTypeInfo(
use = NAME,
include = PROPERTY,
property = "type",
- defaultImpl = HistoryUnknownEvent::class
+ defaultImpl = UnknownTransaction::class
)
/** missing:
AuditorComplaintSent = "auditor-complained-sent",
@@ -117,27 +117,27 @@ ReserveCreated = "reserve-created",
@JsonSubTypes(
Type(value = ExchangeAddedEvent::class, name = "exchange-added"),
Type(value = ExchangeUpdatedEvent::class, name = "exchange-updated"),
- Type(value = ReserveBalanceUpdatedEvent::class, name = "reserve-balance-updated"),
- Type(value = HistoryWithdrawnEvent::class, name = "withdrawn"),
- Type(value = HistoryOrderAcceptedEvent::class, name = "order-accepted"),
- Type(value = HistoryOrderRefusedEvent::class, name = "order-refused"),
- Type(value = HistoryOrderRedirectedEvent::class, name = "order-redirected"),
- Type(value = HistoryPaymentSentEvent::class, name = "payment-sent"),
- Type(value = HistoryPaymentAbortedEvent::class, name = "payment-aborted"),
- Type(value = HistoryTipAcceptedEvent::class, name = "tip-accepted"),
- Type(value = HistoryTipDeclinedEvent::class, name = "tip-declined"),
- Type(value = HistoryRefundedEvent::class, name = "refund"),
- Type(value = HistoryRefreshedEvent::class, name = "refreshed")
+ Type(value = ReserveBalanceUpdatedTransaction::class, name = "reserve-balance-updated"),
+ Type(value = WithdrawTransaction::class, name = "withdrawn"),
+ Type(value = OrderAcceptedTransaction::class, name = "order-accepted"),
+ Type(value = OrderRefusedTransaction::class, name = "order-refused"),
+ Type(value = OrderRedirectedTransaction::class, name = "order-redirected"),
+ Type(value = PaymentTransaction::class, name = "payment-sent"),
+ Type(value = PaymentAbortedTransaction::class, name = "payment-aborted"),
+ Type(value = TipAcceptedTransaction::class, name = "tip-accepted"),
+ Type(value = TipDeclinedTransaction::class, name = "tip-declined"),
+ Type(value = RefundTransaction::class, name = "refund"),
+ Type(value = RefreshTransaction::class, name = "refreshed")
)
@JsonIgnoreProperties(
value = [
"eventId"
]
)
-abstract class HistoryEvent(
+abstract class Transaction(
val timestamp: Timestamp,
@get:LayoutRes
- open val layout: Int = R.layout.history_row,
+ open val layout: Int = R.layout.transaction_row,
@get:LayoutRes
open val detailPageLayout: Int = 0,
@get:StringRes
@@ -150,8 +150,8 @@ abstract class HistoryEvent(
}
-class HistoryUnknownEvent(timestamp: Timestamp) : HistoryEvent(timestamp) {
- override val title = R.string.history_event_unknown
+class UnknownTransaction(timestamp: Timestamp) : Transaction(timestamp) {
+ override val title = R.string.transaction_unknown
}
@JsonTypeName("exchange-added")
@@ -159,7 +159,7 @@ class ExchangeAddedEvent(
timestamp: Timestamp,
val exchangeBaseUrl: String,
val builtIn: Boolean
-) : HistoryEvent(timestamp) {
+) : Transaction(timestamp) {
override val title = R.string.history_event_exchange_added
}
@@ -167,13 +167,13 @@ class ExchangeAddedEvent(
class ExchangeUpdatedEvent(
timestamp: Timestamp,
val exchangeBaseUrl: String
-) : HistoryEvent(timestamp) {
+) : Transaction(timestamp) {
override val title = R.string.history_event_exchange_updated
}
@JsonTypeName("reserve-balance-updated")
-class ReserveBalanceUpdatedEvent(
+class ReserveBalanceUpdatedTransaction(
timestamp: Timestamp,
/**
* Condensed information about the reserve.
@@ -192,12 +192,12 @@ class ReserveBalanceUpdatedEvent(
* Amount that hasn't been withdrawn yet.
*/
val reserveUnclaimedAmount: Amount
-) : HistoryEvent(timestamp) {
- override val title = R.string.history_event_reserve_balance_updated
+) : Transaction(timestamp) {
+ override val title = R.string.transaction_reserve_balance_updated
}
@JsonTypeName("withdrawn")
-class HistoryWithdrawnEvent(
+class WithdrawTransaction(
timestamp: Timestamp,
/**
* Exchange that was withdrawn from.
@@ -218,40 +218,40 @@ class HistoryWithdrawnEvent(
* Amount that actually was added to the wallet's balance.
*/
val amountWithdrawnEffective: Amount
-) : HistoryEvent(timestamp) {
- override val layout = R.layout.history_receive
+) : Transaction(timestamp) {
+ override val layout = R.layout.transaction_in
override val detailPageLayout = R.layout.fragment_event_withdraw
- override val title = R.string.history_event_withdrawn
- override val icon = R.drawable.history_withdrawn
+ override val title = R.string.transaction_withdrawal
+ override val icon = R.drawable.transaction_withdrawal
override val showToUser = true
}
@JsonTypeName("order-accepted")
-class HistoryOrderAcceptedEvent(
+class OrderAcceptedTransaction(
timestamp: Timestamp,
/**
* Condensed info about the order.
*/
val orderShortInfo: OrderShortInfo
-) : HistoryEvent(timestamp) {
+) : Transaction(timestamp) {
override val icon = R.drawable.ic_add_circle
- override val title = R.string.history_event_order_accepted
+ override val title = R.string.transaction_order_accepted
}
@JsonTypeName("order-refused")
-class HistoryOrderRefusedEvent(
+class OrderRefusedTransaction(
timestamp: Timestamp,
/**
* Condensed info about the order.
*/
val orderShortInfo: OrderShortInfo
-) : HistoryEvent(timestamp) {
+) : Transaction(timestamp) {
override val icon = R.drawable.ic_cancel
- override val title = R.string.history_event_order_refused
+ override val title = R.string.transaction_order_refused
}
@JsonTypeName("payment-sent")
-class HistoryPaymentSentEvent(
+class PaymentTransaction(
timestamp: Timestamp,
/**
* Condensed info about the order that we already paid for.
@@ -274,16 +274,16 @@ class HistoryPaymentSentEvent(
* Session ID that the payment was (re-)submitted under.
*/
val sessionId: String?
-) : HistoryEvent(timestamp) {
- override val layout = R.layout.history_payment
+) : Transaction(timestamp) {
+ override val layout = R.layout.transaction_out
override val detailPageLayout = R.layout.fragment_event_paid
- override val title = R.string.history_event_payment_sent
+ override val title = R.string.transaction_payment
override val icon = R.drawable.ic_cash_usd_outline
override val showToUser = true
}
@JsonTypeName("payment-aborted")
-class HistoryPaymentAbortedEvent(
+class PaymentAbortedTransaction(
timestamp: Timestamp,
/**
* Condensed info about the order that we already paid for.
@@ -293,15 +293,15 @@ class HistoryPaymentAbortedEvent(
* Amount that was lost due to refund and refreshing fees.
*/
val amountLost: Amount
-) : HistoryEvent(timestamp) {
- override val layout = R.layout.history_payment
- override val title = R.string.history_event_payment_aborted
- override val icon = R.drawable.history_payment_aborted
+) : Transaction(timestamp) {
+ override val layout = R.layout.transaction_out
+ override val title = R.string.transaction_payment_aborted
+ override val icon = R.drawable.transaction_payment_aborted
override val showToUser = true
}
@JsonTypeName("refreshed")
-class HistoryRefreshedEvent(
+class RefreshTransaction(
timestamp: Timestamp,
/**
* Amount that is now available again because it has
@@ -324,15 +324,15 @@ class HistoryRefreshedEvent(
* more refresh session IDs.
*/
val refreshGroupId: String
-) : HistoryEvent(timestamp) {
- override val layout = R.layout.history_payment
- override val icon = R.drawable.history_refresh
- override val title = R.string.history_event_refreshed
+) : Transaction(timestamp) {
+ override val layout = R.layout.transaction_out
+ override val icon = R.drawable.transaction_refresh
+ override val title = R.string.transaction_refresh
override val showToUser = !(amountRefreshedRaw - amountRefreshedEffective).isZero()
}
@JsonTypeName("order-redirected")
-class HistoryOrderRedirectedEvent(
+class OrderRedirectedTransaction(
timestamp: Timestamp,
/**
* Condensed info about the new order that contains a
@@ -343,13 +343,13 @@ class HistoryOrderRedirectedEvent(
* Condensed info about the order that we already paid for.
*/
val alreadyPaidOrderShortInfo: OrderShortInfo
-) : HistoryEvent(timestamp) {
+) : Transaction(timestamp) {
override val icon = R.drawable.ic_directions
- override val title = R.string.history_event_order_redirected
+ override val title = R.string.transaction_order_redirected
}
@JsonTypeName("tip-accepted")
-class HistoryTipAcceptedEvent(
+class TipAcceptedTransaction(
timestamp: Timestamp,
/**
* Unique identifier for the tip to query more information.
@@ -359,15 +359,15 @@ class HistoryTipAcceptedEvent(
* Raw amount of the tip, without extra fees that apply.
*/
val tipRaw: Amount
-) : HistoryEvent(timestamp) {
- override val icon = R.drawable.history_tip_accepted
- override val title = R.string.history_event_tip_accepted
- override val layout = R.layout.history_receive
+) : Transaction(timestamp) {
+ override val icon = R.drawable.transaction_tip_accepted
+ override val title = R.string.transaction_tip_accepted
+ override val layout = R.layout.transaction_in
override val showToUser = true
}
@JsonTypeName("tip-declined")
-class HistoryTipDeclinedEvent(
+class TipDeclinedTransaction(
timestamp: Timestamp,
/**
* Unique identifier for the tip to query more information.
@@ -377,15 +377,15 @@ class HistoryTipDeclinedEvent(
* Raw amount of the tip, without extra fees that apply.
*/
val tipAmount: Amount
-) : HistoryEvent(timestamp) {
- override val icon = R.drawable.history_tip_declined
- override val title = R.string.history_event_tip_declined
- override val layout = R.layout.history_receive
+) : Transaction(timestamp) {
+ override val icon = R.drawable.transaction_tip_declined
+ override val title = R.string.transaction_tip_declined
+ override val layout = R.layout.transaction_in
override val showToUser = true
}
@JsonTypeName("refund")
-class HistoryRefundedEvent(
+class RefundTransaction(
timestamp: Timestamp,
val orderShortInfo: OrderShortInfo,
/**
@@ -406,10 +406,10 @@ class HistoryRefundedEvent(
* Amount will be added to the wallet's balance after fees and refreshing.
*/
val amountRefundedEffective: Amount
-) : HistoryEvent(timestamp) {
- override val icon = R.drawable.history_refund
- override val title = R.string.history_event_refund
- override val layout = R.layout.history_receive
+) : Transaction(timestamp) {
+ override val icon = R.drawable.transaction_refund
+ override val title = R.string.transaction_refund
+ override val layout = R.layout.transaction_in
override val detailPageLayout = R.layout.fragment_event_paid
override val showToUser = true
}
diff --git a/wallet/src/main/java/net/taler/wallet/history/HistoryAdapter.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
index b9770fb..beebcda 100644
--- a/wallet/src/main/java/net/taler/wallet/history/HistoryAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.history
+package net.taler.wallet.transactions
import android.content.Context
import android.graphics.Paint.STRIKE_THRU_TEXT_FLAG
@@ -29,43 +29,43 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder
import net.taler.common.toRelativeTime
import net.taler.wallet.R
import net.taler.wallet.cleanExchange
-import net.taler.wallet.history.HistoryAdapter.HistoryEventViewHolder
+import net.taler.wallet.transactions.TransactionAdapter.TransactionViewHolder
-internal class HistoryAdapter(
+internal class TransactionAdapter(
private val devMode: Boolean,
private val listener: OnEventClickListener,
- private var history: History = History()
-) : Adapter<HistoryEventViewHolder>() {
+ private var transactions: Transactions = Transactions()
+) : Adapter<TransactionViewHolder>() {
init {
setHasStableIds(false)
}
- override fun getItemViewType(position: Int): Int = history[position].layout
+ override fun getItemViewType(position: Int): Int = transactions[position].layout
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HistoryEventViewHolder {
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TransactionViewHolder {
val view = LayoutInflater.from(parent.context).inflate(viewType, parent, false)
return when (viewType) {
- R.layout.history_receive -> HistoryReceiveViewHolder(view)
- R.layout.history_payment -> HistoryPaymentViewHolder(view)
- else -> GenericHistoryEventViewHolder(view)
+ R.layout.transaction_in -> TransactionInViewHolder(view)
+ R.layout.transaction_out -> TransactionOutViewHolder(view)
+ else -> GenericTransactionViewHolder(view)
}
}
- override fun getItemCount(): Int = history.size
+ override fun getItemCount(): Int = transactions.size
- override fun onBindViewHolder(holder: HistoryEventViewHolder, position: Int) {
- val event = history[position]
+ override fun onBindViewHolder(holder: TransactionViewHolder, position: Int) {
+ val event = transactions[position]
holder.bind(event)
}
- fun update(updatedHistory: History) {
- this.history = updatedHistory
+ fun update(updatedTransactions: Transactions) {
+ this.transactions = updatedTransactions
this.notifyDataSetChanged()
}
- internal abstract inner class HistoryEventViewHolder(private val v: View) : ViewHolder(v) {
+ internal abstract inner class TransactionViewHolder(private val v: View) : ViewHolder(v) {
protected val context: Context = v.context
private val icon: ImageView = v.findViewById(R.id.icon)
@@ -74,7 +74,7 @@ internal class HistoryAdapter(
private val selectableBackground = v.background
@CallSuper
- open fun bind(event: HistoryEvent) {
+ open fun bind(event: Transaction) {
if (devMode || event.detailPageLayout != 0) {
v.background = selectableBackground
v.setOnClickListener { listener.onEventClicked(event) }
@@ -90,103 +90,103 @@ internal class HistoryAdapter(
}
- internal inner class GenericHistoryEventViewHolder(v: View) : HistoryEventViewHolder(v) {
+ internal inner class GenericTransactionViewHolder(v: View) : TransactionViewHolder(v) {
private val info: TextView = v.findViewById(R.id.info)
- override fun bind(event: HistoryEvent) {
- super.bind(event)
- info.text = when (event) {
- is ExchangeAddedEvent -> cleanExchange(event.exchangeBaseUrl)
- is ExchangeUpdatedEvent -> cleanExchange(event.exchangeBaseUrl)
- is ReserveBalanceUpdatedEvent -> event.reserveBalance.toString()
- is HistoryPaymentSentEvent -> event.orderShortInfo.summary
- is HistoryOrderAcceptedEvent -> event.orderShortInfo.summary
- is HistoryOrderRefusedEvent -> event.orderShortInfo.summary
- is HistoryOrderRedirectedEvent -> event.newOrderShortInfo.summary
+ override fun bind(transaction: Transaction) {
+ super.bind(transaction)
+ info.text = when (transaction) {
+ is ExchangeAddedEvent -> cleanExchange(transaction.exchangeBaseUrl)
+ is ExchangeUpdatedEvent -> cleanExchange(transaction.exchangeBaseUrl)
+ is ReserveBalanceUpdatedTransaction -> transaction.reserveBalance.toString()
+ is PaymentTransaction -> transaction.orderShortInfo.summary
+ is OrderAcceptedTransaction -> transaction.orderShortInfo.summary
+ is OrderRefusedTransaction -> transaction.orderShortInfo.summary
+ is OrderRedirectedTransaction -> transaction.newOrderShortInfo.summary
else -> ""
}
}
}
- internal inner class HistoryReceiveViewHolder(v: View) : HistoryEventViewHolder(v) {
+ internal inner class TransactionInViewHolder(v: View) : TransactionViewHolder(v) {
private val summary: TextView = v.findViewById(R.id.summary)
private val amountWithdrawn: TextView = v.findViewById(R.id.amountWithdrawn)
private val paintFlags = amountWithdrawn.paintFlags
- override fun bind(event: HistoryEvent) {
+ override fun bind(event: Transaction) {
super.bind(event)
when (event) {
- is HistoryWithdrawnEvent -> bind(event)
- is HistoryRefundedEvent -> bind(event)
- is HistoryTipAcceptedEvent -> bind(event)
- is HistoryTipDeclinedEvent -> bind(event)
+ is WithdrawTransaction -> bind(event)
+ is RefundTransaction -> bind(event)
+ is TipAcceptedTransaction -> bind(event)
+ is TipDeclinedTransaction -> bind(event)
}
}
- private fun bind(event: HistoryWithdrawnEvent) {
+ private fun bind(event: WithdrawTransaction) {
summary.text = cleanExchange(event.exchangeBaseUrl)
amountWithdrawn.text =
context.getString(R.string.amount_positive, event.amountWithdrawnEffective)
amountWithdrawn.paintFlags = paintFlags
}
- private fun bind(event: HistoryRefundedEvent) {
+ private fun bind(event: RefundTransaction) {
summary.text = event.orderShortInfo.summary
amountWithdrawn.text =
context.getString(R.string.amount_positive, event.amountRefundedEffective)
amountWithdrawn.paintFlags = paintFlags
}
- private fun bind(event: HistoryTipAcceptedEvent) {
+ private fun bind(transaction: TipAcceptedTransaction) {
summary.text = null
- amountWithdrawn.text = context.getString(R.string.amount_positive, event.tipRaw)
+ amountWithdrawn.text = context.getString(R.string.amount_positive, transaction.tipRaw)
amountWithdrawn.paintFlags = paintFlags
}
- private fun bind(event: HistoryTipDeclinedEvent) {
+ private fun bind(transaction: TipDeclinedTransaction) {
summary.text = null
- amountWithdrawn.text = context.getString(R.string.amount_positive, event.tipAmount)
+ amountWithdrawn.text = context.getString(R.string.amount_positive, transaction.tipAmount)
amountWithdrawn.paintFlags = amountWithdrawn.paintFlags or STRIKE_THRU_TEXT_FLAG
}
}
- internal inner class HistoryPaymentViewHolder(v: View) : HistoryEventViewHolder(v) {
+ internal inner class TransactionOutViewHolder(v: View) : TransactionViewHolder(v) {
private val summary: TextView = v.findViewById(R.id.summary)
private val amountPaidWithFees: TextView = v.findViewById(R.id.amountPaidWithFees)
- override fun bind(event: HistoryEvent) {
+ override fun bind(event: Transaction) {
super.bind(event)
when (event) {
- is HistoryPaymentSentEvent -> bind(event)
- is HistoryPaymentAbortedEvent -> bind(event)
- is HistoryRefreshedEvent -> bind(event)
+ is PaymentTransaction -> bind(event)
+ is PaymentAbortedTransaction -> bind(event)
+ is RefreshTransaction -> bind(event)
}
}
- private fun bind(event: HistoryPaymentSentEvent) {
+ private fun bind(event: PaymentTransaction) {
summary.text = event.orderShortInfo.summary
amountPaidWithFees.text =
context.getString(R.string.amount_negative, event.amountPaidWithFees)
}
- private fun bind(event: HistoryPaymentAbortedEvent) {
- summary.text = event.orderShortInfo.summary
- amountPaidWithFees.text = context.getString(R.string.amount_negative, event.amountLost)
+ private fun bind(transaction: PaymentAbortedTransaction) {
+ summary.text = transaction.orderShortInfo.summary
+ amountPaidWithFees.text = context.getString(R.string.amount_negative, transaction.amountLost)
}
- private fun bind(event: HistoryRefreshedEvent) {
+ private fun bind(event: RefreshTransaction) {
val res = when (event.refreshReason) {
- RefreshReason.MANUAL -> R.string.history_event_refresh_reason_manual
- RefreshReason.PAY -> R.string.history_event_refresh_reason_pay
- RefreshReason.REFUND -> R.string.history_event_refresh_reason_refund
- RefreshReason.ABORT_PAY -> R.string.history_event_refresh_reason_abort_pay
- RefreshReason.RECOUP -> R.string.history_event_refresh_reason_recoup
- RefreshReason.BACKUP_RESTORED -> R.string.history_event_refresh_reason_backup_restored
+ RefreshReason.MANUAL -> R.string.transaction_refresh_reason_manual
+ RefreshReason.PAY -> R.string.transaction_refresh_reason_pay
+ RefreshReason.REFUND -> R.string.transaction_refresh_reason_refund
+ RefreshReason.ABORT_PAY -> R.string.transaction_refresh_reason_abort_pay
+ RefreshReason.RECOUP -> R.string.transaction_refresh_reason_recoup
+ RefreshReason.BACKUP_RESTORED -> R.string.transaction_refresh_reason_backup_restored
}
summary.text = context.getString(res)
val fee = event.amountRefreshedRaw - event.amountRefreshedEffective
diff --git a/wallet/src/main/java/net/taler/wallet/history/HistoryEventFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
index b6a2a33..f198215 100644
--- a/wallet/src/main/java/net/taler/wallet/history/HistoryEventFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.history
+package net.taler.wallet.transactions
import android.os.Bundle
import android.view.LayoutInflater
@@ -34,15 +34,15 @@ import kotlinx.android.synthetic.main.fragment_event_withdraw.feeView
import kotlinx.android.synthetic.main.fragment_event_withdraw.timeView
import net.taler.common.Amount
import net.taler.common.toAbsoluteTime
-import net.taler.wallet.R
import net.taler.wallet.MainViewModel
+import net.taler.wallet.R
import net.taler.wallet.cleanExchange
-class HistoryEventFragment : Fragment() {
+class TransactionDetailFragment : Fragment() {
private val model: MainViewModel by activityViewModels()
- private val historyManager by lazy { model.historyManager }
- private val event by lazy { requireNotNull(historyManager.selectedEvent) }
+ private val transactionManager by lazy { model.transactionManager }
+ private val event by lazy { requireNotNull(transactionManager.selectedEvent) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -59,15 +59,15 @@ class HistoryEventFragment : Fragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
requireActivity().title =
- getString(if (event.title != 0) event.title else R.string.history_detail_title)
+ getString(if (event.title != 0) event.title else R.string.transactions_detail_title)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
timeView.text = event.timestamp.ms.toAbsoluteTime(requireContext())
when (val e = event) {
- is HistoryWithdrawnEvent -> bind(e)
- is HistoryPaymentSentEvent -> bind(e)
- is HistoryRefundedEvent -> bind(e)
+ is WithdrawTransaction -> bind(e)
+ is PaymentTransaction -> bind(e)
+ is RefundTransaction -> bind(e)
else -> Toast.makeText(
requireContext(),
"event ${e.javaClass} not implement",
@@ -77,7 +77,7 @@ class HistoryEventFragment : Fragment() {
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- inflater.inflate(R.menu.history_event, menu)
+ inflater.inflate(R.menu.transactions_detail, menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
@@ -90,7 +90,7 @@ class HistoryEventFragment : Fragment() {
}
}
- private fun bind(event: HistoryWithdrawnEvent) {
+ private fun bind(event: WithdrawTransaction) {
effectiveAmountLabel.text = getString(R.string.withdraw_total)
effectiveAmountView.text = event.amountWithdrawnEffective.toString()
chosenAmountLabel.text = getString(R.string.amount_chosen)
@@ -101,14 +101,14 @@ class HistoryEventFragment : Fragment() {
exchangeView.text = cleanExchange(event.exchangeBaseUrl)
}
- private fun bind(event: HistoryPaymentSentEvent) {
+ private fun bind(event: PaymentTransaction) {
amountPaidWithFeesView.text = event.amountPaidWithFees.toString()
val fee = event.amountPaidWithFees - event.orderShortInfo.amount
bindOrderAndFee(event.orderShortInfo, fee)
}
- private fun bind(event: HistoryRefundedEvent) {
- amountPaidWithFeesLabel.text = getString(R.string.history_event_refund)
+ private fun bind(event: RefundTransaction) {
+ amountPaidWithFeesLabel.text = getString(R.string.transaction_refund)
amountPaidWithFeesView.setTextColor(getColor(requireContext(), R.color.green))
amountPaidWithFeesView.text =
getString(R.string.amount_positive, event.amountRefundedEffective.toString())
@@ -121,7 +121,7 @@ class HistoryEventFragment : Fragment() {
feeView.text = getString(R.string.amount_negative, fee.toString())
orderSummaryView.text = orderShortInfo.summary
orderIdView.text =
- getString(R.string.history_event_payment_sent_order_id, orderShortInfo.orderId)
+ getString(R.string.transaction_order_id, orderShortInfo.orderId)
}
}
diff --git a/wallet/src/main/java/net/taler/wallet/history/HistoryManager.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionManager.kt
index 7ce4f5b..c4ab785 100644
--- a/wallet/src/main/java/net/taler/wallet/history/HistoryManager.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionManager.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.history
+package net.taler.wallet.transactions
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
@@ -27,15 +27,16 @@ import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onStart
+import kotlinx.coroutines.launch
import net.taler.wallet.backend.WalletBackendApi
-sealed class HistoryResult {
- object Error : HistoryResult()
- class Success(val history: History) : HistoryResult()
+sealed class TransactionsResult {
+ object Error : TransactionsResult()
+ class Success(val transactions: Transactions) : TransactionsResult()
}
@Suppress("EXPERIMENTAL_API_USAGE")
-class HistoryManager(
+class TransactionManager(
private val walletBackendApi: WalletBackendApi,
private val mapper: ObjectMapper
) {
@@ -45,33 +46,36 @@ class HistoryManager(
val showAll = MutableLiveData<Boolean>()
- var selectedEvent: HistoryEvent? = null
+ var selectedEvent: Transaction? = null
- val history: LiveData<HistoryResult> = showAll.switchMap { showAll ->
- loadHistory(showAll)
+ val transactions: LiveData<TransactionsResult> = showAll.switchMap { showAll ->
+ loadTransactions(showAll)
.onStart { mProgress.postValue(true) }
.onCompletion { mProgress.postValue(false) }
.asLiveData(Dispatchers.IO)
}
- private fun loadHistory(showAll: Boolean) = callbackFlow {
+ private fun loadTransactions(showAll: Boolean) = callbackFlow {
walletBackendApi.sendRequest("getHistory", null) { isError, result ->
- if (isError) {
- offer(HistoryResult.Error)
+ launch(Dispatchers.Default) {
+ if (isError) {
+ offer(TransactionsResult.Error)
+ close()
+ return@launch
+ }
+ val transactions = Transactions()
+ val json = result.getJSONArray("history")
+ for (i in 0 until json.length()) {
+ val event: Transaction = mapper.readValue(json.getString(i))
+ event.json = json.getJSONObject(i)
+ transactions.add(event)
+ }
+ transactions.reverse() // show latest first
+ val filtered =
+ if (showAll) transactions else transactions.filter { it.showToUser } as Transactions
+ offer(TransactionsResult.Success(filtered))
close()
- return@sendRequest
}
- val history = History()
- val json = result.getJSONArray("history")
- for (i in 0 until json.length()) {
- val event: HistoryEvent = mapper.readValue(json.getString(i))
- event.json = json.getJSONObject(i)
- history.add(event)
- }
- history.reverse() // show latest first
- val filtered = if (showAll) history else history.filter { it.showToUser } as History
- offer(HistoryResult.Success(filtered))
- close()
}
awaitClose()
}
diff --git a/wallet/src/main/java/net/taler/wallet/history/HistoryFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt
index 9f83d5a..663a5aa 100644
--- a/wallet/src/main/java/net/taler/wallet/history/HistoryFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.history
+package net.taler.wallet.transactions
import android.os.Bundle
import android.view.LayoutInflater
@@ -32,23 +32,21 @@ import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager.VERTICAL
-import kotlinx.android.synthetic.main.fragment_show_history.*
+import kotlinx.android.synthetic.main.fragment_transactions.*
import net.taler.common.fadeIn
import net.taler.common.fadeOut
-import net.taler.wallet.R
import net.taler.wallet.MainViewModel
+import net.taler.wallet.R
interface OnEventClickListener {
- fun onEventClicked(event: HistoryEvent)
+ fun onEventClicked(event: Transaction)
}
-class HistoryFragment : Fragment(), OnEventClickListener {
+class TransactionsFragment : Fragment(), OnEventClickListener {
private val model: MainViewModel by activityViewModels()
- private val historyManager by lazy { model.historyManager }
- private lateinit var showAllItem: MenuItem
- private var reloadHistoryItem: MenuItem? = null
- private val historyAdapter by lazy { HistoryAdapter(model.devMode.value == true, this) }
+ private val transactionManager by lazy { model.transactionManager }
+ private val transactionAdapter by lazy { TransactionAdapter(model.devMode.value == true, this) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -59,73 +57,56 @@ class HistoryFragment : Fragment(), OnEventClickListener {
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
- return inflater.inflate(R.layout.fragment_show_history, container, false)
+ return inflater.inflate(R.layout.fragment_transactions, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- historyList.apply {
+ list.apply {
layoutManager = LinearLayoutManager(context)
- adapter = historyAdapter
+ adapter = transactionAdapter
addItemDecoration(DividerItemDecoration(context, VERTICAL))
}
- model.devMode.observe(viewLifecycleOwner, Observer { enabled ->
- reloadHistoryItem?.isVisible = enabled
+ transactionManager.progress.observe(viewLifecycleOwner, Observer { show ->
+ progressBar.visibility = if (show) VISIBLE else INVISIBLE
})
- historyManager.progress.observe(viewLifecycleOwner, Observer { show ->
- historyProgressBar.visibility = if (show) VISIBLE else INVISIBLE
- })
- historyManager.history.observe(viewLifecycleOwner, Observer { history ->
- onHistoryResult(history)
+ transactionManager.transactions.observe(viewLifecycleOwner, Observer { result ->
+ onTransactionsResult(result)
})
// kicks off initial load, needs to be adapted if showAll state is ever saved
- if (savedInstanceState == null) historyManager.showAll.value = model.devMode.value
+ if (savedInstanceState == null) transactionManager.showAll.value = model.devMode.value
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- inflater.inflate(R.menu.history, menu)
- showAllItem = menu.findItem(R.id.show_all_history)
- showAllItem.isChecked = historyManager.showAll.value == true
- reloadHistoryItem = menu.findItem(R.id.reload_history).apply {
- isVisible = model.devMode.value!!
- }
+ inflater.inflate(R.menu.transactions, menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
- R.id.show_all_history -> {
- item.isChecked = !item.isChecked
- historyManager.showAll.value = item.isChecked
- true
- }
- R.id.reload_history -> {
- historyManager.showAll.value = showAllItem.isChecked
- true
- }
else -> super.onOptionsItemSelected(item)
}
}
- override fun onEventClicked(event: HistoryEvent) {
+ override fun onEventClicked(event: Transaction) {
if (event.detailPageLayout != 0) {
- historyManager.selectedEvent = event
- findNavController().navigate(R.id.action_walletHistory_to_historyEventFragment)
+ transactionManager.selectedEvent = event
+ findNavController().navigate(R.id.action_nav_transactions_to_nav_transaction_detail)
} else if (model.devMode.value == true) {
JsonDialogFragment.new(event.json.toString(2))
.show(parentFragmentManager, null)
}
}
- private fun onHistoryResult(result: HistoryResult) = when (result) {
- HistoryResult.Error -> {
- historyList.fadeOut()
- historyEmptyState.text = getString(R.string.history_error)
- historyEmptyState.fadeIn()
+ private fun onTransactionsResult(result: TransactionsResult) = when (result) {
+ TransactionsResult.Error -> {
+ list.fadeOut()
+ emptyState.text = getString(R.string.transactions_error)
+ emptyState.fadeIn()
}
- is HistoryResult.Success -> {
- historyEmptyState.visibility = if (result.history.isEmpty()) VISIBLE else INVISIBLE
- historyAdapter.update(result.history)
+ is TransactionsResult.Success -> {
+ emptyState.visibility = if (result.transactions.isEmpty()) VISIBLE else INVISIBLE
+ transactionAdapter.update(result.transactions)
}
}
diff --git a/wallet/src/main/res/drawable/history_payment_aborted.xml b/wallet/src/main/res/drawable/transaction_payment_aborted.xml
index 8d47c26..8d47c26 100644
--- a/wallet/src/main/res/drawable/history_payment_aborted.xml
+++ b/wallet/src/main/res/drawable/transaction_payment_aborted.xml
diff --git a/wallet/src/main/res/drawable/history_refresh.xml b/wallet/src/main/res/drawable/transaction_refresh.xml
index 219b891..219b891 100644
--- a/wallet/src/main/res/drawable/history_refresh.xml
+++ b/wallet/src/main/res/drawable/transaction_refresh.xml
diff --git a/wallet/src/main/res/drawable/history_refund.xml b/wallet/src/main/res/drawable/transaction_refund.xml
index 6c3d0a7..6c3d0a7 100644
--- a/wallet/src/main/res/drawable/history_refund.xml
+++ b/wallet/src/main/res/drawable/transaction_refund.xml
diff --git a/wallet/src/main/res/drawable/history_tip_accepted.xml b/wallet/src/main/res/drawable/transaction_tip_accepted.xml
index b945b53..b945b53 100644
--- a/wallet/src/main/res/drawable/history_tip_accepted.xml
+++ b/wallet/src/main/res/drawable/transaction_tip_accepted.xml
diff --git a/wallet/src/main/res/drawable/history_tip_declined.xml b/wallet/src/main/res/drawable/transaction_tip_declined.xml
index 4bd1633..4bd1633 100644
--- a/wallet/src/main/res/drawable/history_tip_declined.xml
+++ b/wallet/src/main/res/drawable/transaction_tip_declined.xml
diff --git a/wallet/src/main/res/drawable/history_withdrawn.xml b/wallet/src/main/res/drawable/transaction_withdrawal.xml
index 4fd64f5..4fd64f5 100644
--- a/wallet/src/main/res/drawable/history_withdrawn.xml
+++ b/wallet/src/main/res/drawable/transaction_withdrawal.xml
diff --git a/wallet/src/main/res/layout/fragment_event_paid.xml b/wallet/src/main/res/layout/fragment_event_paid.xml
index 4485744..3f17464 100644
--- a/wallet/src/main/res/layout/fragment_event_paid.xml
+++ b/wallet/src/main/res/layout/fragment_event_paid.xml
@@ -20,7 +20,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
- tools:context=".history.HistoryEventFragment">
+ tools:context=".transactions.TransactionDetailFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@@ -28,7 +28,7 @@
<TextView
android:id="@+id/timeView"
- style="@style/HistoryEventLabel.Time"
+ style="@style/TransactionLabel.Time"
app:layout_constraintBottom_toTopOf="@+id/amountPaidWithFeesLabel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -38,8 +38,8 @@
<TextView
android:id="@+id/amountPaidWithFeesLabel"
- style="@style/HistoryEventLabel"
- android:text="@string/history_event_payment_sent_paid"
+ style="@style/TransactionLabel"
+ android:text="@string/transaction_paid"
app:layout_constraintBottom_toTopOf="@+id/amountPaidWithFeesView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -47,7 +47,7 @@
<TextView
android:id="@+id/amountPaidWithFeesView"
- style="@style/HistoryEventContent"
+ style="@style/TransactionContent"
android:textColor="@color/red"
app:layout_constraintBottom_toTopOf="@+id/orderAmountLabel"
app:layout_constraintEnd_toEndOf="parent"
@@ -57,8 +57,8 @@
<TextView
android:id="@+id/orderAmountLabel"
- style="@style/HistoryEventLabel"
- android:text="@string/history_event_payment_sent_amount"
+ style="@style/TransactionLabel"
+ android:text="@string/transaction_order_total"
app:layout_constraintBottom_toTopOf="@+id/orderAmountView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -66,7 +66,7 @@
<TextView
android:id="@+id/orderAmountView"
- style="@style/HistoryEventContent"
+ style="@style/TransactionContent"
app:layout_constraintBottom_toTopOf="@+id/feeLabel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -75,7 +75,7 @@
<TextView
android:id="@+id/feeLabel"
- style="@style/HistoryEventLabel"
+ style="@style/TransactionLabel"
android:text="@string/withdraw_fees"
app:layout_constraintBottom_toTopOf="@+id/feeView"
app:layout_constraintEnd_toEndOf="parent"
@@ -84,7 +84,7 @@
<TextView
android:id="@+id/feeView"
- style="@style/HistoryEventContent"
+ style="@style/TransactionContent"
android:textColor="@color/red"
app:layout_constraintBottom_toTopOf="@+id/orderSummaryLabel"
app:layout_constraintEnd_toEndOf="parent"
@@ -94,8 +94,8 @@
<TextView
android:id="@+id/orderSummaryLabel"
- style="@style/HistoryEventLabel"
- android:text="@string/history_event_payment_sent_order"
+ style="@style/TransactionLabel"
+ android:text="@string/transaction_order"
app:layout_constraintBottom_toTopOf="@+id/orderSummaryView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -103,7 +103,7 @@
<TextView
android:id="@+id/orderSummaryView"
- style="@style/HistoryEventContent"
+ style="@style/TransactionContent"
app:layout_constraintBottom_toTopOf="@+id/orderIdView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -112,8 +112,8 @@
<TextView
android:id="@+id/orderIdView"
- style="@style/HistoryEventLabel"
- android:text="@string/history_event_payment_sent_order_id"
+ style="@style/TransactionLabel"
+ android:text="@string/transaction_order_id"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
diff --git a/wallet/src/main/res/layout/fragment_event_withdraw.xml b/wallet/src/main/res/layout/fragment_event_withdraw.xml
index 9c5d818..5d30fcf 100644
--- a/wallet/src/main/res/layout/fragment_event_withdraw.xml
+++ b/wallet/src/main/res/layout/fragment_event_withdraw.xml
@@ -20,7 +20,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
- tools:context=".history.HistoryEventFragment">
+ tools:context=".transactions.TransactionDetailFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@@ -28,7 +28,7 @@
<TextView
android:id="@+id/timeView"
- style="@style/HistoryEventLabel.Time"
+ style="@style/TransactionLabel.Time"
app:layout_constraintBottom_toTopOf="@+id/effectiveAmountLabel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -38,7 +38,7 @@
<TextView
android:id="@+id/effectiveAmountLabel"
- style="@style/HistoryEventLabel"
+ style="@style/TransactionLabel"
app:layout_constraintBottom_toTopOf="@+id/effectiveAmountView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -64,7 +64,7 @@
<TextView
android:id="@+id/chosenAmountLabel"
- style="@style/HistoryEventLabel"
+ style="@style/TransactionLabel"
app:layout_constraintBottom_toTopOf="@+id/chosenAmountView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -89,7 +89,7 @@
<TextView
android:id="@+id/feeLabel"
- style="@style/HistoryEventLabel"
+ style="@style/TransactionLabel"
android:text="@string/withdraw_fees"
app:layout_constraintBottom_toTopOf="@+id/feeView"
app:layout_constraintEnd_toEndOf="parent"
@@ -115,7 +115,7 @@
<TextView
android:id="@+id/exchangeLabel"
- style="@style/HistoryEventLabel"
+ style="@style/TransactionLabel"
android:text="@string/withdraw_exchange"
app:layout_constraintBottom_toTopOf="@+id/exchangeView"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/wallet/src/main/res/layout/fragment_show_history.xml b/wallet/src/main/res/layout/fragment_transactions.xml
index 97194d8..a2aebcd 100644
--- a/wallet/src/main/res/layout/fragment_show_history.xml
+++ b/wallet/src/main/res/layout/fragment_transactions.xml
@@ -20,22 +20,22 @@
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
- android:id="@+id/historyList"
+ android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
<TextView
- android:id="@+id/historyEmptyState"
+ android:id="@+id/emptyState"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:text="@string/history_empty"
+ android:text="@string/transactions_empty"
android:visibility="invisible"
tools:visibility="visible" />
<ProgressBar
- android:id="@+id/historyProgressBar"
+ android:id="@+id/progressBar"
style="?android:progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/wallet/src/main/res/layout/history_receive.xml b/wallet/src/main/res/layout/transaction_in.xml
index 5f386a2..f116240 100644
--- a/wallet/src/main/res/layout/history_receive.xml
+++ b/wallet/src/main/res/layout/transaction_in.xml
@@ -32,18 +32,18 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- app:srcCompat="@drawable/history_withdrawn"
+ app:srcCompat="@drawable/transaction_withdrawal"
app:tint="?android:colorControlNormal"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/title"
- style="@style/HistoryTitle"
+ style="@style/TransactionTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
- android:text="@string/history_event_withdrawn"
+ android:text="@string/transaction_withdrawal"
app:layout_constraintEnd_toStartOf="@+id/amountWithdrawn"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toTopOf="parent" />
diff --git a/wallet/src/main/res/layout/history_payment.xml b/wallet/src/main/res/layout/transaction_out.xml
index 33cb676..49f76b7 100644
--- a/wallet/src/main/res/layout/history_payment.xml
+++ b/wallet/src/main/res/layout/transaction_out.xml
@@ -38,7 +38,7 @@
<TextView
android:id="@+id/title"
- style="@style/HistoryTitle"
+ style="@style/TransactionTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -46,7 +46,7 @@
app:layout_constraintEnd_toStartOf="@+id/amountPaidWithFees"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toTopOf="parent"
- tools:text="@string/history_event_payment_sent" />
+ tools:text="@string/transaction_payment" />
<TextView
android:id="@+id/summary"
diff --git a/wallet/src/main/res/layout/history_row.xml b/wallet/src/main/res/layout/transaction_row.xml
index 5eac44b..ac6bdb7 100644
--- a/wallet/src/main/res/layout/history_row.xml
+++ b/wallet/src/main/res/layout/transaction_row.xml
@@ -38,7 +38,7 @@
<TextView
android:id="@+id/title"
- style="@style/HistoryTitle"
+ style="@style/TransactionTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -46,7 +46,7 @@
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
- tools:text="My History Event" />
+ tools:text="My Transaction" />
<TextView
android:id="@+id/info"
diff --git a/wallet/src/main/res/menu/balance.xml b/wallet/src/main/res/menu/fragment_main.xml
index d4568d4..d4568d4 100644
--- a/wallet/src/main/res/menu/balance.xml
+++ b/wallet/src/main/res/menu/fragment_main.xml
diff --git a/wallet/src/main/res/menu/history.xml b/wallet/src/main/res/menu/transactions.xml
index bd50f5d..d4568d4 100644
--- a/wallet/src/main/res/menu/history.xml
+++ b/wallet/src/main/res/menu/transactions.xml
@@ -16,15 +16,4 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
- <item
- android:id="@+id/show_all_history"
- android:checkable="true"
- android:checked="false"
- android:title="@string/history_show_all"
- app:showAsAction="never" />
- <item
- android:id="@+id/reload_history"
- android:orderInCategory="100"
- android:title="@string/history_reload"
- app:showAsAction="never" />
</menu>
diff --git a/wallet/src/main/res/menu/history_event.xml b/wallet/src/main/res/menu/transactions_detail.xml
index 45a1e0e..388e3c4 100644
--- a/wallet/src/main/res/menu/history_event.xml
+++ b/wallet/src/main/res/menu/transactions_detail.xml
@@ -18,6 +18,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/show_json"
- android:title="@string/history_detail_json"
+ android:title="@string/transactions_detail_json"
app:showAsAction="never" />
</menu>
diff --git a/wallet/src/main/res/navigation/nav_graph.xml b/wallet/src/main/res/navigation/nav_graph.xml
index d4257b9..f8927a6 100644
--- a/wallet/src/main/res/navigation/nav_graph.xml
+++ b/wallet/src/main/res/navigation/nav_graph.xml
@@ -55,23 +55,22 @@
<fragment
android:id="@+id/settings"
android:name="net.taler.wallet.SettingsFragment"
- android:label="Settings"
- tools:layout="@layout/fragment_settings" />
+ android:label="Settings" />
<fragment
- android:id="@+id/walletHistory"
- android:name="net.taler.wallet.history.HistoryFragment"
- android:label="@string/history_title"
- tools:layout="@layout/fragment_show_history">
+ android:id="@+id/nav_transactions"
+ android:name="net.taler.wallet.transactions.TransactionsFragment"
+ android:label="@string/transactions_title"
+ tools:layout="@layout/fragment_transactions">
<action
- android:id="@+id/action_walletHistory_to_historyEventFragment"
- app:destination="@id/historyEventFragment" />
+ android:id="@+id/action_nav_transactions_to_nav_transaction_detail"
+ app:destination="@id/nav_transactions_detail" />
</fragment>
<fragment
- android:id="@+id/historyEventFragment"
- android:name="net.taler.wallet.history.HistoryEventFragment"
- android:label="@string/history_detail_title"
+ android:id="@+id/nav_transactions_detail"
+ android:name="net.taler.wallet.transactions.TransactionDetailFragment"
+ android:label="@string/transactions_detail_title"
tools:layout="@layout/fragment_event_withdraw" />
<fragment
diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml
index 8eec297..d2840de 100644
--- a/wallet/src/main/res/values/strings.xml
+++ b/wallet/src/main/res/values/strings.xml
@@ -30,55 +30,50 @@
<string name="button_continue">Continue</string>
<string name="button_scan_qr_code">Scan Taler QR Code</string>
- <string name="menu_history">History</string>
<string name="menu_settings">Settings</string>
- <string name="menu_balance_reload">Reload balances</string>
- <string name="menu_developer_mode">Developer Mode</string>
<string name="menu_retry_pending_operations">Retry Pending Operations</string>
<string name="servicedesc">my service</string>
<string name="aiddescription">my aid</string>
<string name="balances_title">Balances</string>
- <string name="amount_positive">+%s</string>
- <string name="amount_negative">-%s</string>
+ <string name="amount_positive">+ %s</string>
+ <string name="amount_negative">- %s</string>
<string name="amount_chosen">Chosen Amount</string>
<string name="balances_inbound_label">inbound</string>
<string name="balances_empty_state">There is no digital cash in your wallet.\n\nYou can get test money from the demo bank:\n\nhttps://bank.demo.taler.net</string>
- <string name="history_title">History</string>
- <string name="history_show_all">Show All</string>
- <string name="history_reload">Reload History</string>
- <string name="history_empty">The wallet history is empty</string>
- <string name="history_error">Could not load history</string>
- <string name="history_detail_title">Transaction</string>
- <string name="history_detail_json">Show JSON</string>
+ <string name="transactions_title">Transactions</string>
+ <string name="transactions_empty">You don\'t have any transactions</string>
+ <string name="transactions_error">Could not load transactions</string>
+ <string name="transactions_detail_title">Transaction</string>
+ <string name="transactions_detail_json">Show JSON</string>
- <!-- HistoryEvents -->
+ <!-- Transactions -->
<string name="history_event_exchange_added">Exchange Added</string>
<string name="history_event_exchange_updated">Exchange Updated</string>
- <string name="history_event_reserve_balance_updated">Reserve Balance Updated</string>
- <string name="history_event_payment_sent">Payment</string>
- <string name="history_event_payment_sent_paid">Paid</string>
- <string name="history_event_payment_sent_amount">Order Total</string>
- <string name="history_event_payment_sent_order">Order</string>
- <string name="history_event_payment_sent_order_id">Order Reference: %1$s</string>
- <string name="history_event_payment_aborted">Payment Aborted</string>
- <string name="history_event_withdrawn">Withdraw</string>
- <string name="history_event_order_accepted">Purchase Confirmed</string>
- <string name="history_event_order_refused">Purchase Cancelled</string>
- <string name="history_event_tip_accepted">Tip Accepted</string>
- <string name="history_event_tip_declined">Tip Declined</string>
- <string name="history_event_order_redirected">Purchase Redirected</string>
- <string name="history_event_refund">Refund</string>
- <string name="history_event_refreshed">Obtained change</string>
- <string name="history_event_refresh_reason_manual">because of manual request</string>
- <string name="history_event_refresh_reason_pay">for payment</string>
- <string name="history_event_refresh_reason_refund">for refund</string>
- <string name="history_event_refresh_reason_abort_pay">to abort payment</string>
- <string name="history_event_refresh_reason_recoup">to recoup funds</string>
- <string name="history_event_refresh_reason_backup_restored">because of restoring from backup</string>
- <string name="history_event_unknown">Unknown Event</string>
+ <string name="transaction_reserve_balance_updated">Reserve Balance Updated</string>
+ <string name="transaction_payment">Payment</string>
+ <string name="transaction_paid">Paid</string>
+ <string name="transaction_order_total">Order Total</string>
+ <string name="transaction_order">Order</string>
+ <string name="transaction_order_id">Order Reference: %1$s</string>
+ <string name="transaction_payment_aborted">Payment Aborted</string>
+ <string name="transaction_withdrawal">Withdraw</string>
+ <string name="transaction_order_accepted">Purchase Confirmed</string>
+ <string name="transaction_order_refused">Purchase Cancelled</string>
+ <string name="transaction_tip_accepted">Tip Accepted</string>
+ <string name="transaction_tip_declined">Tip Declined</string>
+ <string name="transaction_order_redirected">Purchase Redirected</string>
+ <string name="transaction_refund">Refund</string>
+ <string name="transaction_refresh">Obtained change</string>
+ <string name="transaction_refresh_reason_manual">because of manual request</string>
+ <string name="transaction_refresh_reason_pay">for payment</string>
+ <string name="transaction_refresh_reason_refund">for refund</string>
+ <string name="transaction_refresh_reason_abort_pay">to abort payment</string>
+ <string name="transaction_refresh_reason_recoup">to recoup funds</string>
+ <string name="transaction_refresh_reason_backup_restored">because of restoring from backup</string>
+ <string name="transaction_unknown">Unknown Transaction</string>
<string name="payment_fee">+%s payment fee</string>
<string name="payment_button_confirm">Confirm Payment</string>
@@ -118,21 +113,18 @@
<string name="exchange_fee_wire_fee_timespan">Timespan: %1$s - %2$s</string>
<string name="exchange_fee_wire_fee_wire_fee">Wire Fee: %s</string>
<string name="exchange_fee_wire_fee_closing_fee">Closing Fee: %s</string>
+ <string name="exchange_tos_accept">Accept Terms of Service</string>
<string name="pending_operations_title">Pending Operations</string>
<string name="pending_operations_refuse">Refuse Proposal</string>
<string name="pending_operations_no_action">(no action)</string>
- <string name="settings_version">Version Information</string>
- <string name="exchange_tos_accept">Accept Terms of Service</string>
- <string name="settings_backups">Backups</string>
- <string name="settings_export_to_file">Export wallet to file</string>
- <string name="settings_import_from_file">Import from file</string>
+ <string name="settings_dev_mode">Developer Mode</string>
+ <string name="settings_dev_mode_summary">Shows more information intended for debugging</string>
<string name="settings_withdraw_testkudos">Withdraw TESTKUDOS</string>
<string name="settings_withdraw_testkudos_summary">Get money for testing</string>
<string name="settings_reset">Reset Wallet (dangerous!)</string>
<string name="settings_reset_summary">Throws away your money</string>
- <string name="settings_dev_mode_summary">Shows more information intended for debugging</string>
<string name="refund_error">Error processing refund</string>
<string name="refund_success">Refund received</string>
diff --git a/wallet/src/main/res/values/styles.xml b/wallet/src/main/res/values/styles.xml
index 9ebcae5..c8a2c3b 100644
--- a/wallet/src/main/res/values/styles.xml
+++ b/wallet/src/main/res/values/styles.xml
@@ -33,12 +33,12 @@
<style name="AppTheme.Toolbar" parent="Widget.MaterialComponents.Toolbar.Primary" />
- <style name="HistoryTitle">
+ <style name="TransactionTitle">
<item name="android:textSize">16sp</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
- <style name="HistoryEventLabel">
+ <style name="TransactionLabel">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginStart">16dp</item>
@@ -47,12 +47,12 @@
<item name="android:gravity">center</item>
</style>
- <style name="HistoryEventLabel.Time">
+ <style name="TransactionLabel.Time">
<item name="android:layout_marginBottom">16dp</item>
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Medium</item>
</style>
- <style name="HistoryEventContent">
+ <style name="TransactionContent">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginStart">16dp</item>
diff --git a/wallet/src/main/res/xml/settings_main.xml b/wallet/src/main/res/xml/settings_main.xml
index 90f5f6c..d200bb5 100644
--- a/wallet/src/main/res/xml/settings_main.xml
+++ b/wallet/src/main/res/xml/settings_main.xml
@@ -21,7 +21,7 @@
app:icon="@drawable/ic_developer_mode"
app:key="pref_dev_mode"
app:summary="@string/settings_dev_mode_summary"
- app:title="@string/menu_developer_mode" />
+ app:title="@string/settings_dev_mode" />
<Preference
app:icon="@drawable/ic_cash_usd_outline"
diff --git a/wallet/src/test/java/net/taler/wallet/history/ReserveTransactionTest.kt b/wallet/src/test/java/net/taler/wallet/transactions/ReserveTransactionTest.kt
index d3d66f5..4a3c75b 100644
--- a/wallet/src/test/java/net/taler/wallet/history/ReserveTransactionTest.kt
+++ b/wallet/src/test/java/net/taler/wallet/transactions/ReserveTransactionTest.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.history
+package net.taler.wallet.transactions
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule
diff --git a/wallet/src/test/java/net/taler/wallet/history/HistoryEventTest.kt b/wallet/src/test/java/net/taler/wallet/transactions/TransactionTest.kt
index 6b8c41a..6549434 100644
--- a/wallet/src/test/java/net/taler/wallet/history/HistoryEventTest.kt
+++ b/wallet/src/test/java/net/taler/wallet/transactions/TransactionTest.kt
@@ -14,20 +14,20 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.history
+package net.taler.wallet.transactions
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 net.taler.wallet.transactions.RefreshReason.PAY
+import net.taler.wallet.transactions.ReserveType.MANUAL
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
import kotlin.random.Random
-class HistoryEventTest {
+class TransactionTest {
private val mapper = ObjectMapper().registerModule(KotlinModule())
@@ -93,7 +93,7 @@ class HistoryEventTest {
}
@Test
- fun `test ReserveBalanceUpdatedEvent`() {
+ fun `test ReserveBalanceUpdatedTransaction`() {
val json = """{
"type": "reserve-balance-updated",
"eventId": "reserve-balance-updated;K0H10Q6HB9WH0CKHQQMNH5C6GA7A9AR1E2XSS9G1KG3ZXMBVT26G",
@@ -111,17 +111,17 @@ class HistoryEventTest {
"reservePub": "BRT2P0YMQSD5F48V9XHVNH73ZTS6EZC0KCQCPGPZQWTSQB77615G"
}
}""".trimIndent()
- val event: ReserveBalanceUpdatedEvent = mapper.readValue(json)
+ val transaction: ReserveBalanceUpdatedTransaction = mapper.readValue(json)
- assertEquals(timestamp, event.timestamp.ms)
- assertEquals("TESTKUDOS:23", event.reserveAwaitedAmount.toJSONString())
- assertEquals("TESTKUDOS:10", event.reserveBalance.toJSONString())
- assertEquals("TESTKUDOS:0.01", event.reserveUnclaimedAmount.toJSONString())
- assertEquals(exchangeBaseUrl, event.reserveShortInfo.exchangeBaseUrl)
+ assertEquals(timestamp, transaction.timestamp.ms)
+ assertEquals("TESTKUDOS:23", transaction.reserveAwaitedAmount.toJSONString())
+ assertEquals("TESTKUDOS:10", transaction.reserveBalance.toJSONString())
+ assertEquals("TESTKUDOS:0.01", transaction.reserveUnclaimedAmount.toJSONString())
+ assertEquals(exchangeBaseUrl, transaction.reserveShortInfo.exchangeBaseUrl)
}
@Test
- fun `test HistoryWithdrawnEvent`() {
+ fun `test WithdrawTransaction`() {
val json = """{
"type": "withdrawn",
"withdrawalGroupId": "974FT7JDNR20EQKNR21G1HV9PB6T5AZHYHX9NHR51Q30ZK3T10S0",
@@ -137,7 +137,7 @@ class HistoryEventTest {
"reservePub": "BRT2P0YMQSD5F48V9XHVNH73ZTS6EZC0KCQCPGPZQWTSQB77615G"
}
}""".trimIndent()
- val event: HistoryWithdrawnEvent = mapper.readValue(json)
+ val event: WithdrawTransaction = mapper.readValue(json)
assertEquals(
"974FT7JDNR20EQKNR21G1HV9PB6T5AZHYHX9NHR51Q30ZK3T10S0",
@@ -171,7 +171,7 @@ class HistoryEventTest {
}
@Test
- fun `test HistoryOrderAcceptedEvent`() {
+ fun `test OrderAcceptedTransaction`() {
val json = """{
"type": "order-accepted",
"eventId": "order-accepted;EP5MH4R5C9RMNA06YS1QGEJ3EY682PY8R1SGRFRP74EV735N3ATG",
@@ -186,14 +186,14 @@ class HistoryEventTest {
"t_ms": $timestamp
}
}""".trimIndent()
- val event: HistoryOrderAcceptedEvent = mapper.readValue(json)
+ val transaction: OrderAcceptedTransaction = mapper.readValue(json)
- assertEquals(orderShortInfo, event.orderShortInfo)
- assertEquals(timestamp, event.timestamp.ms)
+ assertEquals(orderShortInfo, transaction.orderShortInfo)
+ assertEquals(timestamp, transaction.timestamp.ms)
}
@Test
- fun `test HistoryOrderRefusedEvent`() {
+ fun `test OrderRefusedTransaction`() {
val json = """{
"type": "order-refused",
"eventId": "order-refused;9RJGAYXKWX0Y3V37H66606SXSA7V2CV255EBFS4G1JSH6W1EG7F0",
@@ -208,14 +208,14 @@ class HistoryEventTest {
"t_ms": $timestamp
}
}""".trimIndent()
- val event: HistoryOrderRefusedEvent = mapper.readValue(json)
+ val transaction: OrderRefusedTransaction = mapper.readValue(json)
- assertEquals(orderShortInfo, event.orderShortInfo)
- assertEquals(timestamp, event.timestamp.ms)
+ assertEquals(orderShortInfo, transaction.orderShortInfo)
+ assertEquals(timestamp, transaction.timestamp.ms)
}
@Test
- fun `test HistoryPaymentSentEvent`() {
+ fun `test PaymentTransaction`() {
val json = """{
"type": "payment-sent",
"eventId": "payment-sent;EP5MH4R5C9RMNA06YS1QGEJ3EY682PY8R1SGRFRP74EV735N3ATG",
@@ -234,7 +234,7 @@ class HistoryEventTest {
"numCoins": 6,
"amountPaidWithFees": "KUDOS:0.6"
}""".trimIndent()
- val event: HistoryPaymentSentEvent = mapper.readValue(json)
+ val event: PaymentTransaction = mapper.readValue(json)
assertEquals(orderShortInfo, event.orderShortInfo)
assertEquals(false, event.replay)
@@ -245,7 +245,7 @@ class HistoryEventTest {
}
@Test
- fun `test HistoryPaymentSentEvent without sessionId`() {
+ fun `test PaymentTransaction without sessionId`() {
val json = """{
"type": "payment-sent",
"eventId": "payment-sent;EP5MH4R5C9RMNA06YS1QGEJ3EY682PY8R1SGRFRP74EV735N3ATG",
@@ -263,7 +263,7 @@ class HistoryEventTest {
"numCoins": 6,
"amountPaidWithFees": "KUDOS:0.6"
}""".trimIndent()
- val event: HistoryPaymentSentEvent = mapper.readValue(json)
+ val event: PaymentTransaction = mapper.readValue(json)
assertEquals(orderShortInfo, event.orderShortInfo)
assertEquals(true, event.replay)
@@ -274,7 +274,7 @@ class HistoryEventTest {
}
@Test
- fun `test HistoryPaymentAbortedEvent`() {
+ fun `test PaymentAbortedTransaction`() {
val json = """{
"type": "payment-aborted",
"eventId": "payment-sent;898724XGQ1GGMZB4WY3KND582NSP74FZ60BX0Y87FF81H0FJ8XD0",
@@ -290,15 +290,15 @@ class HistoryEventTest {
},
"amountLost": "KUDOS:0.1"
}""".trimIndent()
- val event: HistoryPaymentAbortedEvent = mapper.readValue(json)
+ val transaction: PaymentAbortedTransaction = mapper.readValue(json)
- assertEquals(orderShortInfo, event.orderShortInfo)
- assertEquals("KUDOS:0.1", event.amountLost.toJSONString())
- assertEquals(timestamp, event.timestamp.ms)
+ assertEquals(orderShortInfo, transaction.orderShortInfo)
+ assertEquals("KUDOS:0.1", transaction.amountLost.toJSONString())
+ assertEquals(timestamp, transaction.timestamp.ms)
}
@Test
- fun `test HistoryTipAcceptedEvent`() {
+ fun `test TipAcceptedTransaction`() {
val json = """{
"type": "tip-accepted",
"timestamp": {
@@ -308,18 +308,18 @@ class HistoryEventTest {
"tipId": "tip-accepted;898724XGQ1GGMZB4WY3KND582NSP74FZ60BX0Y87FF81H0FJ8XD0",
"tipRaw": "KUDOS:4"
}""".trimIndent()
- val event: HistoryTipAcceptedEvent = mapper.readValue(json)
+ val transaction: TipAcceptedTransaction = mapper.readValue(json)
assertEquals(
"tip-accepted;898724XGQ1GGMZB4WY3KND582NSP74FZ60BX0Y87FF81H0FJ8XD0",
- event.tipId
+ transaction.tipId
)
- assertEquals("KUDOS:4", event.tipRaw.toJSONString())
- assertEquals(timestamp, event.timestamp.ms)
+ assertEquals("KUDOS:4", transaction.tipRaw.toJSONString())
+ assertEquals(timestamp, transaction.timestamp.ms)
}
@Test
- fun `test HistoryTipDeclinedEvent`() {
+ fun `test TipDeclinedTransaction`() {
val json = """{
"type": "tip-declined",
"timestamp": {
@@ -329,18 +329,18 @@ class HistoryEventTest {
"tipId": "tip-accepted;998724XGQ1GGMZB4WY3KND582NSP74FZ60BX0Y87FF81H0FJ8XD0",
"tipAmount": "KUDOS:4"
}""".trimIndent()
- val event: HistoryTipDeclinedEvent = mapper.readValue(json)
+ val transaction: TipDeclinedTransaction = mapper.readValue(json)
assertEquals(
"tip-accepted;998724XGQ1GGMZB4WY3KND582NSP74FZ60BX0Y87FF81H0FJ8XD0",
- event.tipId
+ transaction.tipId
)
- assertEquals("KUDOS:4", event.tipAmount.toJSONString())
- assertEquals(timestamp, event.timestamp.ms)
+ assertEquals("KUDOS:4", transaction.tipAmount.toJSONString())
+ assertEquals(timestamp, transaction.timestamp.ms)
}
@Test
- fun `test HistoryRefundedEvent`() {
+ fun `test RefundTransaction`() {
val json = """{
"type": "refund",
"eventId": "refund;898724XGQ1GGMZB4WY3KND582NSP74FZ60BX0Y87FF81H0FJ8XD0",
@@ -359,7 +359,7 @@ class HistoryEventTest {
"amountRefundedInvalid": "KUDOS:0.5",
"amountRefundedEffective": "KUDOS:0.4"
}""".trimIndent()
- val event: HistoryRefundedEvent = mapper.readValue(json)
+ val event: RefundTransaction = mapper.readValue(json)
assertEquals("refund;998724", event.refundGroupId)
assertEquals("KUDOS:1", event.amountRefundedRaw.toJSONString())
@@ -370,7 +370,7 @@ class HistoryEventTest {
}
@Test
- fun `test HistoryRefreshedEvent`() {
+ fun `test RefreshTransaction`() {
val json = """{
"type": "refreshed",
"refreshGroupId": "8AVHKJFAN4QV4C11P56NEY83AJMGFF2KF412AN3Y0QBP09RSN640",
@@ -385,7 +385,7 @@ class HistoryEventTest {
"numOutputCoins": 0,
"numRefreshedInputCoins": 1
}""".trimIndent()
- val event: HistoryRefreshedEvent = mapper.readValue(json)
+ val event: RefreshTransaction = mapper.readValue(json)
assertEquals("KUDOS:0", event.amountRefreshedEffective.toJSONString())
assertEquals("KUDOS:1", event.amountRefreshedRaw.toJSONString())
@@ -398,7 +398,7 @@ class HistoryEventTest {
}
@Test
- fun `test HistoryOrderRedirectedEvent`() {
+ fun `test OrderRedirectedTransaction`() {
val json = """{
"type": "order-redirected",
"eventId": "order-redirected;621J6D5SXG7M17TYA26945DYKNQZPW4600MZ1W8MADA1RRR49F8G",
@@ -420,40 +420,40 @@ class HistoryEventTest {
"t_ms": $timestamp
}
}""".trimIndent()
- val event: HistoryOrderRedirectedEvent = mapper.readValue(json)
+ val transaction: OrderRedirectedTransaction = mapper.readValue(json)
assertEquals(
"898724XGQ1GGMZB4WY3KND582NSP74FZ60BX0Y87FF81H0FJ8XD0",
- event.alreadyPaidOrderShortInfo.proposalId
+ transaction.alreadyPaidOrderShortInfo.proposalId
)
assertEquals(
"https://backend.demo.taler.net/public/instances/FSF/",
- event.alreadyPaidOrderShortInfo.merchantBaseUrl
+ transaction.alreadyPaidOrderShortInfo.merchantBaseUrl
)
- assertEquals("2019.354-01P25CD66P8NG", event.alreadyPaidOrderShortInfo.orderId)
- assertEquals("KUDOS:0.5", event.alreadyPaidOrderShortInfo.amount.toJSONString())
+ assertEquals("2019.354-01P25CD66P8NG", transaction.alreadyPaidOrderShortInfo.orderId)
+ assertEquals("KUDOS:0.5", transaction.alreadyPaidOrderShortInfo.amount.toJSONString())
assertEquals(
"Essay: 1. The Free Software Definition",
- event.alreadyPaidOrderShortInfo.summary
+ transaction.alreadyPaidOrderShortInfo.summary
)
assertEquals(
"621J6D5SXG7M17TYA26945DYKNQZPW4600MZ1W8MADA1RRR49F8G",
- event.newOrderShortInfo.proposalId
+ transaction.newOrderShortInfo.proposalId
)
assertEquals(
"https://backend.demo.taler.net/public/instances/FSF/",
- event.newOrderShortInfo.merchantBaseUrl
+ transaction.newOrderShortInfo.merchantBaseUrl
)
- assertEquals("2019.364-01M4QH6KPMJY4", event.newOrderShortInfo.orderId)
- assertEquals("KUDOS:0.5", event.newOrderShortInfo.amount.toJSONString())
- assertEquals("Essay: 1. The Free Software Definition", event.newOrderShortInfo.summary)
+ assertEquals("2019.364-01M4QH6KPMJY4", transaction.newOrderShortInfo.orderId)
+ assertEquals("KUDOS:0.5", transaction.newOrderShortInfo.amount.toJSONString())
+ assertEquals("Essay: 1. The Free Software Definition", transaction.newOrderShortInfo.summary)
- assertEquals(timestamp, event.timestamp.ms)
+ assertEquals(timestamp, transaction.timestamp.ms)
}
@Test
- fun `test HistoryUnknownEvent`() {
+ fun `test UnknownTransaction`() {
val json = """{
"type": "does not exist",
"timestamp": {
@@ -461,9 +461,9 @@ class HistoryEventTest {
},
"eventId": "does-not-exist;898724XGQ1GGMZB4WY3KND582NSP74FZ60BX0Y87FF81H0FJ8XD0"
}""".trimIndent()
- val event: HistoryEvent = mapper.readValue(json)
+ val event: Transaction = mapper.readValue(json)
- assertEquals(HistoryUnknownEvent::class.java, event.javaClass)
+ assertEquals(UnknownTransaction::class.java, event.javaClass)
assertEquals(timestamp, event.timestamp.ms)
}