[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-android] branch master updated: [pos] Remove QR code once o
From: |
gnunet |
Subject: |
[taler-taler-android] branch master updated: [pos] Remove QR code once order has been claimed |
Date: |
Fri, 05 Feb 2021 17:52:53 +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.
The following commit(s) were added to refs/heads/master by this push:
new 21c7981 [pos] Remove QR code once order has been claimed
21c7981 is described below
commit 21c79819fa6aad2bf9c68bd03faa273ff450ca56
Author: Torsten Grote <t@grobox.de>
AuthorDate: Fri Feb 5 13:49:51 2021 -0300
[pos] Remove QR code once order has been claimed
---
.../java/net/taler/merchantpos/payment/Payment.kt | 1 +
.../net/taler/merchantpos/payment/PaymentManager.kt | 19 ++++++++++++-------
.../merchantpos/payment/ProcessPaymentFragment.kt | 20 ++++++++++++--------
merchant-terminal/src/main/res/values/strings.xml | 1 +
4 files changed, 26 insertions(+), 15 deletions(-)
diff --git
a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/Payment.kt
b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/Payment.kt
index 9200ced..b3ff14b 100644
--- a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/Payment.kt
+++ b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/Payment.kt
@@ -24,6 +24,7 @@ data class Payment(
val currency: String,
val orderId: String? = null,
val talerPayUri: String? = null,
+ val claimed: Boolean = false,
val paid: Boolean = false,
val error: String? = null
)
diff --git
a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentManager.kt
b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentManager.kt
index b017726..98161db 100644
---
a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentManager.kt
+++
b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/PaymentManager.kt
@@ -46,7 +46,7 @@ class PaymentManager(
private val context: Context,
private val configManager: ConfigManager,
private val scope: CoroutineScope,
- private val api: MerchantApi
+ private val api: MerchantApi,
) {
private val mPayment = MutableLiveData<Payment>()
@@ -89,12 +89,17 @@ class PaymentManager(
assertUiThread()
if (!isActive) return@handle // don't continue if job was cancelled
val currentValue = requireNotNull(mPayment.value)
- if (response.paid) {
- mPayment.value = currentValue.copy(paid = true)
- checkTimer.cancel()
- } else if (currentValue.talerPayUri == null) {
- response as CheckPaymentResponse.Unpaid
- mPayment.value = currentValue.copy(talerPayUri =
response.talerPayUri)
+ when (response) {
+ is CheckPaymentResponse.Unpaid -> {
+ mPayment.value = currentValue.copy(talerPayUri =
response.talerPayUri)
+ }
+ is CheckPaymentResponse.Claimed -> {
+ mPayment.value = currentValue.copy(claimed = true)
+ }
+ is CheckPaymentResponse.Paid -> {
+ mPayment.value = currentValue.copy(paid = true)
+ checkTimer.cancel()
+ }
}
}
}
diff --git
a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/ProcessPaymentFragment.kt
b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/ProcessPaymentFragment.kt
index dc5d554..201c9cf 100644
---
a/merchant-terminal/src/main/java/net/taler/merchantpos/payment/ProcessPaymentFragment.kt
+++
b/merchant-terminal/src/main/java/net/taler/merchantpos/payment/ProcessPaymentFragment.kt
@@ -45,8 +45,8 @@ class ProcessPaymentFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View? {
+ savedInstanceState: Bundle?,
+ ): View {
ui = FragmentProcessPaymentBinding.inflate(inflater, container, false)
return ui.root
}
@@ -79,18 +79,22 @@ class ProcessPaymentFragment : Fragment() {
navigate(actionProcessPaymentToPaymentSuccess())
return
}
+ if (payment.claimed) {
+ ui.qrcodeView.fadeOut()
+ ui.payIntroView.setText(R.string.payment_claimed)
+ } else {
+ payment.talerPayUri?.let {
+ ui.qrcodeView.setImageBitmap(makeQrCode(it))
+ ui.qrcodeView.fadeIn()
+ ui.progressBar.fadeOut()
+ }
+ }
ui.payIntroView.fadeIn()
ui.amountView.text = payment.order.total.toString()
payment.orderId?.let {
ui.orderRefView.text = getString(R.string.payment_order_id, it)
ui.orderRefView.fadeIn()
}
- payment.talerPayUri?.let {
- val qrcodeBitmap = makeQrCode(it)
- ui.qrcodeView.setImageBitmap(qrcodeBitmap)
- ui.qrcodeView.fadeIn()
- ui.progressBar.fadeOut()
- }
}
private fun onPaymentCancel() {
diff --git a/merchant-terminal/src/main/res/values/strings.xml
b/merchant-terminal/src/main/res/values/strings.xml
index bee3cd4..f06866d 100644
--- a/merchant-terminal/src/main/res/values/strings.xml
+++ b/merchant-terminal/src/main/res/values/strings.xml
@@ -38,6 +38,7 @@
<string name="payment_intro_nfc">Please let customer scan QR Code or use
NFC to pay.</string>
<string name="payment_intro">Please let customer scan QR Code to
pay.</string>
+ <string name="payment_claimed">Waiting for customer to confirm
payment…</string>
<string name="payment_cancel">Cancel payment</string>
<string name="payment_received">Payment received</string>
<string name="payment_back_button">Continue</string>
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-taler-android] branch master updated: [pos] Remove QR code once order has been claimed,
gnunet <=