gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-android] branch master updated: [wallet] Fixed serializatio


From: gnunet
Subject: [taler-taler-android] branch master updated: [wallet] Fixed serialization error in contract terms
Date: Wed, 30 Aug 2023 15:52:36 +0200

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 fe694e7  [wallet] Fixed serialization error in contract terms
fe694e7 is described below

commit fe694e7c69ca48ad73fa889420b056dadfebb88b
Author: Iván Ávalos <avalos@disroot.org>
AuthorDate: Tue Aug 29 12:01:31 2023 -0600

    [wallet] Fixed serialization error in contract terms
---
 .../src/test/java/net/taler/merchantlib/MerchantApiTest.kt        | 2 +-
 .../src/main/java/net/taler/common/ContractTerms.kt               | 8 ++++----
 wallet/src/main/java/net/taler/wallet/payment/ProductAdapter.kt   | 5 ++++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt 
b/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt
index 9d6defd..cf627c6 100644
--- a/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt
+++ b/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt
@@ -80,7 +80,7 @@ class MerchantApiTest {
                         {
                             "product_id": "${product.productId}",
                             "description": "${product.description}",
-                            "price": "${product.price.toJSONString()}",
+                            "price": "${product.price!!.toJSONString()}",
                             "quantity": ${product.quantity}
                         }
                     ]
diff --git 
a/taler-kotlin-android/src/main/java/net/taler/common/ContractTerms.kt 
b/taler-kotlin-android/src/main/java/net/taler/common/ContractTerms.kt
index 910cc36..88e90b0 100644
--- a/taler-kotlin-android/src/main/java/net/taler/common/ContractTerms.kt
+++ b/taler-kotlin-android/src/main/java/net/taler/common/ContractTerms.kt
@@ -42,7 +42,7 @@ abstract class Product {
     abstract val productId: String?
     abstract val description: String
     abstract val descriptionI18n: Map<String, String>?
-    abstract val price: Amount
+    abstract val price: Amount?
     abstract val location: String?
     abstract val image: String?
     val localizedDescription: String
@@ -60,14 +60,14 @@ data class ContractProduct(
     override val description: String,
     @SerialName("description_i18n")
     override val descriptionI18n: Map<String, String>? = null,
-    override val price: Amount,
+    override val price: Amount? = null,
     @SerialName("delivery_location")
     override val location: String? = null,
     override val image: String? = null,
     val quantity: Int
 ) : Product() {
-    val totalPrice: Amount by lazy {
-        price * quantity
+    val totalPrice: Amount? by lazy {
+        price?.let { price * quantity }
     }
 }
 
diff --git a/wallet/src/main/java/net/taler/wallet/payment/ProductAdapter.kt 
b/wallet/src/main/java/net/taler/wallet/payment/ProductAdapter.kt
index 87b6387..35ec18b 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/ProductAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/ProductAdapter.kt
@@ -81,7 +81,10 @@ internal class ProductAdapter(private val listener: 
ProductImageClickListener) :
                 }
             }
             name.text = product.description
-            price.text = product.totalPrice.toString()
+            price.visibility = product.totalPrice?.let {
+                price.text = it.toString()
+                VISIBLE
+            } ?: GONE
         }
     }
 

-- 
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]