Tabnine Logo
com.ning.billing.subscription.api.user
Code IndexAdd Tabnine to your IDE (free)

How to use com.ning.billing.subscription.api.user

Best Java code snippets using com.ning.billing.subscription.api.user (Showing top 20 results out of 315)

origin: com.ning.billing/killbill-entitlement

@Override
public UUID getBundleId() {
  return bundle.getId();
}
origin: com.ning.billing/killbill-entitlement

@Override
public String getBundleExternalKey() {
  return bundle.getExternalKey();
}
origin: com.ning.billing/killbill-subscription

public DefaultSubscriptionBase createSubscription(final SubscriptionBaseBundle bundle, final String productName, final BillingPeriod term, final String planSet, final DateTime requestedDate)
    throws SubscriptionBaseApiException {
  return createSubscriptionWithBundle(bundle.getId(), productName, term, planSet, requestedDate);
}
origin: com.ning.billing/killbill-subscription

@Test(groups = "fast")
public void testCreateSubscriptionAddOnIncluded() throws SubscriptionBaseApiException {
  final UUID accountId = UUID.randomUUID();
  final SubscriptionBaseBundle aoBundle = subscriptionInternalApi.createBundleForAccount(accountId, "myAOBundle", internalCallContext);
  testUtil.createSubscriptionWithBundle(aoBundle.getId(), "Assault-Rifle", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null);
  tCreateSubscriptionInternal(aoBundle.getId(), "Telescopic-Scope", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, ErrorCode.SUB_CREATE_AO_ALREADY_INCLUDED);
}
origin: com.ning.billing/killbill-subscription

@Test(groups = "fast")
public void testCreateSubscriptionBPExists() throws SubscriptionBaseApiException {
  testUtil.createSubscription(bundle, "Shotgun", BillingPeriod.ANNUAL, PriceListSet.DEFAULT_PRICELIST_NAME);
  tCreateSubscriptionInternal(bundle.getId(), "Shotgun", BillingPeriod.ANNUAL, PriceListSet.DEFAULT_PRICELIST_NAME, ErrorCode.SUB_CREATE_BP_EXISTS);
}
origin: com.ning.billing/killbill-subscription

@Test(groups = "fast")
public void testCreateSubscriptionBadCatalog() {
  // WRONG PRODUCTS
  tCreateSubscriptionInternal(bundle.getId(), null, BillingPeriod.ANNUAL, PriceListSet.DEFAULT_PRICELIST_NAME, ErrorCode.CAT_NULL_PRODUCT_NAME);
  tCreateSubscriptionInternal(bundle.getId(), "Whatever", BillingPeriod.ANNUAL, PriceListSet.DEFAULT_PRICELIST_NAME, ErrorCode.CAT_NO_SUCH_PRODUCT);
  // TODO: MARTIN TO FIX WITH CORRECT ERROR CODE. RIGHT NOW NPE
  // WRONG BILLING PERIOD
  tCreateSubscriptionInternal(bundle.getId(), "Shotgun", null, PriceListSet.DEFAULT_PRICELIST_NAME, ErrorCode.CAT_PLAN_NOT_FOUND);
  // WRONG PLAN SET
  tCreateSubscriptionInternal(bundle.getId(), "Shotgun", BillingPeriod.ANNUAL, "Whatever", ErrorCode.CAT_PRICE_LIST_NOT_FOUND);
}
origin: com.ning.billing/killbill-subscription

  @Test(groups = "slow")
  public void testSubscriptionWithAddOn() throws SubscriptionBaseApiException {
    final String productName = "Shotgun";
    final BillingPeriod term = BillingPeriod.ANNUAL;
    final String planSetName = PriceListSet.DEFAULT_PRICELIST_NAME;

    testListener.pushExpectedEvent(NextEvent.CREATE);

    final DefaultSubscriptionBase subscription = (DefaultSubscriptionBase) subscriptionInternalApi.createSubscription(bundle.getId(),
                                                             testUtil.getProductSpecifier(productName, planSetName, term, null), clock.getUTCNow(), internalCallContext);
    assertNotNull(subscription);

    assertListenerStatus();
  }
}
origin: com.ning.billing/killbill-subscription

  @Test(groups = "fast")
  public void testUncancelBadState() throws SubscriptionBaseApiException {
    final SubscriptionBase subscription = testUtil.createSubscription(bundle, "Shotgun", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME);

    try {
      subscription.uncancel(callContext);
    } catch (SubscriptionBaseApiException e) {
      assertEquals(e.getCode(), ErrorCode.SUB_UNCANCEL_BAD_STATE.getCode());
    }
    assertListenerStatus();
  }
}
origin: com.ning.billing/killbill-subscription

private List<SubscriptionBaseEvent> transferBundle(final DateTime migrateSubscriptionEventEffectiveDate, final DateTime migrateBillingEventEffectiveDate,
                          final DateTime transferDate) throws SubscriptionBaseTransferApiException {
  final ImmutableList<ExistingEvent> existingEvents = createMigrateEvents(migrateSubscriptionEventEffectiveDate, migrateBillingEventEffectiveDate);
  final SubscriptionBuilder subscriptionBuilder = new SubscriptionBuilder();
  final DefaultSubscriptionBase subscription = new DefaultSubscriptionBase(subscriptionBuilder);
  return transferApi.toEvents(existingEvents, subscription, transferDate, callContext);
}
origin: com.ning.billing/killbill-subscription

@Override
@BeforeMethod(groups = "fast")
public void beforeMethod() throws Exception {
  super.beforeMethod();
  test = new TestWithException();
  final DateTime startDate = clock.getUTCNow();
  baseSubscription = testUtil.createSubscription(bundle, baseProduct, BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, startDate);
}
origin: com.ning.billing/killbill-subscription

public static DateTime addDuration(final DateTime input, final List<Duration> durations) {
  return addOrRemoveDuration(input, durations, true);
}
origin: com.ning.billing/killbill-subscription

@Override
public void cancelSubscription(final DefaultSubscriptionBase subscription, final SubscriptionBaseEvent cancelEvent,
                final InternalCallContext context, final int seqId) {
  synchronized (events) {
    cancelNextPhaseEvent(subscription.getId(), context);
    insertEvent(cancelEvent, context);
  }
}
origin: com.ning.billing/killbill-subscription

@Test(groups = "slow")
public void testChangePlanBundleAlignIMM() throws SubscriptionBaseApiException {
  tChangePlanBundleAlignIMM("Shotgun", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, "Assault-Rifle", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME);
}
origin: com.ning.billing/killbill-subscription

@Test(groups = "fast")
public void testCreateSubscriptionAddOnNotAvailable() throws SubscriptionBaseApiException {
  final UUID accountId = UUID.randomUUID();
  final SubscriptionBaseBundle aoBundle = subscriptionInternalApi.createBundleForAccount(accountId, "myAOBundle", internalCallContext);
  testUtil.createSubscriptionWithBundle(aoBundle.getId(), "Pistol", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null);
  tCreateSubscriptionInternal(aoBundle.getId(), "Telescopic-Scope", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, ErrorCode.SUB_CREATE_AO_NOT_AVAILABLE);
}
origin: com.ning.billing/killbill-subscription

public DefaultSubscriptionBase createSubscription(final SubscriptionBaseBundle bundle, final String productName, final BillingPeriod term, final String planSet)
    throws SubscriptionBaseApiException {
  return createSubscriptionWithBundle(bundle.getId(), productName, term, planSet, null);
}
origin: com.ning.billing/killbill-subscription

@Test(groups = "fast")
public void testCreateSubscriptionNoBP() {
  tCreateSubscriptionInternal(bundle.getId(), "Telescopic-Scope", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, ErrorCode.SUB_CREATE_NO_BP);
}
origin: com.ning.billing/killbill-entitlement

public DefaultAccountEventsStreams(final Account account,
                  final Iterable<SubscriptionBaseBundle> bundles,
                  final Map<UUID, Collection<EventsStream>> eventsStreams) {
  this.account = account;
  this.eventsStreams = eventsStreams;
  for (final SubscriptionBaseBundle baseBundle : bundles) {
    this.bundles.put(baseBundle.getId(), baseBundle);
  }
}
origin: com.ning.billing/killbill-subscription

public static DateTime removeDuration(final DateTime input, final List<Duration> durations) {
  return addOrRemoveDuration(input, durations, false);
}
origin: com.ning.billing/killbill-subscription

@Override
public void createNextPhaseEvent(final DefaultSubscriptionBase subscription, final SubscriptionBaseEvent nextPhase, final InternalCallContext context) {
  cancelNextPhaseEvent(subscription.getId(), context);
  insertEvent(nextPhase, context);
}
origin: com.ning.billing/killbill-subscription

@Override
public SubscriptionBaseBundle getSubscriptionBundleFromId(final UUID bundleId, final InternalTenantContext context) {
  for (final SubscriptionBaseBundle cur : bundles) {
    if (cur.getId().equals(bundleId)) {
      return cur;
    }
  }
  return null;
}
com.ning.billing.subscription.api.user

Most used classes

  • SubscriptionBaseBundle
  • SubscriptionBaseApiException
  • SubscriptionBaseTransition
  • DefaultEffectiveSubscriptionEvent
  • DefaultSubscriptionBase
  • SubscriptionBaseTransitionData,
  • SubscriptionBuilder,
  • TestSubscriptionHelper$SubscriptionMigrationCaseWithCTD,
  • TestSubscriptionHelper$TestWithException,
  • TestSubscriptionHelper$TestWithExceptionCallback,
  • TestSubscriptionHelper,
  • TestUserApiAddOn,
  • TestUserApiCancel,
  • TestUserApiChangePlan,
  • TestUserApiCreate,
  • TestUserApiError,
  • TestUserApiRecreate
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