use of org.killbill.billing.invoice.model.DefaultInvoice in project killbill by killbill.
the class TestDefaultInvoiceFormatter method testFormattedAmountUSAndBTC.
@Test(groups = "fast")
public void testFormattedAmountUSAndBTC() throws Exception {
final FixedPriceInvoiceItem fixedItem = new FixedPriceInvoiceItem(UUID.randomUUID(), UUID.randomUUID(), null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), new LocalDate(), new BigDecimal("1105.28843439"), Currency.BTC);
final Invoice invoice = new DefaultInvoice(UUID.randomUUID(), new LocalDate(), new LocalDate(), Currency.BTC);
invoice.addInvoiceItem(fixedItem);
checkOutput(invoice, "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedChargedAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedPaidAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedBalance}}</strong></td>\n" + "</tr>", "<tr>\n" + " <td class=\"amount\"><strong>Ƀ1,105.28843439</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>Ƀ0.00000000</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>Ƀ1,105.28843439</strong></td>\n" + "</tr>", Locale.US);
}
use of org.killbill.billing.invoice.model.DefaultInvoice in project killbill by killbill.
the class TestDefaultInvoiceFormatter method testFormattedAmountUSAndBRL.
@Test(groups = "fast")
public void testFormattedAmountUSAndBRL() throws Exception {
final FixedPriceInvoiceItem fixedItem = new FixedPriceInvoiceItem(UUID.randomUUID(), UUID.randomUUID(), null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), new LocalDate(), new BigDecimal("2635.14"), Currency.BRL);
final Invoice invoice = new DefaultInvoice(UUID.randomUUID(), new LocalDate(), new LocalDate(), Currency.BRL);
invoice.addInvoiceItem(fixedItem);
checkOutput(invoice, "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedChargedAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedPaidAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedBalance}}</strong></td>\n" + "</tr>", "<tr>\n" + " <td class=\"amount\"><strong>R$2,635.14</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>R$0.00</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>R$2,635.14</strong></td>\n" + "</tr>", Locale.US);
}
use of org.killbill.billing.invoice.model.DefaultInvoice in project killbill by killbill.
the class TestDefaultInvoiceFormatter method testFormattedAmountFranceAndEUR.
@Test(groups = "fast")
public void testFormattedAmountFranceAndEUR() throws Exception {
final FixedPriceInvoiceItem fixedItemEUR = new FixedPriceInvoiceItem(UUID.randomUUID(), UUID.randomUUID(), null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), new LocalDate(), new BigDecimal("1499.95"), Currency.EUR);
final Invoice invoiceEUR = new DefaultInvoice(UUID.randomUUID(), new LocalDate(), new LocalDate(), Currency.EUR);
invoiceEUR.addInvoiceItem(fixedItemEUR);
checkOutput(invoiceEUR, "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedChargedAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedPaidAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedBalance}}</strong></td>\n" + "</tr>", "<tr>\n" + " <td class=\"amount\"><strong>1 499,95 €</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>0,00 €</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>1 499,95 €</strong></td>\n" + "</tr>", Locale.FRANCE);
}
use of org.killbill.billing.invoice.model.DefaultInvoice in project killbill by killbill.
the class TestDefaultInvoiceFormatter method testProcessedCurrencyExists.
@Test(groups = "fast")
public void testProcessedCurrencyExists() throws Exception {
// Use InvoiceModelDao to build the invoice to be able to set the processedCurrency (No suitable CTOR for DefaultInvoice on purpose)
final InvoiceModelDao invoiceModelDao = new InvoiceModelDao(UUID.randomUUID(), new LocalDate(), new LocalDate(), Currency.BRL, false);
invoiceModelDao.setProcessedCurrency(Currency.USD);
final Invoice invoice = new DefaultInvoice(invoiceModelDao);
checkOutput(invoice, "{{#invoice.processedCurrency}}" + "<tr>\n" + " <td class=\"processedCurrency\"><strong>{{invoice.processedCurrency}}</strong></td>\n" + "</tr>\n" + "{{/invoice.processedCurrency}}", "<tr>\n" + " <td class=\"processedCurrency\"><strong>USD</strong></td>\n" + "</tr>\n", Locale.US);
}
use of org.killbill.billing.invoice.model.DefaultInvoice in project killbill by killbill.
the class TestDefaultInvoiceFormatter method testFormattedAmountFranceAndJPY.
@Test(groups = "fast")
public void testFormattedAmountFranceAndJPY() throws Exception {
final FixedPriceInvoiceItem fixedItem = new FixedPriceInvoiceItem(UUID.randomUUID(), UUID.randomUUID(), null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), new LocalDate(), new BigDecimal("1500.00"), Currency.JPY);
final Invoice invoice = new DefaultInvoice(UUID.randomUUID(), new LocalDate(), new LocalDate(), Currency.JPY);
invoice.addInvoiceItem(fixedItem);
checkOutput(invoice, "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedChargedAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedPaidAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedBalance}}</strong></td>\n" + "</tr>", "<tr>\n" + " <td class=\"amount\"><strong>1 500 ¥</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>0 ¥</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>1 500 ¥</strong></td>\n" + "</tr>", Locale.FRANCE);
}
Aggregations