Tabnine Logo
Account.getBillCycleDayLocal
Code IndexAdd Tabnine to your IDE (free)

How to use
getBillCycleDayLocal
method
in
org.killbill.billing.account.api.Account

Best Java code snippets using org.killbill.billing.account.api.Account.getBillCycleDayLocal (Showing top 20 results out of 315)

origin: killbill/killbill

currentAccount.getBillCycleDayLocal() != DEFAULT_BILLING_CYCLE_DAY_LOCAL && // There is already a BCD set
!currentAccount.getBillCycleDayLocal().equals(billCycleDayLocal)) { // and it does not match we we have
throw new IllegalArgumentException(String.format("Killbill doesn't support updating the account BCD yet: new=%s, current=%s", billCycleDayLocal, currentAccount.getBillCycleDayLocal()));
origin: killbill/killbill

final Account accountWithNullBCD = new DefaultAccount(accountId, accountDataWithNullBCD);
Assert.assertEquals(accountWithNullBCD.getBillCycleDayLocal(), (Integer) 0);
final Account accountWithZeroBCD = new DefaultAccount(accountId, accountDataWithZeroBCD);
Assert.assertEquals(accountWithNullBCD.mergeWithDelegate(accountWithZeroBCD).getBillCycleDayLocal(), (Integer) 0);
final Account accountWithRealBCD = new DefaultAccount(accountId, accountDataWithRealBCD);
Assert.assertEquals(accountWithNullBCD.mergeWithDelegate(accountWithRealBCD).getBillCycleDayLocal(), (Integer) 12);
final Account accountWithAnotherBCD = new DefaultAccount(accountId, accountDataWithAnotherRealBCD);
Assert.assertEquals(accountWithAnotherBCD.mergeWithDelegate(accountWithAnotherBCD).getBillCycleDayLocal(), (Integer) 20);
try {
  Assert.assertEquals(accountWithAnotherBCD.mergeWithDelegate(accountWithRealBCD).getBillCycleDayLocal(), (Integer) 20);
  Assert.fail();
} catch (final IllegalArgumentException e) {
origin: killbill/killbill

@Test(groups = "fast", description = "Test if Account constructor can accept null values")
public void testConstructorAcceptsNullValues() throws Exception {
  final AccountData accountData = getNullAccountData();
  final Account account = new DefaultAccount(UUID.randomUUID(), accountData);
  Assert.assertNull(account.getExternalKey());
  Assert.assertNull(account.getEmail());
  Assert.assertNull(account.getName());
  Assert.assertNull(account.getFirstNameLength());
  Assert.assertNull(account.getCurrency());
  Assert.assertEquals(account.getBillCycleDayLocal(), (Integer) 0);
  Assert.assertNull(account.getPaymentMethodId());
  Assert.assertNull(account.getTimeZone());
  Assert.assertNull(account.getLocale());
  Assert.assertNull(account.getAddress1());
  Assert.assertNull(account.getAddress2());
  Assert.assertNull(account.getCompanyName());
  Assert.assertNull(account.getCity());
  Assert.assertNull(account.getStateOrProvince());
  Assert.assertNull(account.getCountry());
  Assert.assertNull(account.getPostalCode());
  Assert.assertNull(account.getPhone());
  Assert.assertNull(account.isMigrated());
}
origin: killbill/killbill

@Test(groups = "slow", description = "Test Account update with null values")
public void testShouldBeAbleToPassNullForSomeFieldsToAvoidUpdate() throws Exception {
  final Account account = createAccount(new DefaultAccount(createTestAccount()));
  // Update the address and leave other fields null
  final MutableAccountData mutableAccountData = new DefaultMutableAccountData(null, null, null, 0, null, null, false, 0, null,
                                        clock.getUTCNow(), null, null, null, null, null, null,
                                        null, null, null, null, null, false);
  final String newAddress1 = UUID.randomUUID().toString();
  mutableAccountData.setAddress1(newAddress1);
  accountUserApi.updateAccount(account.getId(), mutableAccountData, callContext);
  final Account retrievedAccount = accountUserApi.getAccountById(account.getId(), callContext);
  Assert.assertEquals(retrievedAccount.getAddress1(), newAddress1);
  Assert.assertEquals(retrievedAccount.getAddress2(), account.getAddress2());
  Assert.assertEquals(retrievedAccount.getCurrency(), account.getCurrency());
  Assert.assertEquals(retrievedAccount.getExternalKey(), account.getExternalKey());
  Assert.assertEquals(retrievedAccount.getBillCycleDayLocal(), account.getBillCycleDayLocal());
}
origin: killbill/killbill

@Override
public void updateBCD(final String externalKey, final int bcd,
           final InternalCallContext context) throws AccountApiException {
  final Account currentAccount = getAccountByKey(externalKey, context);
  if (currentAccount == null) {
    throw new AccountApiException(ErrorCode.ACCOUNT_DOES_NOT_EXIST_FOR_KEY, externalKey);
  }
  if (currentAccount.getBillCycleDayLocal() != DefaultMutableAccountData.DEFAULT_BILLING_CYCLE_DAY_LOCAL) {
    throw new AccountApiException(ErrorCode.ACCOUNT_UPDATE_FAILED);
  }
  final MutableAccountData mutableAccountData = currentAccount.toMutableAccountData();
  mutableAccountData.setBillCycleDayLocal(bcd);
  final AccountModelDao accountToUpdate = new AccountModelDao(currentAccount.getId(), mutableAccountData);
  bcdCacheController.remove(currentAccount.getId());
  bcdCacheController.putIfAbsent(currentAccount.getId(), new Integer(bcd));
  accountDao.update(accountToUpdate, true, context);
}
origin: killbill/killbill

private void checkAccountEquals(final Account finalAccount, final Account delegateAccount) {
  Assert.assertEquals(finalAccount.getExternalKey(), delegateAccount.getExternalKey());
  Assert.assertEquals(finalAccount.getEmail(), delegateAccount.getEmail());
  Assert.assertEquals(finalAccount.getName(), delegateAccount.getName());
  Assert.assertEquals(finalAccount.getFirstNameLength(), delegateAccount.getFirstNameLength());
  Assert.assertEquals(finalAccount.getCurrency(), delegateAccount.getCurrency());
  Assert.assertEquals(finalAccount.getBillCycleDayLocal(), delegateAccount.getBillCycleDayLocal());
  Assert.assertEquals(finalAccount.getPaymentMethodId(), delegateAccount.getPaymentMethodId());
  Assert.assertEquals(finalAccount.getTimeZone(), delegateAccount.getTimeZone());
  Assert.assertEquals(finalAccount.getLocale(), delegateAccount.getLocale());
  Assert.assertEquals(finalAccount.getAddress1(), delegateAccount.getAddress1());
  Assert.assertEquals(finalAccount.getAddress2(), delegateAccount.getAddress2());
  Assert.assertEquals(finalAccount.getCompanyName(), delegateAccount.getCompanyName());
  Assert.assertEquals(finalAccount.getCity(), delegateAccount.getCity());
  Assert.assertEquals(finalAccount.getStateOrProvince(), delegateAccount.getStateOrProvince());
  Assert.assertEquals(finalAccount.getCountry(), delegateAccount.getCountry());
  Assert.assertEquals(finalAccount.getPostalCode(), delegateAccount.getPostalCode());
  Assert.assertEquals(finalAccount.getPhone(), delegateAccount.getPhone());
  Assert.assertEquals(finalAccount.getNotes(), delegateAccount.getNotes());
  Assert.assertEquals(finalAccount.isMigrated(), delegateAccount.isMigrated());
}
origin: killbill/killbill

final AccountData accountDataUpdates1 = getAccountData(account.getBillCycleDayLocal(), account.getCurrency(), account.getExternalKey());
final Account accountUpdates1 = new DefaultAccount(UUID.randomUUID(), accountDataUpdates1);
Assert.assertEquals(updatedAccount2.getExternalKey(), updatedAccount1.getExternalKey());
Assert.assertEquals(updatedAccount2.getCurrency(), updatedAccount1.getCurrency());
Assert.assertEquals(updatedAccount2.getBillCycleDayLocal(), updatedAccount1.getBillCycleDayLocal());
Assert.assertEquals(updatedAccount2.getPaymentMethodId(), updatedAccount1.getPaymentMethodId());
Assert.assertEquals(updatedAccount2.getTimeZone(), updatedAccount1.getTimeZone());
origin: killbill/killbill

@Test(groups = "slow", expectedExceptions = IllegalArgumentException.class, description = "Test updating Account BCD does throws an exception")
public void testShouldntBeAbleToUpdateBillCycleDay() throws Exception {
  final Account account = createAccount(new DefaultAccount(createTestAccount()));
  final MutableAccountData otherAccount = new DefaultAccount(account.getId(), account).toMutableAccountData();
  otherAccount.setBillCycleDayLocal(account.getBillCycleDayLocal() + 2);
  accountUserApi.updateAccount(new DefaultAccount(account.getId(), otherAccount), callContext);
}
origin: killbill/killbill

Assert.assertEquals(retrievedAccount.getFirstNameLength(), account.getFirstNameLength());
Assert.assertEquals(retrievedAccount.getEmail(), account.getEmail());
Assert.assertEquals(retrievedAccount.getBillCycleDayLocal(), account.getBillCycleDayLocal());
Assert.assertEquals(retrievedAccount.getCurrency(), account.getCurrency());
Assert.assertEquals(retrievedAccount.getPaymentMethodId(), account.getPaymentMethodId());
origin: killbill/killbill

if (currentAccount.getBillCycleDayLocal() == DEFAULT_BILLING_CYCLE_DAY_LOCAL && // There is *not* already a BCD set
  accountData.setBillCycleDayLocal(currentAccount.getBillCycleDayLocal());
origin: org.kill-bill.billing/killbill-account

currentAccount.getBillCycleDayLocal() != DEFAULT_BILLING_CYCLE_DAY_LOCAL && // There is already a BCD set
!currentAccount.getBillCycleDayLocal().equals(billCycleDayLocal)) { // and it does not match we we have
throw new IllegalArgumentException(String.format("Killbill doesn't support updating the account BCD yet: new=%s, current=%s", billCycleDayLocal, currentAccount.getBillCycleDayLocal()));
origin: org.kill-bill.billing.plugin.java/killbill-base-plugin

public static Account buildAccount(final Currency currency, final String address1, final String address2, final String city, final String stateOrProvince, final String postalCode, final String country) {
  final Account account = Mockito.mock(Account.class);
  Mockito.when(account.getId()).thenReturn(UUID.randomUUID());
  Mockito.when(account.getExternalKey()).thenReturn(UUID.randomUUID().toString());
  Mockito.when(account.getName()).thenReturn(UUID.randomUUID().toString());
  Mockito.when(account.getFirstNameLength()).thenReturn(4);
  Mockito.when(account.getEmail()).thenReturn(UUID.randomUUID().toString());
  Mockito.when(account.getBillCycleDayLocal()).thenReturn(2);
  Mockito.when(account.getCurrency()).thenReturn(currency);
  Mockito.when(account.getPaymentMethodId()).thenReturn(UUID.randomUUID());
  Mockito.when(account.getTimeZone()).thenReturn(DateTimeZone.getDefault());
  // Return language tag to be able to use Locale.forLanguageTag
  Mockito.when(account.getLocale()).thenReturn("en-US");
  Mockito.when(account.getAddress1()).thenReturn(address1);
  Mockito.when(account.getAddress2()).thenReturn(address2);
  Mockito.when(account.getCompanyName()).thenReturn(UUID.randomUUID().toString());
  Mockito.when(account.getCity()).thenReturn(city);
  Mockito.when(account.getStateOrProvince()).thenReturn(stateOrProvince);
  Mockito.when(account.getPostalCode()).thenReturn(postalCode);
  Mockito.when(account.getCountry()).thenReturn(country);
  Mockito.when(account.getPhone()).thenReturn(UUID.randomUUID().toString().substring(0, 25));
  Mockito.when(account.isMigrated()).thenReturn(true);
  Mockito.when(account.getCreatedDate()).thenReturn(new DateTime(2016, 1, 22, 10, 56, 47, DateTimeZone.UTC));
  Mockito.when(account.getUpdatedDate()).thenReturn(new DateTime(2016, 1, 22, 10, 56, 48, DateTimeZone.UTC));
  return account;
}
origin: org.kill-bill.billing/killbill-payment

Mockito.when(accountData.getEmail()).thenReturn(email);
Mockito.when(accountData.getCurrency()).thenReturn(Currency.USD);
Mockito.when(accountData.getBillCycleDayLocal()).thenReturn(1);
Mockito.when(accountData.isMigrated()).thenReturn(false);
Mockito.when(accountData.getTimeZone()).thenReturn(DateTimeZone.UTC);
origin: org.kill-bill.billing/killbill-beatrix

@Test(groups = "slow")
public void testOutOfDaylightSavingTransition1() throws Exception {
  // Transition out of daylight saving is set for Nov 5
  //
  // Because we use 30 days trial, we start a bit before and that way we can check that computation of BCD crossing out of of daylight saving works as expected.
  //
  final DateTimeZone tz = DateTimeZone.forID("America/Los_Angeles");
  clock.setTime(new DateTime(2017, 11, 1, 00, 30, 0, tz));
  final AccountData accountData = new MockAccountBuilder().currency(Currency.USD)
                              .timeZone(tz)
                              .referenceTime(clock.getUTCNow())
                              .build();
  // Create account with non BCD to force junction BCD logic to activate
  final Account account = createAccountWithNonOsgiPaymentMethod(accountData);
  createBaseEntitlementAndCheckForCompletion(account.getId(), "bundleKey", "Pistol", ProductCategory.BASE, BillingPeriod.MONTHLY,  NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
  final Account accountWithBCD = accountUserApi.getAccountById(account.getId(), callContext);
  assertEquals(accountWithBCD.getBillCycleDayLocal().intValue(), 1);
  busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
  clock.addDays(30);
  assertListenerStatus();
  final List<ExpectedInvoiceItemCheck> expectedInvoices = new ArrayList<ExpectedInvoiceItemCheck>();
  expectedInvoices.add(new ExpectedInvoiceItemCheck(new LocalDate(2017, 12, 1), new LocalDate(2018, 1, 1), InvoiceItemType.RECURRING, new BigDecimal("29.95")));
  invoiceChecker.checkInvoice(account.getId(), 2, callContext, expectedInvoices);
  expectedInvoices.clear();
}
origin: org.kill-bill.billing/killbill-beatrix

@Test(groups = "slow")
public void testIntoDaylightSavingTransition() throws Exception {
  // Daylight saving happened on March 12th.
  //
  // Because we use 30 days trial, we start a bit before and that way we can check that computation of BCD crossing into daylight saving works as expected.
  //
  final DateTimeZone tz = DateTimeZone.forID("America/Los_Angeles");
  clock.setTime(new DateTime(2017, 3, 1, 23, 30, 0, tz));
  final AccountData accountData = new MockAccountBuilder().currency(Currency.USD)
                              .referenceTime(clock.getUTCNow())
                              .timeZone(tz)
                              .build();
  // Create account with non BCD to force junction BCD logic to activate
  final Account account = createAccountWithNonOsgiPaymentMethod(accountData);
  createBaseEntitlementAndCheckForCompletion(account.getId(), "bundleKey", "Pistol", ProductCategory.BASE, BillingPeriod.MONTHLY,  NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
  final Account accountWithBCD = accountUserApi.getAccountById(account.getId(), callContext);
  assertEquals(accountWithBCD.getBillCycleDayLocal().intValue(), 31);
  busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
  clock.addDays(30);
  assertListenerStatus();
  final List<ExpectedInvoiceItemCheck> expectedInvoices = new ArrayList<ExpectedInvoiceItemCheck>();
  expectedInvoices.add(new ExpectedInvoiceItemCheck(new LocalDate(2017, 3, 31), new LocalDate(2017, 4, 30), InvoiceItemType.RECURRING, new BigDecimal("29.95")));
  invoiceChecker.checkInvoice(account.getId(), 2, callContext, expectedInvoices);
  expectedInvoices.clear();
}
origin: org.kill-bill.billing/killbill-account

@Override
public void updateBCD(final String externalKey, final int bcd,
           final InternalCallContext context) throws AccountApiException {
  final Account currentAccount = getAccountByKey(externalKey, context);
  if (currentAccount == null) {
    throw new AccountApiException(ErrorCode.ACCOUNT_DOES_NOT_EXIST_FOR_KEY, externalKey);
  }
  if (currentAccount.getBillCycleDayLocal() != DefaultMutableAccountData.DEFAULT_BILLING_CYCLE_DAY_LOCAL) {
    throw new AccountApiException(ErrorCode.ACCOUNT_UPDATE_FAILED);
  }
  final MutableAccountData mutableAccountData = currentAccount.toMutableAccountData();
  mutableAccountData.setBillCycleDayLocal(bcd);
  final AccountModelDao accountToUpdate = new AccountModelDao(currentAccount.getId(), mutableAccountData);
  bcdCacheController.remove(currentAccount.getId());
  bcdCacheController.putIfAbsent(currentAccount.getId(), new Integer(bcd));
  accountDao.update(accountToUpdate, true, context);
}
origin: org.kill-bill.billing/killbill-beatrix

assertEquals(account.getBillCycleDayLocal(), (Integer) 0);
assertEquals(accountUserApi.getAccountById(account.getId(), callContext).getBillCycleDayLocal(), (Integer) 30);
origin: org.kill-bill.billing/killbill-beatrix

  public Account checkAccount(final UUID accountId, final AccountData accountData, final CallContext context) throws Exception {

    final Account account = accountApi.getAccountById(accountId, context);
    // Not all test pass it, since this is always the same test
    if (accountData != null) {
      Assert.assertEquals(account.getName(), accountData.getName());
      Assert.assertEquals(account.getFirstNameLength(), accountData.getFirstNameLength());
      Assert.assertEquals(account.getEmail(), accountData.getEmail());
      Assert.assertEquals(account.getPhone(), accountData.getPhone());
      Assert.assertEquals(account.getExternalKey(), accountData.getExternalKey());
      Assert.assertEquals(account.getBillCycleDayLocal(), accountData.getBillCycleDayLocal());
      Assert.assertEquals(account.getCurrency(), accountData.getCurrency());
      Assert.assertEquals(account.getTimeZone(), accountData.getTimeZone());
      // createWithPaymentMethod will update the paymentMethod
      //Assert.assertEquals(account.getPaymentMethodId(), accountData.getPaymentMethodId());
    }

    auditChecker.checkAccountCreated(account, context);
    return account;
  }
}
origin: org.kill-bill.billing/killbill-beatrix

@Test(groups = "slow")
public void testCancelSubscriptionAfterTrialWith_START_OF_TERM() throws Exception {
  final LocalDate initialDate = new LocalDate(2015, 8, 1);
  clock.setDay(initialDate);
  Account account = createAccountWithNonOsgiPaymentMethod(getAccountData(0));
  final PlanPhaseSpecifier spec = new PlanPhaseSpecifier("Shotgun", BillingPeriod.ANNUAL, PriceListSet.DEFAULT_PRICELIST_NAME, null);
  busHandler.pushExpectedEvents(NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE);
  final UUID createdEntitlementId = entitlementApi.createBaseEntitlement(account.getId(), new DefaultEntitlementSpecifier(spec), account.getExternalKey(), initialDate, initialDate, false, true, ImmutableList.<PluginProperty>of(), callContext);
  final Entitlement createdEntitlement = entitlementApi.getEntitlementForId(createdEntitlementId, callContext);
  assertEquals(createdEntitlement.getEffectiveStartDate().compareTo(initialDate), 0);
  assertEquals(createdEntitlement.getEffectiveEndDate(), null);
  assertListenerStatus();
  // Move out of trial : 2015-8-31
  busHandler.pushExpectedEvents(NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
  clock.addDays(30);
  assertListenerStatus();
  // SUBSCRIPTION alignment: no account BCD
  account = accountUserApi.getAccountById(account.getId(), callContext);
  Assert.assertEquals(account.getBillCycleDayLocal().intValue(), 0);
  // Move clock a bit to make sure START_OF_TERM brings us back to last Phase date : 2015-9-5
  clock.addDays(5);
  busHandler.pushExpectedEvents(NextEvent.CANCEL, NextEvent.BLOCK, NextEvent.INVOICE);
  final Entitlement cancelledEntitlement = createdEntitlement.cancelEntitlementWithPolicyOverrideBillingPolicy(EntitlementActionPolicy.IMMEDIATE, BillingActionPolicy.START_OF_TERM, null, callContext);
  assertListenerStatus();
  final Subscription subscription = subscriptionApi.getSubscriptionForEntitlementId(cancelledEntitlement.getId(), callContext);
  assertEquals(subscription.getEffectiveEndDate().compareTo(new LocalDate(2015, 9, 5)), 0);
  assertEquals(subscription.getBillingEndDate().compareTo(new LocalDate(2015, 8, 31)), 0);
}
origin: org.kill-bill.billing/killbill-jaxrs

public AccountJson(final Account account, final BigDecimal accountBalance, final BigDecimal accountCBA, @Nullable final AccountAuditLogs accountAuditLogs) {
  super(toAuditLogJson(accountAuditLogs == null ? null : accountAuditLogs.getAuditLogsForAccount()));
  this.accountCBA = accountCBA;
  this.accountBalance = accountBalance;
  this.accountId = account.getId();
  this.externalKey = account.getExternalKey();
  this.name = account.getName();
  this.firstNameLength = account.getFirstNameLength();
  this.email = account.getEmail();
  this.billCycleDayLocal = account.getBillCycleDayLocal();
  this.currency = account.getCurrency();
  this.parentAccountId = account.getParentAccountId();
  this.isPaymentDelegatedToParent = account.isPaymentDelegatedToParent();
  this.paymentMethodId = account.getPaymentMethodId();
  this.referenceTime = account.getReferenceTime();
  this.timeZone = account.getTimeZone() != null ? account.getTimeZone().toString() : null;
  this.address1 = account.getAddress1();
  this.address2 = account.getAddress2();
  this.postalCode = account.getPostalCode();
  this.company = account.getCompanyName();
  this.city = account.getCity();
  this.state = account.getStateOrProvince();
  this.country = account.getCountry();
  this.locale = account.getLocale();
  this.phone = account.getPhone();
  this.notes = account.getNotes();
  this.isMigrated = account.isMigrated();
}
org.killbill.billing.account.apiAccountgetBillCycleDayLocal

Popular methods of Account

  • getId
  • getExternalKey
  • getTimeZone
  • getEmail
  • getName
  • getCurrency
  • getFirstNameLength
  • getPhone
  • getReferenceTime
  • getLocale
  • getParentAccountId
  • getPaymentMethodId
  • getParentAccountId,
  • getPaymentMethodId,
  • isPaymentDelegatedToParent,
  • getAddress1,
  • getAddress2,
  • getCity,
  • getCompanyName,
  • getCountry,
  • getPostalCode

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • getExternalFilesDir (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JButton (javax.swing)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Runner (org.openjdk.jmh.runner)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now