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,13 +74,6 @@ open class FinTsClient(
return@retrieveBasicDataLikeUsersTanMethods return@retrieveBasicDataLikeUsersTanMethods
} }
jobExecutor.getUsersTanMethod(bank) { didSelectTanMethod ->
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 */ /* 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)) { if (jobExecutor.isJobSupported(bank, CustomerSegmentId.TanMediaList)) {
@ -92,7 +85,6 @@ open class FinTsClient(
} }
} }
} }
}
protected open fun addAccountGetAccountsAndTransactions(parameter: AddAccountParameter, bank: BankData, protected open fun addAccountGetAccountsAndTransactions(parameter: AddAccountParameter, bank: BankData,
callback: (AddAccountResponse) -> Unit) { callback: (AddAccountResponse) -> Unit) {

View File

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