Search in sources :

Example 1 with DefaultMutableAccountData

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

the class TestDefaultAccountUserApi method testAccountResetTimeZone.

@Test(groups = "slow", description = "Test failure on resetting timeZone", expectedExceptions = IllegalArgumentException.class)
public void testAccountResetTimeZone() throws Exception {
    final Account account = createAccount(new DefaultAccount(createTestAccount()));
    // Update the address and leave other fields null
    final MutableAccountData mutableAccountData = new DefaultMutableAccountData(account);
    mutableAccountData.setTimeZone(null);
    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 2 with DefaultMutableAccountData

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

the class TestDefaultAccountUserApi method testAccountResetCurrency.

@Test(groups = "slow", description = "Test failure on resetting currency", expectedExceptions = IllegalArgumentException.class)
public void testAccountResetCurrency() throws Exception {
    final Account account = createAccount(new DefaultAccount(createTestAccount()));
    // Update the address and leave other fields null
    final MutableAccountData mutableAccountData = new DefaultMutableAccountData(account);
    mutableAccountData.setCurrency(null);
    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 3 with DefaultMutableAccountData

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

the class AccountTestUtils method createAccountData.

private static MutableAccountData createAccountData(final int billCycleDayUTC, final int billCycleDayLocal, final String phone) {
    final String externalKey = UUID.randomUUID().toString();
    final String email = UUID.randomUUID().toString().substring(0, 4) + '@' + UUID.randomUUID().toString().substring(0, 4);
    final String name = UUID.randomUUID().toString();
    final String locale = Locale.GERMANY.toString();
    final DateTimeZone timeZone = DateTimeZone.forID("America/Los_Angeles");
    final int firstNameLength = name.length();
    final Currency currency = Currency.MXN;
    final UUID paymentMethodId = UUID.randomUUID();
    final String address1 = UUID.randomUUID().toString();
    final String address2 = UUID.randomUUID().toString();
    final String companyName = UUID.randomUUID().toString();
    final String city = UUID.randomUUID().toString();
    final String stateOrProvince = UUID.randomUUID().toString();
    final String country = Locale.GERMANY.getCountry();
    final String postalCode = UUID.randomUUID().toString().substring(0, 4);
    final String notes = UUID.randomUUID().toString();
    return new DefaultMutableAccountData(externalKey, email, name, firstNameLength, currency, null, false, billCycleDayLocal, paymentMethodId, timeZone, locale, address1, address2, companyName, city, stateOrProvince, country, postalCode, phone, notes, false, true);
}
Also used : Currency(org.killbill.billing.catalog.api.Currency) DefaultMutableAccountData(org.killbill.billing.account.api.DefaultMutableAccountData) UUID(java.util.UUID) DateTimeZone(org.joda.time.DateTimeZone)

Example 4 with DefaultMutableAccountData

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

the class TestDefaultAccountUserApi method testAccountChangingTimeZone.

@Test(groups = "slow", description = "Test failure on changing timeZone", expectedExceptions = IllegalArgumentException.class)
public void testAccountChangingTimeZone() throws Exception {
    final Account account = createAccount(new DefaultAccount(createTestAccount()));
    // Update the address and leave other fields null
    final MutableAccountData mutableAccountData = new DefaultMutableAccountData(account);
    mutableAccountData.setTimeZone(DateTimeZone.UTC);
    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 5 with DefaultMutableAccountData

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

the class TestDefaultAccountUserApi method testAccountResetExternalKey.

@Test(groups = "slow", description = "Test failure on resetting externalKey", expectedExceptions = IllegalArgumentException.class)
public void testAccountResetExternalKey() 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(null);
    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)

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