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