diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt index a18fc39c..32d1b6ab 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt @@ -184,12 +184,14 @@ open class FinTsClient( return net.dankito.banking.client.model.response.FinTsClientResponse(null, null, emptyList(), param.finTsModel) } - val finTsServerAddress = config.finTsServerAddressFinder.findFinTsServerAddress(param.bankCode) + val defaultValues = (param as? GetAccountDataParameter)?.defaultBankValues + + val finTsServerAddress = defaultValues?.finTs3ServerAddress ?: config.finTsServerAddressFinder.findFinTsServerAddress(param.bankCode) if (finTsServerAddress.isNullOrBlank()) { return net.dankito.banking.client.model.response.FinTsClientResponse(ErrorCode.BankDoesNotSupportFinTs3, "Either bank does not support FinTS 3.0 or we don't know its FinTS server address", emptyList(), null) } - val bank = mapper.mapToBankData(param, finTsServerAddress) + val bank = mapper.mapToBankData(param, finTsServerAddress, defaultValues) val getAccountInfoResponse = getAccountInfo(param, bank) 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 17d334ba..0c44f91b 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 @@ -26,8 +26,11 @@ open class FinTsModelMapper { protected open val bicFinder = BicFinder() - open fun mapToBankData(param: FinTsClientParameter, finTsServerAddress: String): BankData { - return BankData(param.bankCode, param.loginName, param.password, finTsServerAddress, bicFinder.findBic(param.bankCode) ?: "") + open fun mapToBankData(param: FinTsClientParameter, finTsServerAddress: String, defaultValues: BankData? = null): BankData { + return BankData( + param.bankCode, param.loginName, param.password, finTsServerAddress, + defaultValues?.bic ?: bicFinder.findBic(param.bankCode) ?: "", defaultValues?.bankName ?: "" + ) } open fun mapToAccountData(credentials: BankAccountIdentifier, param: FinTsClientParameter): AccountData { diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/parameter/GetAccountDataParameter.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/parameter/GetAccountDataParameter.kt index a821131b..556396dd 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/parameter/GetAccountDataParameter.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/client/model/parameter/GetAccountDataParameter.kt @@ -23,7 +23,8 @@ open class GetAccountDataParameter( preferredTanMethods: List? = null, preferredTanMedium: String? = null, abortIfTanIsRequired: Boolean = false, - finTsModel: BankData? = null + finTsModel: BankData? = null, + open val defaultBankValues: BankData? = null ) : FinTsClientParameter(bankCode, loginName, password, preferredTanMethods, preferredTanMedium, abortIfTanIsRequired, finTsModel) { open val retrieveOnlyAccountInfo: Boolean