Also taking now message feedbacks into account to evaluate if wrong credentials have been entered

This commit is contained in:
dankito 2020-09-30 04:34:24 +02:00
parent 1c3f3505b0
commit 75525d704a
1 changed files with 19 additions and 5 deletions

View File

@ -29,13 +29,27 @@ open class BankResponse(
open val wrongCredentialsEntered: Boolean
get() {
val wrongCredentialsEnteredFeedbacks = segmentFeedbacks.flatMap { it.feedbacks }
.filter { it.responseCode in 9910..9949 || (it.responseCode == 9210 && it.message.contains("Unbekannt", true)) } // this is not 100 % correct, there are e.g. messages like "9941 TAN ungültig" or "9910 Chipkarte gesperrt", see p. 22-23 FinTS_Rueckmeldungscodes ->
.filterNot { it.message.contains("TAN", true) || it.message.contains("Chipkarte", true) } // ... try to filter these
return wrongCredentialsEnteredFeedbacks.isNotEmpty()
return messageFeedback?.feedbacks?.any { isWrongCredentialsEnteredFeedback(it) } == true
|| segmentFeedbacks.flatMap { it.feedbacks }.any { isWrongCredentialsEnteredFeedback(it) }
}
protected open fun isWrongCredentialsEnteredFeedback(feedback: Feedback): Boolean {
if (feedback.responseCode == 9340) {
return true
}
if (feedback.responseCode in 9910..9949) { // this is not 100 % correct, there are e.g. messages like "9941 TAN ungültig" or "9910 Chipkarte gesperrt", see p. 22-23 FinTS_Rueckmeldungscodes ->
return feedback.message.contains("TAN", true) == false && feedback.message.contains("Chipkarte", true) == false // ... try to filter these
}
if (feedback.responseCode == 9210) { // there are many, many different messages with response code 9210, try to find these with 'Unbekannter Benutzer', 'Benutzerkennung ungültig', 'Bitte korrigieren Sie Ihre Zugangsdaten'
return feedback.message.contains("Unbekannt", true) || feedback.message.contains("kennung", true)
|| feedback.message.contains("Zugangsdaten", true)
}
return false
}
open var tanRequiredButUserDidNotEnterOne = false
open var tanRequiredButWeWereToldToAbortIfSo = false