diff --git a/SampleApplications/NativeApp/src/nativeMain/kotlin/util/CsvWriter.kt b/SampleApplications/NativeApp/src/nativeMain/kotlin/util/CsvWriter.kt index 060d2656..3fd3cd46 100644 --- a/SampleApplications/NativeApp/src/nativeMain/kotlin/util/CsvWriter.kt +++ b/SampleApplications/NativeApp/src/nativeMain/kotlin/util/CsvWriter.kt @@ -41,8 +41,8 @@ open class CsvWriter { protected open suspend fun writeToFile(stream: AsyncStream, valueSeparator: String, customer: CustomerAccount, account: BankAccount, transaction: AccountTransaction) { val amount = if (valueSeparator == ";") transaction.amount.amount.string.replace('.', ',') else transaction.amount.amount.string.replace(',', '.') - stream.writeString(listOf(customer.bankName, account.identifier, transaction.valueDate, amount, transaction.amount.currency, ensureNotNull(transaction.postingText), wrap(transaction.reference), - ensureNotNull(transaction.otherPartyName), ensureNotNull(transaction.otherPartyBankCode), ensureNotNull(transaction.otherPartyAccountId)).joinToString(valueSeparator)) + stream.writeString(listOf(customer.bankName, account.identifier, transaction.valueDate, amount, transaction.amount.currency, ensureNotNull(transaction.postingText), wrap(transaction.reference ?: ""), + ensureNotNull(transaction.otherPartyName), ensureNotNull(transaction.otherPartyBankId), ensureNotNull(transaction.otherPartyAccountId)).joinToString(valueSeparator)) stream.writeString(NewLine) } diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/mapper/FinTsModelMapper.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/mapper/FinTsModelMapper.kt index bb369b0f..02b481fd 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/mapper/FinTsModelMapper.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/mapper/FinTsModelMapper.kt @@ -114,7 +114,7 @@ open class FinTsModelMapper { return AccountTransaction( transaction.amount, transaction.reference, transaction.bookingDate, transaction.valueDate, - transaction.otherPartyName, transaction.otherPartyBankCode, transaction.otherPartyAccountId, + transaction.otherPartyName, transaction.otherPartyBankId, transaction.otherPartyAccountId, transaction.postingText, diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/AccountTransaction.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/AccountTransaction.kt index edf2daab..4e63811a 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/AccountTransaction.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/AccountTransaction.kt @@ -19,7 +19,7 @@ open class AccountTransaction( /** * BIC des Überweisenden / Zahlungsempfängers */ - val otherPartyBankCode: String?, + val otherPartyBankId: String?, /** * IBAN des Überweisenden oder Zahlungsempfängers */ @@ -114,8 +114,8 @@ open class AccountTransaction( // for object deserializers internal constructor() : this(AccountData(), Money(Amount.Zero, ""), "", UnixEpochStart, UnixEpochStart, null, null, null, null) - constructor(account: AccountData, amount: Money, unparsedReference: String, bookingDate: LocalDate, valueDate: LocalDate, otherPartyName: String?, otherPartyBankCode: String?, otherPartyAccountId: String?, postingText: String? = null) - : this(account, amount, unparsedReference, bookingDate, valueDate, otherPartyName, otherPartyBankCode, otherPartyAccountId, postingText, + constructor(account: AccountData, amount: Money, unparsedReference: String, bookingDate: LocalDate, valueDate: LocalDate, otherPartyName: String?, otherPartyBankId: String?, otherPartyAccountId: String?, postingText: String? = null) + : this(account, amount, unparsedReference, bookingDate, valueDate, otherPartyName, otherPartyBankId, otherPartyAccountId, postingText, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, "", null, null, "", null, false) @@ -134,7 +134,7 @@ open class AccountTransaction( if (reference != other.reference) return false if (bookingDate != other.bookingDate) return false if (otherPartyName != other.otherPartyName) return false - if (otherPartyBankCode != other.otherPartyBankCode) return false + if (otherPartyBankId != other.otherPartyBankId) return false if (otherPartyAccountId != other.otherPartyAccountId) return false if (postingText != other.postingText) return false if (valueDate != other.valueDate) return false @@ -148,7 +148,7 @@ open class AccountTransaction( result = 31 * result + reference.hashCode() result = 31 * result + bookingDate.hashCode() result = 31 * result + (otherPartyName?.hashCode() ?: 0) - result = 31 * result + (otherPartyBankCode?.hashCode() ?: 0) + result = 31 * result + (otherPartyBankId?.hashCode() ?: 0) result = 31 * result + (otherPartyAccountId?.hashCode() ?: 0) result = 31 * result + (postingText?.hashCode() ?: 0) result = 31 * result + valueDate.hashCode() diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/Mt940AccountTransactionsParser.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/Mt940AccountTransactionsParser.kt index e6cb8486..a1080a64 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/Mt940AccountTransactionsParser.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/Mt940AccountTransactionsParser.kt @@ -56,7 +56,7 @@ open class Mt940AccountTransactionsParser( transaction.statementLine.valueDate, transaction.information?.otherPartyName, - transaction.information?.otherPartyBankCode, + transaction.information?.otherPartyBankId, transaction.information?.otherPartyAccountId, transaction.information?.postingText, diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/Mt940Parser.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/Mt940Parser.kt index bbb64723..ef0dab60 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/Mt940Parser.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/Mt940Parser.kt @@ -316,7 +316,7 @@ open class Mt940Parser( val referenceParts = mutableListOf() val otherPartyName = StringBuilder() - var otherPartyBankCode: String? = null + var otherPartyBankId: String? = null var otherPartyAccountId: String? = null var bookingText: String? = null var primaNotaNumber: String? = null @@ -332,7 +332,7 @@ open class Mt940Parser( 0 -> bookingText = fieldValue 10 -> primaNotaNumber = fieldValue in 20..29 -> referenceParts.add(fieldValue) - 30 -> otherPartyBankCode = fieldValue + 30 -> otherPartyBankId = fieldValue 31 -> otherPartyAccountId = fieldValue 32, 33 -> otherPartyName.append(fieldValue) 34 -> textKeySupplement = fieldValue @@ -346,7 +346,7 @@ open class Mt940Parser( val otherPartyNameString = if (otherPartyName.isBlank()) null else otherPartyName.toString() return RemittanceInformationField( - reference, otherPartyNameString, otherPartyBankCode, otherPartyAccountId, + reference, otherPartyNameString, otherPartyBankId, otherPartyAccountId, bookingText, primaNotaNumber, textKeySupplement ) } diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/model/RemittanceInformationField.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/model/RemittanceInformationField.kt index acf664df..7828060d 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/model/RemittanceInformationField.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/model/RemittanceInformationField.kt @@ -11,7 +11,7 @@ open class RemittanceInformationField( * BLZ Überweisender / Zahlungsempfänger * Bei SEPA-Zahlungen BIC des Überweisenden / Zahlungsempfängers. */ - val otherPartyBankCode: String?, + val otherPartyBankId: String?, /** * AT 01 IBAN des Überweisenden (Zahlungseingang Überweisung) * AT 04 IBAN des Zahlungsempfängers (Eingang Lastschrift) diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/AccountTransaction.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/AccountTransaction.kt index 19e3812f..8958fb2c 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/AccountTransaction.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/AccountTransaction.kt @@ -16,7 +16,7 @@ open class AccountTransaction( val valueDate: LocalDate, val otherPartyName: String?, - val otherPartyBankCode: String?, + val otherPartyBankId: String?, val otherPartyAccountId: String?, val postingText: String?, @@ -50,8 +50,8 @@ open class AccountTransaction( // for object deserializers internal constructor() : this(Money(Amount.Zero, ""), "", UnixEpochStart, UnixEpochStart, null, null, null, null) - constructor(amount: Money, unparsedReference: String, bookingDate: LocalDate, valueDate: LocalDate, otherPartyName: String?, otherPartyBankCode: String?, otherPartyAccountId: String?, postingText: String?) - : this(amount, unparsedReference, bookingDate, valueDate, otherPartyName, otherPartyBankCode, otherPartyAccountId, postingText, + constructor(amount: Money, unparsedReference: String, bookingDate: LocalDate, valueDate: LocalDate, otherPartyName: String?, otherPartyBankId: String?, otherPartyAccountId: String?, postingText: String?) + : this(amount, unparsedReference, bookingDate, valueDate, otherPartyName, otherPartyBankId, otherPartyAccountId, postingText, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null) @@ -69,7 +69,7 @@ open class AccountTransaction( if (reference != other.reference) return false if (bookingDate != other.bookingDate) return false if (otherPartyName != other.otherPartyName) return false - if (otherPartyBankCode != other.otherPartyBankCode) return false + if (otherPartyBankId != other.otherPartyBankId) return false if (otherPartyAccountId != other.otherPartyAccountId) return false if (postingText != other.postingText) return false if (valueDate != other.valueDate) return false @@ -82,7 +82,7 @@ open class AccountTransaction( result = 31 * result + reference.hashCode() result = 31 * result + bookingDate.hashCode() result = 31 * result + (otherPartyName?.hashCode() ?: 0) - result = 31 * result + (otherPartyBankCode?.hashCode() ?: 0) + result = 31 * result + (otherPartyBankId?.hashCode() ?: 0) result = 31 * result + (otherPartyAccountId?.hashCode() ?: 0) result = 31 * result + (postingText?.hashCode() ?: 0) result = 31 * result + valueDate.hashCode() diff --git a/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/transactions/Mt940ParserTest.kt b/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/transactions/Mt940ParserTest.kt index 83813c13..ac2aa871 100644 --- a/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/transactions/Mt940ParserTest.kt +++ b/fints4k/src/commonTest/kotlin/net/codinux/banking/fints/transactions/Mt940ParserTest.kt @@ -26,12 +26,12 @@ class Mt940ParserTest : FinTsTestBase() { val AccountStatement1Transaction1Amount = Amount("1234,56") val AccountStatement1Transaction1OtherPartyName = "Sender1" - val AccountStatement1Transaction1OtherPartyBankCode = "AAAADE12" + val AccountStatement1Transaction1OtherPartyBankId = "AAAADE12" val AccountStatement1Transaction1OtherPartyAccountId = "DE99876543210987654321" val AccountStatement1Transaction2Amount = Amount("432,10") val AccountStatement1Transaction2OtherPartyName = "Receiver2" - val AccountStatement1Transaction2OtherPartyBankCode = "BBBBDE56" + val AccountStatement1Transaction2OtherPartyBankId = "BBBBDE56" val AccountStatement1Transaction2OtherPartyAccountId = "DE77987654321234567890" val AccountStatement1ClosingBalanceAmount = Amount("13580,23") @@ -67,7 +67,7 @@ class Mt940ParserTest : FinTsTestBase() { val transaction = statement.transactions.first() assertTurnover(transaction.statementLine, AccountStatement1BookingDate, AccountStatement1Transaction1Amount) assertTransactionDetails(transaction.information, AccountStatement1Transaction1OtherPartyName, - AccountStatement1Transaction1OtherPartyBankCode, AccountStatement1Transaction1OtherPartyAccountId) + AccountStatement1Transaction1OtherPartyBankId, AccountStatement1Transaction1OtherPartyAccountId) } @Test @@ -124,12 +124,12 @@ class Mt940ParserTest : FinTsTestBase() { val firstTransaction = statement.transactions.first() assertTurnover(firstTransaction.statementLine, AccountStatement1BookingDate, AccountStatement1Transaction1Amount) assertTransactionDetails(firstTransaction.information, AccountStatement1Transaction1OtherPartyName, - AccountStatement1Transaction1OtherPartyBankCode, AccountStatement1Transaction1OtherPartyAccountId) + AccountStatement1Transaction1OtherPartyBankId, AccountStatement1Transaction1OtherPartyAccountId) val secondTransaction = statement.transactions[1] assertTurnover(secondTransaction.statementLine, AccountStatement1BookingDate, AccountStatement1Transaction2Amount, false) assertTransactionDetails(secondTransaction.information, AccountStatement1Transaction2OtherPartyName, - AccountStatement1Transaction2OtherPartyBankCode, AccountStatement1Transaction2OtherPartyAccountId) + AccountStatement1Transaction2OtherPartyBankId, AccountStatement1Transaction2OtherPartyAccountId) } @Test @@ -307,7 +307,7 @@ class Mt940ParserTest : FinTsTestBase() { result.first().transactions[0].information?.apply { assertEquals("BASISLASTSCHRIFT", postingText) - assertEquals("TUBDDEDD", otherPartyBankCode) + assertEquals("TUBDDEDD", otherPartyBankId) assertEquals("DE87300308801234567890", otherPartyAccountId) assertEquals("6MKL2OT30QENNLIU", endToEndReference) assertEquals("?,3SQNdUbxm9z7dB)+gKYDJAKzCM0G", mandateReference) @@ -363,12 +363,12 @@ class Mt940ParserTest : FinTsTestBase() { } private fun assertTransactionDetails(details: RemittanceInformationField?, otherPartyName: String, - otherPartyBankCode: String, otherPartyAccountId: String) { + otherPartyBankId: String, otherPartyAccountId: String) { assertNotNull(details) assertEquals(otherPartyName, details.otherPartyName) - assertEquals(otherPartyBankCode, details.otherPartyBankCode) + assertEquals(otherPartyBankId, details.otherPartyBankId) assertEquals(otherPartyAccountId, details.otherPartyAccountId) } @@ -380,7 +380,7 @@ class Mt940ParserTest : FinTsTestBase() { :60F:C${convertMt940Date(AccountStatement1PreviousStatementBookingDate)}EUR$AccountStatement1OpeningBalanceAmount :61:${convertMt940Date(AccountStatement1BookingDate)}${convertToShortBookingDate(AccountStatement1BookingDate)}CR${AccountStatement1Transaction1Amount}N062NONREF :86:166?00GUTSCHR. UEBERWEISUNG?109249?20EREF+674?21SVWZ+1908301/ - EUR ${AccountStatement1Transaction1Amount}/20?2219-10-02/...?30$AccountStatement1Transaction1OtherPartyBankCode?31$AccountStatement1Transaction1OtherPartyAccountId + EUR ${AccountStatement1Transaction1Amount}/20?2219-10-02/...?30$AccountStatement1Transaction1OtherPartyBankId?31$AccountStatement1Transaction1OtherPartyAccountId ?32$AccountStatement1Transaction1OtherPartyName :62F:C${convertMt940Date(AccountStatement1BookingDate)}EUR$AccountStatement1ClosingBalanceAmount - @@ -393,11 +393,11 @@ class Mt940ParserTest : FinTsTestBase() { :60F:C${convertMt940Date(AccountStatement1PreviousStatementBookingDate)}EUR$AccountStatement1OpeningBalanceAmount :61:${convertMt940Date(AccountStatement1BookingDate)}${convertToShortBookingDate(AccountStatement1BookingDate)}CR${AccountStatement1Transaction1Amount}N062NONREF :86:166?00GUTSCHR. UEBERWEISUNG?109249?20EREF+674?21SVWZ+1908301/ - EUR ${AccountStatement1Transaction1Amount}/20?2219-10-02/...?30$AccountStatement1Transaction1OtherPartyBankCode?31$AccountStatement1Transaction1OtherPartyAccountId + EUR ${AccountStatement1Transaction1Amount}/20?2219-10-02/...?30$AccountStatement1Transaction1OtherPartyBankId?31$AccountStatement1Transaction1OtherPartyAccountId ?32$AccountStatement1Transaction1OtherPartyName :61:${convertMt940Date(AccountStatement1BookingDate)}${convertToShortBookingDate(AccountStatement1BookingDate)}DR${AccountStatement1Transaction2Amount}N062NONREF :86:166?00ONLINE-UEBERWEISUNG?109249?20EREF+674?21SVWZ+1908301/ - EUR ${AccountStatement1Transaction2Amount}/20?2219-10-02/...?30$AccountStatement1Transaction2OtherPartyBankCode?31$AccountStatement1Transaction2OtherPartyAccountId + EUR ${AccountStatement1Transaction2Amount}/20?2219-10-02/...?30$AccountStatement1Transaction2OtherPartyBankId?31$AccountStatement1Transaction2OtherPartyAccountId ?32$AccountStatement1Transaction2OtherPartyName :62F:C${convertMt940Date(AccountStatement1BookingDate)}EUR${AccountStatement1With2TransactionsClosingBalanceAmount} -