use of io.bitsquare.locale.FiatCurrency in project bitsquare by bitsquare.
the class OfferBookViewModelTest method getOKPayAccount.
private PaymentAccount getOKPayAccount(String currencyCode) {
PaymentAccount paymentAccount = new OKPayAccount();
paymentAccount.setSelectedTradeCurrency(new FiatCurrency(currencyCode));
return paymentAccount;
}
use of io.bitsquare.locale.FiatCurrency in project bitsquare by bitsquare.
the class FiatAccountsDataModel method onSaveNewAccount.
///////////////////////////////////////////////////////////////////////////////////////////
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////
public void onSaveNewAccount(PaymentAccount paymentAccount) {
user.addPaymentAccount(paymentAccount);
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
if (singleTradeCurrency != null) {
if (singleTradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
} else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
tradeCurrencies.stream().forEach(tradeCurrency -> {
if (tradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
});
}
}
use of io.bitsquare.locale.FiatCurrency in project bitsquare by bitsquare.
the class AltCoinAccountsDataModel method onSaveNewAccount.
///////////////////////////////////////////////////////////////////////////////////////////
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////
public void onSaveNewAccount(PaymentAccount paymentAccount) {
user.addPaymentAccount(paymentAccount);
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
if (singleTradeCurrency != null) {
if (singleTradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
} else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
tradeCurrencies.stream().forEach(tradeCurrency -> {
if (tradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
});
}
}
use of io.bitsquare.locale.FiatCurrency in project bitsquare by bitsquare.
the class OfferBookView method setDirectionTitles.
private void setDirectionTitles() {
TradeCurrency selectedTradeCurrency = model.getSelectedTradeCurrency();
if (selectedTradeCurrency != null) {
Offer.Direction direction = model.getDirection();
String preFix = "Create new offer to ";
String directionText = direction == Offer.Direction.BUY ? "buy" : "sell";
String mirroredDirectionText = direction == Offer.Direction.SELL ? "buy" : "sell";
String code = selectedTradeCurrency.getCode();
if (model.showAllTradeCurrenciesProperty.get())
createOfferButton.setText(preFix + directionText + " BTC");
else if (selectedTradeCurrency instanceof FiatCurrency)
createOfferButton.setText(preFix + directionText + " BTC" + (direction == Offer.Direction.BUY ? " with " : " for ") + code);
else
createOfferButton.setText(preFix + mirroredDirectionText + " " + code + " (" + directionText + " BTC)");
}
}
use of io.bitsquare.locale.FiatCurrency in project bitsquare by bitsquare.
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));
((NationalBankAccountContractData) paymentAccount.getContractData()).setBankId(bankId);
return paymentAccount;
}
Aggregations