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