Search in sources :

Example 1 with FiatCurrency

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;
}
Also used : FiatCurrency(io.bitsquare.locale.FiatCurrency)

Example 2 with FiatCurrency

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);
        });
    }
}
Also used : PaymentMethod(io.bitsquare.payment.PaymentMethod) ActivatableDataModel(io.bitsquare.gui.common.model.ActivatableDataModel) FiatCurrency(io.bitsquare.locale.FiatCurrency) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) Inject(com.google.inject.Inject) SetChangeListener(javafx.collections.SetChangeListener) TradeCurrency(io.bitsquare.locale.TradeCurrency) FXCollections(javafx.collections.FXCollections) Collectors(java.util.stream.Collectors) GUIUtil(io.bitsquare.gui.util.GUIUtil) ArrayList(java.util.ArrayList) PaymentAccount(io.bitsquare.payment.PaymentAccount) TradeManager(io.bitsquare.trade.TradeManager) Preferences(io.bitsquare.user.Preferences) User(io.bitsquare.user.User) List(java.util.List) CryptoCurrencyAccount(io.bitsquare.payment.CryptoCurrencyAccount) Stage(javafx.stage.Stage) OpenOfferManager(io.bitsquare.trade.offer.OpenOfferManager) ObservableList(javafx.collections.ObservableList) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) TradeCurrency(io.bitsquare.locale.TradeCurrency) FiatCurrency(io.bitsquare.locale.FiatCurrency)

Example 3 with FiatCurrency

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);
        });
    }
}
Also used : PaymentMethod(io.bitsquare.payment.PaymentMethod) ActivatableDataModel(io.bitsquare.gui.common.model.ActivatableDataModel) FiatCurrency(io.bitsquare.locale.FiatCurrency) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) Inject(com.google.inject.Inject) SetChangeListener(javafx.collections.SetChangeListener) TradeCurrency(io.bitsquare.locale.TradeCurrency) FXCollections(javafx.collections.FXCollections) Collectors(java.util.stream.Collectors) GUIUtil(io.bitsquare.gui.util.GUIUtil) ArrayList(java.util.ArrayList) PaymentAccount(io.bitsquare.payment.PaymentAccount) TradeManager(io.bitsquare.trade.TradeManager) Preferences(io.bitsquare.user.Preferences) User(io.bitsquare.user.User) List(java.util.List) CryptoCurrencyAccount(io.bitsquare.payment.CryptoCurrencyAccount) Stage(javafx.stage.Stage) OpenOfferManager(io.bitsquare.trade.offer.OpenOfferManager) ObservableList(javafx.collections.ObservableList) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) TradeCurrency(io.bitsquare.locale.TradeCurrency) FiatCurrency(io.bitsquare.locale.FiatCurrency)

Example 4 with FiatCurrency

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)");
    }
}
Also used : TradeCurrency(io.bitsquare.locale.TradeCurrency) Offer(io.bitsquare.trade.offer.Offer) FiatCurrency(io.bitsquare.locale.FiatCurrency)

Example 5 with FiatCurrency

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;
}
Also used : Country(io.bitsquare.locale.Country) FiatCurrency(io.bitsquare.locale.FiatCurrency)

Aggregations

FiatCurrency (io.bitsquare.locale.FiatCurrency)8 Country (io.bitsquare.locale.Country)4 TradeCurrency (io.bitsquare.locale.TradeCurrency)3 Inject (com.google.inject.Inject)2 ActivatableDataModel (io.bitsquare.gui.common.model.ActivatableDataModel)2 GUIUtil (io.bitsquare.gui.util.GUIUtil)2 CryptoCurrency (io.bitsquare.locale.CryptoCurrency)2 CryptoCurrencyAccount (io.bitsquare.payment.CryptoCurrencyAccount)2 PaymentAccount (io.bitsquare.payment.PaymentAccount)2 PaymentMethod (io.bitsquare.payment.PaymentMethod)2 TradeManager (io.bitsquare.trade.TradeManager)2 OpenOfferManager (io.bitsquare.trade.offer.OpenOfferManager)2 Preferences (io.bitsquare.user.Preferences)2 User (io.bitsquare.user.User)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 FXCollections (javafx.collections.FXCollections)2 ObservableList (javafx.collections.ObservableList)2 SetChangeListener (javafx.collections.SetChangeListener)2