Implemented passing default bank data to FinTsClient as e.g. bank names returned from bank server are often quite bad, e.g. DB24 for Deutsche Bank
This commit is contained in:
parent
fbafbb62e3
commit
6bf7fdcb44
|
@ -184,12 +184,14 @@ open class FinTsClient(
|
||||||
return net.dankito.banking.client.model.response.FinTsClientResponse(null, null, emptyList(), param.finTsModel)
|
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()) {
|
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)
|
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)
|
val getAccountInfoResponse = getAccountInfo(param, bank)
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,11 @@ open class FinTsModelMapper {
|
||||||
protected open val bicFinder = BicFinder()
|
protected open val bicFinder = BicFinder()
|
||||||
|
|
||||||
|
|
||||||
open fun mapToBankData(param: FinTsClientParameter, finTsServerAddress: String): BankData {
|
open fun mapToBankData(param: FinTsClientParameter, finTsServerAddress: String, defaultValues: BankData? = null): BankData {
|
||||||
return BankData(param.bankCode, param.loginName, param.password, finTsServerAddress, bicFinder.findBic(param.bankCode) ?: "")
|
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 {
|
open fun mapToAccountData(credentials: BankAccountIdentifier, param: FinTsClientParameter): AccountData {
|
||||||
|
|
|
@ -23,7 +23,8 @@ open class GetAccountDataParameter(
|
||||||
preferredTanMethods: List<TanMethodType>? = null,
|
preferredTanMethods: List<TanMethodType>? = null,
|
||||||
preferredTanMedium: String? = null,
|
preferredTanMedium: String? = null,
|
||||||
abortIfTanIsRequired: Boolean = false,
|
abortIfTanIsRequired: Boolean = false,
|
||||||
finTsModel: BankData? = null
|
finTsModel: BankData? = null,
|
||||||
|
open val defaultBankValues: BankData? = null
|
||||||
) : FinTsClientParameter(bankCode, loginName, password, preferredTanMethods, preferredTanMedium, abortIfTanIsRequired, finTsModel) {
|
) : FinTsClientParameter(bankCode, loginName, password, preferredTanMethods, preferredTanMedium, abortIfTanIsRequired, finTsModel) {
|
||||||
|
|
||||||
open val retrieveOnlyAccountInfo: Boolean
|
open val retrieveOnlyAccountInfo: Boolean
|
||||||
|
|
Loading…
Reference in New Issue