diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/TanChallenge.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/TanChallenge.kt index 56425241..bda1b202 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/TanChallenge.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/TanChallenge.kt @@ -32,18 +32,24 @@ open class TanChallenge( this.enterTanResult = EnterTanResult(null, true, responseAfterApprovingDecoupledTan) userApprovedDecoupledTanCallbacks.forEach { it.invoke() } - userApprovedDecoupledTanCallbacks.clear() + clearUserApprovedDecoupledTanCallbacks() } fun userDidNotEnterTan() { + clearUserApprovedDecoupledTanCallbacks() + this.enterTanResult = EnterTanResult(null) } fun userAsksToChangeTanMethod(changeTanMethodTo: TanMethod) { + clearUserApprovedDecoupledTanCallbacks() + this.enterTanResult = EnterTanResult(null, changeTanMethodTo = changeTanMethodTo) } fun userAsksToChangeTanMedium(changeTanMediumTo: TanMedium, changeTanMediumResultCallback: ((FinTsClientResponse) -> Unit)?) { + clearUserApprovedDecoupledTanCallbacks() + this.enterTanResult = EnterTanResult(null, changeTanMediumTo = changeTanMediumTo, changeTanMediumResultCallback = changeTanMediumResultCallback) } @@ -56,6 +62,10 @@ open class TanChallenge( } } + protected open fun clearUserApprovedDecoupledTanCallbacks() { + userApprovedDecoupledTanCallbacks.clear() + } + override fun toString(): String { return "$tanMethod (medium: $tanMediaIdentifier): $messageToShowToUser"