Added ErrorCode.NetworkError
This commit is contained in:
parent
53bfc2d978
commit
ef1f987dd1
|
@ -5,6 +5,8 @@ enum class ErrorCode {
|
|||
|
||||
BankDoesNotSupportFinTs3,
|
||||
|
||||
NetworkError,
|
||||
|
||||
InternalError,
|
||||
|
||||
BankReturnedError,
|
||||
|
|
|
@ -98,6 +98,7 @@ open class FinTsModelMapper {
|
|||
|
||||
open fun mapErrorCode(response: FinTsClientResponse): ErrorCode? {
|
||||
return when {
|
||||
response.didReceiveResponse == false -> ErrorCode.NetworkError
|
||||
response.internalError != null -> ErrorCode.InternalError
|
||||
response.errorMessagesFromBank.isNotEmpty() -> ErrorCode.BankReturnedError
|
||||
response.isPinLocked -> ErrorCode.AccountLocked
|
||||
|
|
|
@ -10,6 +10,8 @@ open class FinTsClientResponse(
|
|||
|
||||
open val successful: Boolean,
|
||||
|
||||
open val didReceiveResponse: Boolean,
|
||||
|
||||
open val noTanMethodSelected: Boolean,
|
||||
|
||||
open val isStrongAuthenticationRequired: Boolean,
|
||||
|
@ -40,7 +42,7 @@ open class FinTsClientResponse(
|
|||
) {
|
||||
|
||||
|
||||
constructor(context: JobContext, response: BankResponse) : this(response.successful, response.noTanMethodSelected,
|
||||
constructor(context: JobContext, response: BankResponse) : this(response.successful, response.didReceiveResponse, response.noTanMethodSelected,
|
||||
response.isStrongAuthenticationRequired, response.tanResponse, context.messageLogWithoutSensitiveData,
|
||||
response.internalError, response.errorsToShowToUser, response.isPinLocked, response.wrongCredentialsEntered,
|
||||
response.tanRequiredButUserDidNotEnterOne, response.tanRequiredButWeWereToldToAbortIfSo,
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.dankito.banking.fints.model.RetrievedAccountData
|
|||
open class GetTransactionsResponse(
|
||||
open val retrievedResponses: List<GetAccountTransactionsResponse>,
|
||||
errorMessage: String? = null
|
||||
) : FinTsClientResponse(isSuccessful(retrievedResponses), retrievedResponses.any { it.noTanMethodSelected },
|
||||
) : FinTsClientResponse(isSuccessful(retrievedResponses), retrievedResponses.all { it.didReceiveResponse }, retrievedResponses.any { it.noTanMethodSelected },
|
||||
retrievedResponses.any { it.isStrongAuthenticationRequired }, retrievedResponses.map { it.tanRequired }.firstOrNull(),
|
||||
retrievedResponses.flatMap { it.messageLogWithoutSensitiveData },
|
||||
errorMessage ?: retrievedResponses.mapNotNull { it.internalError }.joinToString("\r\n"),
|
||||
|
|
Loading…
Reference in New Issue