public String getSendLimitCurrency() { if (_sendLimitAmount != null) { return _sendLimitAmount.getCurrencyUnit().getCurrencyCode(); } else { return null; } } }
@Override protected Object[] toConvertedColumns(Money value) { return new Object[] { value.getCurrencyUnit(), value.getAmountMinorLong() }; }
@Override protected Object[] toConvertedColumns(Money value) { return new Object[] { value.getCurrencyUnit(), value.getAmount() }; }
public String getSendLimitCurrency() { if (_sendLimitAmount != null) { return _sendLimitAmount.getCurrencyUnit().getCurrencyCode(); } else { return null; } } }
@Override protected Object[] toConvertedColumns(Money value) { return new Object[] { value.getCurrencyUnit(), value.getAmountMajorLong() }; }
@Override protected Object[] toConvertedColumns(Money value) { return new Object[] { value.getCurrencyUnit(), value.getAmountMinorLong() }; }
@Override protected Object[] toConvertedColumns(Money value) { return new Object[] { value.getCurrencyUnit(), value.getAmountMajorLong() }; }
@Override protected Object[] toConvertedColumns(Money value) { return new Object[] { value.getCurrencyUnit(), value.getAmount() }; }
@Override public BigDecimal toNonNullValue(Money value) { if (!currencyUnit.equals(value.getCurrencyUnit())) { throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrencyUnit()); } return value.getAmount(); }
@Override public Long toNonNullValue(Money value) { if (!currencyUnit.equals(value.getCurrencyUnit())) { throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrencyUnit()); } return value.getAmountMajorLong(); }
@Override public Long toNonNullValue(Money value) { if (!currencyUnit.equals(value.getCurrencyUnit())) { throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrencyUnit()); } return value.getAmountMinorLong(); }
public static String getAsString(Money money) { if (money == null) { return null; } return money.getAmount().toString() + " " + money.getCurrencyUnit().toString(); }
@JsonProperty @JsonDeserialize(using=MoneyDeserializer.class) public void setAmount(Money amount) { _amount = amount; if (amount != null) { setAmountString(amount.getAmount().toPlainString()); setAmountCurrencyIso(amount.getCurrencyUnit().getCurrencyCode()); } else { setAmountString(null); setAmountCurrencyIso(null); } }
@JsonProperty @JsonDeserialize(using=MoneyDeserializer.class) public void setAmount(Money amount) { _amount = amount; if (amount != null) { setAmountString(amount.getAmount().toPlainString()); setAmountCurrencyIso(amount.getCurrencyUnit().getCurrencyCode()); } else { setAmountString(null); setAmountCurrencyIso(null); } }
public void setPrice(Money price) { _price = price; if (price != null) { setPriceString(price.getAmount().toPlainString()); setPriceCurrencyIso(price.getCurrencyUnit().getCurrencyCode()); } else { setPriceString(null); setPriceCurrencyIso(null); } } }
public void setPrice(Money price) { _price = price; if (price != null) { setPriceString(price.getAmount().toPlainString()); setPriceCurrencyIso(price.getCurrencyUnit().getCurrencyCode()); } else { setPriceString(null); setPriceCurrencyIso(null); } } }
@Override public Transfer buy(Money amount, String paymentMethodId, Boolean commit) throws CoinbaseException, IOException { URL buysUrl; try { buysUrl = new URL(_baseApiUrl, "buys"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } Request request = newAccountSpecificRequest(); request.setQty(amount.getAmount().doubleValue()); request.setPaymentMethodId(paymentMethodId); request.setCurrency(amount.getCurrencyUnit().getCurrencyCode()); request.setCommit(commit); return post(buysUrl, request, TransferResponse.class).getTransfer(); }
@Override public Transfer sell(Money amount, String paymentMethodId, Boolean commit) throws CoinbaseException, IOException { URL sellsUrl; try { sellsUrl = new URL(_baseApiUrl, "sells"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } Request request = newAccountSpecificRequest(); request.setQty(amount.getAmount().doubleValue()); request.setPaymentMethodId(paymentMethodId); request.setCurrency(amount.getCurrencyUnit().getCurrencyCode()); request.setCommit(commit); return post(sellsUrl, request, TransferResponse.class).getTransfer(); }
@Override public Transfer sell(Money amount, String paymentMethodId, Boolean commit) throws CoinbaseException, IOException { URL sellsUrl; try { sellsUrl = new URL(_baseApiUrl, "sells"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } Request request = newAccountSpecificRequest(); request.setQty(amount.getAmount().doubleValue()); request.setPaymentMethodId(paymentMethodId); request.setCurrency(amount.getCurrencyUnit().getCurrencyCode()); request.setCommit(commit); return post(sellsUrl, request, TransferResponse.class).getTransfer(); }
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { BigDecimalType.INSTANCE.set(st, null, index, session); StringType.INSTANCE.set(st, null, index + 1, session); } else { Money money = (Money) value; BigDecimalType.INSTANCE.set(st, money.getAmount(), index, session); StringType.INSTANCE.set(st, money.getCurrencyUnit().getCurrencyCode(), index + 1, session); } }