commit bf79b73f40d34371739fca5c8dc818b4cb1f25ef
parent f7d6e7f82308461bee4afc029400fa39cd1ecb4c
Author: Bohdan Potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Sat, 17 Jan 2026 13:10:09 +0100
[merchant-terminal] fixing amount order posting inventory error
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
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
@@ -74,11 +74,15 @@ class PaymentManager(
fun createPayment(order: Order, includeProducts: Boolean = true) = scope.launch {
val merchantConfig = configManager.merchantConfig!!
mPayment.value = Payment(order, order.summary, configManager.currency!!)
- val inventoryProducts = order.products.mapNotNull { product ->
- val productId = product.productId ?: return@mapNotNull null
- MinimalInventoryProduct(productId = productId, quantity = product.quantity)
+ val inventoryProducts = if (includeProducts) {
+ order.products.mapNotNull { product ->
+ val productId = product.productId ?: return@mapNotNull null
+ MinimalInventoryProduct(productId = productId, quantity = product.quantity)
+ }
+ } else {
+ emptyList()
}
- val useInventoryProducts = inventoryProducts.isNotEmpty()
+ val useInventoryProducts = includeProducts && inventoryProducts.isNotEmpty()
val request = PostOrderRequest(
contractTerms = order.toContractTerms(
includeProducts = includeProducts && !useInventoryProducts