gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: check before double-submission


From: gnunet
Subject: [libeufin] branch master updated: check before double-submission
Date: Thu, 18 Jun 2020 17:04:34 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 60bdc1c  check before double-submission
60bdc1c is described below

commit 60bdc1ccd72f1be6df506775abb227bc93c595d6
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Thu Jun 18 20:34:26 2020 +0530

    check before double-submission
---
 .../kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
index 662d516..80f79c0 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
@@ -34,14 +34,20 @@ import java.time.Instant
 
 
 suspend fun submitPreparedPayment(httpClient: HttpClient, paymentInitiationId: 
Long) {
-    val type = transaction {
+    val r = transaction {
         val paymentInitiation = 
PaymentInitiationEntity.findById(paymentInitiationId)
         if (paymentInitiation == null) {
             throw NexusError(HttpStatusCode.NotFound, "prepared payment not 
found")
         }
-        paymentInitiation.bankAccount.defaultBankConnection?.type
+        object {
+            val type = 
paymentInitiation.bankAccount.defaultBankConnection?.type
+            val submitted = paymentInitiation.submitted
+        }
+    }
+    if (r.submitted) {
+        return
     }
-    when (type) {
+    when (r.type) {
         null -> throw NexusError(HttpStatusCode.NotFound, "no default bank 
connection")
         "ebics" -> submitEbicsPaymentInitiation(httpClient, 
paymentInitiationId)
     }

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