Fixed that if getting user's TAN procedures comdirect says that message is invalid but it isn't
This commit is contained in:
parent
ec0c23e8d1
commit
84c0011e13
|
@ -13,6 +13,7 @@ import net.dankito.fints.messages.datenelemente.implementierte.tan.TanMediumKlas
|
|||
import net.dankito.fints.messages.datenelemente.implementierte.tan.ZkaTanProcedure
|
||||
import net.dankito.fints.messages.segmente.id.CustomerSegmentId
|
||||
import net.dankito.fints.model.*
|
||||
import net.dankito.fints.response.GetUserTanProceduresResponse
|
||||
import net.dankito.fints.response.InstituteSegmentId
|
||||
import net.dankito.fints.response.Response
|
||||
import net.dankito.fints.response.ResponseParser
|
||||
|
@ -467,7 +468,7 @@ open class FinTsClient @JvmOverloads constructor(
|
|||
|
||||
val requestBody = messageBuilder.createInitDialogMessage(bank, customer, product, dialogData, useStrongAuthentication)
|
||||
|
||||
val response = getAndHandleResponseForMessage(requestBody, bank)
|
||||
val response = GetUserTanProceduresResponse(getAndHandleResponseForMessage(requestBody, bank))
|
||||
|
||||
if (response.successful) {
|
||||
updateBankData(bank, response)
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package net.dankito.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
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue