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

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

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

origin: killbill/killbill

@Override
public Account getAccountByKey(final String key, final TenantContext context) {
  for (final Account account : accounts) {
    if (key.equals(account.getExternalKey())) {
      return account;
    }
  }
  return null;
}
origin: killbill/killbill

@Override
public UUID getIdFromKey(final String externalKey, final TenantContext context) {
  for (final Account account : accounts) {
    if (externalKey.equals(account.getExternalKey())) {
      return account.getId();
    }
  }
  return null;
}
origin: killbill/killbill

currentAccount.getExternalKey() != null &&
!currentAccount.getExternalKey().equals(externalKey)) {
throw new IllegalArgumentException(String.format("Killbill doesn't support updating the account external key yet: new=%s, current=%s",
                         externalKey, currentAccount.getExternalKey()));
origin: killbill/killbill

public DefaultImmutableAccountData(final Account account) {
  this(account.getId(),
     account.getExternalKey(),
     account.getCurrency(),
     account.getTimeZone(),
     AccountDateTimeUtils.getFixedOffsetTimeZone(account),
     account.getReferenceTime());
}
origin: killbill/killbill

@Override
public Pagination<Account> searchAccounts(final String searchKey, final Long offset, final Long limit, final TenantContext tenantContext) {
  final List<Account> results = new LinkedList<Account>();
  for (final Account account : accounts) {
    if ((account.getName() != null && account.getName().contains(searchKey)) ||
      (account.getEmail() != null && account.getEmail().contains(searchKey)) ||
      (account.getExternalKey() != null && account.getExternalKey().contains(searchKey)) ||
      (account.getCompanyName() != null && account.getCompanyName().contains(searchKey))) {
      results.add(account);
    }
  }
  return DefaultPagination.<Account>build(offset, limit, accounts.size(), results);
}
origin: killbill/killbill

  public static Account createMockAccount(final AccountData accountData,
                      final AccountUserApi accountUserApi,
                      final AccountInternalApi accountInternalApi,
                      final ImmutableAccountInternalApi immutableAccountInternalApi,
                      final NonEntityDao nonEntityDao,
                      final Clock clock,
                      final InternalCallContextFactory internalCallContextFactory,
                      final MutableCallContext callContext,
                      final MutableInternalCallContext internalCallContext) throws AccountApiException {
    final Account account = accountUserApi.createAccount(accountData, callContext);

    Mockito.when(accountInternalApi.getAccountById(Mockito.<UUID>eq(account.getId()), Mockito.<InternalTenantContext>any())).thenReturn(account);
    Mockito.when(accountInternalApi.getAccountByRecordId(Mockito.<Long>eq(internalCallContext.getAccountRecordId()), Mockito.<InternalTenantContext>any())).thenReturn(account);
    Mockito.when(accountInternalApi.getAccountByKey(Mockito.<String>eq(account.getExternalKey()), Mockito.<InternalTenantContext>any())).thenReturn(account);
    Mockito.when(immutableAccountInternalApi.getImmutableAccountDataByRecordId(Mockito.<Long>eq(internalCallContext.getAccountRecordId()), Mockito.<InternalTenantContext>any())).thenReturn(account);

    ((MockNonEntityDao) nonEntityDao).addTenantRecordIdMapping(account.getId(), internalCallContext);
    ((MockNonEntityDao) nonEntityDao).addAccountRecordIdMapping(account.getId(), internalCallContext);

    refreshCallContext(account.getId(), clock, internalCallContextFactory, callContext, internalCallContext);

    return account;
  }
}
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

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.getName(), accountUpdates2.getName());
Assert.assertEquals(updatedAccount2.getFirstNameLength(), updatedAccount2.getFirstNameLength());
Assert.assertEquals(updatedAccount2.getExternalKey(), updatedAccount1.getExternalKey());
Assert.assertEquals(updatedAccount2.getCurrency(), updatedAccount1.getCurrency());
Assert.assertEquals(updatedAccount2.getBillCycleDayLocal(), updatedAccount1.getBillCycleDayLocal());
origin: killbill/killbill

  @Test(groups = "slow", description = "Test Account creation with same External Key in different tenants")
  public void testCreateAccountWithSameExternalKeyInDifferentTenants() throws Exception {
    final AccountData accountData = createAccountData();

    final Account account1 = accountUserApi.createAccount(accountData, callContext);
    try {
      // Same tenant
      accountUserApi.createAccount(accountData, callContext);
      Assert.fail();
    } catch (final AccountApiException e) {
      assertEquals(e.getCode(), ErrorCode.ACCOUNT_ALREADY_EXISTS.getCode());
    }

    final TenantSqlDao tenantSqlDao = dbi.onDemand(TenantSqlDao.class);
    final TenantModelDao tenant2 = new TenantModelDao();
    tenantSqlDao.create(tenant2, internalCallContext);
    final CallContext callContext2 = new DefaultCallContext(account1.getId(), tenant2.getId(), callContext.getUserName(), callContext.getCallOrigin(), callContext.getUserType(), callContext.getUserToken(), clock);
    final Account account2 = accountUserApi.createAccount(accountData, callContext2);

    Assert.assertEquals(account1.getExternalKey(), account2.getExternalKey());
    Assert.assertNotEquals(account1.getId(), account2.getId());
  }
}
origin: killbill/killbill

accountData.setExternalKey(currentAccount.getExternalKey());
origin: org.kill-bill.billing/killbill-util

@Override
public Account getAccountByKey(final String key, final TenantContext context) {
  for (final Account account : accounts) {
    if (key.equals(account.getExternalKey())) {
      return account;
    }
  }
  return null;
}
origin: org.kill-bill.billing/killbill-util

@Override
public UUID getIdFromKey(final String externalKey, final TenantContext context) {
  for (final Account account : accounts) {
    if (externalKey.equals(account.getExternalKey())) {
      return account.getId();
    }
  }
  return null;
}
origin: org.kill-bill.billing/killbill-payment

@Test(groups = "fast")
public void testPaymentMethodExternalKeySetByPluginIfNonSpecified() throws Exception {
  final Account account = Mockito.mock(Account.class);
  final UUID accountId = UUID.randomUUID();
  Mockito.when(account.getId()).thenReturn(accountId);
  Mockito.when(account.getExternalKey()).thenReturn(accountId.toString());
  final PaymentMethodPlugin paymentMethodPlugin = Mockito.mock(PaymentMethodPlugin.class);
  final Iterable<PluginProperty> properties = ImmutableList.<PluginProperty>of();
  // By default, the external payment plugin sets the external payment method id to "unknown"
  final UUID paymentMethodId2 = paymentMethodProcessor.addPaymentMethod(null, "__EXTERNAL_PAYMENT__", account, false, paymentMethodPlugin, properties, callContext, internalCallContext);
  final PaymentMethod paymentMethod2 = paymentMethodProcessor.getPaymentMethodById(paymentMethodId2, false, false, properties, callContext, internalCallContext);
  Assert.assertEquals(paymentMethod2.getExternalKey(), "unknown");
}
origin: org.kill-bill.billing/killbill-account

public DefaultImmutableAccountData(final Account account) {
  this(account.getId(),
     account.getExternalKey(),
     account.getCurrency(),
     account.getTimeZone(),
     AccountDateTimeUtils.getFixedOffsetTimeZone(account),
     account.getReferenceTime());
}
origin: org.kill-bill.billing/killbill-util

@Override
public Pagination<Account> searchAccounts(final String searchKey, final Long offset, final Long limit, final TenantContext tenantContext) {
  final List<Account> results = new LinkedList<Account>();
  for (final Account account : accounts) {
    if ((account.getName() != null && account.getName().contains(searchKey)) ||
      (account.getEmail() != null && account.getEmail().contains(searchKey)) ||
      (account.getExternalKey() != null && account.getExternalKey().contains(searchKey)) ||
      (account.getCompanyName() != null && account.getCompanyName().contains(searchKey))) {
      results.add(account);
    }
  }
  return DefaultPagination.<Account>build(offset, limit, accounts.size(), results);
}
origin: org.kill-bill.billing/killbill-entitlement

@Test(groups = "slow")
public void testCreateBaseWithEntitlementInThePast() throws AccountApiException, EntitlementApiException, SubscriptionApiException {
  final LocalDate initialDate = new LocalDate(2013, 8, 7);
  clock.setDay(initialDate);
  final Account account = createAccount(getAccountData(7));
  final LocalDate entitlementDate = initialDate.minusDays(3);
  final LocalDate billingDate = null;
  final PlanPhaseSpecifier spec = new PlanPhaseSpecifier("Shotgun",  BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null);
  testListener.pushExpectedEvents(NextEvent.BLOCK, NextEvent.CREATE);
  final UUID entitlementId = entitlementApi.createBaseEntitlement(account.getId(), new DefaultEntitlementSpecifier(spec), account.getExternalKey(), entitlementDate, billingDate, false, true, ImmutableList.<PluginProperty>of(), callContext);
  assertListenerStatus();
  final Entitlement entitlement = entitlementApi.getEntitlementForId(entitlementId, callContext);
  assertEquals(entitlement.getState(), EntitlementState.ACTIVE);
  assertEquals(entitlement.getEffectiveStartDate(), entitlementDate);
}
origin: org.kill-bill.billing/killbill-entitlement

@Test(groups = "slow")
public void testCreateBaseWithBillingInThePast() throws AccountApiException, EntitlementApiException, SubscriptionApiException {
  final LocalDate initialDate = new LocalDate(2013, 8, 7);
  clock.setDay(initialDate);
  final Account account = createAccount(getAccountData(7));
  final LocalDate entitlementDate = null;
  final LocalDate billingDate = initialDate.minusDays(5);
  final PlanPhaseSpecifier spec = new PlanPhaseSpecifier("Shotgun",  BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null);
  testListener.pushExpectedEvents(NextEvent.BLOCK, NextEvent.CREATE);
  final UUID entitlementId = entitlementApi.createBaseEntitlement(account.getId(), new DefaultEntitlementSpecifier(spec), account.getExternalKey(), entitlementDate, billingDate, false, true, ImmutableList.<PluginProperty>of(), callContext);
  assertListenerStatus();
  final Entitlement entitlement = entitlementApi.getEntitlementForId(entitlementId, callContext);
  assertEquals(entitlement.getState(), EntitlementState.ACTIVE);
  assertEquals(entitlement.getEffectiveStartDate(), initialDate);
}
origin: org.kill-bill.billing/killbill-entitlement

@Test(groups = "slow")
public void testCreateBaseWithDifferentInThePast() throws AccountApiException, EntitlementApiException, SubscriptionApiException {
  final LocalDate initialDate = new LocalDate(2013, 8, 7);
  clock.setDay(initialDate);
  final Account account = createAccount(getAccountData(7));
  final LocalDate entitlementDate = initialDate.minusDays(3);
  final LocalDate billingDate = initialDate.minusDays(5);
  final PlanPhaseSpecifier spec = new PlanPhaseSpecifier("Shotgun",  BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null);
  testListener.pushExpectedEvents(NextEvent.BLOCK, NextEvent.CREATE);
  final UUID entitlementId = entitlementApi.createBaseEntitlement(account.getId(), new DefaultEntitlementSpecifier(spec), account.getExternalKey(), entitlementDate, billingDate, false, true, ImmutableList.<PluginProperty>of(), callContext);
  assertListenerStatus();
  final Entitlement entitlement = entitlementApi.getEntitlementForId(entitlementId, callContext);
  assertEquals(entitlement.getState(), EntitlementState.ACTIVE);
  assertEquals(entitlement.getEffectiveStartDate(), entitlementDate);
}
org.killbill.billing.account.apiAccountgetExternalKey

Popular methods of Account

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

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getApplicationContext (Context)
  • getResourceAsStream (ClassLoader)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • 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