mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 18:33:43 +01:00
Merge branch 'master' into mk_master
This commit is contained in:
commit
e5003d9d28
@ -52,6 +52,9 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
@ -234,6 +237,7 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
private boolean useHolderID;
|
||||
private final Runnable closeHandler;
|
||||
private ComboBox<TradeCurrency> currencyComboBox;
|
||||
private boolean accountNrInputTextFieldEdited;
|
||||
|
||||
BankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter, Runnable closeHandler) {
|
||||
@ -288,6 +292,7 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
accountNrInputTextFieldEdited = false;
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
|
||||
@ -346,6 +351,9 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
branchIdInputTextField.setText("");
|
||||
nationalAccountIdInputTextField.setText("");
|
||||
accountNrInputTextField.setText("");
|
||||
accountNrInputTextField.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) accountNrInputTextFieldEdited = true;
|
||||
});
|
||||
accountTypeComboBox.getSelectionModel().clearSelection();
|
||||
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
|
||||
|
||||
@ -617,7 +625,7 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
if (BankUtil.isNationalAccountIdRequired(countryCode)) {
|
||||
String nationalAccountId = nationalAccountIdInputTextField.getText();
|
||||
|
||||
if (countryCode.equals("AR") && nationalAccountId.length() == 22) {
|
||||
if (countryCode.equals("AR") && nationalAccountId.length() == 22 && !accountNrInputTextFieldEdited) {
|
||||
branchIdInputTextField.setText(nationalAccountId.substring(3,7));
|
||||
accountNrInputTextField.setText(nationalAccountId.substring(8,21));
|
||||
}
|
||||
|
@ -249,6 +249,7 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
private boolean useHolderID;
|
||||
private ComboBox<TradeCurrency> currencyComboBox;
|
||||
private final EmailValidator emailValidator;
|
||||
private boolean accountNrInputTextFieldEdited;
|
||||
|
||||
|
||||
public CashDepositForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator,
|
||||
@ -318,6 +319,7 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
accountNrInputTextFieldEdited = false;
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
Tuple3<Label, ComboBox, ComboBox> tuple3 = FormBuilder.addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
|
||||
@ -375,6 +377,9 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
branchIdInputTextField.setText("");
|
||||
nationalAccountIdInputTextField.setText("");
|
||||
accountNrInputTextField.setText("");
|
||||
accountNrInputTextField.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) accountNrInputTextFieldEdited = true;
|
||||
});
|
||||
accountTypeComboBox.getSelectionModel().clearSelection();
|
||||
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
|
||||
|
||||
@ -662,7 +667,7 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
if (BankUtil.isNationalAccountIdRequired(countryCode)) {
|
||||
String nationalAccountId = nationalAccountIdInputTextField.getText();
|
||||
|
||||
if (countryCode.equals("AR") && nationalAccountId.length() == 22) {
|
||||
if (countryCode.equals("AR") && nationalAccountId.length() == 22 && !accountNrInputTextFieldEdited) {
|
||||
branchIdInputTextField.setText(nationalAccountId.substring(3,7));
|
||||
accountNrInputTextField.setText(nationalAccountId.substring(8,21));
|
||||
}
|
||||
|
@ -571,10 +571,10 @@ public class BSFormatter {
|
||||
|
||||
String duration = durationMillis > 0 ? DurationFormatUtils.formatDuration(durationMillis, format) : "";
|
||||
|
||||
duration = StringUtils.replaceOnce(duration, "1 " + seconds, "1 " + second);
|
||||
duration = StringUtils.replaceOnce(duration, "1 " + minutes, "1 " + minute);
|
||||
duration = StringUtils.replaceOnce(duration, "1 " + hours, "1 " + hour);
|
||||
duration = StringUtils.replaceOnce(duration, "1 " + days, "1 " + day);
|
||||
duration = StringUtils.replacePattern(duration, "^1 " + seconds + "|\\b1 " + seconds, "1 " + second);
|
||||
duration = StringUtils.replacePattern(duration, "^1 " + minutes + "|\\b1 " + minutes, "1 " + minute);
|
||||
duration = StringUtils.replacePattern(duration, "^1 " + hours + "|\\b1 " + hours, "1 " + hour);
|
||||
duration = StringUtils.replacePattern(duration, "^1 " + days + "|\\b1 " + days, "1 " + day);
|
||||
return duration.trim();
|
||||
}
|
||||
|
||||
|
@ -102,12 +102,6 @@ public final class AccountNrValidator extends BankValidator {
|
||||
} else {
|
||||
return super.validate(null);
|
||||
}
|
||||
case "AR":
|
||||
length = 13;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.sortCodeNumber", getLabel(), length));
|
||||
default:
|
||||
return super.validate(input);
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ public class BSFormatterTest {
|
||||
assertEquals("1 hour, 0 minutes, 0 seconds", formatter.formatDurationAsWords(oneHour, true));
|
||||
assertEquals("1 hour, 0 minutes, 1 second", formatter.formatDurationAsWords(oneHour + oneSecond, true));
|
||||
assertEquals("1 hour, 0 minutes, 2 seconds", formatter.formatDurationAsWords(oneHour + oneSecond * 2, true));
|
||||
assertEquals("2 days, 21 hours, 28 minutes", formatter.formatDurationAsWords(oneDay * 2 + oneHour * 21 + oneMinute * 28));
|
||||
assertEquals("", formatter.formatDurationAsWords(0));
|
||||
assertTrue(formatter.formatDurationAsWords(0).isEmpty());
|
||||
}
|
||||
|
@ -24,6 +24,6 @@ public class AccountNrValidatorTest {
|
||||
AccountNrValidator validator = new AccountNrValidator("AR");
|
||||
|
||||
assertTrue(validator.validate("4009041813520").isValid);
|
||||
assertFalse(validator.validate("40090418135201").isValid);
|
||||
assertTrue(validator.validate("035-005198/5").isValid);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user