diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt index 0fcc99e1..cc401688 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsJobExecutor.kt @@ -217,7 +217,7 @@ open class FinTsJobExecutor( context.bank, parameter.account) bookedTransactions.addAll(chunkTransaction) - remainingMt940String = remainder + remainingMt940String = remainder ?: "" parameter.retrievedChunkListener?.invoke(bookedTransactions) } diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/IAccountTransactionsParser.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/IAccountTransactionsParser.kt index c310406b..d1841e92 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/IAccountTransactionsParser.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/IAccountTransactionsParser.kt @@ -13,6 +13,6 @@ interface IAccountTransactionsParser { fun parseTransactions(transactionsString: String, bank: BankData, account: AccountData): List - fun parseTransactionsChunk(transactionsChunk: String, bank: BankData, account: AccountData): Pair, String> + fun parseTransactionsChunk(transactionsChunk: String, bank: BankData, account: AccountData): Pair, String?> } \ No newline at end of file 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 a1080a64..267b4694 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 @@ -25,7 +25,7 @@ open class Mt940AccountTransactionsParser( return accountStatements.flatMap { mapToAccountTransactions(it, bank, account) } } - override fun parseTransactionsChunk(transactionsChunk: String, bank: BankData, account: AccountData): Pair, String> { + override fun parseTransactionsChunk(transactionsChunk: String, bank: BankData, account: AccountData): Pair, String?> { val (accountStatements, remainder) = mt940Parser.parseMt940Chunk(transactionsChunk) return Pair(accountStatements.flatMap { mapToAccountTransactions(it, bank, account) }, remainder) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/IMt940Parser.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/IMt940Parser.kt index 69b55f1f..ad6085bc 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/IMt940Parser.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/IMt940Parser.kt @@ -25,6 +25,6 @@ interface IMt940Parser { * be displayed immediately to user and the remainder then be passed together with next partial * HKKAZ response to this method till this whole MT 940 statement is parsed. */ - fun parseMt940Chunk(mt940Chunk: String): Pair, String> + fun parseMt940Chunk(mt940Chunk: String): Pair, String?> } \ No newline at end of file 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 9e254ab4..83c963f6 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 @@ -95,11 +95,11 @@ open class Mt940Parser( * be displayed immediately to user and the remainder then be passed together with next partial * HKKAZ response to this method till this whole MT 940 statement is parsed. */ - override fun parseMt940Chunk(mt940Chunk: String): Pair, String> { + override fun parseMt940Chunk(mt940Chunk: String): Pair, String?> { try { val singleAccountStatementsStrings = splitIntoSingleAccountStatements(mt940Chunk).toMutableList() - var remainder = "" + var remainder: String? = null if (singleAccountStatementsStrings.isNotEmpty() && singleAccountStatementsStrings.last().isEmpty() == false) { remainder = singleAccountStatementsStrings.removeAt(singleAccountStatementsStrings.lastIndex) } 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 12049472..b70fa0d7 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 @@ -110,7 +110,7 @@ class Mt940ParserTest : FinTsTestBase() { // then - assertEmpty(remainder) + assertNull(remainder) assertSize(1, statements)