libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit abfd36afeb4cb497914a0e9756d2ef82dfd17a6c
parent b540026026e0f37996c73073429d024c08be97d1
Author: Florian Dold <florian.dold@gmail.com>
Date:   Thu, 18 Jun 2020 21:23:42 +0530

comment about matching, don't crash on certain transactions

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt | 29+++++++++++++----------------
1 file changed, 13 insertions(+), 16 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 @@ -137,7 +137,7 @@ fun processCamtMessage( } val transactions = getTransactions(camtDoc) logger.info("found ${transactions.size} transactions") - txloop@for (tx in transactions) { + txloop@ for (tx in transactions) { val acctSvcrRef = tx.accountServicerReference if (acctSvcrRef == null) { // FIXME(dold): Report this! @@ -164,21 +164,18 @@ fun processCamtMessage( // assuming batches contain always one element, as aren't fully // implemented now. val uniqueBatchElement = tx.details.get(0) - markInitiatedAsConfirmed( - // if the user has two initiated payments under the same - // IBAN with the same subject, then this logic will cause - // problems. But a programmatic user should take care of this. - uniqueBatchElement.unstructuredRemittanceInformation, - if (uniqueBatchElement.relatedParties.debtorAccount !is AccountIdentificationIban) { - throw NexusError( - HttpStatusCode.InternalServerError, - "Parsed CAMT didn't have IBAN in debtor!" - ) - } else { - uniqueBatchElement.relatedParties.debtorAccount.iban - }, - rawEntity.id.value - ) + + // if the user has two initiated payments under the same + // IBAN with the same subject, then this logic will cause + // problems. But a programmatic user should take care of this. + // FIXME(dold): Actually, we should do the matching via the Refs of the camt message. + if (uniqueBatchElement.relatedParties.debtorAccount is AccountIdentificationIban) { + markInitiatedAsConfirmed( + uniqueBatchElement.unstructuredRemittanceInformation, + uniqueBatchElement.relatedParties.debtorAccount.iban, + rawEntity.id.value + ) + } } } }