Renamed TanProcedure to TanMethod in UI

This commit is contained in:
dankito 2020-09-22 00:25:51 +02:00
parent f5f3f34d3b
commit be42e3b330
42 changed files with 365 additions and 361 deletions

View File

@ -3,7 +3,7 @@ package net.dankito.banking.persistence.model
import com.fasterxml.jackson.annotation.*
import net.dankito.banking.ui.model.ICustomer
import net.dankito.banking.ui.model.tan.TanMedium
import net.dankito.banking.ui.model.tan.TanProcedure
import net.dankito.banking.ui.model.tan.TanMethod
import java.util.*
@ -20,8 +20,8 @@ open class CustomerEntity(
override var userId: String = customerId,
override var iconUrl: String? = null,
override var accounts: List<BankAccountEntity> = listOf(),
override var supportedTanProcedures: List<TanProcedure> = listOf(),
override var selectedTanProcedure: TanProcedure? = null,
override var supportedTanMethods: List<TanMethod> = listOf(),
override var selectedTanMethod: TanMethod? = null,
override var tanMedia: List<TanMedium> = listOf(),
override var countDaysForWhichTransactionsAreKept: Int? = null,
override var technicalId: String = UUID.randomUUID().toString(),

View File

@ -4,20 +4,20 @@ import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.model.tan.TanProcedure
import net.dankito.banking.ui.model.tan.TanMethod
import net.dankito.utils.android.extensions.asActivity
import net.dankito.utils.android.ui.adapter.ListAdapter
open class TanProceduresAdapter : ListAdapter<TanProcedure>() {
open class TanMethodsAdapter : ListAdapter<TanMethod>() {
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View? {
val procedure = getItem(position)
val method = getItem(position)
val view = convertView ?: parent?.context?.asActivity()?.layoutInflater?.inflate(
R.layout.list_item_tan_procedure, parent, false)
R.layout.list_item_tan_method, parent, false)
view?.findViewById<TextView>(R.id.txtTanProcedureDisplayName)?.text = procedure.displayName
view?.findViewById<TextView>(R.id.txtTanMethodDisplayName)?.text = method.displayName
return view
}

View File

@ -18,7 +18,7 @@ import kotlinx.android.synthetic.main.dialog_enter_tan.view.*
import kotlinx.android.synthetic.main.view_collapsible_text.view.*
import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.android.adapter.TanMediumAdapter
import net.dankito.banking.ui.android.adapter.TanProceduresAdapter
import net.dankito.banking.ui.android.adapter.TanMethodsAdapter
import net.dankito.banking.ui.android.di.BankingComponent
import net.dankito.banking.ui.android.listener.ListItemSelectedListener
import net.dankito.banking.ui.model.TypedCustomer
@ -32,10 +32,10 @@ import javax.inject.Inject
open class EnterTanDialog : DialogFragment() {
companion object {
val QrCodeTanProcedures = listOf(TanProcedureType.ChipTanQrCode, TanProcedureType.QrCode)
val QrCodeTanMethods = listOf(TanMethodType.ChipTanQrCode, TanMethodType.QrCode)
val OpticalTanProcedures = listOf(TanProcedureType.ChipTanFlickercode, TanProcedureType.ChipTanQrCode,
TanProcedureType.ChipTanPhotoTanMatrixCode, TanProcedureType.photoTan, TanProcedureType.QrCode)
val OpticalTanMethods = listOf(TanMethodType.ChipTanFlickercode, TanMethodType.ChipTanQrCode,
TanMethodType.ChipTanPhotoTanMatrixCode, TanMethodType.photoTan, TanMethodType.QrCode)
const val DialogTag = "EnterTanDialog"
}
@ -82,7 +82,7 @@ open class EnterTanDialog : DialogFragment() {
}
protected open fun setupUI(rootView: View) {
setupSelectTanProcedureView(rootView)
setupSelectTanMethodView(rootView)
setupTanView(rootView)
@ -95,23 +95,23 @@ open class EnterTanDialog : DialogFragment() {
rootView.btnEnteringTanDone.setOnClickListener { enteringTanDone(rootView.edtxtEnteredTan.text.toString()) }
}
protected open fun setupSelectTanProcedureView(rootView: View) {
val adapter = TanProceduresAdapter()
val tanProceduresWithoutUnsupported = customer.supportedTanProcedures.filterNot { it.type == TanProcedureType.ChipTanUsb } // USB tan generators are not supported on Android
adapter.setItems(tanProceduresWithoutUnsupported)
protected open fun setupSelectTanMethodView(rootView: View) {
val adapter = TanMethodsAdapter()
val tanMethodsWithoutUnsupported = customer.supportedTanMethods.filterNot { it.type == TanMethodType.ChipTanUsb } // USB tan generators are not supported on Android
adapter.setItems(tanMethodsWithoutUnsupported)
rootView.findViewById<Spinner>(R.id.spnTanProcedures)?.let { spinner ->
rootView.findViewById<Spinner>(R.id.spnTanMethods)?.let { spinner ->
spinner.adapter = adapter
val selectedTanProcedure = customer.selectedTanProcedure
?: tanProceduresWithoutUnsupported.firstOrNull { it.type != TanProcedureType.ChipTanManuell && it.type != TanProcedureType.ChipTanUsb }
?: tanProceduresWithoutUnsupported.firstOrNull()
selectedTanProcedure?.let { spinner.setSelection(adapter.getItems().indexOf(selectedTanProcedure)) }
val selectedTanMethod = customer.selectedTanMethod
?: tanMethodsWithoutUnsupported.firstOrNull { it.type != TanMethodType.ChipTanManuell && it.type != TanMethodType.ChipTanUsb }
?: tanMethodsWithoutUnsupported.firstOrNull()
selectedTanMethod?.let { spinner.setSelection(adapter.getItems().indexOf(selectedTanMethod)) }
spinner.onItemSelectedListener = ListItemSelectedListener(adapter) { newSelectedTanProcedure ->
if (newSelectedTanProcedure != selectedTanProcedure) {
tanEnteredCallback(EnterTanResult.userAsksToChangeTanProcedure(newSelectedTanProcedure))
// TODO: find a way to update account.selectedTanProcedure afterwards
spinner.onItemSelectedListener = ListItemSelectedListener(adapter) { newSelectedTanMethod ->
if (newSelectedTanMethod != selectedTanMethod) {
tanEnteredCallback(EnterTanResult.userAsksToChangeTanMethod(newSelectedTanMethod))
// TODO: find a way to update account.selectedTanMethod afterwards
dismiss()
}
@ -120,9 +120,9 @@ open class EnterTanDialog : DialogFragment() {
}
protected open fun setupSelectTanMediumView(rootView: View) {
val tanMediaForTanProcedure = presenter.getTanMediaForTanProcedure(customer, tanChallenge.tanProcedure)
val tanMediaForTanMethod = presenter.getTanMediaForTanMethod(customer, tanChallenge.tanMethod)
if (tanMediaForTanProcedure.size > 1) {
if (tanMediaForTanMethod.size > 1) {
rootView.lytTanMedium.visibility = View.VISIBLE
tanMediumAdapter.setItems(customer.tanMediaSorted)
@ -145,7 +145,7 @@ open class EnterTanDialog : DialogFragment() {
}
protected open fun setupTanView(rootView: View) {
if (OpticalTanProcedures.contains(tanChallenge.tanProcedure.type)) {
if (OpticalTanMethods.contains(tanChallenge.tanMethod.type)) {
setupSelectTanMediumView(rootView)
if (tanChallenge is FlickerCodeTanChallenge) {
@ -158,11 +158,11 @@ open class EnterTanDialog : DialogFragment() {
}
protected open fun setupEnteringTan(rootView: View) {
if (tanChallenge.tanProcedure.isNumericTan) {
if (tanChallenge.tanMethod.isNumericTan) {
rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER
}
tanChallenge.tanProcedure.maxTanInputLength?.let { maxInputLength ->
tanChallenge.tanMethod.maxTanInputLength?.let { maxInputLength ->
rootView.edtxtEnteredTan.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(maxInputLength))
}
@ -260,18 +260,18 @@ open class EnterTanDialog : DialogFragment() {
protected open fun checkIfAppSettingsChanged() {
if (flickerCodeView.didTanProcedureSettingsChange) {
presenter.appSettings.flickerCodeSettings = flickerCodeView.tanProcedureSettings
if (flickerCodeView.didTanMethodSettingsChange) {
presenter.appSettings.flickerCodeSettings = flickerCodeView.tanMethodSettings
presenter.appSettingsChanged()
}
if (tanImageView.didTanProcedureSettingsChange) {
if (tanImageView.didTanMethodSettingsChange) {
if (isQrTan(tanChallenge)) {
presenter.appSettings.qrCodeSettings = tanImageView.tanProcedureSettings
presenter.appSettings.qrCodeSettings = tanImageView.tanMethodSettings
}
else {
presenter.appSettings.photoTanSettings = tanImageView.tanProcedureSettings
presenter.appSettings.photoTanSettings = tanImageView.tanMethodSettings
}
presenter.appSettingsChanged()
@ -279,7 +279,7 @@ open class EnterTanDialog : DialogFragment() {
}
protected open fun isQrTan(tanChallenge: TanChallenge): Boolean {
return QrCodeTanProcedures.contains(tanChallenge.tanProcedure.type)
return QrCodeTanMethods.contains(tanChallenge.tanMethod.type)
}
}

View File

@ -12,7 +12,7 @@ import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.model.tan.FlickerCode
import net.dankito.banking.ui.util.FlickerCodeAnimator
import net.dankito.banking.ui.model.settings.ITanView
import net.dankito.banking.ui.model.settings.TanProcedureSettings
import net.dankito.banking.ui.model.settings.TanMethodSettings
import net.dankito.banking.ui.util.Step
@ -57,10 +57,10 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor(
protected var isFlickerCodePaused = false
override var didTanProcedureSettingsChange: Boolean = false
override var didTanMethodSettingsChange: Boolean = false
protected set
override var tanProcedureSettings: TanProcedureSettings? = null
override var tanMethodSettings: TanMethodSettings? = null
protected set
@ -98,7 +98,7 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor(
setMarkerPositionAfterStripesLayoutSet()
tanProcedureSettings?.let {
tanMethodSettings?.let {
setSize(it.width, it.height, it.space)
setFrequency(it.frequency)
}
@ -156,7 +156,7 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor(
setMarkerPositionAfterStripesLayoutSet()
tanProcedureSettingsChanged()
tanMethodSettingsChanged()
}
protected open fun setMarkerPositionAfterStripesLayoutSet() {
@ -187,13 +187,13 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor(
animator.setFrequency(frequency)
tanProcedureSettingsChanged()
tanMethodSettingsChanged()
}
protected open fun tanProcedureSettingsChanged() {
tanProcedureSettings = TanProcedureSettings(stripesWidth, stripesHeight, spaceBetweenStripes, currentFrequency)
protected open fun tanMethodSettingsChanged() {
tanMethodSettings = TanMethodSettings(stripesWidth, stripesHeight, spaceBetweenStripes, currentFrequency)
didTanProcedureSettingsChange = true // we don't check if settings really changed, it's not that important
didTanMethodSettingsChange = true // we don't check if settings really changed, it's not that important
}
@ -211,10 +211,10 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor(
}
open fun setCode(flickerCode: FlickerCode, tanProcedureSettings: TanProcedureSettings?) {
open fun setCode(flickerCode: FlickerCode, tanMethodSettings: TanMethodSettings?) {
animator.stop()
tanProcedureSettings?.let {
tanMethodSettings?.let {
setSize(it.width, it.height, it.space)
setFrequency(it.frequency)
}
@ -222,8 +222,8 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor(
setFrequency(DefaultFrequency)
}
this.tanProcedureSettings = tanProcedureSettings
this.didTanProcedureSettingsChange = false
this.tanMethodSettings = tanMethodSettings
this.didTanMethodSettingsChange = false
animator.animateFlickerCode(flickerCode) { step ->
showStepOnUiThread(step)

View File

@ -10,7 +10,7 @@ import kotlinx.android.synthetic.main.view_tan_image.view.*
import kotlinx.android.synthetic.main.view_tan_image_size_controls.view.*
import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.model.settings.ITanView
import net.dankito.banking.ui.model.settings.TanProcedureSettings
import net.dankito.banking.ui.model.settings.TanMethodSettings
import net.dankito.banking.ui.model.tan.ImageTanChallenge
@ -30,10 +30,10 @@ open class TanImageView @JvmOverloads constructor(
protected lateinit var imgTanImageView: ImageView
override var didTanProcedureSettingsChange: Boolean = false
override var didTanMethodSettingsChange: Boolean = false
protected set
override var tanProcedureSettings: TanProcedureSettings? = null
override var tanMethodSettings: TanMethodSettings? = null
protected set
@ -55,13 +55,13 @@ open class TanImageView @JvmOverloads constructor(
}
open fun setImage(challenge: ImageTanChallenge, tanProcedureSettings: TanProcedureSettings?) {
open fun setImage(challenge: ImageTanChallenge, tanMethodSettings: TanMethodSettings?) {
val decodedImage = challenge.image
val bitmap = BitmapFactory.decodeByteArray(decodedImage.imageBytes, 0, decodedImage.imageBytes.size)
rootView.imgTanImageView.setImageBitmap(bitmap)
tanProcedureSettings?.let {
tanMethodSettings?.let {
setWidthAndHeight(it.width)
}
}
@ -92,14 +92,14 @@ open class TanImageView @JvmOverloads constructor(
requestLayout()
tanProcedureSettingsChanged(newWidthAndHeight)
tanMethodSettingsChanged(newWidthAndHeight)
}
}
protected open fun tanProcedureSettingsChanged(newWidthAndHeight: Int) {
tanProcedureSettings = TanProcedureSettings(newWidthAndHeight, newWidthAndHeight)
protected open fun tanMethodSettingsChanged(newWidthAndHeight: Int) {
tanMethodSettings = TanMethodSettings(newWidthAndHeight, newWidthAndHeight)
didTanProcedureSettingsChange = true // we don't check if settings really changed, it's not that important
didTanMethodSettingsChange = true // we don't check if settings really changed, it's not that important
}
/**

View File

@ -15,24 +15,24 @@
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="@dimen/dialog_enter_tan_tan_procedure_height"
android:layout_marginBottom="@dimen/dialog_enter_tan_tan_procedure_margin_bottom"
android:layout_height="@dimen/dialog_enter_tan_tan_method_height"
android:layout_marginBottom="@dimen/dialog_enter_tan_tan_method_margin_bottom"
android:gravity="center_vertical"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/dialog_enter_tan_tan_procedure_label_right_margin"
android:layout_marginEnd="@dimen/dialog_enter_tan_tan_procedure_label_right_margin"
android:layout_marginRight="@dimen/dialog_enter_tan_tan_method_label_right_margin"
android:layout_marginEnd="@dimen/dialog_enter_tan_tan_method_label_right_margin"
android:gravity="center_vertical"
android:textStyle="bold"
android:textSize="@dimen/dialog_enter_tan_tan_procedure_text_size"
android:text="@string/dialog_enter_tan_select_tan_procedure"
android:textSize="@dimen/dialog_enter_tan_tan_method_text_size"
android:text="@string/dialog_enter_tan_select_tan_method"
/>
<Spinner
android:id="@+id/spnTanProcedures"
android:id="@+id/spnTanMethods"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtTanProcedureDisplayName"
android:id="@+id/txtTanMethodDisplayName"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/TextAppearance.AppCompat.Medium"
android:textSize="@dimen/dialog_enter_tan_tan_procedure_text_size"
android:textSize="@dimen/dialog_enter_tan_tan_method_text_size"
android:singleLine="true"
android:ellipsize="marquee"
android:padding="@dimen/list_item_tan_procedure_padding"
android:padding="@dimen/list_item_tan_method_padding"
/>

View File

@ -74,7 +74,7 @@
<string name="view_flicker_code_frequency">Geschw.:</string>
<string name="dialog_enter_tan_select_tan_procedure">TAN Verfahren</string>
<string name="dialog_enter_tan_select_tan_method">TAN Verfahren</string>
<string name="dialog_enter_tan_select_tan_medium">TAN Medium</string>
<string name="dialog_enter_tan_tan_description_label">Hinweis Ihrer Bank:</string>
<string name="dialog_enter_tan_enter_tan">TAN eingeben:</string>

View File

@ -112,10 +112,10 @@
<dimen name="view_tan_generator_marker_margin_bottom">6dp</dimen>
<dimen name="dialog_enter_tan_padding">4dp</dimen>
<dimen name="dialog_enter_tan_tan_procedure_height">30dp</dimen>
<dimen name="dialog_enter_tan_tan_procedure_margin_bottom">6dp</dimen>
<dimen name="dialog_enter_tan_tan_procedure_label_right_margin">8dp</dimen>
<dimen name="dialog_enter_tan_tan_procedure_text_size">15sp</dimen>
<dimen name="dialog_enter_tan_tan_method_height">30dp</dimen>
<dimen name="dialog_enter_tan_tan_method_margin_bottom">6dp</dimen>
<dimen name="dialog_enter_tan_tan_method_label_right_margin">8dp</dimen>
<dimen name="dialog_enter_tan_tan_method_text_size">15sp</dimen>
<dimen name="dialog_enter_tan_tan_medium_height">30dp</dimen>
<dimen name="dialog_enter_tan_tan_medium_label_right_margin">8dp</dimen>
<dimen name="dialog_enter_tan_tan_medium_text_size">15sp</dimen>
@ -128,7 +128,7 @@
<dimen name="dialog_enter_tan_enter_tan_margin_bottom">8dp</dimen>
<dimen name="dialog_enter_tan_buttons_width">120dp</dimen>
<dimen name="list_item_tan_procedure_padding">4dp</dimen>
<dimen name="list_item_tan_method_padding">4dp</dimen>
<dimen name="list_item_tan_medium_padding">4dp</dimen>

View File

@ -74,7 +74,7 @@
<string name="view_flicker_code_frequency">Frequency:</string>
<string name="dialog_enter_tan_select_tan_procedure">TAN procedure</string>
<string name="dialog_enter_tan_select_tan_method">TAN procedure</string>
<string name="dialog_enter_tan_select_tan_medium">TAN medium</string>
<string name="dialog_enter_tan_tan_description_label">Hint from your bank:</string>
<string name="dialog_enter_tan_enter_tan">Enter TAN:</string>

View File

@ -49,7 +49,7 @@ add.account.dialog.successfully.added.account.bank.supports.retrieving.transacti
enter.tan.dialog.title=TAN required
enter.tan.dialog.select.tan.procedure=TAN procedure:
enter.tan.dialog.select.tan.method=TAN method:
enter.tan.dialog.select.tan.medium=TAN medium:
enter.tan.dialog.size.label=Size:
enter.tan.dialog.frequency.label=Speed:

View File

@ -49,7 +49,7 @@ add.account.dialog.successfully.added.account.bank.supports.retrieving.transacti
enter.tan.dialog.title=TAN wird benötigt
enter.tan.dialog.select.tan.procedure=TAN Verfahren:
enter.tan.dialog.select.tan.method=TAN Verfahren:
enter.tan.dialog.select.tan.medium=TAN Medium:
enter.tan.dialog.size.label=Größe:
enter.tan.dialog.frequency.label=Geschwindigkeit:

View File

@ -27,7 +27,7 @@ open class EnterTanDialog(
) : Window() {
companion object {
val QrCodeTanProcedures = listOf(TanProcedureType.ChipTanQrCode, TanProcedureType.QrCode)
val QrCodeTanMethods = listOf(TanMethodType.ChipTanQrCode, TanMethodType.QrCode)
private val ButtonHeight = 40.0
private val ButtonWidth = 150.0
@ -41,9 +41,9 @@ open class EnterTanDialog(
protected var tanImageView: TanImageView? = null
protected val tanProceduresWithoutUnsupported = customer.supportedTanProcedures.filterNot { it.type == TanProcedureType.ChipTanUsb } // USB tan generators are not supported
protected val tanMethodsWithoutUnsupported = customer.supportedTanMethods.filterNot { it.type == TanMethodType.ChipTanUsb } // USB tan generators are not supported
protected val selectedTanProcedure = SimpleObjectProperty<TanProcedure>(customer.selectedTanProcedure ?: tanProceduresWithoutUnsupported.firstOrNull { it.displayName.contains("manuell", true) == false } ?: tanProceduresWithoutUnsupported.firstOrNull())
protected val selectedTanMethod = SimpleObjectProperty<TanMethod>(customer.selectedTanMethod ?: tanMethodsWithoutUnsupported.firstOrNull { it.displayName.contains("manuell", true) == false } ?: tanMethodsWithoutUnsupported.firstOrNull())
protected val selectedTanMedium = SimpleObjectProperty<TanMedium>(customer.tanMediaSorted.firstOrNull())
@ -51,8 +51,8 @@ open class EnterTanDialog(
init {
selectedTanProcedure.addListener { _, _, newValue ->
tanEnteredCallback(EnterTanResult.userAsksToChangeTanProcedure(newValue))
selectedTanMethod.addListener { _, _, newValue ->
tanEnteredCallback(EnterTanResult.userAsksToChangeTanMethod(newValue))
close()
}
@ -72,12 +72,12 @@ open class EnterTanDialog(
form {
fieldset {
field(messages["enter.tan.dialog.select.tan.procedure"]) {
field(messages["enter.tan.dialog.select.tan.method"]) {
label.apply {
font = Font.font(font.family, FontWeight.BLACK, font.size)
}
combobox(selectedTanProcedure, tanProceduresWithoutUnsupported) {
combobox(selectedTanMethod, tanMethodsWithoutUnsupported) {
cellFormat {
text = it.displayName
}
@ -261,18 +261,18 @@ open class EnterTanDialog(
protected open fun checkIfAppSettingsChanged() {
if (flickerCodeView?.didTanProcedureSettingsChange == true) {
presenter.appSettings.flickerCodeSettings = flickerCodeView?.tanProcedureSettings
if (flickerCodeView?.didTanMethodSettingsChange == true) {
presenter.appSettings.flickerCodeSettings = flickerCodeView?.tanMethodSettings
presenter.appSettingsChanged()
}
if (tanImageView?.didTanProcedureSettingsChange == true) {
if (tanImageView?.didTanMethodSettingsChange == true) {
if (isQrTan(challenge)) {
presenter.appSettings.qrCodeSettings = tanImageView?.tanProcedureSettings
presenter.appSettings.qrCodeSettings = tanImageView?.tanMethodSettings
}
else {
presenter.appSettings.photoTanSettings = tanImageView?.tanProcedureSettings
presenter.appSettings.photoTanSettings = tanImageView?.tanMethodSettings
}
presenter.appSettingsChanged()
@ -280,7 +280,7 @@ open class EnterTanDialog(
}
protected open fun isQrTan(tanChallenge: TanChallenge): Boolean {
return QrCodeTanProcedures.contains(tanChallenge.tanProcedure.type)
return QrCodeTanMethods.contains(tanChallenge.tanMethod.type)
}
}

View File

@ -6,11 +6,10 @@ import javafx.geometry.Pos
import javafx.scene.paint.Color
import net.dankito.banking.ui.model.tan.FlickerCode
import net.dankito.banking.ui.util.FlickerCodeAnimator
import net.dankito.banking.ui.util.Bit
import net.dankito.banking.javafx.dialogs.tan.controls.ChipTanFlickerCodeStripeView
import net.dankito.banking.javafx.dialogs.tan.controls.TanGeneratorMarkerView
import net.dankito.banking.ui.model.settings.ITanView
import net.dankito.banking.ui.model.settings.TanProcedureSettings
import net.dankito.banking.ui.model.settings.TanMethodSettings
import net.dankito.banking.ui.util.Step
import net.dankito.utils.javafx.ui.extensions.fixedHeight
import net.dankito.utils.javafx.ui.extensions.fixedWidth
@ -20,7 +19,7 @@ import tornadofx.*
open class ChipTanFlickerCodeView(
protected val flickerCode: FlickerCode,
tanProcedureSettings: TanProcedureSettings?
tanMethodSettings: TanMethodSettings?
): View(), ITanView {
companion object {
@ -41,9 +40,9 @@ open class ChipTanFlickerCodeView(
protected val flickerCodeLeftRightMargin = SimpleDoubleProperty(31.0)
protected val stripesHeight = SimpleDoubleProperty(tanProcedureSettings?.height?.toDouble() ?: 127.0)
protected val stripesWidth = SimpleDoubleProperty(tanProcedureSettings?.width?.toDouble() ?: 42.0)
protected val spaceBetweenStripes = SimpleDoubleProperty(tanProcedureSettings?.space?.toDouble() ?: 10.0)
protected val stripesHeight = SimpleDoubleProperty(tanMethodSettings?.height?.toDouble() ?: 127.0)
protected val stripesWidth = SimpleDoubleProperty(tanMethodSettings?.width?.toDouble() ?: 42.0)
protected val spaceBetweenStripes = SimpleDoubleProperty(tanMethodSettings?.space?.toDouble() ?: 10.0)
protected val flickerCodeViewWidth = SimpleDoubleProperty()
@ -59,15 +58,15 @@ open class ChipTanFlickerCodeView(
protected val isMinFrequencyReached = SimpleBooleanProperty(false)
protected val isMaxFrequencyReached = SimpleBooleanProperty(false)
protected var currentFrequency = tanProcedureSettings?.frequency ?: DefaultFrequency
protected var currentFrequency = tanMethodSettings?.frequency ?: DefaultFrequency
protected val animator = FlickerCodeAnimator()
override var didTanProcedureSettingsChange: Boolean = false
override var didTanMethodSettingsChange: Boolean = false
protected set
override var tanProcedureSettings: TanProcedureSettings? = tanProcedureSettings
override var tanMethodSettings: TanMethodSettings? = tanMethodSettings
protected set
@ -203,7 +202,7 @@ open class ChipTanFlickerCodeView(
setSize(stripesWidth.value + ChangeSizeStripeWidthStep, stripesHeight.value + ChangeSizeStripeHeightStep,
spaceBetweenStripes.value + ChangeSizeSpaceBetweenStripesStep)
tanProcedureSettingsChanged()
tanMethodSettingsChanged()
}
updateMinAndMaxSizeReached()
@ -214,7 +213,7 @@ open class ChipTanFlickerCodeView(
setSize(stripesWidth.value - ChangeSizeStripeWidthStep, stripesHeight.value - ChangeSizeStripeHeightStep,
spaceBetweenStripes.value - ChangeSizeSpaceBetweenStripesStep)
tanProcedureSettingsChanged()
tanMethodSettingsChanged()
}
updateMinAndMaxSizeReached()
@ -225,7 +224,7 @@ open class ChipTanFlickerCodeView(
this.stripesHeight.value = height
this.spaceBetweenStripes.value = spaceBetweenStripes
tanProcedureSettingsChanged()
tanMethodSettingsChanged()
updateMinAndMaxSizeReached()
}
@ -264,7 +263,7 @@ open class ChipTanFlickerCodeView(
updateMinAndMaxFrequencyReached()
tanProcedureSettingsChanged()
tanMethodSettingsChanged()
}
protected open fun updateMinAndMaxFrequencyReached() {
@ -273,11 +272,11 @@ open class ChipTanFlickerCodeView(
}
protected open fun tanProcedureSettingsChanged() {
tanProcedureSettings = TanProcedureSettings(stripesWidth.value.toInt(), stripesHeight.value.toInt(),
protected open fun tanMethodSettingsChanged() {
tanMethodSettings = TanMethodSettings(stripesWidth.value.toInt(), stripesHeight.value.toInt(),
spaceBetweenStripes.value.toInt(), currentFrequency)
didTanProcedureSettingsChange = true // we don't check if settings really changed, it's not that important
didTanMethodSettingsChange = true // we don't check if settings really changed, it's not that important
}
}

View File

@ -5,7 +5,7 @@ import javafx.geometry.Pos
import javafx.scene.image.Image
import javafx.scene.image.ImageView
import net.dankito.banking.ui.model.settings.ITanView
import net.dankito.banking.ui.model.settings.TanProcedureSettings
import net.dankito.banking.ui.model.settings.TanMethodSettings
import net.dankito.banking.ui.model.tan.TanImage
import net.dankito.utils.javafx.ui.extensions.updateWindowSize
import tornadofx.*
@ -14,7 +14,7 @@ import java.io.ByteArrayInputStream
open class TanImageView(
protected val tanImage: TanImage,
tanProcedureSettings: TanProcedureSettings?
tanMethodSettings: TanMethodSettings?
) : View(), ITanView {
companion object {
@ -34,10 +34,10 @@ open class TanImageView(
protected var tanImageView: ImageView by singleAssign()
override var didTanProcedureSettingsChange: Boolean = false
override var didTanMethodSettingsChange: Boolean = false
protected set
override var tanProcedureSettings: TanProcedureSettings? = tanProcedureSettings
override var tanMethodSettings: TanMethodSettings? = tanMethodSettings
protected set
@ -58,7 +58,7 @@ open class TanImageView(
}
}
tanProcedureSettings?.let {
tanMethodSettings?.let {
runLater {
setWidthAndHeight(it.width.toDouble())
}
@ -86,17 +86,17 @@ open class TanImageView(
updateWindowSize()
tanProcedureSettingsChanged(newWidthAndHeight.toInt())
tanMethodSettingsChanged(newWidthAndHeight.toInt())
}
isMinSizeReached.value = tanImageView.fitHeight <= MinHeight
isMaxSizeReached.value = tanImageView.fitHeight >= MaxHeight
}
protected open fun tanProcedureSettingsChanged(newWidthAndHeight: Int) {
tanProcedureSettings = TanProcedureSettings(newWidthAndHeight, newWidthAndHeight)
protected open fun tanMethodSettingsChanged(newWidthAndHeight: Int) {
tanMethodSettings = TanMethodSettings(newWidthAndHeight, newWidthAndHeight)
didTanProcedureSettingsChange = true // we don't check if settings really changed, it's not that important
didTanMethodSettingsChange = true // we don't check if settings really changed, it's not that important
}
}

View File

@ -1,7 +1,7 @@
package net.dankito.banking.ui.model
import net.dankito.banking.ui.model.tan.TanMedium
import net.dankito.banking.ui.model.tan.TanProcedure
import net.dankito.banking.ui.model.tan.TanMethod
import net.dankito.utils.multiplatform.UUID
@ -30,9 +30,9 @@ open class Customer(
override var technicalId: String = UUID.random()
override var supportedTanProcedures: List<TanProcedure> = listOf()
override var supportedTanMethods: List<TanMethod> = listOf()
override var selectedTanProcedure: TanProcedure? = null
override var selectedTanMethod: TanMethod? = null
override var tanMedia: List<TanMedium> = listOf()

View File

@ -2,7 +2,7 @@ package net.dankito.banking.ui.model
import net.dankito.banking.ui.model.tan.TanMedium
import net.dankito.banking.ui.model.tan.TanMediumStatus
import net.dankito.banking.ui.model.tan.TanProcedure
import net.dankito.banking.ui.model.tan.TanMethod
import net.dankito.banking.util.sortedByDisplayIndex
import net.dankito.utils.multiplatform.BigDecimal
import net.dankito.utils.multiplatform.sum
@ -27,8 +27,8 @@ interface ICustomer<TAccount: IBankAccount<TAccountTransaction>, TAccountTransac
var accounts: List<TAccount>
var supportedTanProcedures: List<TanProcedure>
var selectedTanProcedure: TanProcedure?
var supportedTanMethods: List<TanMethod>
var selectedTanMethod: TanMethod?
var tanMedia: List<TanMedium>
var userSetDisplayName: String?

View File

@ -56,9 +56,9 @@ interface IModelCreator {
) : IAccountTransaction
fun createTanProcedure(displayName: String, type: TanProcedureType, bankInternalProcedureCode: String,
maxTanInputLength: Int? = null, allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric): TanProcedure {
return TanProcedure(displayName, type, bankInternalProcedureCode, maxTanInputLength)
fun createTanMethod(displayName: String, type: TanMethodType, bankInternalMethodCode: String,
maxTanInputLength: Int? = null, allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric): TanMethod {
return TanMethod(displayName, type, bankInternalMethodCode, maxTanInputLength)
}
fun createTanMedium(displayName: String, status: TanMediumStatus): TanMedium {

View File

@ -2,9 +2,9 @@ package net.dankito.banking.ui.model.settings
open class AppSettings(
var flickerCodeSettings: TanProcedureSettings? = null,
var qrCodeSettings: TanProcedureSettings? = null,
var photoTanSettings: TanProcedureSettings? = null
var flickerCodeSettings: TanMethodSettings? = null,
var qrCodeSettings: TanMethodSettings? = null,
var photoTanSettings: TanMethodSettings? = null
) {
internal constructor() : this(null, null, null) // for object deserializers

View File

@ -3,8 +3,8 @@ package net.dankito.banking.ui.model.settings
interface ITanView {
val didTanProcedureSettingsChange: Boolean
val didTanMethodSettingsChange: Boolean
val tanProcedureSettings: TanProcedureSettings?
val tanMethodSettings: TanMethodSettings?
}

View File

@ -1,7 +1,7 @@
package net.dankito.banking.ui.model.settings
open class TanProcedureSettings(
open class TanMethodSettings(
var width: Int,
var height: Int,
var space: Int = -1, // only needed for flicker code view

View File

@ -5,7 +5,7 @@ import net.dankito.banking.ui.model.responses.BankingClientResponse
open class EnterTanResult protected constructor(
val enteredTan: String?,
val changeTanProcedureTo: TanProcedure? = null,
val changeTanMethodTo: TanMethod? = null,
val changeTanMediumTo: TanMedium? = null,
val changeTanMediumResultCallback: ((BankingClientResponse) -> Unit)? = null
) {
@ -20,8 +20,8 @@ open class EnterTanResult protected constructor(
return EnterTanResult(null)
}
fun userAsksToChangeTanProcedure(changeTanProcedureTo: TanProcedure): EnterTanResult {
return EnterTanResult(null, changeTanProcedureTo)
fun userAsksToChangeTanMethod(changeTanMethodTo: TanMethod): EnterTanResult {
return EnterTanResult(null, changeTanMethodTo)
}
fun userAsksToChangeTanMedium(changeTanMediumTo: TanMedium, changeTanMediumResultCallback: ((BankingClientResponse) -> Unit)?): EnterTanResult {
@ -31,8 +31,8 @@ open class EnterTanResult protected constructor(
}
override fun toString(): String {
if (changeTanProcedureTo != null) {
return "User asks to change TAN procedure to $changeTanProcedureTo"
if (changeTanMethodTo != null) {
return "User asks to change TAN method to $changeTanMethodTo"
}
if (changeTanMediumTo != null) {

View File

@ -4,12 +4,12 @@ package net.dankito.banking.ui.model.tan
open class FlickerCodeTanChallenge(
val flickerCode: FlickerCode,
messageToShowToUser: String,
tanProcedure: TanProcedure
tanMethod: TanMethod
) : TanChallenge(messageToShowToUser, tanProcedure) {
) : TanChallenge(messageToShowToUser, tanMethod) {
override fun toString(): String {
return "$tanProcedure $flickerCode: $messageToShowToUser"
return "$tanMethod $flickerCode: $messageToShowToUser"
}
}

View File

@ -4,12 +4,12 @@ package net.dankito.banking.ui.model.tan
open class ImageTanChallenge(
val image: TanImage,
messageToShowToUser: String,
tanProcedure: TanProcedure
tanMethod: TanMethod
) : TanChallenge(messageToShowToUser, tanProcedure) {
) : TanChallenge(messageToShowToUser, tanMethod) {
override fun toString(): String {
return "$tanProcedure $image: $messageToShowToUser"
return "$tanMethod $image: $messageToShowToUser"
}
}

View File

@ -3,11 +3,11 @@ package net.dankito.banking.ui.model.tan
open class TanChallenge(
val messageToShowToUser: String,
val tanProcedure: TanProcedure
val tanMethod: TanMethod
) {
override fun toString(): String {
return "$tanProcedure: $messageToShowToUser"
return "$tanMethod: $messageToShowToUser"
}
}

View File

@ -5,16 +5,21 @@ import net.dankito.utils.multiplatform.UUID
import kotlin.jvm.Transient
open class TanProcedure(
open class TanMethod(
@Transient
override val displayName: String,
open val type: TanProcedureType,
open val bankInternalProcedureCode: String,
@Transient
open val type: TanMethodType,
@Transient
open val bankInternalMethodCode: String,
@Transient
open val maxTanInputLength: Int? = null,
@Transient
open val allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric
) : Displayable {
internal constructor() : this("", TanProcedureType.EnterTan, "") // for object deserializers
internal constructor() : this("", TanMethodType.EnterTan, "") // for object deserializers
@Transient
@ -26,11 +31,11 @@ open class TanProcedure(
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is TanProcedure) return false
if (other !is TanMethod) return false
if (displayName != other.displayName) return false
if (type != other.type) return false
if (bankInternalProcedureCode != other.bankInternalProcedureCode) return false
if (bankInternalMethodCode != other.bankInternalMethodCode) return false
return true
}
@ -38,13 +43,13 @@ open class TanProcedure(
override fun hashCode(): Int {
var result = displayName.hashCode()
result = 31 * result + type.hashCode()
result = 31 * result + bankInternalProcedureCode.hashCode()
result = 31 * result + bankInternalMethodCode.hashCode()
return result
}
override fun toString(): String {
return "$displayName ($type, ${bankInternalProcedureCode})"
return "$displayName ($type, ${bankInternalMethodCode})"
}
}

View File

@ -1,7 +1,7 @@
package net.dankito.banking.ui.model.tan
enum class TanProcedureType {
enum class TanMethodType {
EnterTan,

View File

@ -48,8 +48,8 @@ open class BankingPresenter(
) {
companion object {
val ChipTanTanProcedures = listOf(TanProcedureType.ChipTanManuell, TanProcedureType.ChipTanFlickercode, TanProcedureType.ChipTanUsb,
TanProcedureType.ChipTanQrCode, TanProcedureType.ChipTanPhotoTanMatrixCode)
val ChipTanTanMethods = listOf(TanMethodType.ChipTanManuell, TanMethodType.ChipTanFlickercode, TanMethodType.ChipTanUsb,
TanMethodType.ChipTanQrCode, TanMethodType.ChipTanPhotoTanMatrixCode)
protected const val OneDayMillis = 24 * 60 * 60 * 1000L
@ -84,7 +84,7 @@ open class BankingPresenter(
}
router.getTanFromUserFromNonUiThread(customer, tanChallenge, this@BankingPresenter) { result ->
if (result.changeTanProcedureTo != null || result.changeTanMediumTo != null) { // then either selected TAN medium or procedure will change -> save account on next call to enterTan() as then changes will be visible
if (result.changeTanMethodTo != null || result.changeTanMediumTo != null) { // then either selected TAN medium or method will change -> save account on next call to enterTan() as then changes will be visible
saveAccountOnNextEnterTanInvocation = true
}
@ -778,11 +778,11 @@ open class BankingPresenter(
}
open fun getTanMediaForTanProcedure(bank: TypedCustomer, tanProcedure: TanProcedure): List<TanMedium> {
if (ChipTanTanProcedures.contains(tanProcedure.type)) {
open fun getTanMediaForTanMethod(bank: TypedCustomer, tanMethod: TanMethod): List<TanMedium> {
if (ChipTanTanMethods.contains(tanMethod.type)) {
return bank.tanMediaSorted.filterIsInstance<TanGeneratorTanMedium>()
}
else if (tanProcedure.type == TanProcedureType.SmsTan) {
else if (tanMethod.type == TanMethodType.SmsTan) {
return bank.tanMediaSorted.filterIsInstance<MobilePhoneTanMedium>()
}

View File

@ -98,7 +98,7 @@
36E21ED524DC549800649DC8 /* BankSettingsDialog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21ED424DC549800649DC8 /* BankSettingsDialog.swift */; };
36E21ED724DC617200649DC8 /* BankAccountSettingsDialog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21ED624DC617200649DC8 /* BankAccountSettingsDialog.swift */; };
36E21EDB24DC990300649DC8 /* LabelledUIKitTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21EDA24DC990300649DC8 /* LabelledUIKitTextField.swift */; };
36E21EDD24DCA89100649DC8 /* TanProcedurePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21EDC24DCA89100649DC8 /* TanProcedurePicker.swift */; };
36E21EDD24DCA89100649DC8 /* TanMethodPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21EDC24DCA89100649DC8 /* TanMethodPicker.swift */; };
36E21EDF24DCCC2700649DC8 /* CheckmarkListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21EDE24DCCC2700649DC8 /* CheckmarkListItem.swift */; };
36E7BA1424B3D05C00757859 /* ViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E7BA1324B3D05C00757859 /* ViewExtensions.swift */; };
36FC929C24B39A05002B12E9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36FC929B24B39A05002B12E9 /* AppDelegate.swift */; };
@ -240,7 +240,7 @@
36E21ED424DC549800649DC8 /* BankSettingsDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankSettingsDialog.swift; sourceTree = "<group>"; };
36E21ED624DC617200649DC8 /* BankAccountSettingsDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankAccountSettingsDialog.swift; sourceTree = "<group>"; };
36E21EDA24DC990300649DC8 /* LabelledUIKitTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelledUIKitTextField.swift; sourceTree = "<group>"; };
36E21EDC24DCA89100649DC8 /* TanProcedurePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TanProcedurePicker.swift; sourceTree = "<group>"; };
36E21EDC24DCA89100649DC8 /* TanMethodPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TanMethodPicker.swift; sourceTree = "<group>"; };
36E21EDE24DCCC2700649DC8 /* CheckmarkListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckmarkListItem.swift; sourceTree = "<group>"; };
36E7BA1324B3D05C00757859 /* ViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewExtensions.swift; sourceTree = "<group>"; };
36E7BA1824B9E70C00757859 /* xcode-frameworks */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "xcode-frameworks"; path = "../../tools/BankFinder/build/xcode-frameworks"; sourceTree = "<group>"; };
@ -353,7 +353,7 @@
360782D224F429F70098FEFE /* FlickerCodeStripe.swift */,
3608D6C124FBA9C6006C93A8 /* TrianglePointingDown.swift */,
3608D6C524FBAB41006C93A8 /* TanGeneratorPositionMarker.swift */,
36E21EDC24DCA89100649DC8 /* TanProcedurePicker.swift */,
36E21EDC24DCA89100649DC8 /* TanMethodPicker.swift */,
360782CA24E5746A0098FEFE /* FlickerCodeAnimator.swift */,
);
path = tan;
@ -754,7 +754,7 @@
36BCF89524C31F02005BEC29 /* AppData.swift in Sources */,
3642F01A2502931F005186FE /* InstantPaymentInfoView.swift in Sources */,
36B8A44F2503D97D00C15359 /* AuthenticationType.swift in Sources */,
36E21EDD24DCA89100649DC8 /* TanProcedurePicker.swift in Sources */,
36E21EDD24DCA89100649DC8 /* TanMethodPicker.swift in Sources */,
3608D6C624FBAB41006C93A8 /* TanGeneratorPositionMarker.swift in Sources */,
36B8A4542503E93B00C15359 /* UIAlert.swift in Sources */,
36BE065B24CA4B3500CBBB68 /* SelectBankDialog.swift in Sources */,

View File

@ -69,20 +69,20 @@
<attribute name="finTsServerAddress" attributeType="String"/>
<attribute name="iconUrl" optional="YES" attributeType="String"/>
<attribute name="password" attributeType="String"/>
<attribute name="selectedTanProcedureCode" optional="YES" attributeType="String"/>
<attribute name="selectedTanMethodCode" optional="YES" attributeType="String"/>
<attribute name="userId" attributeType="String"/>
<attribute name="userSetDisplayName" optional="YES" attributeType="String"/>
<relationship name="accounts" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="PersistedBankAccount" inverseName="customer" inverseEntity="PersistedBankAccount"/>
<relationship name="supportedTanProcedures" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="PersistedTanProcedure"/>
<relationship name="supportedTanMethods" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="PersistedTanMethod"/>
<relationship name="tanMedia" optional="YES" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="PersistedTanMedium"/>
</entity>
<entity name="PersistedTanMedium" representedClassName="PersistedTanMedium" syncable="YES" codeGenerationType="class">
<attribute name="displayName" attributeType="String"/>
<attribute name="status" attributeType="String"/>
</entity>
<entity name="PersistedTanProcedure" representedClassName="PersistedTanProcedure" syncable="YES" codeGenerationType="class">
<entity name="PersistedTanMethod" representedClassName="PersistedTanMethod" syncable="YES" codeGenerationType="class">
<attribute name="allowedTanFormat" attributeType="String" defaultValueString=""/>
<attribute name="bankInternalProcedureCode" attributeType="String"/>
<attribute name="bankInternalMethodCode" attributeType="String"/>
<attribute name="displayName" attributeType="String"/>
<attribute name="maxTanInputLength" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="type" attributeType="String"/>
@ -90,8 +90,8 @@
<elements>
<element name="PersistedAccountTransaction" positionX="-36" positionY="45" width="128" height="553"/>
<element name="PersistedBankAccount" positionX="-54" positionY="63" width="128" height="343"/>
<element name="PersistedCustomer" positionX="-63" positionY="-18" width="128" height="28"/>
<element name="PersistedCustomer" positionX="-63" positionY="-18" width="128" height="283"/>
<element name="PersistedTanMedium" positionX="-45" positionY="144" width="128" height="28"/>
<element name="PersistedTanProcedure" positionX="-54" positionY="135" width="128" height="118"/>
<element name="PersistedTanMethod" positionX="-54" positionY="135" width="128" height="118"/>
</elements>
</model>

View File

@ -122,7 +122,7 @@ Unfortunately, Bankmeister cannot know whether a bank charges for instant paymen
/* EnterTanDialog */
"Enter TAN Dialog Title" = "Enter TAN";
"TAN procedure" = "TAN procedure";
"TAN method" = "TAN method";
"TAN medium" = "TAN medium";
"Tan Generator Frequency" = "Frequency";
"Size" = "Size";

View File

@ -4,15 +4,15 @@ import BankingUiSwift
let previewBanks = createPreviewBanks()
let previewTanProcedures = createPreviewTanProcedures()
let previewTanMethods = createPreviewTanMethod()
let previewTanMedia = createPreviewTanMedia()
let previewTanChallenge = TanChallenge(messageToShowToUser: "Hier ist eine Nachricht deiner Bank, die dir die Welt erklaert", tanProcedure: previewTanProcedures[0])
let previewTanChallenge = TanChallenge(messageToShowToUser: "Hier ist eine Nachricht deiner Bank, die dir die Welt erklaert", tanMethod: previewTanMethods[0])
let previewImageTanChallenge = ImageTanChallenge(image: TanImage(mimeType: "image/png", imageBytes: KotlinByteArray(size: 0), decodingError: nil), messageToShowToUser: "", tanProcedure: previewTanProcedures[1])
let previewImageTanChallenge = ImageTanChallenge(image: TanImage(mimeType: "image/png", imageBytes: KotlinByteArray(size: 0), decodingError: nil), messageToShowToUser: "", tanMethod: previewTanMethods[1])
let previewFlickerCodeTanChallenge = FlickerCodeTanChallenge(flickerCode: FlickerCode(challengeHHD_UC: "", parsedDataSet: "", decodingError: nil), messageToShowToUser: "", tanProcedure: previewTanProcedures[0])
let previewFlickerCodeTanChallenge = FlickerCodeTanChallenge(flickerCode: FlickerCode(challengeHHD_UC: "", parsedDataSet: "", decodingError: nil), messageToShowToUser: "", tanMethod: previewTanMethods[0])
func createPreviewBanks() -> [ICustomer] {
@ -35,11 +35,11 @@ func createPreviewBanks() -> [ICustomer] {
}
func createPreviewTanProcedures() -> [TanProcedure] {
func createPreviewTanMethod() -> [TanMethod] {
return [
TanProcedure(displayName: "chipTAN optisch", type: .chiptanflickercode, bankInternalProcedureCode: "", maxTanInputLength: 6, allowedTanFormat: .numeric),
TanProcedure(displayName: "chipTAN QR", type: .chiptanqrcode, bankInternalProcedureCode: "", maxTanInputLength: 8, allowedTanFormat: .numeric),
TanProcedure(displayName: "Secure Super Duper Plus", type: .apptan, bankInternalProcedureCode: "", maxTanInputLength: 6, allowedTanFormat: .alphanumeric)
TanMethod(displayName: "chipTAN optisch", type: .chiptanflickercode, bankInternalMethodCode: "", maxTanInputLength: 6, allowedTanFormat: .numeric),
TanMethod(displayName: "chipTAN QR", type: .chiptanqrcode, bankInternalMethodCode: "", maxTanInputLength: 8, allowedTanFormat: .numeric),
TanMethod(displayName: "Secure Super Duper Plus", type: .apptan, bankInternalMethodCode: "", maxTanInputLength: 6, allowedTanFormat: .alphanumeric)
]
}

View File

@ -122,7 +122,7 @@ Ob eine Bank Gebühren für Echtzeitüberweisungen erhebt, kann Bankmeister leid
/* EnterTanDialog */
"Enter TAN Dialog Title" = "TAN-Abfrage";
"TAN procedure" = "TAN Verfahren";
"TAN method" = "TAN Verfahren";
"TAN medium" = "TAN Medium";
"Tan Generator Frequency" = "Geschw.";
"Size" = "Größe";

View File

@ -166,8 +166,8 @@ extension Remittee : Identifiable {
}
extension TanProcedure : Identifiable {
extension TanMethod : Identifiable {
public var id: String { self.bankInternalProcedureCode }
public var id: String { self.bankInternalMethodCode }
}

View File

@ -44,9 +44,9 @@ class CoreDataBankingPersistence: IBankingPersistence, IRemitteeSearcher {
}
}
for tanProcedure in customer.supportedTanProcedures {
if let mappedTanProcedure = mappedCustomer.supportedTanProcedures?.first { ($0 as! PersistedTanProcedure).bankInternalProcedureCode == tanProcedure.bankInternalProcedureCode } as? PersistedTanProcedure {
tanProcedure.technicalId = mappedTanProcedure.objectIDAsString
for tanMethod in customer.supportedTanMethods {
if let mappedTanMethod = mappedCustomer.supportedTanMethods?.first { ($0 as! PersistedTanMethod).bankInternalMethodCode == tanMethod.bankInternalMethodCode } as? PersistedTanMethod {
tanMethod.technicalId = mappedTanMethod.objectIDAsString
}
}

View File

@ -15,8 +15,8 @@ class Mapper {
mapped.accounts = map(mapped, customer.accounts?.array as? [PersistedBankAccount])
mapped.supportedTanProcedures = map(customer.supportedTanProcedures?.array as? [PersistedTanProcedure])
mapped.selectedTanProcedure = mapped.supportedTanProcedures.first(where: { $0.bankInternalProcedureCode == customer.selectedTanProcedureCode })
mapped.supportedTanMethods = map(customer.supportedTanMethods?.array as? [PersistedTanMethod])
mapped.selectedTanMethod = mapped.supportedTanMethods.first(where: { $0.bankInternalMethodCode == customer.selectedTanMethodCode })
mapped.tanMedia = map(customer.tanMedia?.array as? [PersistedTanMedium])
@ -44,8 +44,8 @@ class Mapper {
mapped.accounts = NSOrderedSet(array: map(mapped, customer.accounts, context))
mapped.supportedTanProcedures = NSOrderedSet(array: map(customer.supportedTanProcedures, context))
mapped.selectedTanProcedureCode = customer.selectedTanProcedure?.bankInternalProcedureCode
mapped.supportedTanMethods = NSOrderedSet(array: map(customer.supportedTanMethods, context))
mapped.selectedTanMethodCode = customer.selectedTanMethod?.bankInternalMethodCode
mapped.tanMedia = NSOrderedSet(array: map(customer.tanMedia, context))
@ -203,65 +203,65 @@ class Mapper {
}
func map(_ tanProcedures: [PersistedTanProcedure]?) -> [TanProcedure] {
return tanProcedures?.map { map($0) } ?? []
func map(_ tanMethods: [PersistedTanMethod]?) -> [TanMethod] {
return tanMethods?.map { map($0) } ?? []
}
func map(_ tanProcedure: PersistedTanProcedure) -> TanProcedure {
let mapped = TanProcedure(
displayName: map(tanProcedure.displayName),
type: mapTanProcedureType(tanProcedure.type),
bankInternalProcedureCode: map(tanProcedure.bankInternalProcedureCode),
maxTanInputLength: map(tanProcedure.maxTanInputLength),
allowedTanFormat: tanProcedure.allowedTanFormat == "numeric" ? .numeric : .alphanumeric
func map(_ tanMethod: PersistedTanMethod) -> TanMethod {
let mapped = TanMethod(
displayName: map(tanMethod.displayName),
type: mapTanMethodType(tanMethod.type),
bankInternalMethodCode: map(tanMethod.bankInternalMethodCode),
maxTanInputLength: map(tanMethod.maxTanInputLength),
allowedTanFormat: tanMethod.allowedTanFormat == "numeric" ? .numeric : .alphanumeric
)
mapped.technicalId = tanProcedure.objectIDAsString
mapped.technicalId = tanMethod.objectIDAsString
return mapped
}
func map(_ tanProcedures: [TanProcedure], _ context: NSManagedObjectContext) -> [PersistedTanProcedure] {
return tanProcedures.map { map($0, context) }
func map(_ tanMethods: [TanMethod], _ context: NSManagedObjectContext) -> [PersistedTanMethod] {
return tanMethods.map { map($0, context) }
}
func map(_ tanProcedure: TanProcedure, _ context: NSManagedObjectContext) -> PersistedTanProcedure {
let mapped = context.objectByID(tanProcedure.technicalId) ?? PersistedTanProcedure(context: context)
func map(_ tanMethod: TanMethod, _ context: NSManagedObjectContext) -> PersistedTanMethod {
let mapped = context.objectByID(tanMethod.technicalId) ?? PersistedTanMethod(context: context)
mapped.displayName = tanProcedure.displayName
mapped.type = tanProcedure.type.name
mapped.bankInternalProcedureCode = tanProcedure.bankInternalProcedureCode
mapped.displayName = tanMethod.displayName
mapped.type = tanMethod.type.name
mapped.bankInternalMethodCode = tanMethod.bankInternalMethodCode
mapped.maxTanInputLength = map(tanProcedure.maxTanInputLength) ?? -1
mapped.allowedTanFormat = tanProcedure.allowedTanFormat.name
mapped.maxTanInputLength = map(tanMethod.maxTanInputLength) ?? -1
mapped.allowedTanFormat = tanMethod.allowedTanFormat.name
return mapped
}
func mapTanProcedureType(_ type: String?) -> TanProcedureType {
func mapTanMethodType(_ type: String?) -> TanMethodType {
switch type {
case TanProcedureType.entertan.name:
return TanProcedureType.entertan
case TanProcedureType.chiptanmanuell.name:
return TanProcedureType.chiptanmanuell
case TanProcedureType.chiptanflickercode.name:
return TanProcedureType.chiptanflickercode
case TanProcedureType.chiptanusb.name:
return TanProcedureType.chiptanusb
case TanProcedureType.chiptanqrcode.name:
return TanProcedureType.chiptanqrcode
case TanProcedureType.chiptanphototanmatrixcode.name:
return TanProcedureType.chiptanphototanmatrixcode
case TanProcedureType.smstan.name:
return TanProcedureType.smstan
case TanProcedureType.apptan.name:
return TanProcedureType.apptan
case TanProcedureType.phototan.name:
return TanProcedureType.phototan
case TanProcedureType.qrcode.name:
return TanProcedureType.qrcode
case TanMethodType.entertan.name:
return TanMethodType.entertan
case TanMethodType.chiptanmanuell.name:
return TanMethodType.chiptanmanuell
case TanMethodType.chiptanflickercode.name:
return TanMethodType.chiptanflickercode
case TanMethodType.chiptanusb.name:
return TanMethodType.chiptanusb
case TanMethodType.chiptanqrcode.name:
return TanMethodType.chiptanqrcode
case TanMethodType.chiptanphototanmatrixcode.name:
return TanMethodType.chiptanphototanmatrixcode
case TanMethodType.smstan.name:
return TanMethodType.smstan
case TanMethodType.apptan.name:
return TanMethodType.apptan
case TanMethodType.phototan.name:
return TanMethodType.phototan
case TanMethodType.qrcode.name:
return TanMethodType.qrcode
default:
return TanProcedureType.entertan
return TanMethodType.entertan
}
}

View File

@ -17,7 +17,7 @@ struct BankSettingsDialog: View {
@State private var customerId: String
@State private var password: String
@State private var selectedTanProcedure: TanProcedure?
@State private var selectedTanMethod: TanMethod?
@State private var accountsSorted: [IBankAccount]
@ -28,7 +28,7 @@ struct BankSettingsDialog: View {
return bank.displayName != displayName
|| bank.customerId != customerId
|| bank.password != password
|| bank.selectedTanProcedure != selectedTanProcedure
|| bank.selectedTanMethod != selectedTanMethod
}
@ -40,7 +40,7 @@ struct BankSettingsDialog: View {
_customerId = State(initialValue: bank.customerId)
_password = State(initialValue: bank.password)
_selectedTanProcedure = State(initialValue: bank.selectedTanProcedure)
_selectedTanMethod = State(initialValue: bank.selectedTanMethod)
_accountsSorted = State(initialValue: bank.accountsSorted)
}
@ -59,8 +59,8 @@ struct BankSettingsDialog: View {
}
Section {
TanProcedurePicker(bank) { selectedTanProcedure in
self.selectedTanProcedure = selectedTanProcedure
TanMethodPicker(bank) { selectedTanMethod in
self.selectedTanMethod = selectedTanMethod
}
}
@ -133,7 +133,7 @@ struct BankSettingsDialog: View {
bank.customerId = customerId
bank.password = password
bank.selectedTanProcedure = selectedTanProcedure
bank.selectedTanMethod = selectedTanMethod
presenter.accountUpdated(bank: bank)
}

View File

@ -54,7 +54,7 @@ struct EnterTanDialog: View {
self.customersTanMedia = customer.tanMediaSorted
self.showSelectTanMediumView = self.customersTanMedia.count > 1 // TODO: use isOpticalTanProcedure && tanMedia.count > 1
self.showSelectTanMediumView = self.customersTanMedia.count > 1 // TODO: use isOpticalTanMethod && tanMedia.count > 1
self.flickerCodeTanChallenge = tanChallenge as? FlickerCodeTanChallenge
self.imageTanChallenge = tanChallenge as? ImageTanChallenge
@ -73,8 +73,8 @@ struct EnterTanDialog: View {
var body: some View {
Form {
Section {
TanProcedurePicker(customer, state.tanChallenge.tanProcedure) { selectedTanProcedure in
self.selectedTanProcedureChanged(selectedTanProcedure)
TanMethodPicker(customer, state.tanChallenge.tanMethod) { selectedTanMethod in
self.selectedTanMethodChanged(selectedTanMethod)
}
if showSelectTanMediumView {
@ -109,8 +109,8 @@ struct EnterTanDialog: View {
.padding(.vertical, 2)
Section {
LabelledUIKitTextField(label: "Enter TAN:", text: $enteredTan, keyboardType: tanChallenge.tanProcedure.isNumericTan ? .numberPad : .default,
autocapitalizationType: .none, addDoneButton: tanChallenge.tanProcedure.isNumericTan, actionOnReturnKeyPress: {
LabelledUIKitTextField(label: "Enter TAN:", text: $enteredTan, keyboardType: tanChallenge.tanMethod.isNumericTan ? .numberPad : .default,
autocapitalizationType: .none, addDoneButton: tanChallenge.tanMethod.isNumericTan, actionOnReturnKeyPress: {
if self.isRequiredDataEntered() {
self.enteringTanDone()
return true
@ -143,12 +143,12 @@ struct EnterTanDialog: View {
return self.enteredTan.isNotBlank
}
private func selectedTanProcedureChanged(_ changeTanProcedureTo: TanProcedure) {
// do async as at this point Picker dialog gets dismissed -> this EnterTanDialog would never get dismissed (and dismiss has to be called before callback.changeTanProcedure())
private func selectedTanMethodChanged(_ changeTanMethodTo: TanMethod) {
// do async as at this point Picker dialog gets dismissed -> this EnterTanDialog would never get dismissed (and dismiss has to be called before callback.changeTanMethod())
DispatchQueue.main.async {
self.dismissDialog()
self.state.callback(EnterTanResult.Companion().userAsksToChangeTanProcedure(changeTanProcedureTo: changeTanProcedureTo))
self.state.callback(EnterTanResult.Companion().userAsksToChangeTanMethod(changeTanMethodTo: changeTanMethodTo))
}
}
@ -216,7 +216,7 @@ struct EnterTanDialog: View {
struct EnterTanDialog_Previews: PreviewProvider {
static var previews: some View {
let customer = Customer(bankCode: "", customerId: "", password: "", finTsServerAddress: "")
customer.supportedTanProcedures = previewTanProcedures
customer.supportedTanMethods = previewTanMethods
customer.tanMedia = previewTanMedia

View File

@ -0,0 +1,72 @@
import SwiftUI
import BankingUiSwift
struct TanMethodPicker: View {
private let bank: ICustomer
private let selectedTanMethodChanged: (TanMethod) -> Void
private var customersTanMethods: [TanMethod] = []
private let initiallySelectedTanMethod: TanMethod?
@State private var selectedTanMethodIndex: Int
private var selectedTanMethodIndexBinding: Binding<Int> {
Binding<Int>(
get: { self.selectedTanMethodIndex },
set: { newValue in
if (self.selectedTanMethodIndex != newValue || self.initiallySelectedTanMethod == nil) { // only if TAN method has really changed
self.selectedTanMethodIndex = newValue
self.dispatchSelectedTanMethodChanged(self.customersTanMethods[newValue])
}
})
}
init(_ bank: ICustomer, _ initiallySelectedTanMethod: TanMethod? = nil, selectedTanMethodChanged: @escaping (TanMethod) -> Void) {
self.bank = bank
self.selectedTanMethodChanged = selectedTanMethodChanged
self.customersTanMethods = bank.supportedTanMethods.filter( {$0.type != .chiptanusb } ) // USB tan generators are not supported on iOS
self.initiallySelectedTanMethod = initiallySelectedTanMethod ?? bank.selectedTanMethod
let initiallySelectedTanMethodType = self.initiallySelectedTanMethod?.type
_selectedTanMethodIndex = State(initialValue: customersTanMethods.firstIndex(where: { $0.type == initiallySelectedTanMethodType } )
?? bank.supportedTanMethods.firstIndex(where: { $0.type != .chiptanmanuell && $0.type != .chiptanusb } )
?? 0)
}
var body: some View {
Picker("TAN method", selection: selectedTanMethodIndexBinding) {
ForEach(0 ..< self.customersTanMethods.count) { index in
Text(self.customersTanMethods[index].displayName)
}
}
}
private func dispatchSelectedTanMethodChanged(_ selectedTanMethod: TanMethod) {
// do async as at this point Picker dialog gets dismissed -> this EnterTanDialog would never get dismissed (and dismiss has to be called before callback.changeTanMethod())
DispatchQueue.main.async {
self.selectedTanMethodChanged(selectedTanMethod)
}
}
}
struct TanMethodPicker_Previews: PreviewProvider {
static var previews: some View {
TanMethodPicker(previewBanks[0]) { _ in }
}
}

View File

@ -1,72 +0,0 @@
import SwiftUI
import BankingUiSwift
struct TanProcedurePicker: View {
private let bank: ICustomer
private let selectedTanProcedureChanged: (TanProcedure) -> Void
private var customersTanProcedures: [TanProcedure] = []
private let initiallySelectedTanProcedure: TanProcedure?
@State private var selectedTanProcedureIndex: Int
private var selectedTanProcedureIndexBinding: Binding<Int> {
Binding<Int>(
get: { self.selectedTanProcedureIndex },
set: { newValue in
if (self.selectedTanProcedureIndex != newValue || self.initiallySelectedTanProcedure == nil) { // only if TAN procedure has really changed
self.selectedTanProcedureIndex = newValue
self.dispatchSelectedTanProcedureChanged(self.customersTanProcedures[newValue])
}
})
}
init(_ bank: ICustomer, _ initiallySelectedTanProcedure: TanProcedure? = nil, selectedTanProcedureChanged: @escaping (TanProcedure) -> Void) {
self.bank = bank
self.selectedTanProcedureChanged = selectedTanProcedureChanged
self.customersTanProcedures = bank.supportedTanProcedures.filter( {$0.type != .chiptanusb } ) // USB tan generators are not supported on iOS
self.initiallySelectedTanProcedure = initiallySelectedTanProcedure ?? bank.selectedTanProcedure
let initiallySelectedTanProcedureType = self.initiallySelectedTanProcedure?.type
_selectedTanProcedureIndex = State(initialValue: customersTanProcedures.firstIndex(where: { $0.type == initiallySelectedTanProcedureType } )
?? bank.supportedTanProcedures.firstIndex(where: { $0.type != .chiptanmanuell && $0.type != .chiptanusb } )
?? 0)
}
var body: some View {
Picker("TAN procedure", selection: selectedTanProcedureIndexBinding) {
ForEach(0 ..< self.customersTanProcedures.count) { index in
Text(self.customersTanProcedures[index].displayName)
}
}
}
private func dispatchSelectedTanProcedureChanged(_ selectedTanProcedure: TanProcedure) {
// do async as at this point Picker dialog gets dismissed -> this EnterTanDialog would never get dismissed (and dismiss has to be called before callback.changeTanProcedure())
DispatchQueue.main.async {
self.selectedTanProcedureChanged(selectedTanProcedure)
}
}
}
struct TanProcedurePicker_Previews: PreviewProvider {
static var previews: some View {
TanProcedurePicker(previewBanks[0]) { _ in }
}
}

View File

@ -220,7 +220,7 @@ open class fints4kBankingClient(
return object : FinTsClientCallback {
override fun askUserForTanMethod(supportedTanMethods: List<TanMethod>, suggestedTanMethod: TanMethod?, callback: (TanMethod?) -> Unit) {
handleAskUserForTanProcedure(supportedTanMethods, suggestedTanMethod, callback)
handleAskUserForTanMethod(supportedTanMethods, suggestedTanMethod, callback)
}
override fun enterTan(bank: BankData, tanChallenge: TanChallenge, callback: (EnterTanResult) -> Unit) {
@ -234,13 +234,13 @@ open class fints4kBankingClient(
}
}
protected open fun handleAskUserForTanProcedure(supportedTanMethods: List<TanMethod>, suggestedTanMethod: TanMethod?, callback: (TanMethod?) -> Unit) {
protected open fun handleAskUserForTanMethod(supportedTanMethods: List<TanMethod>, suggestedTanMethod: TanMethod?, callback: (TanMethod?) -> Unit) {
// we simply return suggestedTanProcedure as even so it's not user's preferred TAN procedure she still can select it in EnterTanDialog
callback(suggestedTanMethod)
}
protected open fun handleEnterTan(bank: BankData, tanChallenge: TanChallenge, enterTanCallback: (EnterTanResult) -> Unit, clientCallback: BankingClientCallback) {
mapper.updateTanMediaAndProcedures(this@fints4kBankingClient.customer, bank)
mapper.updateTanMediaAndMethods(this@fints4kBankingClient.customer, bank)
clientCallback.enterTan(this@fints4kBankingClient.customer, mapper.mapTanChallenge(tanChallenge)) { result ->
enterTanCallback(mapper.mapEnterTanResult(result, bank))
@ -248,7 +248,7 @@ open class fints4kBankingClient(
}
protected open fun handleEnterTanGeneratorAtc(bank: BankData, tanMedium: TanGeneratorTanMedium, enterAtcCallback: (EnterTanGeneratorAtcResult) -> Unit, clientCallback: BankingClientCallback) {
mapper.updateTanMediaAndProcedures(this@fints4kBankingClient.customer, bank)
mapper.updateTanMediaAndMethods(this@fints4kBankingClient.customer, bank)
clientCallback.enterTanGeneratorAtc(mapper.mapTanMedium(tanMedium)) { result ->
enterAtcCallback(mapper.mapEnterTanGeneratorAtcResult(result))

View File

@ -93,7 +93,7 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) {
bank.bankCode = customer.bankCode
bank.selectedTanMethod = findTanMethod(bank, customer.selectedTanProcedure) ?: bank.selectedTanMethod
bank.selectedTanMethod = findTanMethod(bank, customer.selectedTanMethod) ?: bank.selectedTanMethod
}
@ -236,15 +236,15 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) {
open fun updateTanMediaAndMethods(account: TypedCustomer, bank: BankData) {
account.supportedTanProcedures = bank.tanMethodsAvailableForUser.map { tanMethod ->
account.supportedTanMethods = bank.tanMethodsAvailableForUser.map { tanMethod ->
findMappedTanMethod(account, tanMethod) ?: mapTanMethod(tanMethod)
}
if (bank.isTanMethodSelected) {
account.selectedTanProcedure = findMappedTanMethod(account, bank.selectedTanMethod)
account.selectedTanMethod = findMappedTanMethod(account, bank.selectedTanMethod)
}
else {
account.selectedTanProcedure = null
account.selectedTanMethod = null
}
account.tanMedia = bank.tanMedia.map { tanMedium ->
@ -253,12 +253,12 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) {
}
open fun mapTanMethods(tanMethods: List<net.dankito.banking.fints.model.TanMethod>): List<TanProcedure> {
open fun mapTanMethods(tanMethods: List<net.dankito.banking.fints.model.TanMethod>): List<TanMethod> {
return tanMethods.map { mapTanMethod(it) }
}
open fun mapTanMethod(tanMethod: net.dankito.banking.fints.model.TanMethod): TanProcedure {
return modelCreator.createTanProcedure(
open fun mapTanMethod(tanMethod: net.dankito.banking.fints.model.TanMethod): TanMethod {
return modelCreator.createTanMethod(
tanMethod.displayName,
mapTanMethodType(tanMethod.type),
tanMethod.securityFunction.code,
@ -267,18 +267,18 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) {
)
}
open fun mapTanMethodType(type: net.dankito.banking.fints.model.TanMethodType): TanProcedureType {
open fun mapTanMethodType(type: net.dankito.banking.fints.model.TanMethodType): TanMethodType {
return when (type) {
net.dankito.banking.fints.model.TanMethodType.EnterTan -> TanProcedureType.EnterTan
net.dankito.banking.fints.model.TanMethodType.ChipTanManuell -> TanProcedureType.ChipTanManuell
net.dankito.banking.fints.model.TanMethodType.ChipTanFlickercode -> TanProcedureType.ChipTanFlickercode
net.dankito.banking.fints.model.TanMethodType.ChipTanUsb -> TanProcedureType.ChipTanUsb
net.dankito.banking.fints.model.TanMethodType.ChipTanQrCode -> TanProcedureType.ChipTanQrCode
net.dankito.banking.fints.model.TanMethodType.ChipTanPhotoTanMatrixCode -> TanProcedureType.ChipTanPhotoTanMatrixCode
net.dankito.banking.fints.model.TanMethodType.SmsTan -> TanProcedureType.SmsTan
net.dankito.banking.fints.model.TanMethodType.AppTan -> TanProcedureType.AppTan
net.dankito.banking.fints.model.TanMethodType.photoTan -> TanProcedureType.photoTan
net.dankito.banking.fints.model.TanMethodType.QrCode -> TanProcedureType.QrCode
net.dankito.banking.fints.model.TanMethodType.EnterTan -> TanMethodType.EnterTan
net.dankito.banking.fints.model.TanMethodType.ChipTanManuell -> TanMethodType.ChipTanManuell
net.dankito.banking.fints.model.TanMethodType.ChipTanFlickercode -> TanMethodType.ChipTanFlickercode
net.dankito.banking.fints.model.TanMethodType.ChipTanUsb -> TanMethodType.ChipTanUsb
net.dankito.banking.fints.model.TanMethodType.ChipTanQrCode -> TanMethodType.ChipTanQrCode
net.dankito.banking.fints.model.TanMethodType.ChipTanPhotoTanMatrixCode -> TanMethodType.ChipTanPhotoTanMatrixCode
net.dankito.banking.fints.model.TanMethodType.SmsTan -> TanMethodType.SmsTan
net.dankito.banking.fints.model.TanMethodType.AppTan -> TanMethodType.AppTan
net.dankito.banking.fints.model.TanMethodType.photoTan -> TanMethodType.photoTan
net.dankito.banking.fints.model.TanMethodType.QrCode -> TanMethodType.QrCode
}
}
@ -289,16 +289,16 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) {
}
}
protected open fun findMappedTanMethod(customer: TypedCustomer, tanMethod: net.dankito.banking.fints.model.TanMethod): TanProcedure? {
return customer.supportedTanProcedures.firstOrNull { it.bankInternalProcedureCode == tanMethod.securityFunction.code }
protected open fun findMappedTanMethod(customer: TypedCustomer, tanMethod: net.dankito.banking.fints.model.TanMethod): TanMethod? {
return customer.supportedTanMethods.firstOrNull { it.bankInternalMethodCode == tanMethod.securityFunction.code }
}
protected open fun findTanMethod(bank: BankData, tanProcedure: TanProcedure?): net.dankito.banking.fints.model.TanMethod? {
if (tanProcedure == null) {
protected open fun findTanMethod(bank: BankData, tanMethod: TanMethod?): net.dankito.banking.fints.model.TanMethod? {
if (tanMethod == null) {
return null
}
return bank.tanMethodsAvailableForUser.firstOrNull { it.securityFunction.code == tanProcedure.bankInternalProcedureCode }
return bank.tanMethodsAvailableForUser.firstOrNull { it.securityFunction.code == tanMethod.bankInternalMethodCode }
}
protected open fun findMappedTanMedium(customer: TypedCustomer, tanMedium: net.dankito.banking.fints.messages.datenelemente.implementierte.tan.TanMedium): TanMedium? {
@ -393,29 +393,29 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) {
}
open fun mapTanMethod(tanProcedure: TanProcedure): net.dankito.banking.fints.model.TanMethod {
open fun mapTanMethod(tanMethod: TanMethod): net.dankito.banking.fints.model.TanMethod {
return net.dankito.banking.fints.model.TanMethod(
tanProcedure.displayName,
Sicherheitsfunktion.values().first { it.code == tanProcedure.bankInternalProcedureCode },
mapTanMethodType(tanProcedure.type),
tanMethod.displayName,
Sicherheitsfunktion.values().first { it.code == tanMethod.bankInternalMethodCode },
mapTanMethodType(tanMethod.type),
null, // TODO: where to get HDD Version from?
tanProcedure.maxTanInputLength,
mapAllowedTanFormat(tanProcedure.allowedTanFormat)
tanMethod.maxTanInputLength,
mapAllowedTanFormat(tanMethod.allowedTanFormat)
)
}
open fun mapTanMethodType(type: TanProcedureType): net.dankito.banking.fints.model.TanMethodType {
open fun mapTanMethodType(type: TanMethodType): net.dankito.banking.fints.model.TanMethodType {
return when (type) {
TanProcedureType.EnterTan -> net.dankito.banking.fints.model.TanMethodType.EnterTan
TanProcedureType.ChipTanManuell -> net.dankito.banking.fints.model.TanMethodType.ChipTanManuell
TanProcedureType.ChipTanFlickercode -> net.dankito.banking.fints.model.TanMethodType.ChipTanFlickercode
TanProcedureType.ChipTanUsb -> net.dankito.banking.fints.model.TanMethodType.ChipTanUsb
TanProcedureType.ChipTanQrCode -> net.dankito.banking.fints.model.TanMethodType.ChipTanQrCode
TanProcedureType.ChipTanPhotoTanMatrixCode -> net.dankito.banking.fints.model.TanMethodType.ChipTanPhotoTanMatrixCode
TanProcedureType.SmsTan -> net.dankito.banking.fints.model.TanMethodType.SmsTan
TanProcedureType.AppTan -> net.dankito.banking.fints.model.TanMethodType.AppTan
TanProcedureType.photoTan -> net.dankito.banking.fints.model.TanMethodType.photoTan
TanProcedureType.QrCode -> net.dankito.banking.fints.model.TanMethodType.QrCode
TanMethodType.EnterTan -> net.dankito.banking.fints.model.TanMethodType.EnterTan
TanMethodType.ChipTanManuell -> net.dankito.banking.fints.model.TanMethodType.ChipTanManuell
TanMethodType.ChipTanFlickercode -> net.dankito.banking.fints.model.TanMethodType.ChipTanFlickercode
TanMethodType.ChipTanUsb -> net.dankito.banking.fints.model.TanMethodType.ChipTanUsb
TanMethodType.ChipTanQrCode -> net.dankito.banking.fints.model.TanMethodType.ChipTanQrCode
TanMethodType.ChipTanPhotoTanMatrixCode -> net.dankito.banking.fints.model.TanMethodType.ChipTanPhotoTanMatrixCode
TanMethodType.SmsTan -> net.dankito.banking.fints.model.TanMethodType.SmsTan
TanMethodType.AppTan -> net.dankito.banking.fints.model.TanMethodType.AppTan
TanMethodType.photoTan -> net.dankito.banking.fints.model.TanMethodType.photoTan
TanMethodType.QrCode -> net.dankito.banking.fints.model.TanMethodType.QrCode
}
}
@ -427,7 +427,7 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) {
}
open fun mapEnterTanResult(result: EnterTanResult, bank: BankData): net.dankito.banking.fints.model.EnterTanResult {
result.changeTanProcedureTo?.let { changeTanMethodTo ->
result.changeTanMethodTo?.let { changeTanMethodTo ->
return net.dankito.banking.fints.model.EnterTanResult.userAsksToChangeTanMethod(mapTanMethod(changeTanMethodTo))
}