Displaying now also response code to user. May she then can help us better (or she may even knows what to do with this information)

This commit is contained in:
dankito 2020-09-30 02:24:13 +02:00
parent 0303f94bee
commit e4aa38e11f
1 changed files with 10 additions and 2 deletions

View File

@ -62,18 +62,26 @@ open class BankResponse(
get() {
val errorMessages = segmentFeedbacks
.flatMap { it.feedbacks }
.mapNotNull { if (it.isError) it.message else null }
.mapNotNull { mapToMessageToShowToUser(it) }
.toMutableList()
messageFeedback?.let { messageFeedback ->
if (messageFeedback.isError) {
errorMessages.addAll(0, messageFeedback.feedbacks.mapNotNull { if (it.isError) it.message else null })
errorMessages.addAll(0, messageFeedback.feedbacks.mapNotNull { mapToMessageToShowToUser(it) })
}
}
return errorMessages
}
protected open fun mapToMessageToShowToUser(feedback: Feedback): String? {
if (feedback.isError) {
return "${feedback.responseCode}: ${feedback.message}"
}
return null
}
open var followUpResponse: BankResponse? = null