use of bisq.core.locale.Country in project bisq-desktop by bisq-network.
the class OfferBookViewModelTest method getSepaAccount.
private PaymentAccount getSepaAccount(String currencyCode, String countryCode, String bic, ArrayList<String> countryCodes) {
CountryBasedPaymentAccount paymentAccount = new SepaAccount();
paymentAccount.setSingleTradeCurrency(new FiatCurrency(currencyCode));
paymentAccount.setCountry(new Country(countryCode, null, null));
((SepaAccountPayload) paymentAccount.getPaymentAccountPayload()).setBic(bic);
countryCodes.forEach(((SepaAccountPayload) paymentAccount.getPaymentAccountPayload())::addAcceptedCountry);
return paymentAccount;
}
use of bisq.core.locale.Country in project bisq-desktop by bisq-network.
the class OfferBookViewModelTest method getNationalBankAccount.
private PaymentAccount getNationalBankAccount(String currencyCode, String countryCode, String bankId) {
CountryBasedPaymentAccount paymentAccount = new NationalBankAccount();
paymentAccount.setSingleTradeCurrency(new FiatCurrency(currencyCode));
paymentAccount.setCountry(new Country(countryCode, null, null));
((NationalBankAccountPayload) paymentAccount.getPaymentAccountPayload()).setBankId(bankId);
return paymentAccount;
}
use of bisq.core.locale.Country in project bisq-desktop by bisq-network.
the class OfferBookViewModelTest method getSpecificBanksAccount.
private PaymentAccount getSpecificBanksAccount(String currencyCode, String countryCode, String bankId, ArrayList<String> bankIds) {
SpecificBanksAccount paymentAccount = new SpecificBanksAccount();
paymentAccount.setSingleTradeCurrency(new FiatCurrency(currencyCode));
paymentAccount.setCountry(new Country(countryCode, null, null));
((SpecificBanksAccountPayload) paymentAccount.getPaymentAccountPayload()).setBankId(bankId);
bankIds.forEach(((SpecificBanksAccountPayload) paymentAccount.getPaymentAccountPayload())::addAcceptedBank);
return paymentAccount;
}
use of bisq.core.locale.Country in project bisq-desktop by bisq-network.
the class SepaForm method updateCountriesSelection.
private void updateCountriesSelection(boolean isEditable, List<CheckBox> checkBoxList) {
checkBoxList.stream().forEach(checkBox -> {
String countryCode = (String) checkBox.getUserData();
TradeCurrency selectedCurrency = sepaAccount.getSelectedTradeCurrency();
if (selectedCurrency == null) {
Country country = CountryUtil.getDefaultCountry();
if (CountryUtil.getAllSepaCountries().contains(country))
selectedCurrency = CurrencyUtil.getCurrencyByCountryCode(country.code);
}
boolean selected;
if (isEditable && selectedCurrency != null) {
selected = true;
sepaAccount.addAcceptedCountry(countryCode);
} else {
selected = sepaAccount.getAcceptedCountryCodes().contains(countryCode);
}
checkBox.setSelected(selected);
});
}
use of bisq.core.locale.Country in project bisq-desktop by bisq-network.
the class SepaInstantForm method addFormForAddAccount.
@Override
public void addFormForAddAccount() {
gridRowFrom = gridRow + 1;
InputTextField holderNameInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner")).second;
holderNameInputTextField.setValidator(inputValidator);
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
sepaInstantAccount.setHolderName(newValue);
updateFromInputs();
});
ibanInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second;
ibanInputTextField.setValidator(ibanValidator);
ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
sepaInstantAccount.setIban(newValue);
updateFromInputs();
});
InputTextField bicInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, "BIC:").second;
bicInputTextField.setValidator(bicValidator);
bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
sepaInstantAccount.setBic(newValue);
updateFromInputs();
});
FormBuilder.addLabel(gridPane, ++gridRow, Res.getWithCol("payment.bank.country"));
HBox hBox = new HBox();
hBox.setSpacing(10);
ComboBox<Country> countryComboBox = new ComboBox<>();
currencyComboBox = new ComboBox<>();
currencyTextField = new TextField("");
currencyTextField.setEditable(false);
currencyTextField.setMouseTransparent(true);
currencyTextField.setFocusTraversable(false);
currencyTextField.setMinWidth(300);
currencyTextField.setVisible(false);
currencyTextField.setManaged(false);
currencyComboBox.setVisible(false);
currencyComboBox.setManaged(false);
hBox.getChildren().addAll(countryComboBox, currencyTextField, currencyComboBox);
GridPane.setRowIndex(hBox, gridRow);
GridPane.setColumnIndex(hBox, 1);
gridPane.getChildren().add(hBox);
countryComboBox.setPromptText(Res.get("payment.select.bank.country"));
countryComboBox.setConverter(new StringConverter<Country>() {
@Override
public String toString(Country country) {
return country.name + " (" + country.code + ")";
}
@Override
public Country fromString(String s) {
return null;
}
});
countryComboBox.setOnAction(e -> {
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
sepaInstantAccount.setCountry(selectedItem);
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code);
setupCurrency(selectedItem, currency);
updateCountriesSelection(true, euroCountryCheckBoxes);
updateCountriesSelection(true, nonEuroCountryCheckBoxes);
updateFromInputs();
});
addEuroCountriesGrid(true);
addNonEuroCountriesGrid(true);
addLimitations();
addAccountNameTextFieldWithAutoFillCheckBox();
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllSepaInstantCountries()));
Country country = CountryUtil.getDefaultCountry();
if (CountryUtil.getAllSepaInstantCountries().contains(country)) {
countryComboBox.getSelectionModel().select(country);
sepaInstantAccount.setCountry(country);
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(country.code);
setupCurrency(country, currency);
}
updateFromInputs();
}
Aggregations