Added tanRequiredButWeWereToldToAbortIfSo to GetTransactionsResponse to not show an error message on UI if a TAN is required but we told client to abort if one is required

This commit is contained in:
dankito 2020-05-25 18:17:02 +02:00
parent a8eb748f57
commit d94dad345c
3 changed files with 6 additions and 3 deletions

View File

@ -12,6 +12,7 @@ open class GetTransactionsResponse(
val unbookedTransactions: Map<BankAccount, List<Any>> = mapOf(), val unbookedTransactions: Map<BankAccount, List<Any>> = mapOf(),
val balances: Map<BankAccount, BigDecimal> = mapOf(), val balances: Map<BankAccount, BigDecimal> = mapOf(),
error: Exception? = null, error: Exception? = null,
userCancelledAction: Boolean = false userCancelledAction: Boolean = false,
val tanRequiredButWeWereToldToAbortIfSo: Boolean = false
) )
: BankingClientResponse(isSuccessful, errorToShowToUser, error, userCancelledAction) : BankingClientResponse(isSuccessful, errorToShowToUser, error, userCancelledAction)

View File

@ -278,7 +278,9 @@ open class BankingPresenter(
client.getTransactionsAsync(bankAccount, GetTransactionsParameter(true, fromDate, null, abortIfTanIsRequired, { receivedAccountsTransactionChunk(bankAccount, it) } )) { response -> client.getTransactionsAsync(bankAccount, GetTransactionsParameter(true, fromDate, null, abortIfTanIsRequired, { receivedAccountsTransactionChunk(bankAccount, it) } )) { response ->
if (response.tanRequiredButWeWereToldToAbortIfSo == false) { // don't call retrievedAccountTransactions() if aborted due to TAN required but we told client to abort if so
retrievedAccountTransactions(bankAccount, startDate, response) retrievedAccountTransactions(bankAccount, startDate, response)
}
callback(response) callback(response)
} }

View File

@ -53,7 +53,7 @@ open class fints4kModelMapper {
mapOf(bankAccount to mapTransactions(bankAccount, response.bookedTransactions)), mapOf(bankAccount to mapTransactions(bankAccount, response.bookedTransactions)),
mapOf(), // TODO: map unbooked transactions mapOf(), // TODO: map unbooked transactions
response.balance?.let { mapOf(bankAccount to it) } ?: mapOf(), response.balance?.let { mapOf(bankAccount to it) } ?: mapOf(),
response.exception, response.userCancelledAction) response.exception, response.userCancelledAction, response.tanRequiredButWeWereToldToAbortIfSo)
} }
open fun mapErrorToShowToUser(response: FinTsClientResponse): String? { open fun mapErrorToShowToUser(response: FinTsClientResponse): String? {