From e4b6a7efd59650bf4647203137bd38d5fe300753 Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 16 Oct 2020 19:03:21 +0200 Subject: [PATCH] If Pin or chipTan is locked only warning but no error is returned by server -> check also these feedbacks to detect if response was successful --- .../net/dankito/banking/fints/response/BankResponse.kt | 8 ++++++-- .../dankito/banking/fints/response/segments/Feedback.kt | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/BankResponse.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/BankResponse.kt index f90e83a8..090877be 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/BankResponse.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/BankResponse.kt @@ -25,7 +25,11 @@ open class BankResponse( get() = messageCreationError == null open val responseContainsErrors: Boolean - get() = errorMessage == null && messageFeedback?.isError == true + get() = errorMessage == null && + (messageFeedback?.isError == true || isPinLocked) + + open val isPinLocked: Boolean + get() = segmentFeedbacks.flatMap { it.feedbacks }.any { it.isPinLocked } open val wrongCredentialsEntered: Boolean get() { @@ -98,7 +102,7 @@ open class BankResponse( } protected open fun mapToMessageToShowToUser(feedback: Feedback): String? { - if (feedback.isError) { + if (feedback.isError || feedback.isPinLocked) { if (feedback.responseCode != 9800) { // filter out 'Dialogabbruch' feedbacks, is of no value to user return "${feedback.responseCode}: ${feedback.message}" } diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/segments/Feedback.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/segments/Feedback.kt index 0920920c..24c0b55f 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/segments/Feedback.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/segments/Feedback.kt @@ -45,6 +45,9 @@ open class Feedback( val isWarning: Boolean get() = responseCode in 3000..3999 + val isPinLocked: Boolean + get() = responseCode in 3930..3939 + val isError: Boolean get() = responseCode in 9000..9999