Extracted createNoTanMethodSelectedResponse()
This commit is contained in:
parent
fed10e21c0
commit
dee1fd7211
|
@ -156,15 +156,11 @@ open class FinTsJobExecutor(
|
||||||
getAnonymousBankInfo(bank) { anonymousBankInfoResponse ->
|
getAnonymousBankInfo(bank) { anonymousBankInfoResponse ->
|
||||||
if (anonymousBankInfoResponse.successful == false) {
|
if (anonymousBankInfoResponse.successful == false) {
|
||||||
callback(anonymousBankInfoResponse)
|
callback(anonymousBankInfoResponse)
|
||||||
}
|
} else if (bank.tanMethodSupportedByBank.isEmpty()) { // should only be a theoretical error
|
||||||
else if (bank.tanMethodSupportedByBank.isEmpty()) { // should only be a theoretical error
|
callback(BankResponse(true, errorMessage = "Die TAN Verfahren der Bank konnten nicht ermittelt werden")) // TODO: translate
|
||||||
callback(
|
} else {
|
||||||
BankResponse(true,
|
|
||||||
errorMessage = "Die TAN Verfahren der Bank konnten nicht ermittelt werden")
|
|
||||||
) // TODO: translate
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bank.tanMethodsAvailableForUser = bank.tanMethodSupportedByBank
|
bank.tanMethodsAvailableForUser = bank.tanMethodSupportedByBank
|
||||||
|
|
||||||
getUsersTanMethod(bank) { didSelectTanMethod ->
|
getUsersTanMethod(bank) { didSelectTanMethod ->
|
||||||
if (didSelectTanMethod) {
|
if (didSelectTanMethod) {
|
||||||
val dialogContext = DialogContext(bank, product)
|
val dialogContext = DialogContext(bank, product)
|
||||||
|
@ -174,9 +170,8 @@ open class FinTsJobExecutor(
|
||||||
|
|
||||||
callback(initDialogResponse)
|
callback(initDialogResponse)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
callback(createNoTanMethodSelectedResponse(bank))
|
||||||
callback(BankResponse(false))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +193,7 @@ open class FinTsJobExecutor(
|
||||||
callback(response)
|
callback(response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
open fun getTransactionsAsync(parameter: GetTransactionsParameter, bank: BankData, callback: (GetTransactionsResponse) -> Unit) {
|
open fun getTransactionsAsync(parameter: GetTransactionsParameter, bank: BankData, callback: (GetTransactionsResponse) -> Unit) {
|
||||||
|
|
||||||
|
@ -653,15 +648,22 @@ open class FinTsJobExecutor(
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
getUsersTanMethod(bank) {
|
getUsersTanMethod(bank) {
|
||||||
callback(BankResponse(bank.isTanMethodSelected, noTanMethodSelected = !!!bank.isTanMethodSelected))
|
callback(createNoTanMethodSelectedResponse(bank))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
callback(BankResponse(bank.isTanMethodSelected, noTanMethodSelected = !!!bank.isTanMethodSelected))
|
callback(createNoTanMethodSelectedResponse(bank))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createNoTanMethodSelectedResponse(bank: BankData): BankResponse {
|
||||||
|
val noTanMethodSelected = !!!bank.isTanMethodSelected
|
||||||
|
val errorMessage = if (noTanMethodSelected) "User did not select a TAN method" else null // TODO: translate
|
||||||
|
|
||||||
|
return BankResponse(true, noTanMethodSelected = noTanMethodSelected, errorMessage = errorMessage)
|
||||||
|
}
|
||||||
|
|
||||||
open fun getUsersTanMethod(bank: BankData, done: (Boolean) -> Unit) {
|
open fun getUsersTanMethod(bank: BankData, done: (Boolean) -> Unit) {
|
||||||
if (bank.tanMethodsAvailableForUser.size == 1) { // user has only one TAN method -> set it and we're done
|
if (bank.tanMethodsAvailableForUser.size == 1) { // user has only one TAN method -> set it and we're done
|
||||||
bank.selectedTanMethod = bank.tanMethodsAvailableForUser.first()
|
bank.selectedTanMethod = bank.tanMethodsAvailableForUser.first()
|
||||||
|
|
Loading…
Reference in New Issue