diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/callback/NoOpFinTsClientCallback.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/callback/NoOpFinTsClientCallback.kt new file mode 100644 index 00000000..af7f2fbe --- /dev/null +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/callback/NoOpFinTsClientCallback.kt @@ -0,0 +1,23 @@ +package net.dankito.fints.callback + +import net.dankito.fints.messages.datenelemente.implementierte.tan.TanGeneratorTanMedium +import net.dankito.fints.model.* + + +open class NoOpFinTsClientCallback : FinTsClientCallback { + + override fun askUserForTanProcedure(supportedTanProcedures: List, + suggestedTanProcedure: TanProcedure?): TanProcedure? { + + return suggestedTanProcedure + } + + override fun enterTan(customer: CustomerData, tanChallenge: TanChallenge): EnterTanResult { + return EnterTanResult.userDidNotEnterTan() + } + + override fun enterTanGeneratorAtc(customer: CustomerData, tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult { + return EnterTanGeneratorAtcResult.userDidNotEnterTan() + } + +} \ No newline at end of file diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/callback/SimpleFinTsClientCallback.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/callback/SimpleFinTsClientCallback.kt new file mode 100644 index 00000000..cb08f5e9 --- /dev/null +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/callback/SimpleFinTsClientCallback.kt @@ -0,0 +1,27 @@ +package net.dankito.fints.callback + +import net.dankito.fints.messages.datenelemente.implementierte.tan.TanGeneratorTanMedium +import net.dankito.fints.model.* + + +open class SimpleFinTsClientCallback( + protected val enterTan: ((customer: CustomerData, tanChallenge: TanChallenge) -> EnterTanResult)? = null, + protected val enterTanGeneratorAtc: ((customer: CustomerData, tanMedium: TanGeneratorTanMedium) -> EnterTanGeneratorAtcResult)? = null, + protected val askUserForTanProcedure: ((supportedTanProcedures: List, suggestedTanProcedure: TanProcedure?) -> TanProcedure?)? = null +) : FinTsClientCallback { + + override fun askUserForTanProcedure(supportedTanProcedures: List, + suggestedTanProcedure: TanProcedure?): TanProcedure? { + + return askUserForTanProcedure?.invoke(supportedTanProcedures, suggestedTanProcedure) ?: suggestedTanProcedure + } + + override fun enterTan(customer: CustomerData, tanChallenge: TanChallenge): EnterTanResult { + return enterTan?.invoke(customer, tanChallenge) ?: EnterTanResult.userDidNotEnterTan() + } + + override fun enterTanGeneratorAtc(customer: CustomerData, tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult { + return enterTanGeneratorAtc?.invoke(customer, tanMedium) ?: EnterTanGeneratorAtcResult.userDidNotEnterTan() + } + +} \ No newline at end of file