@Override public Integer getAccountBCD(final UUID accountId, final InternalTenantContext context) { final AccountModelDao account = getById(accountId, context); return account != null ? account.getBillingCycleDayLocal() : 0; }
currentAccount.getBillingCycleDayLocal() != DEFAULT_BILLING_CYCLE_DAY_LOCAL && // There is already a BCD set !currentAccount.getBillingCycleDayLocal().equals(billingCycleDayLocal)) { // and it does not match we we have throw new IllegalArgumentException(String.format("Killbill doesn't support updating the account BCD: new=%s, current=%s", billingCycleDayLocal, currentAccount.getBillingCycleDayLocal()));
Assert.assertEquals(account.getFirstNameLength(), firstNameLength); Assert.assertEquals(account.getCurrency(), currency); Assert.assertEquals(account.getBillingCycleDayLocal(), (Integer) billCycleDay); Assert.assertEquals(account.getPaymentMethodId(), paymentMethodId); Assert.assertEquals(account.getTimeZone(), timeZone);
public static void checkAccountsEqual(final AccountModelDao retrievedAccount, final AccountModelDao account) { if (retrievedAccount == null || account == null) { Assert.assertNull(retrievedAccount); Assert.assertNull(account); return; } // Check all fields but createdDate/updatedDate (comes from the callcontext) Assert.assertEquals(retrievedAccount.getId(), account.getId()); Assert.assertEquals(retrievedAccount.getExternalKey(), account.getExternalKey()); Assert.assertEquals(retrievedAccount.getEmail(), account.getEmail()); Assert.assertEquals(retrievedAccount.getName(), account.getName()); Assert.assertEquals(retrievedAccount.getFirstNameLength(), account.getFirstNameLength()); Assert.assertEquals(retrievedAccount.getCurrency(), account.getCurrency()); Assert.assertEquals(retrievedAccount.getBillingCycleDayLocal(), account.getBillingCycleDayLocal()); Assert.assertEquals(retrievedAccount.getPaymentMethodId(), account.getPaymentMethodId()); Assert.assertEquals(retrievedAccount.getTimeZone(), account.getTimeZone()); Assert.assertEquals(retrievedAccount.getLocale(), account.getLocale()); Assert.assertEquals(retrievedAccount.getAddress1(), account.getAddress1()); Assert.assertEquals(retrievedAccount.getAddress2(), account.getAddress2()); Assert.assertEquals(retrievedAccount.getCompanyName(), account.getCompanyName()); Assert.assertEquals(retrievedAccount.getCity(), account.getCity()); Assert.assertEquals(retrievedAccount.getStateOrProvince(), account.getStateOrProvince()); Assert.assertEquals(retrievedAccount.getCountry(), account.getCountry()); Assert.assertEquals(retrievedAccount.getPostalCode(), account.getPostalCode()); Assert.assertEquals(retrievedAccount.getPhone(), account.getPhone()); Assert.assertEquals(retrievedAccount.getMigrated(), account.getMigrated()); }
private List<ChangedField> calculateChangedFields(final AccountModelDao oldData, final AccountModelDao newData, final DateTime changeDate) { final List<ChangedField> tmpChangedFields = new ArrayList<ChangedField>(); addIfValueChanged(tmpChangedFields, "externalKey", oldData.getExternalKey(), newData.getExternalKey(), changeDate); addIfValueChanged(tmpChangedFields, "email", oldData.getEmail(), newData.getEmail(), changeDate); addIfValueChanged(tmpChangedFields, "firstName", oldData.getName(), newData.getName(), changeDate); addIfValueChanged(tmpChangedFields, "currency", (oldData.getCurrency() != null) ? oldData.getCurrency().toString() : null, (newData.getCurrency() != null) ? newData.getCurrency().toString() : null, changeDate); addIfValueChanged(tmpChangedFields, "billCycleDayLocal", String.valueOf(oldData.getBillingCycleDayLocal()), String.valueOf(newData.getBillingCycleDayLocal()), changeDate); addIfValueChanged(tmpChangedFields, "paymentMethodId", (oldData.getPaymentMethodId() != null) ? oldData.getPaymentMethodId().toString() : null, (newData.getPaymentMethodId() != null) ? newData.getPaymentMethodId().toString() : null, changeDate); addIfValueChanged(tmpChangedFields, "locale", oldData.getLocale(), newData.getLocale(), changeDate); addIfValueChanged(tmpChangedFields, "timeZone", (oldData.getTimeZone() == null) ? null : oldData.getTimeZone().toString(), (newData.getTimeZone() == null) ? null : newData.getTimeZone().toString(), changeDate); addIfValueChanged(tmpChangedFields, "address1", oldData.getAddress1(), newData.getAddress1(), changeDate); addIfValueChanged(tmpChangedFields, "address2", oldData.getAddress2(), newData.getAddress2(), changeDate); addIfValueChanged(tmpChangedFields, "city", oldData.getCity(), newData.getCity(), changeDate); addIfValueChanged(tmpChangedFields, "stateOrProvince", oldData.getStateOrProvince(), newData.getStateOrProvince(), changeDate); addIfValueChanged(tmpChangedFields, "country", oldData.getCountry(), newData.getCountry(), changeDate); addIfValueChanged(tmpChangedFields, "postalCode", oldData.getPostalCode(), newData.getPostalCode(), changeDate); addIfValueChanged(tmpChangedFields, "phone", oldData.getPhone(), newData.getPhone(), changeDate); return tmpChangedFields; }
public DefaultAccountData(final AccountModelDao d) { this(d.getExternalKey(), d.getName(), d.getFirstNameLength(), d.getEmail(), d.getBillingCycleDayLocal(), d.getCurrency() != null ? d.getCurrency().name() : null, d.getParentAccountId(), d.getIsPaymentDelegatedToParent(), d.getPaymentMethodId(), d.getReferenceTime() != null ? d.getReferenceTime().toString() : null, d.getTimeZone() != null ? d.getTimeZone().getID() : null, d.getLocale(), d.getAddress1(), d.getAddress2(), d.getCompanyName(), d.getCity(), d.getStateOrProvince(), d.getPostalCode(), d.getCountry(), d.getPhone(), d.getNotes(), d.getMigrated()); }
public DefaultAccount(final AccountModelDao accountModelDao) { this(accountModelDao.getId(), accountModelDao.getCreatedDate(), accountModelDao.getUpdatedDate(), accountModelDao.getExternalKey(), accountModelDao.getEmail(), accountModelDao.getName(), accountModelDao.getFirstNameLength(), accountModelDao.getCurrency(), accountModelDao.getParentAccountId(), accountModelDao.getIsPaymentDelegatedToParent(), accountModelDao.getBillingCycleDayLocal(), accountModelDao.getPaymentMethodId(), accountModelDao.getReferenceTime(), accountModelDao.getTimeZone(), accountModelDao.getLocale(), accountModelDao.getAddress1(), accountModelDao.getAddress2(), accountModelDao.getCompanyName(), accountModelDao.getCity(), accountModelDao.getStateOrProvince(), accountModelDao.getCountry(), accountModelDao.getPostalCode(), accountModelDao.getPhone(), accountModelDao.getNotes(), accountModelDao.getMigrated()); }
if (currentAccount.getBillingCycleDayLocal() == DEFAULT_BILLING_CYCLE_DAY_LOCAL && // There is *not* already a BCD set setBillingCycleDayLocal(currentAccount.getBillingCycleDayLocal());
currentAccount.getBillingCycleDayLocal() != DEFAULT_BILLING_CYCLE_DAY_LOCAL && // There is already a BCD set !currentAccount.getBillingCycleDayLocal().equals(billingCycleDayLocal)) { // and it does not match we we have throw new IllegalArgumentException(String.format("Killbill doesn't support updating the account BCD: new=%s, current=%s", billingCycleDayLocal, currentAccount.getBillingCycleDayLocal()));
private List<ChangedField> calculateChangedFields(final AccountModelDao oldData, final AccountModelDao newData, final DateTime changeDate) { final List<ChangedField> tmpChangedFields = new ArrayList<ChangedField>(); addIfValueChanged(tmpChangedFields, "externalKey", oldData.getExternalKey(), newData.getExternalKey(), changeDate); addIfValueChanged(tmpChangedFields, "email", oldData.getEmail(), newData.getEmail(), changeDate); addIfValueChanged(tmpChangedFields, "firstName", oldData.getName(), newData.getName(), changeDate); addIfValueChanged(tmpChangedFields, "currency", (oldData.getCurrency() != null) ? oldData.getCurrency().toString() : null, (newData.getCurrency() != null) ? newData.getCurrency().toString() : null, changeDate); addIfValueChanged(tmpChangedFields, "billCycleDayLocal", String.valueOf(oldData.getBillingCycleDayLocal()), String.valueOf(newData.getBillingCycleDayLocal()), changeDate); addIfValueChanged(tmpChangedFields, "paymentMethodId", (oldData.getPaymentMethodId() != null) ? oldData.getPaymentMethodId().toString() : null, (newData.getPaymentMethodId() != null) ? newData.getPaymentMethodId().toString() : null, changeDate); addIfValueChanged(tmpChangedFields, "locale", oldData.getLocale(), newData.getLocale(), changeDate); addIfValueChanged(tmpChangedFields, "timeZone", (oldData.getTimeZone() == null) ? null : oldData.getTimeZone().toString(), (newData.getTimeZone() == null) ? null : newData.getTimeZone().toString(), changeDate); addIfValueChanged(tmpChangedFields, "address1", oldData.getAddress1(), newData.getAddress1(), changeDate); addIfValueChanged(tmpChangedFields, "address2", oldData.getAddress2(), newData.getAddress2(), changeDate); addIfValueChanged(tmpChangedFields, "city", oldData.getCity(), newData.getCity(), changeDate); addIfValueChanged(tmpChangedFields, "stateOrProvince", oldData.getStateOrProvince(), newData.getStateOrProvince(), changeDate); addIfValueChanged(tmpChangedFields, "country", oldData.getCountry(), newData.getCountry(), changeDate); addIfValueChanged(tmpChangedFields, "postalCode", oldData.getPostalCode(), newData.getPostalCode(), changeDate); addIfValueChanged(tmpChangedFields, "phone", oldData.getPhone(), newData.getPhone(), changeDate); return tmpChangedFields; }
public DefaultAccountData(final AccountModelDao d) { this(d.getExternalKey(), d.getName(), d.getFirstNameLength(), d.getEmail(), d.getBillingCycleDayLocal(), d.getCurrency() != null ? d.getCurrency().name() : null, d.getParentAccountId(), d.getIsPaymentDelegatedToParent(), d.getPaymentMethodId(), d.getReferenceTime() != null ? d.getReferenceTime().toString() : null, d.getTimeZone() != null ? d.getTimeZone().getID() : null, d.getLocale(), d.getAddress1(), d.getAddress2(), d.getCompanyName(), d.getCity(), d.getStateOrProvince(), d.getPostalCode(), d.getCountry(), d.getPhone(), d.getNotes(), d.getMigrated()); }
if (currentAccount.getBillingCycleDayLocal() == DEFAULT_BILLING_CYCLE_DAY_LOCAL && // There is *not* already a BCD set setBillingCycleDayLocal(currentAccount.getBillingCycleDayLocal());
public DefaultAccount(final AccountModelDao accountModelDao) { this(accountModelDao.getId(), accountModelDao.getCreatedDate(), accountModelDao.getUpdatedDate(), accountModelDao.getExternalKey(), accountModelDao.getEmail(), accountModelDao.getName(), accountModelDao.getFirstNameLength(), accountModelDao.getCurrency(), accountModelDao.getParentAccountId(), accountModelDao.getIsPaymentDelegatedToParent(), accountModelDao.getBillingCycleDayLocal(), accountModelDao.getPaymentMethodId(), accountModelDao.getReferenceTime(), accountModelDao.getTimeZone(), accountModelDao.getLocale(), accountModelDao.getAddress1(), accountModelDao.getAddress2(), accountModelDao.getCompanyName(), accountModelDao.getCity(), accountModelDao.getStateOrProvince(), accountModelDao.getCountry(), accountModelDao.getPostalCode(), accountModelDao.getPhone(), accountModelDao.getNotes(), accountModelDao.getMigrated()); }