Search in sources :

Example 1 with EventSubscription

use of org.killbill.billing.client.model.gen.EventSubscription in project killbill by killbill.

the class TestAccountTimeline method testAccountTimeline.

@Test(groups = "slow", description = "Can retrieve the timeline without audits")
public void testAccountTimeline() throws Exception {
    clock.setTime(new DateTime(2012, 4, 25, 0, 3, 42, 0));
    final Account accountJson = createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice();
    final AccountTimeline timeline = getAccountTimeline(accountJson.getAccountId(), AuditLevel.NONE);
    Assert.assertEquals(timeline.getPayments().size(), 1);
    Assert.assertEquals(timeline.getInvoices().size(), 2);
    Assert.assertEquals(timeline.getBundles().size(), 1);
    Assert.assertEquals(timeline.getBundles().get(0).getSubscriptions().size(), 1);
    Assert.assertEquals(timeline.getBundles().get(0).getSubscriptions().get(0).getEvents().size(), 3);
    Assert.assertNotNull(timeline.getInvoices().get(0).getBundleKeys());
    final List<EventSubscription> events = timeline.getBundles().get(0).getSubscriptions().get(0).getEvents();
    Assert.assertEquals(events.get(0).getEffectiveDate(), new LocalDate(2012, 4, 25));
    Assert.assertEquals(events.get(0).getEventType(), SubscriptionEventType.START_ENTITLEMENT);
    Assert.assertEquals(events.get(1).getEffectiveDate(), new LocalDate(2012, 4, 25));
    Assert.assertEquals(events.get(1).getEventType(), SubscriptionEventType.START_BILLING);
    Assert.assertEquals(events.get(2).getEffectiveDate(), new LocalDate(2012, 5, 25));
    Assert.assertEquals(events.get(2).getEventType(), SubscriptionEventType.PHASE);
}
Also used : Account(org.killbill.billing.client.model.gen.Account) EventSubscription(org.killbill.billing.client.model.gen.EventSubscription) AccountTimeline(org.killbill.billing.client.model.gen.AccountTimeline) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) Test(org.testng.annotations.Test)

Aggregations

DateTime (org.joda.time.DateTime)1 LocalDate (org.joda.time.LocalDate)1 Account (org.killbill.billing.client.model.gen.Account)1 AccountTimeline (org.killbill.billing.client.model.gen.AccountTimeline)1 EventSubscription (org.killbill.billing.client.model.gen.EventSubscription)1 Test (org.testng.annotations.Test)1