mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
SEPA IBAN - fix country code validation
This commit is contained in:
parent
7fc406761a
commit
ab1a8a8a2b
4 changed files with 14 additions and 13 deletions
|
@ -4229,7 +4229,6 @@ validation.bic.sepaRevolutBic=Revolut Sepa accounts are not supported.
|
|||
validation.btc.invalidFormat=Invalid format for a Bitcoin address.
|
||||
validation.bsq.invalidFormat=Invalid format for a BSQ address.
|
||||
validation.email.invalidAddress=Invalid address
|
||||
validation.iban.countryCodeNotMatchCountryOfBank=Country code must match country of bank
|
||||
validation.iban.invalidCountryCode=Country code invalid
|
||||
validation.iban.checkSumNotNumeric=Checksum must be numeric
|
||||
validation.iban.nonNumericChars=Non-alphanumeric character detected
|
||||
|
|
|
@ -70,13 +70,17 @@ public class SepaForm extends GeneralSepaForm {
|
|||
private final SepaIBANValidator sepaIBANValidator;
|
||||
private final BICValidator bicValidator;
|
||||
|
||||
public SepaForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, SepaIBANValidator sepaIBANValidator,
|
||||
BICValidator bicValidator, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow, CoinFormatter formatter) {
|
||||
public SepaForm(PaymentAccount paymentAccount,
|
||||
AccountAgeWitnessService accountAgeWitnessService,
|
||||
BICValidator bicValidator,
|
||||
InputValidator inputValidator,
|
||||
GridPane gridPane,
|
||||
int gridRow,
|
||||
CoinFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.sepaAccount = (SepaAccount) paymentAccount;
|
||||
this.sepaIBANValidator = sepaIBANValidator;
|
||||
this.bicValidator = bicValidator;
|
||||
this.sepaIBANValidator = new SepaIBANValidator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,13 +143,8 @@ public class SepaForm extends GeneralSepaForm {
|
|||
});
|
||||
|
||||
countryComboBox.valueProperty().addListener((ov, oldValue, newValue) -> {
|
||||
if (ibanInputTextField.validate()) {
|
||||
String ibanCountryCode = ibanInputTextField.getText(0, 2);
|
||||
String comboBoxCountryCode = countryComboBox.getValue().code;
|
||||
if (!ibanCountryCode.equals(comboBoxCountryCode)) {
|
||||
ibanInputTextField.setInvalid(Res.get("validation.iban.countryCodeNotMatchCountryOfBank"));
|
||||
}
|
||||
}
|
||||
sepaIBANValidator.setRestrictToCountry(newValue.code);
|
||||
ibanInputTextField.refreshValidation();
|
||||
});
|
||||
|
||||
updateFromInputs();
|
||||
|
|
|
@ -533,7 +533,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
|
|||
case PaymentMethod.PERFECT_MONEY_ID:
|
||||
return new PerfectMoneyForm(paymentAccount, accountAgeWitnessService, perfectMoneyValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.SEPA_ID:
|
||||
return new SepaForm(paymentAccount, accountAgeWitnessService, sepaIBANValidator, bicValidator, inputValidator, root, gridRow, formatter);
|
||||
return new SepaForm(paymentAccount, accountAgeWitnessService, bicValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.SEPA_INSTANT_ID:
|
||||
return new SepaInstantForm(paymentAccount, accountAgeWitnessService, sepaIBANValidator, bicValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.FASTER_PAYMENTS_ID:
|
||||
|
|
|
@ -24,9 +24,12 @@ import java.math.BigInteger;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
// TODO Does not yet recognize special letters like ä, ö, ü, å, ... as invalid characters
|
||||
public class IBANValidator extends InputValidator {
|
||||
|
||||
@Setter
|
||||
private String restrictToCountry = "";
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
|
|
Loading…
Add table
Reference in a new issue