Fixed that getUsersTanMethod() is async but caller had no chance to wait for response
This commit is contained in:
parent
ee38799cad
commit
63ec9e074a
|
@ -182,8 +182,7 @@ open class FinTsClient(
|
|||
}
|
||||
else {
|
||||
bank.tanMethodsAvailableForUser = bank.tanMethodSupportedByBank
|
||||
getUsersTanMethod(bank)
|
||||
|
||||
getUsersTanMethod(bank) {
|
||||
val dialogContext = DialogContext(bank, product)
|
||||
|
||||
initDialogWithStrongCustomerAuthenticationAfterSuccessfulPreconditionChecks(dialogContext) { initDialogResponse ->
|
||||
|
@ -194,6 +193,7 @@ open class FinTsClient(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected open fun getAccounts(bank: BankData, callback: (BankResponse) -> Unit) {
|
||||
|
@ -632,30 +632,34 @@ open class FinTsClient(
|
|||
callback(BankResponse(false, noTanMethodSelected = true))
|
||||
}
|
||||
else {
|
||||
getUsersTanMethod(bank)
|
||||
getUsersTanMethod(bank) {
|
||||
callback(BankResponse(bank.isTanMethodSelected, noTanMethodSelected = !!!bank.isTanMethodSelected))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
getUsersTanMethod(bank)
|
||||
getUsersTanMethod(bank) {
|
||||
callback(BankResponse(bank.isTanMethodSelected, noTanMethodSelected = !!!bank.isTanMethodSelected))
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
callback(BankResponse(bank.isTanMethodSelected, noTanMethodSelected = !!!bank.isTanMethodSelected))
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun getUsersTanMethod(bank: BankData) {
|
||||
protected open fun getUsersTanMethod(bank: BankData, done: () -> Unit) {
|
||||
if (bank.tanMethodsAvailableForUser.size == 1) { // user has only one TAN method -> set it and we're done
|
||||
bank.selectedTanMethod = bank.tanMethodsAvailableForUser.first()
|
||||
done()
|
||||
}
|
||||
else {
|
||||
// we know user's supported tan methods, now ask user which one to select
|
||||
callback.askUserForTanMethod(bank.tanMethodsAvailableForUser, selectSuggestedTanMethod(bank)) { selectedTanMethod ->
|
||||
selectedTanMethod?.let {
|
||||
bank.selectedTanMethod = selectedTanMethod
|
||||
done()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue