[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated (f1fead3a -> cdf522a9)
From: |
gnunet |
Subject: |
[libeufin] branch master updated (f1fead3a -> cdf522a9) |
Date: |
Tue, 13 Dec 2022 20:26:37 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a change to branch master
in repository libeufin.
from f1fead3a test IBAN conflict
new b8041b12 remove addressed note
new cdf522a9 Disk space policy at Nexus.
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:
nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt | 5 -----
.../tech/libeufin/nexus/bankaccount/BankAccount.kt | 17 +++++++++++------
.../main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt | 1 -
nexus/src/test/kotlin/MakeEnv.kt | 2 --
.../tech/libeufin/sandbox/EbicsProtocolBackend.kt | 11 ++++-------
sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 17 -----------------
6 files changed, 15 insertions(+), 38 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 30192362..4c6dc18e 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -285,9 +285,6 @@ object NexusBankAccountsTable : LongIdTable() {
val lastStatementCreationTimestamp =
long("lastStatementCreationTimestamp").nullable()
val lastReportCreationTimestamp =
long("lastReportCreationTimestamp").nullable()
val lastNotificationCreationTimestamp =
long("lastNotificationCreationTimestamp").nullable()
-
- // Highest bank message ID that this bank account is aware of.
- val highestSeenBankMessageSerialId = long("highestSeenBankMessageSerialId")
val pain001Counter = long("pain001counter").default(1)
}
@@ -297,13 +294,11 @@ class NexusBankAccountEntity(id: EntityID<Long>) :
LongEntity(id) {
return find { NexusBankAccountsTable.bankAccountName eq name
}.firstOrNull()
}
}
-
var bankAccountName by NexusBankAccountsTable.bankAccountName
var accountHolder by NexusBankAccountsTable.accountHolder
var iban by NexusBankAccountsTable.iban
var bankCode by NexusBankAccountsTable.bankCode
var defaultBankConnection by NexusBankConnectionEntity
optionalReferencedOn NexusBankAccountsTable.defaultBankConnection
- var highestSeenBankMessageSerialId by
NexusBankAccountsTable.highestSeenBankMessageSerialId
var pain001Counter by NexusBankAccountsTable.pain001Counter
var lastStatementCreationTimestamp by
NexusBankAccountsTable.lastStatementCreationTimestamp
var lastReportCreationTimestamp by
NexusBankAccountsTable.lastReportCreationTimestamp
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 102feaa2..6025e5ee 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
@@ -39,6 +39,9 @@ import java.time.Instant
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
+// Defaults to false. Gets true if defined as "yes".
+private val keepBankMessages: String? =
System.getenv("LIBEUFIN_NEXUS_KEEP_BANK_MESSAGES")
+
fun requireBankAccount(call: ApplicationCall, parameterKey: String):
NexusBankAccountEntity {
val name = call.parameters[parameterKey]
if (name == null) {
@@ -301,10 +304,10 @@ fun ingestBankMessagesIntoAccount(bankConnectionId:
String, bankAccountId: Strin
if (acct == null) {
throw NexusError(HttpStatusCode.InternalServerError, "account not
found")
}
- var lastId = acct.highestSeenBankMessageSerialId
NexusBankMessageEntity.find {
- (NexusBankMessagesTable.bankConnection eq conn.id) and
- (NexusBankMessagesTable.id greater
acct.highestSeenBankMessageSerialId)
+ (NexusBankMessagesTable.bankConnection eq conn.id) and not(
+ NexusBankMessagesTable.errors
+ )
}.orderBy(Pair(NexusBankMessagesTable.id, SortOrder.ASC)).forEach {
val doc =
XMLUtil.parseStringIntoDom(it.message.bytes.toString(Charsets.UTF_8))
val processingResult = processCamtMessage(bankAccountId, doc,
it.code)
@@ -312,11 +315,14 @@ fun ingestBankMessagesIntoAccount(bankConnectionId:
String, bankAccountId: Strin
it.errors = true
return@forEach
}
- lastId = it.id.value
+ /**
+ * The XML document from the bank parsed correctly,
+ * remove now from the database.
+ */
+ if (keepBankMessages == null || keepBankMessages != "yes")
it.delete()
totalNew += processingResult.newTransactions
downloadedTransactions += processingResult.downloadedTransactions
}
- acct.highestSeenBankMessageSerialId = lastId
}
// return totalNew
return CamtTransactionsCount(
@@ -443,7 +449,6 @@ fun importBankAccount(call: ApplicationCall,
offeredBankAccountId: String, nexus
iban = offeredAccount[OfferedBankAccountsTable.iban]
bankCode =
offeredAccount[OfferedBankAccountsTable.bankCode]
defaultBankConnection = conn
- highestSeenBankMessageSerialId = 0
accountHolder =
offeredAccount[OfferedBankAccountsTable.accountHolder]
}
logger.info("Account ${newImportedAccount.id} gets
imported")
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
index a8069977..0cc58106 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
@@ -305,7 +305,6 @@ fun Route.ebicsBankConnectionRoutes(client: HttpClient) {
reason = "bank gave no BIC"
)
defaultBankConnection = conn
- highestSeenBankMessageSerialId = 0
}
}
}
diff --git a/nexus/src/test/kotlin/MakeEnv.kt b/nexus/src/test/kotlin/MakeEnv.kt
index 58b2affb..1eab2016 100644
--- a/nexus/src/test/kotlin/MakeEnv.kt
+++ b/nexus/src/test/kotlin/MakeEnv.kt
@@ -89,7 +89,6 @@ fun prepNexusDb() {
iban = FOO_USER_IBAN
bankCode = "SANDBOXX"
defaultBankConnection = c
- highestSeenBankMessageSerialId = 0
accountHolder = "foo"
}
val b = NexusBankAccountEntity.new {
@@ -97,7 +96,6 @@ fun prepNexusDb() {
iban = BAR_USER_IBAN
bankCode = "SANDBOXX"
defaultBankConnection = c
- highestSeenBankMessageSerialId = 0
accountHolder = "bar"
}
}
diff --git
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index 7a0eb33a..a50d99b2 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -27,10 +27,7 @@ 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
@@ -287,10 +284,10 @@ fun buildCamtString(
* - Proprietary code of the bank transaction
* - Id of the servicer (Issuer and Code)
*/
- val creationTime = getUTCnow() // FIXME: should this be the payment time?
- val dashedDate = creationTime.toDashedDate()
- val zonedDateTime = creationTime.toZonedString()
- val creationTimeMillis = creationTime.toInstant().toEpochMilli()
+ val camtCreationTime = getUTCnow() // FIXME: should this be the payment
time?
+ val dashedDate = camtCreationTime.toDashedDate()
+ val zonedDateTime = camtCreationTime.toZonedString()
+ val creationTimeMillis = camtCreationTime.toInstant().toEpochMilli()
val messageId = "sandbox-${creationTimeMillis}"
val currency = getDefaultDemobank().currency
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index cde8e6b4..52d0d86a 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -17,23 +17,6 @@
* <http://www.gnu.org/licenses/>
*/
-
-/*
-General thoughts:
-
- - since sandbox will run on the public internet for the demobank, all
endpoints except
- explicitly public ones should use authentication (basic auth)
- - the authentication should be *very* simple and *not* be part of the
database state.
- instead, a LIBEUFIN_SANDBOX_ADMIN_TOKEN environment variable will be used to
- set the authentication.
-
- - All sandbox will require the ADMIN_TOKEN, except:
- - the /ebicsweb endpoint, because EBICS handles authentication here
- (EBICS subscribers are checked)
- - the /demobank(/...) endpoints (except registration and public accounts),
- because authentication is handled by checking the demobank user
credentials
- */
-
package tech.libeufin.sandbox
import UtilError
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libeufin] branch master updated (f1fead3a -> cdf522a9),
gnunet <=