Also using now InputValidator in JavaFX

This commit is contained in:
dankito 2020-05-14 14:51:33 +02:00
parent d32bb7d167
commit 3d54bed50d
1 changed files with 8 additions and 9 deletions

View File

@ -13,8 +13,7 @@ import net.dankito.banking.ui.model.BankAccount
import net.dankito.banking.ui.model.parameters.TransferMoneyData import net.dankito.banking.ui.model.parameters.TransferMoneyData
import net.dankito.banking.ui.model.responses.BankingClientResponse import net.dankito.banking.ui.model.responses.BankingClientResponse
import net.dankito.banking.ui.presenter.BankingPresenter import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.fints.messages.segmente.implementierte.sepa.ISepaMessageCreator import net.dankito.banking.util.InputValidator
import net.dankito.fints.messages.segmente.implementierte.sepa.SepaMessageCreator
import net.dankito.fints.model.BankInfo import net.dankito.fints.model.BankInfo
import net.dankito.utils.javafx.ui.controls.doubleTextfield import net.dankito.utils.javafx.ui.controls.doubleTextfield
import net.dankito.utils.javafx.ui.dialogs.Window import net.dankito.utils.javafx.ui.dialogs.Window
@ -66,7 +65,7 @@ open class TransferMoneyDialog @JvmOverloads constructor(
protected val requiredDataEntered = SimpleBooleanProperty(false) protected val requiredDataEntered = SimpleBooleanProperty(false)
protected val sepaMessageCreator: ISepaMessageCreator = SepaMessageCreator() protected val inputValidator = InputValidator()
protected val dialogService = JavaFxDialogService() protected val dialogService = JavaFxDialogService()
@ -276,11 +275,11 @@ open class TransferMoneyDialog @JvmOverloads constructor(
protected open fun checkIfRequiredDataEnteredOnUiThread() { protected open fun checkIfRequiredDataEnteredOnUiThread() {
requiredDataEntered.value = requiredDataEntered.value =
remitteeName.value.isNotBlank() remitteeName.value.isNotBlank()
&& sepaMessageCreator.containsOnlyAllowedCharacters(remitteeName.value) // TODO: show error message for illegal characters && inputValidator.isRemitteeNameValid(remitteeName.value) // TODO: show error message for illegal characters
&& remitteeIban.value.isNotEmpty() // TODO: check if it is of length > 12, in Germany > 22? && inputValidator.isValidIban(remitteeIban.value)
&& remitteeBic.value.isNotEmpty() // TODO: check if it is of length is 8 or 11? && inputValidator.isValidBic(remitteeBic.value)
&& amount.value > 0 && amount.value > 0
&& sepaMessageCreator.containsOnlyAllowedCharacters(usage.value) // TODO: show error message for illegal characters && inputValidator.isUsageValid(usage.value) // TODO: show error message for illegal characters
} }
@ -293,11 +292,11 @@ open class TransferMoneyDialog @JvmOverloads constructor(
val bankAccount = selectedBankAccount.value val bankAccount = selectedBankAccount.value
val data = TransferMoneyData( val data = TransferMoneyData(
remitteeName.value, inputValidator.convertToAllowedSepaCharacters(remitteeName.value),
remitteeIban.value.replace(" ", ""), remitteeIban.value.replace(" ", ""),
remitteeBic.value.replace(" ", ""), remitteeBic.value.replace(" ", ""),
amount.value.toBigDecimal(), amount.value.toBigDecimal(),
usage.value, inputValidator.convertToAllowedSepaCharacters(usage.value),
instantPayment.value instantPayment.value
) )