Implemented setting selected TAN procedure without asking user if there is only one allowed TAN procedure

This commit is contained in:
dankito 2020-05-13 20:33:31 +02:00
parent 1859fb2575
commit a0e7fe0534
1 changed files with 15 additions and 5 deletions

View File

@ -172,8 +172,13 @@ open class FinTsClient @JvmOverloads constructor(
var didOverwriteUserUnselectedTanProcedure = false var didOverwriteUserUnselectedTanProcedure = false
if (customer.isTanProcedureSelected == false && customer.supportedTanProcedures.isNotEmpty()) { if (customer.isTanProcedureSelected == false && customer.supportedTanProcedures.isNotEmpty()) {
didOverwriteUserUnselectedTanProcedure = true if (customer.supportedTanProcedures.size == 1) { // user has only one TAN procedure -> set it and we're done
customer.selectedTanProcedure = customer.supportedTanProcedures.first() // TODO: check if user has only one TAN procedure -> set it and we're done customer.selectedTanProcedure = customer.supportedTanProcedures.first()
}
else {
didOverwriteUserUnselectedTanProcedure = true
customer.selectedTanProcedure = customer.supportedTanProcedures.first()
}
} }
@ -501,9 +506,14 @@ open class FinTsClient @JvmOverloads constructor(
return Response(false, noTanProcedureSelected = true) return Response(false, noTanProcedureSelected = true)
} }
// we know user's supported tan procedures, now ask user which one to select if (customer.supportedTanProcedures.size == 1) { // user has only one TAN procedure -> set it and we're done
callback.askUserForTanProcedure(customer.supportedTanProcedures, selectSuggestedTanProcedure(customer))?.let { customer.selectedTanProcedure = customer.supportedTanProcedures.first()
customer.selectedTanProcedure = it }
else {
// we know user's supported tan procedures, now ask user which one to select
callback.askUserForTanProcedure(customer.supportedTanProcedures, selectSuggestedTanProcedure(customer))?.let {
customer.selectedTanProcedure = it
}
} }
} }