Skip to content

Commit 781e66d

Browse files
committed
feat: add existing item validation
1 parent f3391af commit 781e66d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/src/main/java/to/bitkit/data/CacheStore.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class CacheStore @Inject constructor(
3838
}
3939

4040
suspend fun addPaidOrder(orderId: String, txId: String) {
41+
if (orderId in store.data.first().paidOrders) {
42+
Logger.debug("Order $orderId already added")
43+
return
44+
}
45+
4146
store.updateData {
4247
val newEntry = mapOf(orderId to txId)
4348
val updatedOrders = newEntry + it.paidOrders

0 commit comments

Comments
 (0)