gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated (e59182e5 -> a85bd9f4)


From: gnunet
Subject: [libeufin] branch master updated (e59182e5 -> a85bd9f4)
Date: Fri, 15 Jul 2022 15:19:43 +0200

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

ms pushed a change to branch master
in repository libeufin.

    from e59182e5 bounce duplicate reserves
     new f11653de upgrade exposed
     new a85bd9f4 sandbox: avoid parallelism

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 sandbox/build.gradle                                |  3 +--
 sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt |  2 --
 .../tech/libeufin/sandbox/EbicsProtocolBackend.kt   | 21 +++++++++++++++++++--
 .../src/main/kotlin/tech/libeufin/sandbox/Main.kt   |  9 ++++++++-
 4 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/sandbox/build.gradle b/sandbox/build.gradle
index 41a1d7f8..ff138430 100644
--- a/sandbox/build.gradle
+++ b/sandbox/build.gradle
@@ -41,7 +41,7 @@ sourceSets {
 }
 
 def ktor_version = '1.6.1'
-def exposed_version = '0.32.1'
+def exposed_version = '0.38.2'
 
 dependencies {
     implementation "com.hubspot.jinjava:jinjava:2.5.9"
@@ -82,7 +82,6 @@ application {
     applicationDefaultJvmArgs = ['-Djava.net.preferIPv6Addresses=true']
 }
 
-
 jar {
     manifest {
         attributes "Main-Class": "tech.libeufin.sandbox.MainKt"
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index 27f5d3d0..4ae592ef 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -481,8 +481,6 @@ object BankAccountReportsTable : IntIdTable() {
     val bankAccount = reference("bankAccount", BankAccountsTable)
 }
 
-
-
 fun dbDropTables(dbConnectionString: String) {
     Database.connect(dbConnectionString)
     transaction {
diff --git 
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index a4b1f5c4..fcf2bee8 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -27,11 +27,14 @@ import io.ktor.request.*
 import io.ktor.response.respond
 import io.ktor.response.respondText
 import io.ktor.util.AttributeKey
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
 import org.apache.xml.security.binding.xmldsig.RSAKeyValueType
 import org.jetbrains.exposed.exceptions.ExposedSQLException
 import org.jetbrains.exposed.sql.*
 import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
 import org.jetbrains.exposed.sql.statements.api.ExposedBlob
+import 
org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction
 import org.jetbrains.exposed.sql.transactions.transaction
 import org.w3c.dom.Document
 import tech.libeufin.util.*
@@ -44,6 +47,7 @@ import tech.libeufin.util.ebics_s001.UserSignatureData
 import java.math.BigDecimal
 import java.security.interfaces.RSAPrivateCrtKey
 import java.security.interfaces.RSAPublicKey
+import java.sql.Connection
 import java.util.*
 import java.util.zip.DeflaterInputStream
 import java.util.zip.InflaterInputStream
@@ -697,6 +701,16 @@ private fun handleCct(paymentRequest: String) {
     logger.debug("Pain.001: $paymentRequest")
     val parseResult = parsePain001(paymentRequest)
     transaction {
+        val maybeExist = BankAccountTransactionEntity.find {
+            BankAccountTransactionsTable.pmtInfId eq parseResult.pmtInfId
+        }.firstOrNull()
+        if (maybeExist != null) {
+            logger.info(
+                "Nexus submitted twice the PAIN: ${maybeExist.pmtInfId}. Not 
taking any action." +
+                        "  Sandbox gave it this reference: 
${maybeExist.accountServicerReference}"
+            )
+            return@transaction
+        }
         try {
             val bankAccount = getBankAccountFromIban(parseResult.debtorIban)
             if (parseResult.currency != bankAccount.demoBank.currency) throw 
EbicsRequestError(
@@ -1002,7 +1016,7 @@ private fun makePartnerInfo(subscriber: 
EbicsSubscriberEntity): EbicsTypes.Partn
                         this.value = bankAccount.iban
                     }
                 )
-                this.currency = "EUR"
+                this.currency = bankAccount.demoBank.currency
                 this.description = "Ordinary Bank Account"
                 this.bankCodeList = listOf(
                     EbicsTypes.GeneralBankCode().apply {
@@ -1265,7 +1279,10 @@ private fun 
handleEbicsUploadTransactionTransmission(requestContext: RequestCont
             }
         }
         if (getOrderTypeFromTransactionId(requestTransactionID) == "CCT") {
-            logger.debug("Attempting a payment.")
+            logger.debug(
+                "Attempting a payment in thread (name/id): " +
+                        
"${Thread.currentThread().name}/${Thread.currentThread().id}"
+            )
             handleCct(unzippedData.toString(Charsets.UTF_8))
         }
         return EbicsResponse.createForUploadTransferPhase(
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index ef97b4df..52ab1556 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -58,6 +58,7 @@ import io.ktor.application.*
 import io.ktor.features.*
 import io.ktor.http.*
 import io.ktor.jackson.*
+import io.ktor.network.sockets.*
 import io.ktor.request.*
 import io.ktor.response.*
 import io.ktor.routing.*
@@ -65,7 +66,10 @@ import io.ktor.server.engine.*
 import io.ktor.server.netty.*
 import io.ktor.util.*
 import io.ktor.util.date.*
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
 import kotlinx.coroutines.newSingleThreadContext
+import kotlinx.coroutines.withContext
 import org.jetbrains.exposed.sql.*
 import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
 import org.jetbrains.exposed.sql.statements.api.ExposedBlob
@@ -951,7 +955,6 @@ val sandboxApp: Application.() -> Unit = {
             }
             call.respond(EbicsHostsResponse(ebicsHosts))
         }
-
         // Process one EBICS request
         post("/ebicsweb") {
             try {
@@ -1600,6 +1603,10 @@ fun serverMain(port: Int) {
                 this.host = "[::1]"
             }
             module(sandboxApp)
+        },
+        configure = {
+            workerGroupSize = 1
+            callGroupSize = 1
         }
     )
     logger.info("LibEuFin Sandbox running on port $port")

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