Tabnine Logo
MockAccountBuilder
Code IndexAdd Tabnine to your IDE (free)

How to use
MockAccountBuilder
in
org.killbill.billing.mock

Best Java code snippets using org.killbill.billing.mock.MockAccountBuilder (Showing top 20 results out of 315)

origin: killbill/killbill

public AccountData initAccountData(final Clock clock) {
  final AccountData accountData = new MockAccountBuilder().name(UUIDs.randomUUID().toString().substring(1, 8))
                              .firstNameLength(6)
                              .email(UUIDs.randomUUID().toString().substring(1, 8))
                              .phone(UUIDs.randomUUID().toString().substring(1, 8))
                              .migrated(false)
                              .externalKey(UUIDs.randomUUID().toString())
                              .billingCycleDayLocal(1)
                              .currency(Currency.USD)
                              .paymentMethodId(UUIDs.randomUUID())
                              .referenceTime(clock.getUTCNow())
                              .timeZone(DateTimeZone.forID("Europe/Paris"))
                              .build();
  assertNotNull(accountData);
  return accountData;
}
origin: killbill/killbill

@Override
public Account createAccount(final AccountData data, final CallContext context) throws AccountApiException {
  final Account result = new MockAccountBuilder(data).build();
  accounts.add(result);
  return result;
}
origin: killbill/killbill

  private void createAccountAndRefreshTimeAwareContext(final DateTimeZone dateTimeZone, final DateTime referenceDateTime) throws AccountApiException {
    final Account accountData = new MockAccountBuilder().externalKey(UUID.randomUUID().toString())
                              .timeZone(dateTimeZone)
                              .createdDate(referenceDateTime)
                              .build();

    GuicyKillbillTestSuiteNoDB.createMockAccount(accountData,
                           accountUserApi,
                           accountInternalApi,
                           immutableAccountInternalApi,
                           nonEntityDao,
                           clock,
                           internalCallContextFactory,
                           callContext,
                           internalCallContext);
  }
}
origin: killbill/killbill

                  final String phone,
                  final String notes) {
final Account result = new MockAccountBuilder(id)
    .externalKey(externalKey)
    .email(email)
    .name(name).firstNameLength(firstNameLength)
    .currency(currency)
    .billingCycleDayLocal(billCycleDayLocal)
    .paymentMethodId(paymentMethodId)
    .timeZone(timeZone)
    .locale(locale)
    .address1(address1)
    .address2(address2)
    .companyName(companyName)
    .city(city)
    .stateOrProvince(stateOrProvince)
    .country(country)
    .postalCode(postalCode)
    .phone(phone)
    .notes(notes)
    .build();
accounts.add(result);
return result;
origin: killbill/killbill

public MockAccountBuilder(final AccountData data) {
  this.address1(data.getAddress1());
  this.address2(data.getAddress2());
  this.billingCycleDayLocal(data.getBillCycleDayLocal());
  this.city(data.getCity());
  this.companyName(data.getCompanyName());
  this.country(data.getCountry());
  this.currency(data.getCurrency());
  this.parentAccountId(data.getParentAccountId());
  this.isPaymentDelegatedToParent(data.isPaymentDelegatedToParent());
  this.email(data.getEmail());
  this.externalKey(data.getExternalKey());
  this.firstNameLength(data.getFirstNameLength());
  this.locale(data.getLocale());
  this.migrated(data.isMigrated());
  this.name(data.getName());
  this.paymentMethodId(data.getPaymentMethodId());
  this.phone(data.getPhone());
  this.notes(data.getNotes());
  this.postalCode(data.getPostalCode());
  this.stateOrProvince(data.getStateOrProvince());
  this.referenceTime(data.getReferenceTime());
  this.timeZone(data.getTimeZone());
  if (data instanceof Account) {
    this.id = ((Account) data).getId();
    this.createdDate(((Account) data).getCreatedDate());
    this.updatedDate(((Account) data).getUpdatedDate());
  } else {
    this.id = UUID.randomUUID();
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: killbill/killbill

Assert.assertEquals(history1.getLocale(), createdAccount.getLocale());
final AccountData accountData = new MockAccountBuilder(new DefaultAccount(account)).migrated(false)
                                          .locale("FR-CA")
                                          .build();
final AccountModelDao updatedAccount = new AccountModelDao(account.getId(), accountData);
accountDao.update(updatedAccount, true, internalCallContext);
Assert.assertEquals(history2.getLocale(), retrievedAccount.getLocale());
final AccountData accountData2 = new MockAccountBuilder(new DefaultAccount(updatedAccount)).locale("en_US")
                                              .build();
final AccountModelDao updatedAccount2 = new AccountModelDao(account.getId(), accountData2);
accountDao.update(updatedAccount2, true, internalCallContext);
origin: org.kill-bill.billing/killbill-payment

public UUID addTestPaymentMethod(final String pluginName, final Account account, final PaymentMethodPlugin paymentMethodInfo, final Iterable<PluginProperty> pluginProperties) throws Exception {
  final boolean setDefault = paymentMethodInfo.isDefaultPaymentMethod();
  final UUID paymentMethodId = paymentApi.addPaymentMethod(account, paymentMethodInfo.getExternalPaymentMethodId(), pluginName, setDefault, paymentMethodInfo, pluginProperties, context);
  if (isFastTest() && setDefault) {
    final Account account1 = new MockAccountBuilder(account).paymentMethodId(paymentMethodId).build();
    accountApi.updateAccount(account1, context);
  }
  return paymentMethodId;
}
origin: org.kill-bill.billing/killbill-util

public MockAccountBuilder(final AccountData data) {
  this.address1(data.getAddress1());
  this.address2(data.getAddress2());
  this.billingCycleDayLocal(data.getBillCycleDayLocal());
  this.city(data.getCity());
  this.companyName(data.getCompanyName());
  this.country(data.getCountry());
  this.currency(data.getCurrency());
  this.parentAccountId(data.getParentAccountId());
  this.isPaymentDelegatedToParent(data.isPaymentDelegatedToParent());
  this.email(data.getEmail());
  this.externalKey(data.getExternalKey());
  this.firstNameLength(data.getFirstNameLength());
  this.locale(data.getLocale());
  this.migrated(data.isMigrated());
  this.name(data.getName());
  this.paymentMethodId(data.getPaymentMethodId());
  this.phone(data.getPhone());
  this.notes(data.getNotes());
  this.postalCode(data.getPostalCode());
  this.stateOrProvince(data.getStateOrProvince());
  this.referenceTime(data.getReferenceTime());
  this.timeZone(data.getTimeZone());
  if (data instanceof Account) {
    this.id = ((Account) data).getId();
    this.createdDate(((Account) data).getCreatedDate());
    this.updatedDate(((Account) data).getUpdatedDate());
  } else {
    this.id = UUID.randomUUID();
origin: org.kill-bill.billing/killbill-util

                  final String phone,
                  final String notes) {
final Account result = new MockAccountBuilder(id)
    .externalKey(externalKey)
    .email(email)
    .name(name).firstNameLength(firstNameLength)
    .currency(currency)
    .billingCycleDayLocal(billCycleDayLocal)
    .paymentMethodId(paymentMethodId)
    .timeZone(timeZone)
    .locale(locale)
    .address1(address1)
    .address2(address2)
    .companyName(companyName)
    .city(city)
    .stateOrProvince(stateOrProvince)
    .country(country)
    .postalCode(postalCode)
    .phone(phone)
    .notes(notes)
    .build();
accounts.add(result);
return result;
origin: killbill/killbill

  private void refreshCallContext(final DateTime effectiveDateTime, final DateTimeZone timeZone) {
    final Account account = new MockAccountBuilder().timeZone(timeZone)
                            .createdDate(effectiveDateTime)
                            .referenceTime(effectiveDateTime)
                            .build();
    internalCallContext.setFixedOffsetTimeZone(AccountDateTimeUtils.getFixedOffsetTimeZone(account));
    internalCallContext.setReferenceTime(account.getReferenceTime());
  }
}
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-util

@Override
public Account createAccount(final AccountData data, final CallContext context) throws AccountApiException {
  final Account result = new MockAccountBuilder(data).build();
  accounts.add(result);
  return result;
}
origin: org.kill-bill.billing/killbill-entitlement

protected AccountData getAccountData(final int billingDay) {
  return new MockAccountBuilder().name(UUID.randomUUID().toString().substring(1, 8))
                  .firstNameLength(6)
                  .email(UUID.randomUUID().toString().substring(1, 8))
                  .phone(UUID.randomUUID().toString().substring(1, 8))
                  .migrated(false)
                  .externalKey(UUID.randomUUID().toString().substring(1, 8))
                  .billingCycleDayLocal(billingDay)
                  .currency(Currency.USD)
                  .paymentMethodId(UUID.randomUUID())
                  .referenceTime(clock.getUTCNow())
                  .timeZone(DateTimeZone.UTC)
                  .build();
}
origin: org.kill-bill.billing/killbill-entitlement

  private void createAccount(final DateTimeZone dateTimeZone, final DateTime referenceDateTime) throws AccountApiException {
    final Account accountData = new MockAccountBuilder().externalKey(UUID.randomUUID().toString())
                              .timeZone(dateTimeZone)
                              .referenceTime(referenceDateTime)
                              .createdDate(referenceDateTime)
                              .build();

    GuicyKillbillTestSuiteNoDB.createMockAccount(accountData,
                           accountUserApi,
                           accountInternalApi,
                           immutableAccountInternalApi,
                           nonEntityDao,
                           clock,
                           internalCallContextFactory,
                           callContext,
                           internalCallContext);
  }
}
origin: org.kill-bill.billing/killbill-beatrix

clock.setTime(new DateTime(2016, 11, 5, 23, 30, 0, tz));
final AccountData accountData = new MockAccountBuilder().currency(Currency.USD)
                            .referenceTime(clock.getUTCNow())
                            .timeZone(tz)
                            .build();
origin: org.kill-bill.billing/killbill-beatrix

protected AccountData getChildAccountData(final int billingDay, final UUID parentAccountId, final boolean isPaymentDelegatedToParent) {
  return new MockAccountBuilder().name(UUID.randomUUID().toString().substring(1, 8))
                  .firstNameLength(6)
                  .email(UUID.randomUUID().toString().substring(1, 8))
                  .phone(UUID.randomUUID().toString().substring(1, 8))
                  .migrated(false)
                  .externalKey(UUID.randomUUID().toString().substring(1, 8))
                  .billingCycleDayLocal(billingDay)
                  .currency(Currency.USD)
                  .paymentMethodId(UUID.randomUUID())
                  .referenceTime(clock.getUTCNow())
                  .timeZone(DateTimeZone.UTC)
                  .parentAccountId(parentAccountId)
                  .isPaymentDelegatedToParent(isPaymentDelegatedToParent)
                  .build();
}
origin: org.kill-bill.billing/killbill-util

  private void createAccountAndRefreshTimeAwareContext(final DateTimeZone dateTimeZone, final DateTime referenceDateTime) throws AccountApiException {
    final Account accountData = new MockAccountBuilder().externalKey(UUID.randomUUID().toString())
                              .timeZone(dateTimeZone)
                              .createdDate(referenceDateTime)
                              .build();

    GuicyKillbillTestSuiteNoDB.createMockAccount(accountData,
                           accountUserApi,
                           accountInternalApi,
                           immutableAccountInternalApi,
                           nonEntityDao,
                           clock,
                           internalCallContextFactory,
                           callContext,
                           internalCallContext);
  }
}
origin: org.kill-bill.billing/killbill-beatrix

@Test(groups = "slow")
public void testIntoDaylightSavingTransition3() throws Exception {
  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)
                              .timeZone(tz)
                              .referenceTime(clock.getUTCNow())
                              .build();
  // Create account with non BCD to force junction BCD logic to activate
  final Account account = createAccountWithNonOsgiPaymentMethod(accountData);
  final PlanPhaseSpecifier spec = new PlanPhaseSpecifier("pistol-monthly-notrial",null);
  busHandler.pushExpectedEvents(NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE, NextEvent.INVOICE_PAYMENT, NextEvent.PAYMENT);
  entitlementApi.createBaseEntitlement(account.getId(), new DefaultEntitlementSpecifier(spec), "bundleExternalKey", null, null, false, true, ImmutableList.<PluginProperty>of(), callContext);
  assertListenerStatus();
  busHandler.pushExpectedEvents(NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
  // Technically, we should see the invoice at the end of day in the account timezone, but this is not the case, the invoice comes slightly after (30')
  // clock.setTime(new DateTime(2017, 4, 1, 23, 59, 0, tz));
  //
  // But this is really not very important as long as invoicing is correct
  clock.addMonths(1);
  // Add one hour to hit the notification date of 2017-04-02T07:30:00.000Z
  clock.addDeltaFromReality(3600 * 1000);
  assertListenerStatus();
}
origin: org.kill-bill.billing/killbill-beatrix

protected AccountData getAccountData(@Nullable final Integer billingDay, final DateTimeZone tz) {
  final MockAccountBuilder builder = new MockAccountBuilder()
      .name(UUID.randomUUID().toString().substring(1, 8))
      .firstNameLength(6)
      .email(UUID.randomUUID().toString().substring(1, 8))
      .phone(UUID.randomUUID().toString().substring(1, 8))
      .migrated(false)
      .externalKey(UUID.randomUUID().toString().substring(1, 8))
      .currency(Currency.USD)
      .referenceTime(clock.getUTCNow())
      .timeZone(tz);
  if (billingDay != null) {
    builder.billingCycleDayLocal(billingDay);
  }
  return builder.build();
}
org.killbill.billing.mockMockAccountBuilder

Most used methods

  • <init>
  • build
  • migrated
  • paymentMethodId
  • billingCycleDayLocal
  • currency
  • email
  • externalKey
  • firstNameLength
  • name
  • phone
  • timeZone
  • phone,
  • timeZone,
  • referenceTime,
  • createdDate,
  • isPaymentDelegatedToParent,
  • locale,
  • parentAccountId,
  • address1,
  • address2,
  • city

Popular in Java

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • findViewById (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Notification (javax.management)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top plugins for WebStorm
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