Added getUsersTanMethod() to retrieveBasicDataLikeUsersTanMethods() so that it's callers don't have to do this

This commit is contained in:
dankito 2021-10-31 16:08:42 +01:00
parent 4d3c1aece3
commit cb25a2294a
2 changed files with 16 additions and 23 deletions

View File

@ -74,22 +74,14 @@ open class FinTsClient(
return@retrieveBasicDataLikeUsersTanMethods
}
jobExecutor.getUsersTanMethod(bank) { didSelectTanMethod ->
/* Second dialog: some banks require that in order to initialize a dialog with strong customer authorization TAN media is required */
if (didSelectTanMethod == false) {
callback(AddAccountResponse(BankResponse(false), bank))
return@getUsersTanMethod
}
/* Second dialog: some banks require that in order to initialize a dialog with strong customer authorization TAN media is required */
if (jobExecutor.isJobSupported(bank, CustomerSegmentId.TanMediaList)) {
getTanMediaList(bank, TanMedienArtVersion.Alle, TanMediumKlasse.AlleMedien) {
addAccountGetAccountsAndTransactions(parameter, bank, callback)
}
} else {
if (jobExecutor.isJobSupported(bank, CustomerSegmentId.TanMediaList)) {
getTanMediaList(bank, TanMedienArtVersion.Alle, TanMediumKlasse.AlleMedien) {
addAccountGetAccountsAndTransactions(parameter, bank, callback)
}
} else {
addAccountGetAccountsAndTransactions(parameter, bank, callback)
}
}
}

View File

@ -110,7 +110,15 @@ open class FinTsJobExecutor(
getAndHandleResponseForMessage(message, dialogContext) { response ->
closeDialog(dialogContext)
handleGetUsersTanMethodsResponse(response, dialogContext, callback)
handleGetUsersTanMethodsResponse(response, dialogContext) { getTanMethodsResponse ->
if (bank.tanMethodsAvailableForUser.isEmpty()) { // could not retrieve supported tan methods for user
callback(BankResponse(false, noTanMethodSelected = true))
} else {
getUsersTanMethod(bank) {
callback(BankResponse(bank.isTanMethodSelected, noTanMethodSelected = !!!bank.isTanMethodSelected))
}
}
}
}
}
@ -632,15 +640,8 @@ open class FinTsJobExecutor(
protected open fun ensureTanMethodIsSelected(bank: BankData, callback: (BankResponse) -> Unit) {
if (bank.isTanMethodSelected == false) {
if (bank.tanMethodsAvailableForUser.isEmpty()) {
retrieveBasicDataLikeUsersTanMethods(bank) {
if (bank.tanMethodsAvailableForUser.isEmpty()) { // could not retrieve supported tan methods for user
callback(BankResponse(false, noTanMethodSelected = true))
}
else {
getUsersTanMethod(bank) {
callback(BankResponse(bank.isTanMethodSelected, noTanMethodSelected = !!!bank.isTanMethodSelected))
}
}
retrieveBasicDataLikeUsersTanMethods(bank) { retrieveBasicDataResponse ->
callback(retrieveBasicDataResponse)
}
}
else {