Search in sources :

Example 1 with Accounts

use of org.killbill.billing.client.model.Accounts in project killbill by killbill.

the class TestAccount method testGetChildrenAccounts.

@Test(groups = "slow", description = "retrieve children accounts by parent account id")
public void testGetChildrenAccounts() throws Exception {
    final Account parentAccount = createAccount();
    final Account childInput = getAccount();
    childInput.setParentAccountId(parentAccount.getAccountId());
    childInput.setIsPaymentDelegatedToParent(true);
    Account childAccount = killBillClient.createAccount(childInput, requestOptions);
    childAccount = killBillClient.getAccount(childAccount.getAccountId(), true, true, requestOptions);
    final Account childInput2 = getAccount();
    childInput2.setParentAccountId(parentAccount.getAccountId());
    childInput2.setIsPaymentDelegatedToParent(true);
    Account childAccount2 = killBillClient.createAccount(childInput2, requestOptions);
    childAccount2 = killBillClient.getAccount(childAccount2.getAccountId(), true, true, requestOptions);
    // Retrieves children accounts by parent account id
    final Accounts childrenAccounts = killBillClient.getChildrenAccounts(parentAccount.getAccountId(), true, true, requestOptions);
    Assert.assertEquals(childrenAccounts.size(), 2);
    Assert.assertTrue(childrenAccounts.get(0).equals(childAccount));
    Assert.assertTrue(childrenAccounts.get(1).equals(childAccount2));
}
Also used : Account(org.killbill.billing.client.model.Account) Accounts(org.killbill.billing.client.model.Accounts) Test(org.testng.annotations.Test)

Example 2 with Accounts

use of org.killbill.billing.client.model.Accounts in project killbill by killbill.

the class TestAccount method testAccountsPagination.

@Test(groups = "slow", description = "Can paginate through all accounts")
public void testAccountsPagination() throws Exception {
    for (int i = 0; i < 5; i++) {
        createAccount();
    }
    final Accounts allAccounts = killBillClient.getAccounts(requestOptions);
    Assert.assertEquals(allAccounts.size(), 5);
    Accounts page = killBillClient.getAccounts(0L, 1L, requestOptions);
    for (int i = 0; i < 5; i++) {
        Assert.assertNotNull(page);
        Assert.assertEquals(page.size(), 1);
        Assert.assertEquals(page.get(0), allAccounts.get(i));
        page = page.getNext();
    }
    Assert.assertNull(page);
}
Also used : Accounts(org.killbill.billing.client.model.Accounts) Test(org.testng.annotations.Test)

Example 3 with Accounts

use of org.killbill.billing.client.model.Accounts in project killbill by killbill.

the class TestAccount method testEmptyGetChildrenAccounts.

@Test(groups = "slow", description = "retrieve an empty children accounts list by a non parent account id")
public void testEmptyGetChildrenAccounts() throws Exception {
    // Retrieves children accounts by parent account id
    final Accounts childrenAccounts = killBillClient.getChildrenAccounts(UUID.randomUUID(), false, false, requestOptions);
    Assert.assertEquals(childrenAccounts.size(), 0);
}
Also used : Accounts(org.killbill.billing.client.model.Accounts) Test(org.testng.annotations.Test)

Example 4 with Accounts

use of org.killbill.billing.client.model.Accounts in project killbill by killbill.

the class TestAccount method testGetChildrenAccountsByNullId.

@Test(groups = "slow", description = "retrieve an empty children accounts list by a null id")
public void testGetChildrenAccountsByNullId() throws Exception {
    // Retrieves children accounts by parent account id
    final Accounts childrenAccounts = killBillClient.getChildrenAccounts(null, true, true, requestOptions);
    Assert.assertEquals(childrenAccounts.size(), 0);
}
Also used : Accounts(org.killbill.billing.client.model.Accounts) Test(org.testng.annotations.Test)

Aggregations

Accounts (org.killbill.billing.client.model.Accounts)4 Test (org.testng.annotations.Test)4 Account (org.killbill.billing.client.model.Account)1