use of io.bisq.common.locale.TradeCurrency in project bisq-api by mrosseel.
the class BisqProxy method addPaymentAccount.
public PaymentAccount addPaymentAccount(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()) {
if (tradeCurrencies.contains(CurrencyUtil.getDefaultTradeCurrency()))
paymentAccount.setSelectedTradeCurrency(CurrencyUtil.getDefaultTradeCurrency());
else
paymentAccount.setSelectedTradeCurrency(tradeCurrencies.get(0));
tradeCurrencies.forEach(tradeCurrency -> {
if (tradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
});
}
accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
return paymentAccount;
}
use of io.bisq.common.locale.TradeCurrency in project bisq-api by mrosseel.
the class AbstractPaymentAccountConverter method toRestModel.
protected void toRestModel(R rest, B business) {
rest.id = business.getId();
rest.accountName = business.getAccountName();
final TradeCurrency selectedTradeCurrency = business.getSelectedTradeCurrency();
if (null != selectedTradeCurrency)
rest.selectedTradeCurrency = selectedTradeCurrency.getCode();
final List<TradeCurrency> tradeCurrencies = business.getTradeCurrencies();
if (null != tradeCurrencies)
tradeCurrencies.stream().forEach(currency -> rest.tradeCurrencies.add(currency.getCode()));
}
Aggregations