use of org.killbill.billing.invoice.model.TaxInvoiceItem in project killbill by killbill.
the class DefaultInvoiceUserApi method insertItems.
private List<InvoiceItem> insertItems(final UUID accountId, final LocalDate effectiveDate, final InvoiceItemType itemType, final Iterable<InvoiceItem> inputItems, final boolean autoCommit, final LinkedList<PluginProperty> properties, final CallContext context) throws InvoiceApiException {
final InternalTenantContext internalTenantContext = internalCallContextFactory.createInternalTenantContext(accountId, context);
ImmutableAccountData accountData;
try {
accountData = accountUserApi.getImmutableAccountDataById(accountId, internalTenantContext);
} catch (AccountApiException e) {
throw new InvoiceApiException(e);
}
final Currency accountCurrency = accountData.getCurrency();
final WithAccountLock withAccountLock = new WithAccountLock() {
@Override
public Iterable<DefaultInvoice> prepareInvoices() throws InvoiceApiException {
final LocalDate invoiceDate = internalTenantContext.toLocalDate(context.getCreatedDate());
final Map<UUID, DefaultInvoice> newAndExistingInvoices = new HashMap<UUID, DefaultInvoice>();
UUID newInvoiceId = null;
for (final InvoiceItem inputItem : inputItems) {
if (inputItem.getAmount() == null || inputItem.getAmount().compareTo(BigDecimal.ZERO) < 0) {
if (itemType == InvoiceItemType.EXTERNAL_CHARGE) {
throw new InvoiceApiException(ErrorCode.EXTERNAL_CHARGE_AMOUNT_INVALID, inputItem.getAmount());
} else if (itemType == InvoiceItemType.CREDIT_ADJ) {
throw new InvoiceApiException(ErrorCode.CREDIT_AMOUNT_INVALID, inputItem.getAmount());
}
}
if (inputItem.getCurrency() != null && !inputItem.getCurrency().equals(accountCurrency)) {
throw new InvoiceApiException(ErrorCode.CURRENCY_INVALID, inputItem.getCurrency(), accountCurrency);
}
final UUID invoiceIdForItem = inputItem.getInvoiceId();
final Invoice curInvoiceForItem;
if (invoiceIdForItem == null) {
final Currency currency = inputItem.getCurrency();
final InvoiceStatus status = autoCommit ? InvoiceStatus.COMMITTED : InvoiceStatus.DRAFT;
if (newInvoiceId == null) {
final DefaultInvoice newInvoiceForItems = new DefaultInvoice(accountId, invoiceDate, effectiveDate, currency, status);
newInvoiceId = newInvoiceForItems.getId();
newAndExistingInvoices.put(newInvoiceId, newInvoiceForItems);
}
curInvoiceForItem = newAndExistingInvoices.get(newInvoiceId);
} else {
if (newAndExistingInvoices.get(invoiceIdForItem) == null) {
final DefaultInvoice existingInvoiceForExternalCharge = getInvoiceInternal(invoiceIdForItem, context);
switch(existingInvoiceForExternalCharge.getStatus()) {
case COMMITTED:
throw new InvoiceApiException(ErrorCode.INVOICE_ALREADY_COMMITTED, existingInvoiceForExternalCharge.getId());
case VOID:
// TODO Add missing error https://github.com/killbill/killbill/issues/1501
throw new IllegalStateException(String.format("Cannot add credit or external charge for invoice id %s because it is in \" + InvoiceStatus.VOID + \" status\"", existingInvoiceForExternalCharge.getId()));
case DRAFT:
default:
break;
}
newAndExistingInvoices.put(invoiceIdForItem, existingInvoiceForExternalCharge);
}
curInvoiceForItem = newAndExistingInvoices.get(invoiceIdForItem);
}
final InvoiceItem newInvoiceItem;
switch(itemType) {
case EXTERNAL_CHARGE:
newInvoiceItem = new ExternalChargeInvoiceItem(UUIDs.randomUUID(), context.getCreatedDate(), curInvoiceForItem.getId(), accountId, inputItem.getBundleId(), inputItem.getSubscriptionId(), inputItem.getProductName(), inputItem.getPlanName(), inputItem.getPhaseName(), inputItem.getPrettyProductName(), inputItem.getPrettyPlanName(), inputItem.getPrettyPhaseName(), inputItem.getDescription(), MoreObjects.firstNonNull(inputItem.getStartDate(), effectiveDate), inputItem.getEndDate(), inputItem.getAmount(), inputItem.getRate(), accountCurrency, inputItem.getLinkedItemId(), inputItem.getQuantity(), inputItem.getItemDetails());
break;
case CREDIT_ADJ:
newInvoiceItem = new CreditAdjInvoiceItem(UUIDs.randomUUID(), context.getCreatedDate(), curInvoiceForItem.getId(), accountId, effectiveDate, inputItem.getDescription(), // Note! The amount is negated here!
inputItem.getAmount().negate(), inputItem.getRate(), inputItem.getCurrency(), inputItem.getQuantity(), inputItem.getItemDetails());
break;
case TAX:
newInvoiceItem = new TaxInvoiceItem(UUIDs.randomUUID(), curInvoiceForItem.getId(), accountId, inputItem.getBundleId(), inputItem.getDescription(), MoreObjects.firstNonNull(inputItem.getStartDate(), effectiveDate), inputItem.getAmount(), accountCurrency);
break;
default:
throw new IllegalStateException(String.format("Unsupported to add item of type '%s'", itemType));
}
curInvoiceForItem.addInvoiceItem(newInvoiceItem);
}
return newAndExistingInvoices.values();
}
};
return invoiceApiHelper.dispatchToInvoicePluginsAndInsertItems(accountId, false, withAccountLock, properties, context);
}
use of org.killbill.billing.invoice.model.TaxInvoiceItem in project killbill by killbill.
the class TestWithTaxItems method testBasicTaxItems.
@Test(groups = "slow")
public void testBasicTaxItems() throws Exception {
// We take april as it has 30 days (easier to play with BCD)
// Set clock to the initial start date - we implicitly assume here that the account timezone is UTC
clock.setDay(new LocalDate(2012, 4, 1));
final AccountData accountData = getAccountData(1);
final Account account = createAccountWithNonOsgiPaymentMethod(accountData);
accountChecker.checkAccount(account.getId(), accountData, callContext);
//
// Create original subscription (Trial PHASE) -> $0 invoice.
final DefaultEntitlement bpSubscription = createBaseEntitlementAndCheckForCompletion(account.getId(), "bundleKey", "Pistol", ProductCategory.BASE, BillingPeriod.MONTHLY, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
invoiceChecker.checkInvoice(account.getId(), 1, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 4, 1), null, InvoiceItemType.FIXED, new BigDecimal("0")));
subscriptionChecker.checkSubscriptionCreated(bpSubscription.getId(), internalCallContext);
// Move to Evergreen PHASE, but add AUTO_INVOICING_OFF => No invoice
add_AUTO_INVOICING_OFF_Tag(account.getId(), ObjectType.ACCOUNT);
busHandler.pushExpectedEvent(NextEvent.PHASE);
clock.addDays(30);
assertListenerStatus();
// Add Cleaning ADD_ON => No Invoice
busHandler.pushExpectedEvents(NextEvent.CREATE, NextEvent.BLOCK);
addAOEntitlementAndCheckForCompletion(bpSubscription.getBundleId(), "Cleaning", ProductCategory.ADD_ON, BillingPeriod.MONTHLY);
assertListenerStatus();
// Make sure TestInvoicePluginApi will return an additional TAX item
final UUID pluginInvoiceItemId = UUID.randomUUID();
testInvoicePluginApi.addTaxItem(new TaxInvoiceItem(pluginInvoiceItemId, null, account.getId(), null, "Tax Item", new LocalDate(2012, 5, 1), BigDecimal.ONE, account.getCurrency()));
// Remove AUTO_INVOICING_OFF => Invoice + Payment
remove_AUTO_INVOICING_OFF_Tag(account.getId(), ObjectType.ACCOUNT, NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
invoiceChecker.checkInvoice(account.getId(), 2, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("29.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("2.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), null, InvoiceItemType.TAX, new BigDecimal("1.0")));
final List<Invoice> invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), false, false, callContext);
assertEquals(invoices.size(), 2);
final List<InvoiceItem> invoiceItems = invoices.get(1).getInvoiceItems();
final InvoiceItem taxItem = Iterables.tryFind(invoiceItems, new Predicate<InvoiceItem>() {
@Override
public boolean apply(final InvoiceItem input) {
return input.getInvoiceItemType() == InvoiceItemType.TAX;
}
}).orNull();
assertNotNull(taxItem);
// verify the ID is the one passed by the plugin #818
assertEquals(taxItem.getId(), pluginInvoiceItemId);
// Add AUTO_INVOICING_OFF and change to a higher plan on the same day that already include the 'Cleaning' ADD_ON, so it gets cancelled
add_AUTO_INVOICING_OFF_Tag(account.getId(), ObjectType.ACCOUNT);
busHandler.pushExpectedEvents(NextEvent.CHANGE, NextEvent.CANCEL, NextEvent.BLOCK);
changeEntitlementAndCheckForCompletion(bpSubscription, "Shotgun", BillingPeriod.MONTHLY, BillingActionPolicy.IMMEDIATE);
assertListenerStatus();
// Make sure TestInvoicePluginApi will return an additional TAX item
testInvoicePluginApi.addTaxItem(new TaxInvoiceItem(UUID.randomUUID(), null, account.getId(), null, "Tax Item", new LocalDate(2012, 5, 1), BigDecimal.ONE, account.getCurrency()));
// Remove AUTO_INVOICING_OFF => Invoice + Payment
remove_AUTO_INVOICING_OFF_Tag(account.getId(), ObjectType.ACCOUNT, NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
invoiceChecker.checkInvoice(account.getId(), 2, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("29.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("2.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), null, InvoiceItemType.TAX, new BigDecimal("1.0")));
invoiceChecker.checkInvoice(account.getId(), 3, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("249.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.REPAIR_ADJ, new BigDecimal("-29.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.REPAIR_ADJ, new BigDecimal("-2.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), null, InvoiceItemType.TAX, new BigDecimal("1.0")));
// Add AUTO_INVOICING_OFF and change to a higher plan on the same day
add_AUTO_INVOICING_OFF_Tag(account.getId(), ObjectType.ACCOUNT);
busHandler.pushExpectedEvent(NextEvent.CHANGE);
changeEntitlementAndCheckForCompletion(bpSubscription, "Assault-Rifle", BillingPeriod.MONTHLY, BillingActionPolicy.IMMEDIATE);
assertListenerStatus();
// Make sure TestInvoicePluginApi will return an additional TAX item
// Verify we support passing extra items for a null invoiceItemId #1182 (as advertised in our doc)
testInvoicePluginApi.addTaxItem(new TaxInvoiceItem(null, null, account.getId(), null, "Tax Item", new LocalDate(2012, 5, 1), BigDecimal.ONE, account.getCurrency()));
// Remove AUTO_INVOICING_OFF => Invoice + Payment
remove_AUTO_INVOICING_OFF_Tag(account.getId(), ObjectType.ACCOUNT, NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
invoiceChecker.checkInvoice(account.getId(), 3, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("249.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.REPAIR_ADJ, new BigDecimal("-29.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.REPAIR_ADJ, new BigDecimal("-2.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), null, InvoiceItemType.TAX, new BigDecimal("1.0")));
invoiceChecker.checkInvoice(account.getId(), 4, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("599.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.REPAIR_ADJ, new BigDecimal("-249.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), null, InvoiceItemType.TAX, new BigDecimal("1.0")));
}
use of org.killbill.billing.invoice.model.TaxInvoiceItem in project killbill by killbill.
the class TestWithTaxItems method testUpdateTaxItems.
@Test(groups = "slow")
public void testUpdateTaxItems() throws Exception {
clock.setDay(new LocalDate(2012, 4, 1));
final AccountData accountData = getAccountData(1);
final Account account = createAccountWithNonOsgiPaymentMethod(accountData);
// Create original subscription (Trial PHASE) -> $0 invoice.
final DefaultEntitlement bpSubscription = createBaseEntitlementAndCheckForCompletion(account.getId(), "bundleKey", "Pistol", ProductCategory.BASE, BillingPeriod.MONTHLY, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
invoiceChecker.checkInvoice(account.getId(), 1, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 4, 1), null, InvoiceItemType.FIXED, new BigDecimal("0")));
subscriptionChecker.checkSubscriptionCreated(bpSubscription.getId(), internalCallContext);
// Add tags to keep DRAFT invoices and reuse them
add_AUTO_INVOICING_DRAFT_Tag(account.getId(), ObjectType.ACCOUNT);
add_AUTO_INVOICING_REUSE_DRAFT_Tag(account.getId(), ObjectType.ACCOUNT);
// Make sure TestInvoicePluginApi will return an additional TAX item
final UUID invoiceTaxItemId = UUID.randomUUID();
testInvoicePluginApi.addTaxItem(new TaxInvoiceItem(invoiceTaxItemId, null, account.getId(), null, "Tax Item", new LocalDate(2012, 4, 1), BigDecimal.ONE, account.getCurrency()));
// Insert external charge autoCommit = false => Invoice will be in DRAFT
invoiceUserApi.insertExternalCharges(account.getId(), clock.getUTCNow().toLocalDate(), ImmutableList.<InvoiceItem>of(new ExternalChargeInvoiceItem(null, account.getId(), null, "foo", new LocalDate(2012, 4, 1), null, new BigDecimal("33.80"), account.getCurrency(), null)), false, null, callContext);
// Make sure TestInvoicePluginApi **update** the original TAX item
testInvoicePluginApi.addTaxItem(new TaxInvoiceItem(invoiceTaxItemId, null, account.getId(), null, "Tax Item", new LocalDate(2012, 4, 1), new BigDecimal("12.45"), account.getCurrency()));
// Move to Evergreen PHASE, but invoice remains in DRAFT mode
busHandler.pushExpectedEvents(NextEvent.PHASE);
clock.addDays(30);
assertListenerStatus();
final List<Invoice> accountInvoices = invoiceUserApi.getInvoicesByAccount(account.getId(), false, false, callContext);
assertEquals(accountInvoices.size(), 2);
// Commit invoice
busHandler.pushExpectedEvents(NextEvent.INVOICE, NextEvent.INVOICE_PAYMENT, NextEvent.PAYMENT);
invoiceUserApi.commitInvoice(accountInvoices.get(1).getId(), callContext);
assertListenerStatus();
invoiceChecker.checkInvoice(account.getId(), 2, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 4, 1), null, InvoiceItemType.EXTERNAL_CHARGE, new BigDecimal("33.80")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("29.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 4, 1), null, InvoiceItemType.TAX, new BigDecimal("12.45")));
}
use of org.killbill.billing.invoice.model.TaxInvoiceItem in project killbill by killbill.
the class TestWithTaxItems method testTaxRateStartAndEndDate.
@Test(groups = "slow")
public void testTaxRateStartAndEndDate() throws Exception {
// Set clock to the initial start date - we implicitly assume here that the account timezone is UTC
clock.setDay(new LocalDate(2017, 11, 15));
final AccountData accountData = getAccountData(null);
final Account account = createAccountWithNonOsgiPaymentMethod(accountData);
accountChecker.checkAccount(account.getId(), accountData, callContext);
// Create original subscription (Trial PHASE) -> $0 invoice.
final DefaultEntitlement bpSubscription = createBaseEntitlementAndCheckForCompletion(account.getId(), "bundleKey", "Pistol", ProductCategory.BASE, BillingPeriod.MONTHLY, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
invoiceChecker.checkInvoice(account.getId(), 1, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2017, 11, 15), null, InvoiceItemType.FIXED, new BigDecimal("0")));
subscriptionChecker.checkSubscriptionCreated(bpSubscription.getId(), internalCallContext);
busHandler.pushExpectedEvents(NextEvent.INVOICE);
final InvoiceItem inputCredit = new CreditAdjInvoiceItem(null, account.getId(), clock.getUTCToday(), "VIP", new BigDecimal("100"), account.getCurrency(), null);
invoiceUserApi.insertCredits(account.getId(), clock.getUTCToday(), ImmutableList.of(inputCredit), true, null, callContext);
assertListenerStatus();
invoiceChecker.checkInvoice(account.getId(), 2, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2017, 11, 15), new LocalDate(2017, 11, 15), InvoiceItemType.CBA_ADJ, new BigDecimal("100")), new ExpectedInvoiceItemCheck(new LocalDate(2017, 11, 15), new LocalDate(2017, 11, 15), InvoiceItemType.CREDIT_ADJ, new BigDecimal("-100")));
// Make sure TestInvoicePluginApi will return an additional TAX item
testInvoicePluginApi.addTaxItem(new TaxInvoiceItem(UUID.randomUUID(), null, null, account.getId(), null, null, null, null, null, null, null, null, null, null, null, new LocalDate(2017, 12, 15), new LocalDate(2017, 12, 31), "Tax Item 2017", BigDecimal.ONE, account.getCurrency(), null, null));
testInvoicePluginApi.addTaxItem(new TaxInvoiceItem(UUID.randomUUID(), null, null, account.getId(), null, null, null, null, null, null, null, null, null, null, null, new LocalDate(2018, 1, 1), new LocalDate(2018, 1, 15), "Tax Item 2018", BigDecimal.TEN, account.getCurrency(), null, null));
// Move to Evergreen PHASE to verify non-dry-run scenario
busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE);
clock.addDays(30);
assertListenerStatus();
invoiceChecker.checkInvoice(account.getId(), 3, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2017, 12, 15), new LocalDate(2018, 1, 15), InvoiceItemType.RECURRING, new BigDecimal("29.95")), new ExpectedInvoiceItemCheck(new LocalDate(2017, 12, 15), new LocalDate(2017, 12, 31), InvoiceItemType.TAX, new BigDecimal("1.0")), new ExpectedInvoiceItemCheck(new LocalDate(2018, 1, 1), new LocalDate(2018, 1, 15), InvoiceItemType.TAX, new BigDecimal("10.0")), new ExpectedInvoiceItemCheck(new LocalDate(2017, 12, 15), new LocalDate(2017, 12, 15), InvoiceItemType.CBA_ADJ, new BigDecimal("-40.95")));
}
use of org.killbill.billing.invoice.model.TaxInvoiceItem in project killbill by killbill.
the class TestWithTaxItems method testWithAdjustments.
@Test(groups = "slow")
public void testWithAdjustments() throws Exception {
// We take april as it has 30 days (easier to play with BCD)
// Set clock to the initial start date - we implicitly assume here that the account timezone is UTC
clock.setDay(new LocalDate(2012, 4, 1));
final AccountData accountData = getAccountData(1);
final Account account = createAccountWithNonOsgiPaymentMethod(accountData);
accountChecker.checkAccount(account.getId(), accountData, callContext);
// Create original subscription (Trial PHASE) -> $0 invoice.
final DefaultEntitlement bpSubscription = createBaseEntitlementAndCheckForCompletion(account.getId(), "bundleKey", "Pistol", ProductCategory.BASE, BillingPeriod.MONTHLY, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
invoiceChecker.checkInvoice(account.getId(), 1, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 4, 1), null, InvoiceItemType.FIXED, new BigDecimal("0")));
subscriptionChecker.checkSubscriptionCreated(bpSubscription.getId(), internalCallContext);
// Make sure TestInvoicePluginApi will return an additional TAX item
testInvoicePluginApi.addTaxItem(new TaxInvoiceItem(UUID.randomUUID(), null, account.getId(), null, "Tax Item", new LocalDate(2012, 5, 1), new BigDecimal("3.00"), account.getCurrency()));
// Move to Evergreen PHASE to verify non-dry-run scenario
busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
clock.addDays(30);
assertListenerStatus();
final Invoice secondInvoice = invoiceChecker.checkInvoice(account.getId(), 2, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("29.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), null, InvoiceItemType.TAX, new BigDecimal("3.00")));
final InvoiceItem recurringItemId = Iterables.find(secondInvoice.getInvoiceItems(), new Predicate<InvoiceItem>() {
@Override
public boolean apply(final InvoiceItem input) {
return input.getInvoiceItemType() == InvoiceItemType.RECURRING;
}
});
testInvoicePluginApi.addTaxItem(new TaxInvoiceItem(UUID.randomUUID(), null, account.getId(), null, "Tax Item (refund)", new LocalDate(2012, 5, 8), new BigDecimal("-1.00"), account.getCurrency()));
clock.addDays(7);
busHandler.pushExpectedEvents(NextEvent.INVOICE_ADJUSTMENT);
invoiceUserApi.insertInvoiceItemAdjustment(account.getId(), secondInvoice.getId(), recurringItemId.getId(), new LocalDate(2012, 5, 8), new BigDecimal("10"), account.getCurrency(), "", "", ImmutableList.of(), callContext);
assertListenerStatus();
invoiceChecker.checkInvoice(account.getId(), 2, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), new LocalDate(2012, 6, 1), InvoiceItemType.RECURRING, new BigDecimal("29.95")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 8), new LocalDate(2012, 5, 8), InvoiceItemType.ITEM_ADJ, new BigDecimal("-10.00")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 8), new LocalDate(2012, 5, 8), InvoiceItemType.CBA_ADJ, new BigDecimal("11.00")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), null, InvoiceItemType.TAX, new BigDecimal("3.00")), new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 8), null, InvoiceItemType.TAX, new BigDecimal("-1.00")));
}
Aggregations