Search in sources :

Example 11 with DefaultMutableAccountData

use of org.killbill.billing.account.api.DefaultMutableAccountData in project killbill by killbill.

the class TestDefaultAccountUserApi method testAccountChangeExternalKey.

@Test(groups = "slow", description = "Test failure on changing externalKey", expectedExceptions = IllegalArgumentException.class)
public void testAccountChangeExternalKey() throws Exception {
    final Account account = createAccount(new DefaultAccount(createTestAccount()));
    // Update the address and leave other fields null
    final MutableAccountData mutableAccountData = new DefaultMutableAccountData(account);
    mutableAccountData.setExternalKey("somethingVeryDifferent");
    DefaultAccount newAccount = new DefaultAccount(account.getId(), mutableAccountData);
    accountUserApi.updateAccount(newAccount, callContext);
}
Also used : DefaultAccount(org.killbill.billing.account.api.DefaultAccount) AccountTestUtils.createTestAccount(org.killbill.billing.account.AccountTestUtils.createTestAccount) Account(org.killbill.billing.account.api.Account) DefaultAccount(org.killbill.billing.account.api.DefaultAccount) DefaultMutableAccountData(org.killbill.billing.account.api.DefaultMutableAccountData) MutableAccountData(org.killbill.billing.account.api.MutableAccountData) DefaultMutableAccountData(org.killbill.billing.account.api.DefaultMutableAccountData) Test(org.testng.annotations.Test)

Example 12 with DefaultMutableAccountData

use of org.killbill.billing.account.api.DefaultMutableAccountData in project killbill by killbill.

the class TestAccountDao method testMinimalFields.

@Test(groups = "slow", description = "Test Account: verify minimal set of required fields")
public void testMinimalFields() throws Exception {
    final String email = UUID.randomUUID().toString();
    final String name = UUID.randomUUID().toString();
    final AccountData accountData = new DefaultMutableAccountData(null, email, name, 0, null, null, false, 0, null, null, null, null, null, null, null, null, null, null, null, null, false, true);
    final AccountModelDao account = new AccountModelDao(UUID.randomUUID(), accountData);
    accountDao.create(account, internalCallContext);
    final AccountModelDao retrievedAccount = accountDao.getById(account.getId(), internalCallContext);
    checkAccountsEqual(retrievedAccount, account);
    // Verify a default external key was set
    Assert.assertEquals(retrievedAccount.getExternalKey(), retrievedAccount.getId().toString());
    // Verify a default time zone was set
    Assert.assertEquals(retrievedAccount.getTimeZone(), DateTimeZone.UTC);
}
Also used : DefaultMutableAccountData(org.killbill.billing.account.api.DefaultMutableAccountData) MutableAccountData(org.killbill.billing.account.api.MutableAccountData) AccountData(org.killbill.billing.account.api.AccountData) DefaultMutableAccountData(org.killbill.billing.account.api.DefaultMutableAccountData) Test(org.testng.annotations.Test)

Aggregations

DefaultMutableAccountData (org.killbill.billing.account.api.DefaultMutableAccountData)12 DefaultAccount (org.killbill.billing.account.api.DefaultAccount)10 MutableAccountData (org.killbill.billing.account.api.MutableAccountData)10 Test (org.testng.annotations.Test)10 AccountTestUtils.createTestAccount (org.killbill.billing.account.AccountTestUtils.createTestAccount)9 Account (org.killbill.billing.account.api.Account)9 UUID (java.util.UUID)1 DateTimeZone (org.joda.time.DateTimeZone)1 AccountApiException (org.killbill.billing.account.api.AccountApiException)1 AccountData (org.killbill.billing.account.api.AccountData)1 Currency (org.killbill.billing.catalog.api.Currency)1