Package org.joda.money

Examples of org.joda.money.Money


        if (transaction.getAmount() == null) {
            throw new CoinbaseException("Amount is a required field");
        }

        // Massage amount
        Money amount = transaction.getAmount();
        transaction.setAmount(null);

        transaction.setAmountString(amount.getAmount().toPlainString());
        transaction.setAmountCurrencyIso(amount.getCurrencyUnit().getCurrencyCode());

        return transaction;
    }
View Full Code Here


        if (button.getPrice() == null) {
            throw new CoinbaseException("Price is a required field");
        }

        // Massage amount
        Money price = button.getPrice();
        button.setPrice(null);

        button.setPriceString(price.getAmount().toPlainString());
        button.setPriceCurrencyIso(price.getCurrencyUnit().getCurrencyCode());

        return button;
    }
View Full Code Here

        assertThat(converter).isInstanceOf(MoneyConverter.class);
    }

    @Test
    public void canSerialize() {
        Money money= Money.of(CurrencyUnit.EUR, 12);

        Object value = new MoneyConverter().toDbValue(money);

        Assert.assertThat((String) value, is(money.toString()));
    }
View Full Code Here

        Assert.assertThat((String) value, is(money.toString()));
    }

    @Test
    public void canDeserialize() {
        Money money = Money.of(CurrencyUnit.EUR, 33);

        Object value = new MoneyConverter().fromDbValue(money.toString());

        Assert.assertThat(value, notNullValue());
        Assert.assertThat((Money) value, is(money));
    }
View Full Code Here

TOP

Related Classes of org.joda.money.Money

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.