Added SimpleFinTsClientCallback and NoOpFinTsClientCallback
This commit is contained in:
parent
3e853da70c
commit
56972da14d
|
@ -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<TanProcedure>,
|
||||
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()
|
||||
}
|
||||
|
||||
}
|
|
@ -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<TanProcedure>, suggestedTanProcedure: TanProcedure?) -> TanProcedure?)? = null
|
||||
) : FinTsClientCallback {
|
||||
|
||||
override fun askUserForTanProcedure(supportedTanProcedures: List<TanProcedure>,
|
||||
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()
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue