diff options
Diffstat (limited to 'merchant-terminal/src')
-rw-r--r-- | merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt | 3 | ||||
-rw-r--r-- | merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt index 7def7cc..971f92c 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/config/PosConfig.kt @@ -23,6 +23,7 @@ import net.taler.common.ContractProduct import net.taler.common.Product import net.taler.common.TalerUtils import net.taler.lib.common.Amount +import net.taler.merchantlib.MerchantConfig import java.util.UUID data class Config( @@ -37,7 +38,7 @@ data class Config( @Serializable data class PosConfig( @SerialName("config") - val merchantConfig: net.taler.merchantlib.MerchantConfig, + val merchantConfig: MerchantConfig, val categories: List<Category>, val products: List<ConfigProduct> ) diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt index 56cdc8a..a89a85d 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt @@ -88,12 +88,10 @@ class OrderManager(private val context: Context) : ConfigurationReceiver { this.currency = currency mCategories.postValue(posConfig.categories) mProducts.postValue(productsByCategory[posConfig.categories[0]]) - // Initialize first empty order, note this won't work when updating config mid-flight - if (orders.isEmpty()) { - val id = orderCounter++ - orders[id] = MutableLiveOrder(id, currency, productsByCategory) - mCurrentOrderId.postValue(id) - } + orders.clear() + orderCounter = 0 + orders[0] = MutableLiveOrder(0, currency, productsByCategory) + mCurrentOrderId.postValue(0) null // success, no error string } else context.getString(R.string.config_error_product_zero) } @@ -116,7 +114,7 @@ class OrderManager(private val context: Context) : ConfigurationReceiver { if (orderId == currentId) foundCurrentOrder = true } if (nextId == null) { - nextId = orderCounter++ + nextId = ++orderCounter orders[nextId] = MutableLiveOrder(nextId, currency, productsByCategory) } val currentOrder = order(currentId) |