From 3160ebaa2c07a4f77022e1161ad85bab5cd65ace Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 12 Aug 2020 15:13:43 +0200 Subject: [PATCH] Fixed that GetUserTanProceduresResponse isn't required anymore --- .../net/dankito/banking/fints/FinTsClient.kt | 5 +--- .../response/GetUserTanProceduresResponse.kt | 24 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/GetUserTanProceduresResponse.kt diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsClient.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsClient.kt index c2b852d1..31076b84 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsClient.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/FinTsClient.kt @@ -12,7 +12,6 @@ import net.dankito.banking.fints.messages.datenelemente.implementierte.signatur. import net.dankito.banking.fints.messages.datenelemente.implementierte.tan.* import net.dankito.banking.fints.messages.segmente.id.CustomerSegmentId import net.dankito.banking.fints.model.* -import net.dankito.banking.fints.response.GetUserTanProceduresResponse import net.dankito.banking.fints.response.InstituteSegmentId import net.dankito.banking.fints.response.Response import net.dankito.banking.fints.response.ResponseParser @@ -567,9 +566,7 @@ open class FinTsClient( val message = messageBuilder.createInitDialogMessage(dialogContext) - getAndHandleResponseForMessage(message, dialogContext) { unmappedResponse -> - val response = GetUserTanProceduresResponse(unmappedResponse) - dialogContext.response = response + getAndHandleResponseForMessage(message, dialogContext) { response -> if (response.successful) { updateBankData(dialogContext.bank, response) diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/GetUserTanProceduresResponse.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/GetUserTanProceduresResponse.kt deleted file mode 100644 index a94c7cad..00000000 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/GetUserTanProceduresResponse.kt +++ /dev/null @@ -1,24 +0,0 @@ -package net.dankito.banking.fints.response - - -open class GetUserTanProceduresResponse(bankResponse: Response) - : Response(bankResponse.didReceiveResponse, bankResponse.receivedResponse, bankResponse.receivedSegments, - bankResponse.exception, bankResponse.noTanProcedureSelected, bankResponse.messageCreationError) { - - /** - * comdirect sends "9955::Unzulässiges TAN-Verfahren." even though '999' is a valid TAN procedure - * for init dialog if user's TAN procedures are not known yet - * -> check if the only error is '9955', then it's still a success. - */ - override val successful: Boolean - get() = noTanProcedureSelected == false && couldCreateMessage && didReceiveResponse - && tanRequiredButUserDidNotEnterOne == false - && (responseContainsErrors == false || containsOnlyInvalidTanProcedureError()) - - protected open fun containsOnlyInvalidTanProcedureError(): Boolean { - val errorFeedbacks = segmentFeedbacks.flatMap { it.feedbacks }.filter { it.isError } - - return errorFeedbacks.size == 1 && errorFeedbacks.first().responseCode == 9955 - } - -} \ No newline at end of file