use of org.killbill.billing.client.model.gen.Account in project killbill by killbill.
the class TestAccount method testAccountOk.
@Test(groups = "slow", description = "Can create, retrieve, search and update accounts")
public void testAccountOk() throws Exception {
final Account input = createAccount();
// Create a second account (https://github.com/killbill/killbill/issues/1422 regression testing)
final Account secondAccount = createAccount();
final Account retrievedSecondAccount = accountApi.getAccountByKey(secondAccount.getExternalKey(), requestOptions);
Assert.assertEquals(secondAccount, retrievedSecondAccount);
// Retrieves by external key
final Account retrievedAccount = accountApi.getAccountByKey(input.getExternalKey(), requestOptions);
Assert.assertEquals(input, retrievedAccount);
// Try search endpoint
searchAccount(input, retrievedAccount);
// Force limit=1 (https://github.com/killbill/killbill/issues/1422 regression testing)
final Accounts allAccounts = accountApi.searchAccounts(input.getCompany(), 0L, 1L, false, false, AuditLevel.NONE, requestOptions);
// Company name is the same for both accounts
Assert.assertEquals(allAccounts.size(), 1);
Assert.assertEquals(allAccounts.get(0).getExternalKey(), retrievedAccount.getExternalKey());
final Accounts secondPage = allAccounts.getNext();
Assert.assertEquals(secondPage.size(), 1);
Assert.assertEquals(secondPage.get(0).getExternalKey(), retrievedSecondAccount.getExternalKey());
// Update Account
final Account newInput = new Account(input.getAccountId(), "zozo", 4, input.getExternalKey(), "rr@google.com", 18, Currency.USD, null, false, null, null, "UTC", "bl1", "bh2", "", "", "ca", "San Francisco", "usa", "en", "415-255-2991", "notes", false, null, null, EMPTY_AUDIT_LOGS);
accountApi.updateAccount(input.getAccountId(), newInput, requestOptions);
final Account updatedAccount = accountApi.getAccount(input.getAccountId(), requestOptions);
// referenceTime is set automatically by system, no way to guess it
newInput.setReferenceTime(updatedAccount.getReferenceTime());
Assert.assertTrue(updatedAccount.equals(newInput));
// Try search endpoint
searchAccount(input, null);
}
use of org.killbill.billing.client.model.gen.Account 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 = accountApi.createAccount(childInput, requestOptions);
childAccount = accountApi.getAccount(childAccount.getAccountId(), true, true, AuditLevel.NONE, requestOptions);
final Account childInput2 = getAccount();
childInput2.setParentAccountId(parentAccount.getAccountId());
childInput2.setIsPaymentDelegatedToParent(true);
Account childAccount2 = accountApi.createAccount(childInput2, requestOptions);
childAccount2 = accountApi.getAccount(childAccount2.getAccountId(), true, true, AuditLevel.NONE, requestOptions);
// Retrieves children accounts by parent account id
final Accounts childrenAccounts = accountApi.getChildrenAccounts(parentAccount.getAccountId(), true, true, AuditLevel.NONE, requestOptions);
Assert.assertEquals(childrenAccounts.size(), 2);
Assert.assertTrue(childrenAccounts.get(0).equals(childAccount));
Assert.assertTrue(childrenAccounts.get(1).equals(childAccount2));
}
use of org.killbill.billing.client.model.gen.Account in project killbill by killbill.
the class TestAccount method testAccountPaymentsWithRefund.
@Test(groups = "slow")
public void testAccountPaymentsWithRefund() throws Exception {
final Account accountJson = createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice();
// Verify payments
final InvoicePayments objFromJson = accountApi.getInvoicePayments(accountJson.getAccountId(), NULL_PLUGIN_PROPERTIES, requestOptions);
Assert.assertEquals(objFromJson.size(), 1);
}
use of org.killbill.billing.client.model.gen.Account in project killbill by killbill.
the class TestAccount method testEmptyAccount.
@Test(groups = "slow", description = "Verify no PII data is required")
public void testEmptyAccount() throws Exception {
final Account emptyAccount = new Account();
final Account account = accountApi.createAccount(emptyAccount, requestOptions);
Assert.assertNotNull(account.getExternalKey());
Assert.assertNull(account.getName());
Assert.assertNull(account.getEmail());
}
use of org.killbill.billing.client.model.gen.Account in project killbill by killbill.
the class TestAccount method testAccountWithBalance.
@Test(groups = "slow", description = "Can retrieve the account balance")
public void testAccountWithBalance() throws Exception {
final Account accountJson = createAccountNoPMBundleAndSubscriptionAndWaitForFirstInvoice();
final Account accountWithBalance = accountApi.getAccount(accountJson.getAccountId(), true, false, AuditLevel.NONE, requestOptions);
final BigDecimal accountBalance = accountWithBalance.getAccountBalance();
Assert.assertTrue(accountBalance.compareTo(BigDecimal.ZERO) > 0);
}
Aggregations