[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: duplication check based on transaction
From: |
gnunet |
Subject: |
[libeufin] branch master updated: duplication check based on transaction status |
Date: |
Tue, 09 Jun 2020 14:28:06 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 9f34f08 duplication check based on transaction status
9f34f08 is described below
commit 9f34f086bab15cda3f1eac459e0a90ea87b01641
Author: MS <ms@taler.net>
AuthorDate: Tue Jun 9 14:27:44 2020 +0200
duplication check based on transaction status
---
nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
index 450c1ee..57a9d25 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
@@ -106,12 +106,26 @@ fun getEbicsSubscriberDetails(userId: String,
transportId: String): EbicsClientS
// returns true if the payment is found in the database.
fun isDuplicate(camt: Document, acctSvcrRef: String): Boolean {
- val found = transaction {
- RawBankTransactionEntity.find {
+ val foundWithStatus = transaction {
+ val res = RawBankTransactionEntity.find {
RawBankTransactionsTable.uid eq acctSvcrRef
}.firstOrNull()
+ if (res != null) {
+ Pair(true, res.status)
+ } else {
+ Pair(false, null)
+ }
}
- return found != null
+ if (!foundWithStatus.first)
+ return false
+
+ // ignore if status if the same as the one stored previously
+ val givenStatus =
camt.pickString("//*[local-name()='Ntry']//*[local-name()='Sts']")
+ if (givenStatus == foundWithStatus.second)
+ return true
+
+ // at this point, the message has neither a known status, or it is itself
known.
+ return false
}
fun processCamtMessage(
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: duplication check based on transaction status,
gnunet <=