mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-02 03:36:24 -04:00
Customize bank form for countries: GB, US, BR, NZ, AU, CA, SE, MX, HK
This commit is contained in:
parent
bb3c950833
commit
77ae3a590f
18 changed files with 406 additions and 155 deletions
|
@ -25,6 +25,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BankUtil {
|
public class BankUtil {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(BankUtil.class);
|
private static final Logger log = LoggerFactory.getLogger(BankUtil.class);
|
||||||
|
|
||||||
// BankName
|
// BankName
|
||||||
|
@ -32,12 +33,28 @@ public class BankUtil {
|
||||||
switch (countryCode) {
|
switch (countryCode) {
|
||||||
case "GB":
|
case "GB":
|
||||||
case "US":
|
case "US":
|
||||||
|
case "NZ":
|
||||||
|
case "AU":
|
||||||
|
case "CA":
|
||||||
|
case "SE":
|
||||||
|
case "HK":
|
||||||
return false;
|
return false;
|
||||||
|
case "MX":
|
||||||
|
case "BR":
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getBankNameLabel(String countryCode) {
|
||||||
|
switch (countryCode) {
|
||||||
|
case "BR":
|
||||||
|
return "Bank name:";
|
||||||
|
default:
|
||||||
|
return "Bank name (optional):";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// BankId
|
// BankId
|
||||||
public static boolean isBankIdRequired(String countryCode) {
|
public static boolean isBankIdRequired(String countryCode) {
|
||||||
|
@ -45,7 +62,14 @@ public class BankUtil {
|
||||||
case "GB":
|
case "GB":
|
||||||
case "US":
|
case "US":
|
||||||
case "BR":
|
case "BR":
|
||||||
|
case "NZ":
|
||||||
|
case "AU":
|
||||||
|
case "SE":
|
||||||
return false;
|
return false;
|
||||||
|
case "CA":
|
||||||
|
case "MX":
|
||||||
|
case "HK":
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -53,12 +77,13 @@ public class BankUtil {
|
||||||
|
|
||||||
public static String getBankIdLabel(String countryCode) {
|
public static String getBankIdLabel(String countryCode) {
|
||||||
switch (countryCode) {
|
switch (countryCode) {
|
||||||
case "GB":
|
case "CA":
|
||||||
case "US":
|
return "Institution Number:";
|
||||||
case "BR":
|
case "MX":
|
||||||
log.warn("BankId must not be used for country " + countryCode);
|
case "HK":
|
||||||
|
return "Bank code:";
|
||||||
default:
|
default:
|
||||||
return "Bank nr. or BIC/SWIFT:";
|
return "Bank nr. (e.g. BIC or SWIFT) (optional):";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,7 +94,14 @@ public class BankUtil {
|
||||||
case "GB":
|
case "GB":
|
||||||
case "US":
|
case "US":
|
||||||
case "BR":
|
case "BR":
|
||||||
|
case "AU":
|
||||||
|
case "CA":
|
||||||
return true;
|
return true;
|
||||||
|
case "NZ":
|
||||||
|
case "MX":
|
||||||
|
case "HK":
|
||||||
|
case "SE":
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -83,6 +115,8 @@ public class BankUtil {
|
||||||
return "Routing Number:";
|
return "Routing Number:";
|
||||||
case "BR":
|
case "BR":
|
||||||
return "Branch code:";
|
return "Branch code:";
|
||||||
|
case "AU":
|
||||||
|
return "BSB code:";
|
||||||
case "CA":
|
case "CA":
|
||||||
return "Transit Number:";
|
return "Transit Number:";
|
||||||
default:
|
default:
|
||||||
|
@ -104,9 +138,17 @@ public class BankUtil {
|
||||||
case "GB":
|
case "GB":
|
||||||
case "US":
|
case "US":
|
||||||
case "BR":
|
case "BR":
|
||||||
|
case "NZ":
|
||||||
|
case "AU":
|
||||||
|
case "CA":
|
||||||
|
case "HK":
|
||||||
return "Account number:";
|
return "Account number:";
|
||||||
|
case "SE":
|
||||||
|
return "Bankgiro number:";
|
||||||
|
case "MX":
|
||||||
|
return "CLABE:";
|
||||||
default:
|
default:
|
||||||
return "Account nr. or IBAN:";
|
return "Account nr. (e.g. IBAN):";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +157,7 @@ public class BankUtil {
|
||||||
switch (countryCode) {
|
switch (countryCode) {
|
||||||
case "US":
|
case "US":
|
||||||
case "BR":
|
case "BR":
|
||||||
|
case "CA":
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -125,6 +168,7 @@ public class BankUtil {
|
||||||
switch (countryCode) {
|
switch (countryCode) {
|
||||||
case "US":
|
case "US":
|
||||||
case "BR":
|
case "BR":
|
||||||
|
case "CA":
|
||||||
return "Account type:";
|
return "Account type:";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
|
@ -135,6 +179,7 @@ public class BankUtil {
|
||||||
switch (countryCode) {
|
switch (countryCode) {
|
||||||
case "US":
|
case "US":
|
||||||
case "BR":
|
case "BR":
|
||||||
|
case "CA":
|
||||||
return Arrays.asList("Checking", "Savings");
|
return Arrays.asList("Checking", "Savings");
|
||||||
default:
|
default:
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
@ -163,4 +208,22 @@ public class BankUtil {
|
||||||
return "Personal ID:";
|
return "Personal ID:";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
public static boolean useValidation(String countryCode) {
|
||||||
|
switch (countryCode) {
|
||||||
|
case "GB":
|
||||||
|
case "US":
|
||||||
|
case "BR":
|
||||||
|
case "AU":
|
||||||
|
case "CA":
|
||||||
|
case "NZ":
|
||||||
|
case "MX":
|
||||||
|
case "HK":
|
||||||
|
case "SE":
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,13 +52,12 @@ public abstract class BankAccountContractData extends CountryBasedPaymentAccount
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPaymentDetailsForTradePopup() {
|
public String getPaymentDetailsForTradePopup() {
|
||||||
String holderIdString = BankUtil.isHolderIdRequired(countryCode) ? (BankUtil.getHolderIdLabel(countryCode) + ": " + holderTaxId + "\n") : "";
|
String bankName = BankUtil.isBankNameRequired(countryCode) ? BankUtil.getBankNameLabel(countryCode) + " " + this.bankName + "\n" : "";
|
||||||
|
String bankId = BankUtil.isBankIdRequired(countryCode) ? BankUtil.getBankIdLabel(countryCode) + " " + this.bankId + "\n" : "";
|
||||||
String bankName = BankUtil.isBankNameRequired(countryCode) ? "Bank name: " + this.bankName + "\n" : "";
|
String branchId = BankUtil.isBranchIdRequired(countryCode) ? BankUtil.getBranchIdLabel(countryCode) + " " + this.branchId + "\n" : "";
|
||||||
String bankId = BankUtil.isBankIdRequired(countryCode) ? BankUtil.getBankIdLabel(countryCode) + this.bankId + "\n" : "";
|
String accountNr = BankUtil.isAccountNrRequired(countryCode) ? BankUtil.getAccountNrLabel(countryCode) + " " + this.accountNr + "\n" : "";
|
||||||
String branchId = BankUtil.isBranchIdRequired(countryCode) ? BankUtil.getBranchIdLabel(countryCode) + this.branchId + "\n" : "";
|
String accountType = BankUtil.isAccountTypeRequired(countryCode) ? BankUtil.getAccountTypeLabel(countryCode) + " " + this.accountType + "\n" : "";
|
||||||
String accountNr = BankUtil.isAccountNrRequired(countryCode) ? BankUtil.getAccountNrLabel(countryCode) + this.accountNr + "\n" : "";
|
String holderIdString = BankUtil.isHolderIdRequired(countryCode) ? (BankUtil.getHolderIdLabel(countryCode) + " " + holderTaxId + "\n") : "";
|
||||||
String accountType = BankUtil.isAccountTypeRequired(countryCode) ? BankUtil.getAccountTypeLabel(countryCode) + this.accountType + "\n" : "";
|
|
||||||
|
|
||||||
return "Holder name: " + holderName + "\n" +
|
return "Holder name: " + holderName + "\n" +
|
||||||
bankName +
|
bankName +
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package io.bitsquare.gui.components;
|
package io.bitsquare.gui.components;
|
||||||
|
|
||||||
import io.bitsquare.common.UserThread;
|
import io.bitsquare.common.UserThread;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.collections.transformation.FilteredList;
|
import javafx.collections.transformation.FilteredList;
|
||||||
|
@ -22,11 +21,11 @@ public class SearchComboBox<T> extends ComboBox<T> {
|
||||||
filteredList = new FilteredList<>(items);
|
filteredList = new FilteredList<>(items);
|
||||||
setEditable(true);
|
setEditable(true);
|
||||||
|
|
||||||
itemsProperty().addListener(new WeakChangeListener<>((observable, oldValue, newValue) -> {
|
itemsProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
filteredList = new FilteredList<>(newValue);
|
filteredList = new FilteredList<>(newValue);
|
||||||
setItems(filteredList);
|
setItems(filteredList);
|
||||||
}));
|
});
|
||||||
getEditor().textProperty().addListener(new WeakChangeListener<>((observable, oldValue, newValue) -> {
|
getEditor().textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!filteredList.stream().filter(item -> getConverter().toString(item).equals(newValue)).
|
if (!filteredList.stream().filter(item -> getConverter().toString(item).equals(newValue)).
|
||||||
findAny().isPresent()) {
|
findAny().isPresent()) {
|
||||||
UserThread.execute(() -> {
|
UserThread.execute(() -> {
|
||||||
|
@ -37,6 +36,6 @@ public class SearchComboBox<T> extends ComboBox<T> {
|
||||||
show();
|
show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,7 +27,6 @@ import io.bitsquare.payment.AliPayAccount;
|
||||||
import io.bitsquare.payment.AliPayAccountContractData;
|
import io.bitsquare.payment.AliPayAccountContractData;
|
||||||
import io.bitsquare.payment.PaymentAccount;
|
import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccountContractData;
|
import io.bitsquare.payment.PaymentAccountContractData;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -60,10 +59,10 @@ public class AliPayForm extends PaymentMethodForm {
|
||||||
|
|
||||||
accountNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account nr.:").second;
|
accountNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account nr.:").second;
|
||||||
accountNrInputTextField.setValidator(aliPayValidator);
|
accountNrInputTextField.setValidator(aliPayValidator);
|
||||||
accountNrInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
aliPayAccount.setAccountNr(newValue);
|
aliPayAccount.setAccountNr(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
|
|
||||||
addLabelTextField(gridPane, ++gridRow, "Currency:", aliPayAccount.getSingleTradeCurrency().getNameAndCode());
|
addLabelTextField(gridPane, ++gridRow, "Currency:", aliPayAccount.getSingleTradeCurrency().getNameAndCode());
|
||||||
addAllowedPeriod();
|
addAllowedPeriod();
|
||||||
|
|
|
@ -24,7 +24,7 @@ import io.bitsquare.gui.components.InputTextField;
|
||||||
import io.bitsquare.gui.util.BSFormatter;
|
import io.bitsquare.gui.util.BSFormatter;
|
||||||
import io.bitsquare.gui.util.Layout;
|
import io.bitsquare.gui.util.Layout;
|
||||||
import io.bitsquare.gui.util.validation.AccountNrValidator;
|
import io.bitsquare.gui.util.validation.AccountNrValidator;
|
||||||
import io.bitsquare.gui.util.validation.BankValidator;
|
import io.bitsquare.gui.util.validation.BankIdValidator;
|
||||||
import io.bitsquare.gui.util.validation.BranchIdValidator;
|
import io.bitsquare.gui.util.validation.BranchIdValidator;
|
||||||
import io.bitsquare.gui.util.validation.InputValidator;
|
import io.bitsquare.gui.util.validation.InputValidator;
|
||||||
import io.bitsquare.locale.*;
|
import io.bitsquare.locale.*;
|
||||||
|
@ -32,7 +32,6 @@ import io.bitsquare.payment.BankAccountContractData;
|
||||||
import io.bitsquare.payment.CountryBasedPaymentAccount;
|
import io.bitsquare.payment.CountryBasedPaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccount;
|
import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccountContractData;
|
import io.bitsquare.payment.PaymentAccountContractData;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
@ -63,51 +62,127 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
private Tuple2<Label, ComboBox> accountTypeTuple;
|
private Tuple2<Label, ComboBox> accountTypeTuple;
|
||||||
private Label accountTypeLabel;
|
private Label accountTypeLabel;
|
||||||
private ComboBox<String> accountTypeComboBox;
|
private ComboBox<String> accountTypeComboBox;
|
||||||
|
private boolean validatorsApplied;
|
||||||
|
|
||||||
static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
|
static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
|
||||||
BankAccountContractData bankAccountContractData = (BankAccountContractData) paymentAccountContractData;
|
BankAccountContractData data = (BankAccountContractData) paymentAccountContractData;
|
||||||
String countryCode = ((BankAccountContractData) paymentAccountContractData).getCountryCode();
|
String countryCode = ((BankAccountContractData) paymentAccountContractData).getCountryCode();
|
||||||
|
|
||||||
if (bankAccountContractData.getHolderTaxId() != null)
|
if (data.getHolderTaxId() != null)
|
||||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name / " + BankUtil.getHolderIdLabel(countryCode),
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name / " + BankUtil.getHolderIdLabel(countryCode),
|
||||||
bankAccountContractData.getHolderName() + " / " + bankAccountContractData.getHolderTaxId());
|
data.getHolderName() + " / " + data.getHolderTaxId());
|
||||||
else
|
else
|
||||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name:", bankAccountContractData.getHolderName());
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name:", data.getHolderName());
|
||||||
|
|
||||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Country of bank:", CountryUtil.getNameAndCode(countryCode));
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Country of bank:", CountryUtil.getNameAndCode(countryCode));
|
||||||
|
|
||||||
String bankCodeLabel = BankUtil.getBankIdLabel(countryCode);
|
// We don't want to display more than 6 rows to avoid scrolling, so if we get too many fields we combine them horizontally
|
||||||
String branchCodeLabel = BankUtil.getBranchIdLabel(countryCode);
|
int nrRows = 0;
|
||||||
boolean branchCodeDisplayed = false;
|
if (BankUtil.isBankNameRequired(countryCode))
|
||||||
if (BankUtil.isBankNameRequired(countryCode) && BankUtil.isBankIdRequired(countryCode)) {
|
nrRows++;
|
||||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Bank name / " + bankCodeLabel,
|
if (BankUtil.isBankIdRequired(countryCode))
|
||||||
bankAccountContractData.getBankName() + " / " + bankAccountContractData.getBankId());
|
nrRows++;
|
||||||
} else if (BankUtil.isBankNameRequired(countryCode) && !BankUtil.isBankIdRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode)) {
|
if (BankUtil.isBranchIdRequired(countryCode))
|
||||||
branchCodeDisplayed = true;
|
nrRows++;
|
||||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Bank name / " + branchCodeLabel,
|
if (BankUtil.isAccountNrRequired(countryCode))
|
||||||
bankAccountContractData.getBankName() + " / " + bankAccountContractData.getBranchId());
|
nrRows++;
|
||||||
} else if (BankUtil.isBankNameRequired(countryCode)) {
|
if (BankUtil.isAccountTypeRequired(countryCode))
|
||||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Bank name:", bankAccountContractData.getBankName());
|
nrRows++;
|
||||||
} else if (BankUtil.isBankIdRequired(countryCode)) {
|
|
||||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankCodeLabel, bankAccountContractData.getBankId());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
String bankNameLabel = BankUtil.getBankNameLabel(countryCode);
|
||||||
|
String bankIdLabel = BankUtil.getBankIdLabel(countryCode);
|
||||||
|
String branchIdLabel = BankUtil.getBranchIdLabel(countryCode);
|
||||||
String accountNrLabel = BankUtil.getAccountNrLabel(countryCode);
|
String accountNrLabel = BankUtil.getAccountNrLabel(countryCode);
|
||||||
String accountTypeLabel = BankUtil.getAccountTypeLabel(countryCode);
|
String accountTypeLabel = BankUtil.getAccountTypeLabel(countryCode);
|
||||||
|
|
||||||
String accountTypeString = "";
|
|
||||||
String accountTypeLabelString = "";
|
|
||||||
|
|
||||||
if (BankUtil.isAccountTypeRequired(countryCode)) {
|
boolean accountNrAccountTypeCombined = false;
|
||||||
accountTypeString = " (" + bankAccountContractData.getAccountType() + ")";
|
boolean bankNameBankIdCombined = false;
|
||||||
accountTypeLabelString = " (" + accountTypeLabel.substring(0, accountTypeLabel.length() - 1) + "):";
|
boolean bankIdBranchIdCombined = false;
|
||||||
|
boolean bankNameBranchIdCombined = false;
|
||||||
|
boolean branchIdAccountNrCombined = false;
|
||||||
|
if (nrRows > 2) {
|
||||||
|
// Try combine AccountNr + AccountType
|
||||||
|
accountNrAccountTypeCombined = BankUtil.isAccountNrRequired(countryCode) && BankUtil.isAccountTypeRequired(countryCode);
|
||||||
|
if (accountNrAccountTypeCombined)
|
||||||
|
nrRows--;
|
||||||
|
|
||||||
|
if (nrRows > 2) {
|
||||||
|
// Next we try BankName + BankId
|
||||||
|
bankNameBankIdCombined = BankUtil.isBankNameRequired(countryCode) && BankUtil.isBankIdRequired(countryCode);
|
||||||
|
if (bankNameBankIdCombined)
|
||||||
|
nrRows--;
|
||||||
|
|
||||||
|
if (nrRows > 2) {
|
||||||
|
// Next we try BankId + BranchId
|
||||||
|
bankIdBranchIdCombined = !bankNameBankIdCombined && BankUtil.isBankIdRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
|
||||||
|
if (bankIdBranchIdCombined)
|
||||||
|
nrRows--;
|
||||||
|
|
||||||
|
if (nrRows > 2) {
|
||||||
|
// Next we try BankId + BranchId
|
||||||
|
bankNameBranchIdCombined = !bankNameBankIdCombined && !bankIdBranchIdCombined &&
|
||||||
|
BankUtil.isBankNameRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
|
||||||
|
if (bankNameBranchIdCombined)
|
||||||
|
nrRows--;
|
||||||
|
|
||||||
|
if (nrRows > 2) {
|
||||||
|
branchIdAccountNrCombined = !bankNameBranchIdCombined && !bankIdBranchIdCombined && !accountNrAccountTypeCombined &&
|
||||||
|
BankUtil.isBranchIdRequired(countryCode) && BankUtil.isAccountNrRequired(countryCode);
|
||||||
|
if (branchIdAccountNrCombined)
|
||||||
|
nrRows--;
|
||||||
|
|
||||||
|
if (nrRows > 2)
|
||||||
|
log.warn("We still have too many rows....");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!branchCodeDisplayed && BankUtil.isBranchIdRequired(countryCode))
|
if (bankNameBankIdCombined) {
|
||||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchCodeLabel, bankAccountContractData.getBranchId());
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
|
||||||
if (BankUtil.isAccountNrRequired(countryCode))
|
bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + bankIdLabel.substring(0, bankIdLabel.length() - 1) + ":",
|
||||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel.substring(0, accountNrLabel.length() - 1) +
|
data.getBankName() + " / " + data.getBankId());
|
||||||
accountTypeLabelString, bankAccountContractData.getAccountNr() + accountTypeString);
|
}
|
||||||
|
if (bankNameBranchIdCombined) {
|
||||||
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
|
||||||
|
bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":",
|
||||||
|
data.getBankName() + " / " + data.getBranchId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && BankUtil.isBankNameRequired(countryCode))
|
||||||
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel, data.getBankName());
|
||||||
|
|
||||||
|
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && !branchIdAccountNrCombined && bankIdBranchIdCombined) {
|
||||||
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
|
||||||
|
bankIdLabel.substring(0, bankIdLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":",
|
||||||
|
data.getBankId() + " / " + data.getBranchId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bankNameBankIdCombined && !bankIdBranchIdCombined && BankUtil.isBankIdRequired(countryCode))
|
||||||
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel, data.getBankId());
|
||||||
|
|
||||||
|
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && branchIdAccountNrCombined) {
|
||||||
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
|
||||||
|
branchIdLabel.substring(0, branchIdLabel.length() - 1) + " / " + accountNrLabel.substring(0, accountNrLabel.length() - 1) + ":",
|
||||||
|
data.getBranchId() + " / " + data.getAccountNr());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && !branchIdAccountNrCombined && BankUtil.isBranchIdRequired(countryCode))
|
||||||
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel, data.getBranchId());
|
||||||
|
|
||||||
|
if (!branchIdAccountNrCombined && accountNrAccountTypeCombined) {
|
||||||
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
|
||||||
|
accountNrLabel.substring(0, accountNrLabel.length() - 1) + " / " + accountTypeLabel,
|
||||||
|
data.getAccountNr() + " / " + data.getAccountType());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!branchIdAccountNrCombined && !accountNrAccountTypeCombined && BankUtil.isAccountNrRequired(countryCode))
|
||||||
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel, data.getAccountNr());
|
||||||
|
|
||||||
|
if (!accountNrAccountTypeCombined && BankUtil.isAccountTypeRequired(countryCode))
|
||||||
|
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountTypeLabel, data.getAccountType());
|
||||||
|
|
||||||
return gridRow;
|
return gridRow;
|
||||||
}
|
}
|
||||||
|
@ -199,6 +274,7 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
|
branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
|
||||||
accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
|
accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
|
||||||
accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
|
accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
|
||||||
|
holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
|
||||||
|
|
||||||
bankNameInputTextField.setText("");
|
bankNameInputTextField.setText("");
|
||||||
bankIdInputTextField.setText("");
|
bankIdInputTextField.setText("");
|
||||||
|
@ -207,14 +283,29 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
accountTypeComboBox.getSelectionModel().clearSelection();
|
accountTypeComboBox.getSelectionModel().clearSelection();
|
||||||
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
|
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
|
||||||
|
|
||||||
|
if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
|
||||||
|
validatorsApplied = true;
|
||||||
|
holderIdInputTextField.setValidator(inputValidator);
|
||||||
|
bankNameInputTextField.setValidator(inputValidator);
|
||||||
|
bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
|
||||||
|
branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
|
||||||
|
accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
|
||||||
|
} else {
|
||||||
|
validatorsApplied = false;
|
||||||
|
holderIdInputTextField.setValidator(null);
|
||||||
|
bankNameInputTextField.setValidator(null);
|
||||||
|
bankIdInputTextField.setValidator(null);
|
||||||
|
branchIdInputTextField.setValidator(null);
|
||||||
|
accountNrInputTextField.setValidator(null);
|
||||||
|
}
|
||||||
|
holderNameInputTextField.resetValidation();
|
||||||
|
holderIdInputTextField.resetValidation();
|
||||||
bankNameInputTextField.resetValidation();
|
bankNameInputTextField.resetValidation();
|
||||||
bankIdInputTextField.resetValidation();
|
bankIdInputTextField.resetValidation();
|
||||||
branchIdInputTextField.resetValidation();
|
branchIdInputTextField.resetValidation();
|
||||||
accountNrInputTextField.resetValidation();
|
accountNrInputTextField.resetValidation();
|
||||||
|
|
||||||
if (holderIdInputTextField != null) {
|
|
||||||
holderIdInputTextField.resetValidation();
|
|
||||||
holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
|
|
||||||
boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
|
boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
|
||||||
if (requiresHolderId) {
|
if (requiresHolderId) {
|
||||||
holderNameInputTextField.minWidthProperty().unbind();
|
holderNameInputTextField.minWidthProperty().unbind();
|
||||||
|
@ -227,38 +318,30 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
holderIdLabel.setManaged(requiresHolderId);
|
holderIdLabel.setManaged(requiresHolderId);
|
||||||
holderIdInputTextField.setVisible(requiresHolderId);
|
holderIdInputTextField.setVisible(requiresHolderId);
|
||||||
holderIdInputTextField.setManaged(requiresHolderId);
|
holderIdInputTextField.setManaged(requiresHolderId);
|
||||||
}
|
|
||||||
|
|
||||||
bankNameTuple.second.resetValidation();
|
|
||||||
bankIdTuple.second.resetValidation();
|
|
||||||
branchIdTuple.second.resetValidation();
|
|
||||||
accountNrTuple.second.resetValidation();
|
|
||||||
|
|
||||||
boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
|
boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
|
||||||
bankNameTuple.first.setVisible(bankNameRequired);
|
bankNameTuple.first.setVisible(bankNameRequired);
|
||||||
bankNameTuple.first.setManaged(bankNameRequired);
|
bankNameTuple.first.setManaged(bankNameRequired);
|
||||||
bankNameTuple.second.setVisible(bankNameRequired);
|
bankNameInputTextField.setVisible(bankNameRequired);
|
||||||
bankNameTuple.second.setManaged(bankNameRequired);
|
bankNameInputTextField.setManaged(bankNameRequired);
|
||||||
|
|
||||||
boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
|
boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
|
||||||
bankIdTuple.first.setVisible(bankIdRequired);
|
bankIdTuple.first.setVisible(bankIdRequired);
|
||||||
bankIdTuple.first.setManaged(bankIdRequired);
|
bankIdTuple.first.setManaged(bankIdRequired);
|
||||||
bankIdTuple.second.setVisible(bankIdRequired);
|
bankIdInputTextField.setVisible(bankIdRequired);
|
||||||
bankIdTuple.second.setManaged(bankIdRequired);
|
bankIdInputTextField.setManaged(bankIdRequired);
|
||||||
|
|
||||||
boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
|
boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
|
||||||
branchIdTuple.first.setVisible(branchIdRequired);
|
branchIdTuple.first.setVisible(branchIdRequired);
|
||||||
branchIdTuple.first.setManaged(branchIdRequired);
|
branchIdTuple.first.setManaged(branchIdRequired);
|
||||||
branchIdTuple.second.setVisible(branchIdRequired);
|
branchIdInputTextField.setVisible(branchIdRequired);
|
||||||
branchIdTuple.second.setManaged(branchIdRequired);
|
branchIdInputTextField.setManaged(branchIdRequired);
|
||||||
((BankValidator) branchIdTuple.second.getValidator()).setCountryCode(bankAccountContractData.getCountryCode());
|
|
||||||
|
|
||||||
boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
|
boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
|
||||||
accountNrTuple.first.setVisible(accountNrRequired);
|
accountNrTuple.first.setVisible(accountNrRequired);
|
||||||
accountNrTuple.first.setManaged(accountNrRequired);
|
accountNrTuple.first.setManaged(accountNrRequired);
|
||||||
accountNrTuple.second.setVisible(accountNrRequired);
|
accountNrInputTextField.setVisible(accountNrRequired);
|
||||||
accountNrTuple.second.setManaged(accountNrRequired);
|
accountNrInputTextField.setManaged(accountNrRequired);
|
||||||
((BankValidator) accountNrTuple.second.getValidator()).setCountryCode(bankAccountContractData.getCountryCode());
|
|
||||||
|
|
||||||
boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
|
boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
|
||||||
accountTypeTuple.first.setVisible(accountTypeRequired);
|
accountTypeTuple.first.setVisible(accountTypeRequired);
|
||||||
|
@ -286,43 +369,39 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
|
|
||||||
bankNameTuple = addLabelInputTextField(gridPane, ++gridRow, "Bank name:");
|
bankNameTuple = addLabelInputTextField(gridPane, ++gridRow, "Bank name:");
|
||||||
bankNameInputTextField = bankNameTuple.second;
|
bankNameInputTextField = bankNameTuple.second;
|
||||||
bankNameInputTextField.setValidator(inputValidator);
|
|
||||||
bankNameInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
bankAccountContractData.setBankName(newValue);
|
bankAccountContractData.setBankName(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
|
|
||||||
}));
|
});
|
||||||
|
|
||||||
bankIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(""));
|
bankIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(""));
|
||||||
bankIdLabel = bankIdTuple.first;
|
bankIdLabel = bankIdTuple.first;
|
||||||
bankIdInputTextField = bankIdTuple.second;
|
bankIdInputTextField = bankIdTuple.second;
|
||||||
bankIdInputTextField.setValidator(inputValidator);
|
bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
bankIdInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
|
||||||
bankAccountContractData.setBankId(newValue);
|
bankAccountContractData.setBankId(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
|
|
||||||
}));
|
});
|
||||||
|
|
||||||
branchIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(""));
|
branchIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(""));
|
||||||
branchIdLabel = branchIdTuple.first;
|
branchIdLabel = branchIdTuple.first;
|
||||||
branchIdInputTextField = branchIdTuple.second;
|
branchIdInputTextField = branchIdTuple.second;
|
||||||
branchIdInputTextField.setValidator(new BranchIdValidator());
|
branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
branchIdInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
|
||||||
bankAccountContractData.setBranchId(newValue);
|
bankAccountContractData.setBranchId(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
|
|
||||||
}));
|
});
|
||||||
|
|
||||||
accountNrTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(""));
|
accountNrTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(""));
|
||||||
accountNrLabel = accountNrTuple.first;
|
accountNrLabel = accountNrTuple.first;
|
||||||
accountNrInputTextField = accountNrTuple.second;
|
accountNrInputTextField = accountNrTuple.second;
|
||||||
accountNrInputTextField.setValidator(new AccountNrValidator());
|
accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
accountNrInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
|
||||||
bankAccountContractData.setAccountNr(newValue);
|
bankAccountContractData.setAccountNr(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
|
|
||||||
}));
|
});
|
||||||
|
|
||||||
|
|
||||||
accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, "");
|
accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, "");
|
||||||
accountTypeLabel = accountTypeTuple.first;
|
accountTypeLabel = accountTypeTuple.first;
|
||||||
|
@ -352,12 +431,12 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
Tuple4<Label, InputTextField, Label, InputTextField> tuple = addLabelInputTextFieldLabelInputTextField(gridPane, ++gridRow, "Account holder name:", BankUtil.getHolderIdLabel(""));
|
Tuple4<Label, InputTextField, Label, InputTextField> tuple = addLabelInputTextFieldLabelInputTextField(gridPane, ++gridRow, "Account holder name:", BankUtil.getHolderIdLabel(""));
|
||||||
holderNameInputTextField = tuple.second;
|
holderNameInputTextField = tuple.second;
|
||||||
holderNameInputTextField.setMinWidth(300);
|
holderNameInputTextField.setMinWidth(300);
|
||||||
holderNameInputTextField.setValidator(inputValidator);
|
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
holderNameInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
|
||||||
bankAccountContractData.setHolderName(newValue);
|
bankAccountContractData.setHolderName(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
holderNameInputTextField.minWidthProperty().bind(currencyTextField.widthProperty());
|
holderNameInputTextField.minWidthProperty().bind(currencyTextField.widthProperty());
|
||||||
|
holderNameInputTextField.setValidator(inputValidator);
|
||||||
|
|
||||||
holderIdLabel = tuple.third;
|
holderIdLabel = tuple.third;
|
||||||
holderIdLabel.setVisible(false);
|
holderIdLabel.setVisible(false);
|
||||||
|
@ -366,11 +445,10 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
holderIdInputTextField = tuple.forth;
|
holderIdInputTextField = tuple.forth;
|
||||||
holderIdInputTextField.setVisible(false);
|
holderIdInputTextField.setVisible(false);
|
||||||
holderIdInputTextField.setManaged(false);
|
holderIdInputTextField.setManaged(false);
|
||||||
holderIdInputTextField.setValidator(inputValidator);
|
holderIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
holderIdInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
|
||||||
bankAccountContractData.setHolderTaxId(newValue);
|
bankAccountContractData.setHolderTaxId(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -409,11 +487,12 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
@Override
|
@Override
|
||||||
public void updateAllInputsValid() {
|
public void updateAllInputsValid() {
|
||||||
boolean result = isAccountNameValid()
|
boolean result = isAccountNameValid()
|
||||||
&& holderNameInputTextField.getValidator().validate(bankAccountContractData.getHolderName()).isValid
|
|
||||||
&& paymentAccount.getSingleTradeCurrency() != null
|
&& paymentAccount.getSingleTradeCurrency() != null
|
||||||
&& getCountryBasedPaymentAccount().getCountry() != null;
|
&& getCountryBasedPaymentAccount().getCountry() != null
|
||||||
|
&& holderNameInputTextField.getValidator().validate(bankAccountContractData.getHolderName()).isValid;
|
||||||
|
|
||||||
String countryCode = bankAccountContractData.getCountryCode();
|
String countryCode = bankAccountContractData.getCountryCode();
|
||||||
|
if (validatorsApplied && BankUtil.useValidation(countryCode)) {
|
||||||
if (BankUtil.isBankNameRequired(countryCode))
|
if (BankUtil.isBankNameRequired(countryCode))
|
||||||
result &= bankNameInputTextField.getValidator().validate(bankAccountContractData.getBankName()).isValid;
|
result &= bankNameInputTextField.getValidator().validate(bankAccountContractData.getBankName()).isValid;
|
||||||
|
|
||||||
|
@ -429,17 +508,17 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
if (BankUtil.isAccountTypeRequired(countryCode))
|
if (BankUtil.isAccountTypeRequired(countryCode))
|
||||||
result &= bankAccountContractData.getAccountType() != null;
|
result &= bankAccountContractData.getAccountType() != null;
|
||||||
|
|
||||||
if (getCountryBasedPaymentAccount().getCountry() != null &&
|
if (BankUtil.isHolderIdRequired(countryCode))
|
||||||
BankUtil.isHolderIdRequired(getCountryBasedPaymentAccount().getCountry().code))
|
|
||||||
result &= holderIdInputTextField.getValidator().validate(bankAccountContractData.getHolderTaxId()).isValid;
|
result &= holderIdInputTextField.getValidator().validate(bankAccountContractData.getHolderTaxId()).isValid;
|
||||||
|
}
|
||||||
allInputsValid.set(result);
|
allInputsValid.set(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addHolderNameAndIdForDisplayAccount() {
|
protected void addHolderNameAndIdForDisplayAccount() {
|
||||||
if (BankUtil.isHolderIdRequired(bankAccountContractData.getCountryCode())) {
|
String countryCode = bankAccountContractData.getCountryCode();
|
||||||
|
if (BankUtil.isHolderIdRequired(countryCode)) {
|
||||||
Tuple4<Label, TextField, Label, TextField> tuple = addLabelTextFieldLabelTextField(gridPane, ++gridRow,
|
Tuple4<Label, TextField, Label, TextField> tuple = addLabelTextFieldLabelTextField(gridPane, ++gridRow,
|
||||||
"Account holder name:", BankUtil.getHolderIdLabel(bankAccountContractData.getCountryCode()));
|
"Account holder name:", BankUtil.getHolderIdLabel(countryCode));
|
||||||
TextField holderNameTextField = tuple.second;
|
TextField holderNameTextField = tuple.second;
|
||||||
holderNameTextField.setText(bankAccountContractData.getHolderName());
|
holderNameTextField.setText(bankAccountContractData.getHolderName());
|
||||||
holderNameTextField.setMinWidth(300);
|
holderNameTextField.setMinWidth(300);
|
||||||
|
|
|
@ -30,7 +30,6 @@ import io.bitsquare.payment.CryptoCurrencyAccount;
|
||||||
import io.bitsquare.payment.CryptoCurrencyAccountContractData;
|
import io.bitsquare.payment.CryptoCurrencyAccountContractData;
|
||||||
import io.bitsquare.payment.PaymentAccount;
|
import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccountContractData;
|
import io.bitsquare.payment.PaymentAccountContractData;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
@ -81,10 +80,10 @@ public class BlockChainForm extends PaymentMethodForm {
|
||||||
addressInputTextField = tuple2.second;
|
addressInputTextField = tuple2.second;
|
||||||
addressInputTextField.setValidator(altCoinAddressValidator);
|
addressInputTextField.setValidator(altCoinAddressValidator);
|
||||||
|
|
||||||
addressInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
addressInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
cryptoCurrencyAccount.setAddress(newValue);
|
cryptoCurrencyAccount.setAddress(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
|
|
||||||
addAllowedPeriod();
|
addAllowedPeriod();
|
||||||
addAccountNameTextFieldWithAutoFillCheckBox();
|
addAccountNameTextFieldWithAutoFillCheckBox();
|
||||||
|
|
|
@ -28,7 +28,6 @@ import io.bitsquare.payment.OKPayAccount;
|
||||||
import io.bitsquare.payment.OKPayAccountContractData;
|
import io.bitsquare.payment.OKPayAccountContractData;
|
||||||
import io.bitsquare.payment.PaymentAccount;
|
import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccountContractData;
|
import io.bitsquare.payment.PaymentAccountContractData;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.VPos;
|
import javafx.geometry.VPos;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
|
@ -67,10 +66,10 @@ public class OKPayForm extends PaymentMethodForm {
|
||||||
|
|
||||||
accountNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Wallet ID:").second;
|
accountNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Wallet ID:").second;
|
||||||
accountNrInputTextField.setValidator(okPayValidator);
|
accountNrInputTextField.setValidator(okPayValidator);
|
||||||
accountNrInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
okPayAccount.setAccountNr(newValue);
|
okPayAccount.setAccountNr(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
|
|
||||||
addCurrenciesGrid(true);
|
addCurrenciesGrid(true);
|
||||||
addAllowedPeriod();
|
addAllowedPeriod();
|
||||||
|
|
|
@ -27,7 +27,6 @@ import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccountContractData;
|
import io.bitsquare.payment.PaymentAccountContractData;
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
|
@ -92,10 +91,10 @@ public abstract class PaymentMethodForm {
|
||||||
accountNameTextField.setEditable(false);
|
accountNameTextField.setEditable(false);
|
||||||
accountNameTextField.setValidator(inputValidator);
|
accountNameTextField.setValidator(inputValidator);
|
||||||
accountNameTextField.setFocusTraversable(false);
|
accountNameTextField.setFocusTraversable(false);
|
||||||
accountNameTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
accountNameTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
paymentAccount.setAccountName(newValue);
|
paymentAccount.setAccountName(newValue);
|
||||||
updateAllInputsValid();
|
updateAllInputsValid();
|
||||||
}));
|
});
|
||||||
useCustomAccountNameCheckBox = tuple.third;
|
useCustomAccountNameCheckBox = tuple.third;
|
||||||
useCustomAccountNameCheckBox.setSelected(false);
|
useCustomAccountNameCheckBox.setSelected(false);
|
||||||
useCustomAccountNameCheckBox.setOnAction(e -> {
|
useCustomAccountNameCheckBox.setOnAction(e -> {
|
||||||
|
|
|
@ -27,7 +27,6 @@ import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccountContractData;
|
import io.bitsquare.payment.PaymentAccountContractData;
|
||||||
import io.bitsquare.payment.PerfectMoneyAccount;
|
import io.bitsquare.payment.PerfectMoneyAccount;
|
||||||
import io.bitsquare.payment.PerfectMoneyAccountContractData;
|
import io.bitsquare.payment.PerfectMoneyAccountContractData;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -61,10 +60,10 @@ public class PerfectMoneyForm extends PaymentMethodForm {
|
||||||
|
|
||||||
accountNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account nr.:").second;
|
accountNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account nr.:").second;
|
||||||
accountNrInputTextField.setValidator(perfectMoneyValidator);
|
accountNrInputTextField.setValidator(perfectMoneyValidator);
|
||||||
accountNrInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
perfectMoneyAccount.setAccountNr(newValue);
|
perfectMoneyAccount.setAccountNr(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
|
|
||||||
addLabelTextField(gridPane, ++gridRow, "Currency:", perfectMoneyAccount.getSingleTradeCurrency().getNameAndCode());
|
addLabelTextField(gridPane, ++gridRow, "Currency:", perfectMoneyAccount.getSingleTradeCurrency().getNameAndCode());
|
||||||
addAllowedPeriod();
|
addAllowedPeriod();
|
||||||
|
|
|
@ -25,7 +25,6 @@ import io.bitsquare.locale.BankUtil;
|
||||||
import io.bitsquare.payment.CountryBasedPaymentAccount;
|
import io.bitsquare.payment.CountryBasedPaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccount;
|
import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccountContractData;
|
import io.bitsquare.payment.PaymentAccountContractData;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
|
@ -52,10 +51,10 @@ public class SameBankForm extends BankForm {
|
||||||
Tuple2<Label, InputTextField> tuple = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:");
|
Tuple2<Label, InputTextField> tuple = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:");
|
||||||
InputTextField holderNameInputTextField = tuple.second;
|
InputTextField holderNameInputTextField = tuple.second;
|
||||||
holderNameInputTextField.setValidator(inputValidator);
|
holderNameInputTextField.setValidator(inputValidator);
|
||||||
holderNameInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
bankAccountContractData.setHolderName(newValue);
|
bankAccountContractData.setHolderName(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,6 @@ import io.bitsquare.gui.util.validation.IBANValidator;
|
||||||
import io.bitsquare.gui.util.validation.InputValidator;
|
import io.bitsquare.gui.util.validation.InputValidator;
|
||||||
import io.bitsquare.locale.*;
|
import io.bitsquare.locale.*;
|
||||||
import io.bitsquare.payment.*;
|
import io.bitsquare.payment.*;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.geometry.HPos;
|
import javafx.geometry.HPos;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
|
@ -81,25 +80,25 @@ public class SepaForm extends PaymentMethodForm {
|
||||||
|
|
||||||
InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:").second;
|
InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:").second;
|
||||||
holderNameInputTextField.setValidator(inputValidator);
|
holderNameInputTextField.setValidator(inputValidator);
|
||||||
holderNameInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
sepaAccount.setHolderName(newValue);
|
sepaAccount.setHolderName(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
|
|
||||||
ibanInputTextField = addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second;
|
ibanInputTextField = addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second;
|
||||||
ibanInputTextField.setValidator(ibanValidator);
|
ibanInputTextField.setValidator(ibanValidator);
|
||||||
ibanInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
sepaAccount.setIban(newValue);
|
sepaAccount.setIban(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
|
|
||||||
}));
|
});
|
||||||
bicInputTextField = addLabelInputTextField(gridPane, ++gridRow, "BIC/SWIFT:").second;
|
bicInputTextField = addLabelInputTextField(gridPane, ++gridRow, "BIC/SWIFT:").second;
|
||||||
bicInputTextField.setValidator(bicValidator);
|
bicInputTextField.setValidator(bicValidator);
|
||||||
bicInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
sepaAccount.setBic(newValue);
|
sepaAccount.setBic(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
|
|
||||||
}));
|
});
|
||||||
|
|
||||||
|
|
||||||
addLabel(gridPane, ++gridRow, "Country of your Bank:");
|
addLabel(gridPane, ++gridRow, "Country of your Bank:");
|
||||||
|
|
|
@ -27,7 +27,6 @@ import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentAccountContractData;
|
import io.bitsquare.payment.PaymentAccountContractData;
|
||||||
import io.bitsquare.payment.SwishAccount;
|
import io.bitsquare.payment.SwishAccount;
|
||||||
import io.bitsquare.payment.SwishAccountContractData;
|
import io.bitsquare.payment.SwishAccountContractData;
|
||||||
import javafx.beans.value.WeakChangeListener;
|
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -62,17 +61,17 @@ public class SwishForm extends PaymentMethodForm {
|
||||||
|
|
||||||
InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:").second;
|
InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:").second;
|
||||||
holderNameInputTextField.setValidator(inputValidator);
|
holderNameInputTextField.setValidator(inputValidator);
|
||||||
holderNameInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
swishAccount.setHolderName(newValue);
|
swishAccount.setHolderName(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
|
|
||||||
mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Mobile nr.:").second;
|
mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Mobile nr.:").second;
|
||||||
mobileNrInputTextField.setValidator(swishValidator);
|
mobileNrInputTextField.setValidator(swishValidator);
|
||||||
mobileNrInputTextField.textProperty().addListener(new WeakChangeListener<>((ov, oldValue, newValue) -> {
|
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
swishAccount.setMobileNr(newValue);
|
swishAccount.setMobileNr(newValue);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
}));
|
});
|
||||||
|
|
||||||
addLabelTextField(gridPane, ++gridRow, "Currency:", swishAccount.getSingleTradeCurrency().getNameAndCode());
|
addLabelTextField(gridPane, ++gridRow, "Currency:", swishAccount.getSingleTradeCurrency().getNameAndCode());
|
||||||
addAllowedPeriod();
|
addAllowedPeriod();
|
||||||
|
|
|
@ -19,18 +19,24 @@ package io.bitsquare.gui.util.validation;
|
||||||
|
|
||||||
|
|
||||||
import io.bitsquare.locale.BSResources;
|
import io.bitsquare.locale.BSResources;
|
||||||
|
import io.bitsquare.locale.BankUtil;
|
||||||
|
|
||||||
public final class AccountNrValidator extends BankValidator {
|
public final class AccountNrValidator extends BankValidator {
|
||||||
|
public AccountNrValidator(String countryCode) {
|
||||||
|
super(countryCode);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValidationResult validate(String input) {
|
public ValidationResult validate(String input) {
|
||||||
String message;
|
int length;
|
||||||
|
String input2;
|
||||||
switch (countryCode) {
|
switch (countryCode) {
|
||||||
case "GB":
|
case "GB":
|
||||||
if (isNumberWithFixedLength(input, 8))
|
length = 8;
|
||||||
|
if (isNumberWithFixedLength(input, length))
|
||||||
return super.validate(input);
|
return super.validate(input);
|
||||||
else
|
else
|
||||||
return new ValidationResult(false, BSResources.get("validation.accountNr", 8));
|
return new ValidationResult(false, BSResources.get("validation.accountNr", length));
|
||||||
case "US":
|
case "US":
|
||||||
if (isNumberInRange(input, 4, 17))
|
if (isNumberInRange(input, 4, 17))
|
||||||
return super.validate(input);
|
return super.validate(input);
|
||||||
|
@ -41,9 +47,43 @@ public final class AccountNrValidator extends BankValidator {
|
||||||
return super.validate(input);
|
return super.validate(input);
|
||||||
else
|
else
|
||||||
return new ValidationResult(false, BSResources.get("validation.accountNrChars", "1 - 20"));
|
return new ValidationResult(false, BSResources.get("validation.accountNrChars", "1 - 20"));
|
||||||
|
case "NZ":
|
||||||
|
input2 = input != null ? input.replaceAll("-", "") : null;
|
||||||
|
if (isNumberInRange(input2, 15, 16))
|
||||||
|
return super.validate(input);
|
||||||
|
else
|
||||||
|
return new ValidationResult(false, "Account number must be of format: 03-1587-0050000-00");
|
||||||
|
case "AU":
|
||||||
|
if (isNumberInRange(input, 4, 10))
|
||||||
|
return super.validate(input);
|
||||||
|
else
|
||||||
|
return new ValidationResult(false, BSResources.get("validation.accountNr", "4 - 10"));
|
||||||
|
case "CA":
|
||||||
|
if (isNumberInRange(input, 7, 12))
|
||||||
|
return super.validate(input);
|
||||||
|
else
|
||||||
|
return new ValidationResult(false, BSResources.get("validation.accountNr", "7 - 12"));
|
||||||
|
case "MX":
|
||||||
|
length = 18;
|
||||||
|
if (isNumberWithFixedLength(input, length))
|
||||||
|
return super.validate(input);
|
||||||
|
else
|
||||||
|
return new ValidationResult(false, BSResources.get("validation.sortCodeNumber", getLabel(), length));
|
||||||
|
case "HK":
|
||||||
|
input2 = input != null ? input.replaceAll("-", "") : null;
|
||||||
|
if (isNumberInRange(input2, 9, 12))
|
||||||
|
return super.validate(input);
|
||||||
|
else
|
||||||
|
return new ValidationResult(false, "Account number must be of format: 005-231289-112");
|
||||||
default:
|
default:
|
||||||
return super.validate(input);
|
return super.validate(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getLabel() {
|
||||||
|
String label = BankUtil.getAccountNrLabel(countryCode);
|
||||||
|
return label.substring(0, label.length() - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Bitsquare.
|
||||||
|
*
|
||||||
|
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.bitsquare.gui.util.validation;
|
||||||
|
|
||||||
|
|
||||||
|
import io.bitsquare.locale.BSResources;
|
||||||
|
import io.bitsquare.locale.BankUtil;
|
||||||
|
|
||||||
|
public final class BankIdValidator extends BankValidator {
|
||||||
|
public BankIdValidator(String countryCode) {
|
||||||
|
super(countryCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ValidationResult validate(String input) {
|
||||||
|
int length;
|
||||||
|
|
||||||
|
switch (countryCode) {
|
||||||
|
case "CA":
|
||||||
|
length = 3;
|
||||||
|
if (isNumberWithFixedLength(input, length))
|
||||||
|
return super.validate(input);
|
||||||
|
else
|
||||||
|
return new ValidationResult(false, BSResources.get("validation.bankIdNumber", getLabel(), length));
|
||||||
|
case "HK":
|
||||||
|
length = 3;
|
||||||
|
if (isNumberWithFixedLength(input, length))
|
||||||
|
return super.validate(input);
|
||||||
|
else
|
||||||
|
return new ValidationResult(false, BSResources.get("validation.bankIdNumber", getLabel(), length));
|
||||||
|
default:
|
||||||
|
return super.validate(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getLabel() {
|
||||||
|
String label = BankUtil.getBankIdLabel(countryCode);
|
||||||
|
return label.substring(0, label.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -25,7 +25,7 @@ public abstract class BankValidator extends InputValidator {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCountryCode(String countryCode) {
|
public BankValidator(String countryCode) {
|
||||||
this.countryCode = countryCode;
|
this.countryCode = countryCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,34 +19,57 @@ package io.bitsquare.gui.util.validation;
|
||||||
|
|
||||||
|
|
||||||
import io.bitsquare.locale.BSResources;
|
import io.bitsquare.locale.BSResources;
|
||||||
|
import io.bitsquare.locale.BankUtil;
|
||||||
|
|
||||||
public final class BranchIdValidator extends BankValidator {
|
public final class BranchIdValidator extends BankValidator {
|
||||||
|
|
||||||
|
public BranchIdValidator(String countryCode) {
|
||||||
|
super(countryCode);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValidationResult validate(String input) {
|
public ValidationResult validate(String input) {
|
||||||
int length;
|
int length;
|
||||||
|
String label = BankUtil.getBankIdLabel(countryCode);
|
||||||
switch (countryCode) {
|
switch (countryCode) {
|
||||||
case "GB":
|
case "GB":
|
||||||
length = 6;
|
length = 6;
|
||||||
if (isNumberWithFixedLength(input, length))
|
if (isNumberWithFixedLength(input, length))
|
||||||
return super.validate(input);
|
return super.validate(input);
|
||||||
else
|
else
|
||||||
return new ValidationResult(false, BSResources.get("validation.sortCodeNumber", "Sort code", length));
|
return new ValidationResult(false, BSResources.get("validation.sortCodeNumber", getLabel(), length));
|
||||||
case "US":
|
case "US":
|
||||||
length = 9;
|
length = 9;
|
||||||
if (isNumberWithFixedLength(input, length))
|
if (isNumberWithFixedLength(input, length))
|
||||||
return super.validate(input);
|
return super.validate(input);
|
||||||
else
|
else
|
||||||
return new ValidationResult(false, BSResources.get("validation.sortCodeNumber", "Routing number", length));
|
return new ValidationResult(false, BSResources.get("validation.sortCodeNumber", getLabel(), length));
|
||||||
case "BR":
|
case "BR":
|
||||||
if (isStringInRange(input, 2, 6))
|
if (isStringInRange(input, 2, 6))
|
||||||
return super.validate(input);
|
return super.validate(input);
|
||||||
else
|
else
|
||||||
return new ValidationResult(false, BSResources.get("validation.sortCodeChars", "Branch code", "2 - 6"));
|
return new ValidationResult(false, BSResources.get("validation.sortCodeChars", getLabel(), "2 - 6"));
|
||||||
|
case "AU":
|
||||||
|
length = 6;
|
||||||
|
if (isNumberWithFixedLength(input, length))
|
||||||
|
return super.validate(input);
|
||||||
|
else
|
||||||
|
return new ValidationResult(false, BSResources.get("validation.sortCodeChars", getLabel(), length));
|
||||||
|
case "CA":
|
||||||
|
length = 5;
|
||||||
|
if (isNumberWithFixedLength(input, length))
|
||||||
|
return super.validate(input);
|
||||||
|
else
|
||||||
|
return new ValidationResult(false, BSResources.get("validation.sortCodeNumber", getLabel(), length));
|
||||||
default:
|
default:
|
||||||
return super.validate(input);
|
return super.validate(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getLabel() {
|
||||||
|
String label = BankUtil.getBranchIdLabel(countryCode);
|
||||||
|
return label.substring(0, label.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
package io.bitsquare.gui.util.validation;
|
package io.bitsquare.gui.util.validation;
|
||||||
|
|
||||||
import io.bitsquare.locale.BSResources;
|
import io.bitsquare.locale.BSResources;
|
||||||
import org.apache.commons.lang3.math.NumberUtils;
|
|
||||||
|
|
||||||
public class InputValidator {
|
public class InputValidator {
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ public class InputValidator {
|
||||||
|
|
||||||
protected boolean isPositiveNumber(String input) {
|
protected boolean isPositiveNumber(String input) {
|
||||||
try {
|
try {
|
||||||
return input != null && NumberUtils.isNumber(input) && Long.parseLong(input) >= 0;
|
return input != null && Long.parseLong(input) >= 0;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ validation.passwordTooShort=The password you entered is too short. It needs to h
|
||||||
validation.passwordTooLong=The password you entered is too long. It cannot be longer as 50 characters.
|
validation.passwordTooLong=The password you entered is too long. It cannot be longer as 50 characters.
|
||||||
validation.sortCodeNumber={0} must consist of {1} numbers
|
validation.sortCodeNumber={0} must consist of {1} numbers
|
||||||
validation.sortCodeChars={0} must consist of {1} characters
|
validation.sortCodeChars={0} must consist of {1} characters
|
||||||
|
validation.bankIdNumber={0} must consist of {1} numbers
|
||||||
validation.accountNr=Account number must consist of {0} numbers
|
validation.accountNr=Account number must consist of {0} numbers
|
||||||
validation.accountNrChars=Account number must consist of {0} characters
|
validation.accountNrChars=Account number must consist of {0} characters
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue