summaryrefslogtreecommitdiff
path: root/nexus
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-01-19 00:09:59 +0100
committerMS <ms@taler.net>2021-01-19 00:09:59 +0100
commitd48d5c51730dc7fe4fd957a8e72e89e378741a71 (patch)
tree8d9580e84ca141a198282187193a62e5ef902925 /nexus
parent39e51101a579c434f5ade883b025ca328d19cb0f (diff)
downloadlibeufin-d48d5c51730dc7fe4fd957a8e72e89e378741a71.tar.gz
libeufin-d48d5c51730dc7fe4fd957a8e72e89e378741a71.tar.bz2
libeufin-d48d5c51730dc7fe4fd957a8e72e89e378741a71.zip
Finding outgoing payments in Camt ONLY based on PmtInfId.
Diffstat (limited to 'nexus')
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt4
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt12
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt4
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/iso20022/Iso20022.kt3
4 files changed, 9 insertions, 14 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 8871412e..26bf5541 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -172,7 +172,6 @@ object PaymentInitiationsTable : LongIdTable() {
val sum = amount("sum")
val currency = varchar("currency", length = 3).default("EUR")
val endToEndId = text("endToEndId")
- val messageId = text("messageId")
val paymentInformationId = text("paymentInformationId")
val instructionId = text("instructionId")
val subject = text("subject")
@@ -180,6 +179,7 @@ object PaymentInitiationsTable : LongIdTable() {
val creditorBic = text("creditorBic").nullable()
val creditorName = text("creditorName")
val submitted = bool("submitted").default(false)
+ val messageId = text("messageId")
/**
* Points at the raw transaction witnessing that this
@@ -203,8 +203,8 @@ class PaymentInitiationEntity(id: EntityID<Long>) : LongEntity(id) {
var creditorName by PaymentInitiationsTable.creditorName
var submitted by PaymentInitiationsTable.submitted
var paymentInformationId by PaymentInitiationsTable.paymentInformationId
- var messageId by PaymentInitiationsTable.messageId
var instructionId by PaymentInitiationsTable.instructionId
+ var messageId by PaymentInitiationsTable.messageId
var confirmationTransaction by NexusBankTransactionEntity optionalReferencedOn PaymentInitiationsTable.confirmationTransaction
}
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 542e237f..84bdd838 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
@@ -182,17 +182,15 @@ fun processCamtMessage(bankAccountId: String, camtDoc: Document, code: String):
// This block tries to acknowledge a former outgoing payment as booked.
if (singletonBatchedTransaction.creditDebitIndicator == CreditDebitIndicator.DBIT) {
val t0 = singletonBatchedTransaction.details
- val msgId = t0.messageId
val pmtInfId = t0.paymentInformationId
- if (msgId != null && pmtInfId != null) {
+ if (pmtInfId != null) {
val paymentInitiation = PaymentInitiationEntity.find {
- (PaymentInitiationsTable.messageId eq msgId) and
- (PaymentInitiationsTable.bankAccount eq acct.id) and
- (PaymentInitiationsTable.paymentInformationId eq pmtInfId)
+ PaymentInitiationsTable.bankAccount eq acct.id and (
+ PaymentInitiationsTable.paymentInformationId eq pmtInfId)
}.firstOrNull()
if (paymentInitiation != null) {
- logger.info("Could confirm one initiated payment: $msgId")
+ logger.info("Could confirm one initiated payment: $pmtInfId")
paymentInitiation.confirmationTransaction = rawEntity
}
}
@@ -271,8 +269,8 @@ fun addPaymentInitiation(paymentData: Pain001Data, debitorAccount: NexusBankAcco
creditorBic = paymentData.creditorBic
creditorIban = paymentData.creditorIban
preparationDate = now
- messageId = "leuf-mp1-$nowHex-$painHex-$acctHex"
endToEndId = "leuf-e-$nowHex-$painHex-$acctHex"
+ messageId = "leuf-mp1-$nowHex-$painHex-$acctHex"
paymentInformationId = "leuf-p-$nowHex-$painHex-$acctHex"
instructionId = "leuf-i-$nowHex-$painHex-$acctHex"
}
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 5e6fc655..cedf91e9 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
@@ -765,12 +765,12 @@ suspend fun submitEbicsPaymentInitiation(httpClient: HttpClient, paymentInitiati
creditorIban = paymentInitiation.creditorIban,
creditorName = paymentInitiation.creditorName,
creditorBic = paymentInitiation.creditorBic,
- messageId = paymentInitiation.messageId,
paymentInformationId = paymentInitiation.paymentInformationId,
preparationTimestamp = paymentInitiation.preparationDate,
subject = paymentInitiation.subject,
instructionId = paymentInitiation.instructionId,
- endToEndId = paymentInitiation.endToEndId
+ endToEndId = paymentInitiation.endToEndId,
+ messageId = paymentInitiation.messageId
)
)
if (!XMLUtil.validateFromString(painMessage)) throw NexusError(
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/iso20022/Iso20022.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/iso20022/Iso20022.kt
index 8b0ce139..182738c9 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/iso20022/Iso20022.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/iso20022/Iso20022.kt
@@ -712,9 +712,6 @@ private fun XmlElementDestructor.extractTransactionDetails(
endToEndId = maybeUniqueChildNamed("Refs") {
maybeUniqueChildNamed("EndToEndId") { focusElement.textContent }
},
- messageId = maybeUniqueChildNamed("Refs") {
- maybeUniqueChildNamed("MsgId") { focusElement.textContent }
- },
paymentInformationId = maybeUniqueChildNamed("Refs") {
maybeUniqueChildNamed("PmtInfId") { focusElement.textContent }
},