mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Improve auto-naming of accounts
This commit is contained in:
parent
8dba40c3f0
commit
4db16760f0
9 changed files with 23 additions and 22 deletions
|
@ -52,7 +52,7 @@ public class BankUtil {
|
||||||
case "BR":
|
case "BR":
|
||||||
return "Bank name:";
|
return "Bank name:";
|
||||||
default:
|
default:
|
||||||
return "Bank name (optional):";
|
return isBankNameRequired(countryCode) ? "Bank name:" : "Bank name (optional):";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class BankUtil {
|
||||||
case "HK":
|
case "HK":
|
||||||
return "Bank code:";
|
return "Bank code:";
|
||||||
default:
|
default:
|
||||||
return "Bank ID (e.g. BIC or SWIFT) (optional):";
|
return isBankIdRequired(countryCode) ? "Bank ID (e.g. BIC or SWIFT):" : "Bank ID (e.g. BIC or SWIFT) (optional):";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class BankUtil {
|
||||||
case "CA":
|
case "CA":
|
||||||
return "Transit Number:";
|
return "Transit Number:";
|
||||||
default:
|
default:
|
||||||
return "Branch nr. (optional):";
|
return isBranchIdRequired(countryCode) ? "Branch nr.:" : "Branch nr. (optional):";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,9 @@ public class AliPayForm extends PaymentMethodForm {
|
||||||
protected void autoFillNameTextField() {
|
protected void autoFillNameTextField() {
|
||||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||||
String accountNr = accountNrInputTextField.getText();
|
String accountNr = accountNrInputTextField.getText();
|
||||||
accountNr = StringUtils.abbreviate(accountNr, 5);
|
accountNr = StringUtils.abbreviate(accountNr, 9);
|
||||||
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
||||||
accountNameTextField.setText(method.concat(", ").concat(accountNr));
|
accountNameTextField.setText(method.concat(": ").concat(accountNr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -470,27 +470,27 @@ abstract class BankForm extends PaymentMethodForm {
|
||||||
countryCode = "";
|
countryCode = "";
|
||||||
if (BankUtil.isBankIdRequired(countryCode)) {
|
if (BankUtil.isBankIdRequired(countryCode)) {
|
||||||
bankId = bankIdInputTextField.getText();
|
bankId = bankIdInputTextField.getText();
|
||||||
if (bankId.length() > 6)
|
if (bankId.length() > 9)
|
||||||
bankId = StringUtils.abbreviate(bankId, 9);
|
bankId = StringUtils.abbreviate(bankId, 9);
|
||||||
} else if (BankUtil.isBranchIdRequired(countryCode)) {
|
} else if (BankUtil.isBranchIdRequired(countryCode)) {
|
||||||
bankId = branchIdInputTextField.getText();
|
bankId = branchIdInputTextField.getText();
|
||||||
if (bankId.length() > 6)
|
if (bankId.length() > 9)
|
||||||
bankId = StringUtils.abbreviate(bankId, 9);
|
bankId = StringUtils.abbreviate(bankId, 9);
|
||||||
} else if (BankUtil.isBankNameRequired(countryCode)) {
|
} else if (BankUtil.isBankNameRequired(countryCode)) {
|
||||||
bankId = bankNameInputTextField.getText();
|
bankId = bankNameInputTextField.getText();
|
||||||
if (bankId.length() > 6)
|
if (bankId.length() > 9)
|
||||||
bankId = StringUtils.abbreviate(bankId, 9);
|
bankId = StringUtils.abbreviate(bankId, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
String accountNr = accountNrInputTextField.getText();
|
String accountNr = accountNrInputTextField.getText();
|
||||||
if (accountNr.length() > 6)
|
if (accountNr.length() > 9)
|
||||||
accountNr = StringUtils.abbreviate(accountNr, 9);
|
accountNr = StringUtils.abbreviate(accountNr, 9);
|
||||||
|
|
||||||
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
||||||
if (bankId != null)
|
if (bankId != null && !bankId.isEmpty())
|
||||||
accountNameTextField.setText(method.concat(", ").concat(bankId).concat(", ").concat(accountNr));
|
accountNameTextField.setText(method.concat(": ").concat(bankId).concat(", ").concat(accountNr));
|
||||||
else
|
else
|
||||||
accountNameTextField.setText(method.concat(", ").concat(accountNr));
|
accountNameTextField.setText(method.concat(": ").concat(accountNr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class CryptoCurrencyForm extends PaymentMethodForm {
|
||||||
String address = addressInputTextField.getText();
|
String address = addressInputTextField.getText();
|
||||||
address = StringUtils.abbreviate(address, 9);
|
address = StringUtils.abbreviate(address, 9);
|
||||||
String currency = paymentAccount.getSingleTradeCurrency() != null ? paymentAccount.getSingleTradeCurrency().getCode() : "?";
|
String currency = paymentAccount.getSingleTradeCurrency() != null ? paymentAccount.getSingleTradeCurrency().getCode() : "?";
|
||||||
accountNameTextField.setText(method.concat(", ").concat(currency).concat(", ").concat(address));
|
accountNameTextField.setText(currency.concat(": ").concat(address));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,9 +117,9 @@ public class OKPayForm extends PaymentMethodForm {
|
||||||
protected void autoFillNameTextField() {
|
protected void autoFillNameTextField() {
|
||||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||||
String accountNr = accountNrInputTextField.getText();
|
String accountNr = accountNrInputTextField.getText();
|
||||||
accountNr = StringUtils.abbreviate(accountNr, 5);
|
accountNr = StringUtils.abbreviate(accountNr, 9);
|
||||||
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
||||||
accountNameTextField.setText(method.concat(", ").concat(accountNr));
|
accountNameTextField.setText(method.concat(": ").concat(accountNr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,9 +75,9 @@ public class PerfectMoneyForm extends PaymentMethodForm {
|
||||||
protected void autoFillNameTextField() {
|
protected void autoFillNameTextField() {
|
||||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||||
String accountNr = accountNrInputTextField.getText();
|
String accountNr = accountNrInputTextField.getText();
|
||||||
accountNr = StringUtils.abbreviate(accountNr, 5);
|
accountNr = StringUtils.abbreviate(accountNr, 9);
|
||||||
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
||||||
accountNameTextField.setText(method.concat(", ").concat(accountNr));
|
accountNameTextField.setText(method.concat(": ").concat(accountNr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,12 +280,12 @@ public class SepaForm extends PaymentMethodForm {
|
||||||
protected void autoFillNameTextField() {
|
protected void autoFillNameTextField() {
|
||||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||||
String iban = ibanInputTextField.getText();
|
String iban = ibanInputTextField.getText();
|
||||||
if (iban.length() > 5)
|
if (iban.length() > 9)
|
||||||
iban = StringUtils.abbreviate(iban, 5);
|
iban = StringUtils.abbreviate(iban, 9);
|
||||||
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
||||||
String country = ((CountryBasedPaymentAccount) paymentAccount).getCountry() != null ? ((CountryBasedPaymentAccount) paymentAccount).getCountry().code : "?";
|
String country = ((CountryBasedPaymentAccount) paymentAccount).getCountry() != null ? ((CountryBasedPaymentAccount) paymentAccount).getCountry().code : "?";
|
||||||
String currency = paymentAccount.getSingleTradeCurrency() != null ? paymentAccount.getSingleTradeCurrency().getCode() : "?";
|
String currency = paymentAccount.getSingleTradeCurrency() != null ? paymentAccount.getSingleTradeCurrency().getCode() : "?";
|
||||||
accountNameTextField.setText(method.concat(", ").concat(currency).concat(", ").concat(country).concat(", ").concat(iban));
|
accountNameTextField.setText(method.concat(" (").concat(currency).concat("/").concat(country).concat("): ").concat(iban));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,9 +82,9 @@ public class SwishForm extends PaymentMethodForm {
|
||||||
protected void autoFillNameTextField() {
|
protected void autoFillNameTextField() {
|
||||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||||
String mobileNr = mobileNrInputTextField.getText();
|
String mobileNr = mobileNrInputTextField.getText();
|
||||||
mobileNr = StringUtils.abbreviate(mobileNr, 5);
|
mobileNr = StringUtils.abbreviate(mobileNr, 9);
|
||||||
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
||||||
accountNameTextField.setText(method.concat(", ").concat(mobileNr));
|
accountNameTextField.setText(method.concat(": ").concat(mobileNr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -763,6 +763,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
||||||
|
|
||||||
paymentAccountsComboBox = addLabelComboBox(gridPane, gridRow, "Payment account:", Layout.FIRST_ROW_DISTANCE).second;
|
paymentAccountsComboBox = addLabelComboBox(gridPane, gridRow, "Payment account:", Layout.FIRST_ROW_DISTANCE).second;
|
||||||
paymentAccountsComboBox.setPromptText("Select payment account");
|
paymentAccountsComboBox.setPromptText("Select payment account");
|
||||||
|
paymentAccountsComboBox.setMinWidth(300);
|
||||||
editOfferElements.add(paymentAccountsComboBox);
|
editOfferElements.add(paymentAccountsComboBox);
|
||||||
|
|
||||||
// we display either currencyComboBox (multi currency account) or currencyTextField (single)
|
// we display either currencyComboBox (multi currency account) or currencyTextField (single)
|
||||||
|
|
Loading…
Add table
Reference in a new issue