From 0660498ceb5130b265e76aa439735821b183b5a9 Mon Sep 17 00:00:00 2001 From: dankl Date: Wed, 1 Jan 2020 21:08:18 +0100 Subject: [PATCH] Set default values for (rare cases) changeTanProcedureTo and changeTanMediumTo; updated toString() --- .../net/dankito/fints/model/EnterTanResult.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/model/EnterTanResult.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/model/EnterTanResult.kt index c618e785..eb6abcb3 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/model/EnterTanResult.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/model/EnterTanResult.kt @@ -6,23 +6,23 @@ import net.dankito.fints.response.client.FinTsClientResponse open class EnterTanResult protected constructor( val enteredTan: String?, - val changeTanProcedureTo: TanProcedure?, - val changeTanMediumTo: TanMedium?, + val changeTanProcedureTo: TanProcedure? = null, + val changeTanMediumTo: TanMedium? = null, val changeTanMediumResultCallback: ((FinTsClientResponse) -> Unit)? = null ) { companion object { fun userEnteredTan(enteredTan: String): EnterTanResult { - return EnterTanResult(enteredTan, null, null) + return EnterTanResult(enteredTan) } fun userDidNotEnterTan(): EnterTanResult { - return EnterTanResult(null, null, null) + return EnterTanResult(null) } fun userAsksToChangeTanProcedure(changeTanProcedureTo: TanProcedure): EnterTanResult { - return EnterTanResult(null, changeTanProcedureTo, null) + return EnterTanResult(null, changeTanProcedureTo) } fun userAsksToChangeTanMedium(changeTanMediumTo: TanMedium, changeTanMediumResultCallback: (FinTsClientResponse) -> Unit): EnterTanResult { @@ -32,6 +32,10 @@ open class EnterTanResult protected constructor( } override fun toString(): String { + if (changeTanProcedureTo != null) { + return "User asks to change TAN procedure to $changeTanProcedureTo" + } + if (changeTanMediumTo != null) { return "User asks to change TAN medium to $changeTanMediumTo" }