diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt index b8352c19..acfc6c2b 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt @@ -808,9 +808,7 @@ open class FinTsClient @JvmOverloads constructor( accountInfo.accountType, accountInfo.currency, accountHolderName, accountInfo.productName, accountInfo.accountLimit, accountInfo.allowedJobNames) - val accounts = customer.accounts.toMutableList() - accounts.add(newAccount) - customer.accounts = accounts + customer.addAccount(newAccount) } // TODO: may also make use of other info diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/model/CustomerData.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/model/CustomerData.kt index 4d994705..99a85cab 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/model/CustomerData.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/model/CustomerData.kt @@ -11,7 +11,7 @@ open class CustomerData( val userId: String = customerId, var name: String = "", var iban: String? = null, - var accounts: List = listOf(), + val accounts: List = mutableListOf(), var updVersion: Int = UPDVersion.VersionNotReceivedYet, var supportedTanProcedures: List = listOf(), var selectedTanProcedure: TanProcedure = TanProcedureNotSelected, @@ -49,6 +49,11 @@ open class CustomerData( } + open fun addAccount(account: AccountData) { + (accounts as? MutableList)?.add(account) + } + + override fun toString(): String { return customerId }