Tabnine Logo
PlanPhase.getPhaseType
Code IndexAdd Tabnine to your IDE (free)

How to use
getPhaseType
method
in
com.ning.billing.catalog.api.PlanPhase

Best Java code snippets using com.ning.billing.catalog.api.PlanPhase.getPhaseType (Showing top 20 results out of 315)

origin: com.ning.billing/killbill-subscription

private void checkChangePlan(final DefaultSubscriptionBase subscription, final String expProduct, final ProductCategory expCategory,
               final BillingPeriod expBillingPeriod, final PhaseType expPhase) {
  final Plan currentPlan = subscription.getCurrentPlan();
  assertNotNull(currentPlan);
  assertEquals(currentPlan.getProduct().getName(), expProduct);
  assertEquals(currentPlan.getProduct().getCategory(), expCategory);
  assertEquals(currentPlan.getBillingPeriod(), expBillingPeriod);
  final PlanPhase currentPhase = subscription.getCurrentPhase();
  assertNotNull(currentPhase);
  assertEquals(currentPhase.getPhaseType(), expPhase);
}
origin: com.ning.billing/killbill-junction

  initialPhaseType = null;
} else {
  initialPhaseType = initialPhase.getPhaseType();
origin: com.ning.billing/killbill-jaxrs

final PhaseJson phaseJson = new PhaseJson(phase.getPhaseType().toString(), prices);
phases.add(phaseJson);
origin: com.ning.billing/killbill-analytics

@Test(groups = "fast")
public void testConstructor() throws Exception {
  Assert.assertEquals(subscription.getRoundedMrr(), 0.0);
  Assert.assertEquals(subscription.getSlug(), phase.getName());
  Assert.assertEquals(subscription.getPhase(), phase.getPhaseType().toString());
  Assert.assertEquals(subscription.getBillingPeriod(), phase.getBillingPeriod());
  Assert.assertEquals(subscription.getPrice(), phase.getRecurringPrice().getPrice(null));
  Assert.assertEquals(subscription.getProductCategory(), product.getCategory());
  Assert.assertEquals(subscription.getProductName(), product.getName());
  Assert.assertEquals(subscription.getProductType(), product.getCatalogName());
  Assert.assertEquals(subscription.getStartDate(), isubscription.getStartDate());
}
origin: com.ning.billing/killbill-catalog

@Override
public DateTime dateOfFirstRecurringNonZeroCharge(final DateTime subscriptionStartDate, final PhaseType initialPhaseType) {
  DateTime result = subscriptionStartDate.toDateTime();
  boolean skipPhase = initialPhaseType == null ? false : true;
  for (final PlanPhase phase : getAllPhases()) {
    if (skipPhase) {
      if (phase.getPhaseType() != initialPhaseType) {
        continue;
      } else {
        skipPhase = false;
      }
    }
    if (phase.getRecurringPrice() == null || phase.getRecurringPrice().isZero()) {
      result = phase.getDuration().addToDateTime(result);
    } else {
      break;
    }
  }
  return result;
}
origin: com.ning.billing/killbill-analytics

public BusinessInvoiceItemModelDao(@Nullable final String externalKey, final InvoiceItem invoiceItem, @Nullable final Plan plan, @Nullable final PlanPhase planPhase) {
  this(invoiceItem.getAmount(), planPhase != null ? planPhase.getBillingPeriod().toString() : null, invoiceItem.getCreatedDate(), invoiceItem.getCurrency(),
     /* Populate end date for fixed items for convenience (null in invoice_items table) */
     (invoiceItem.getEndDate() == null && planPhase != null) ? invoiceItem.getStartDate().plus(planPhase.getDuration().toJodaPeriod()) : invoiceItem.getEndDate(),
     externalKey, invoiceItem.getInvoiceId(), invoiceItem.getId(), invoiceItem.getLinkedItemId(), invoiceItem.getInvoiceItemType().toString(),
     planPhase != null ? planPhase.getPhaseType().toString() : null, plan != null ? plan.getProduct().getCategory().toString() : null,
     plan != null ? plan.getProduct().getName() : null, plan != null ? plan.getProduct().getCatalogName() : null,
     planPhase != null ? planPhase.getName() : null, invoiceItem.getStartDate(), invoiceItem.getUpdatedDate());
}
origin: com.ning.billing/killbill-subscription

assertEquals(currentPhase.getPhaseType(), PhaseType.EVERGREEN);
origin: com.ning.billing/killbill-subscription

@Test(groups = "slow")
public void testSingleBasePlan() throws SubscriptionBaseMigrationApiException {
  final DateTime startDate = clock.getUTCNow().minusMonths(2);
  final DateTime beforeMigration = clock.getUTCNow();
  final AccountMigration toBeMigrated = testUtil.createAccountForMigrationWithRegularBasePlan(startDate);
  final DateTime afterMigration = clock.getUTCNow();
  testListener.pushExpectedEvent(NextEvent.MIGRATE_ENTITLEMENT);
  migrationApi.migrate(toBeMigrated, callContext);
  assertListenerStatus();
  final List<SubscriptionBaseBundle> bundles = subscriptionInternalApi.getBundlesForAccount(toBeMigrated.getAccountKey(), internalCallContext);
  assertEquals(bundles.size(), 1);
  final SubscriptionBaseBundle bundle = bundles.get(0);
  final List<SubscriptionBase> subscriptions = subscriptionInternalApi.getSubscriptionsForBundle(bundle.getId(), internalCallContext);
  assertEquals(subscriptions.size(), 1);
  final SubscriptionBase subscription = subscriptions.get(0);
  assertTrue(subscription.getStartDate().compareTo(startDate) == 0);
  assertEquals(subscription.getEndDate(), null);
  assertEquals(subscription.getCurrentPriceList().getName(), PriceListSet.DEFAULT_PRICELIST_NAME);
  assertEquals(subscription.getCurrentPhase().getPhaseType(), PhaseType.EVERGREEN);
  assertEquals(subscription.getState(), EntitlementState.ACTIVE);
  assertEquals(subscription.getCurrentPlan().getName(), "shotgun-annual");
  assertEquals(subscription.getChargedThroughDate(), startDate.plusYears(1));
  assertListenerStatus();
}
origin: com.ning.billing/killbill-subscription

assertEquals(currentPhase.getPhaseType(), PhaseType.EVERGREEN);
origin: com.ning.billing/killbill-subscription

assertEquals(subscription.getEndDate(), null);
assertEquals(subscription.getCurrentPriceList().getName(), PriceListSet.DEFAULT_PRICELIST_NAME);
assertEquals(subscription.getCurrentPhase().getPhaseType(), PhaseType.TRIAL);
assertEquals(subscription.getState(), EntitlementState.ACTIVE);
assertEquals(subscription.getCurrentPlan().getName(), "assault-rifle-monthly");
assertEquals(subscription.getEndDate(), null);
assertEquals(subscription.getCurrentPriceList().getName(), PriceListSet.DEFAULT_PRICELIST_NAME);
assertEquals(subscription.getCurrentPhase().getPhaseType(), PhaseType.EVERGREEN);
assertEquals(subscription.getState(), EntitlementState.ACTIVE);
assertEquals(subscription.getCurrentPlan().getName(), "assault-rifle-monthly");
origin: com.ning.billing/killbill-subscription

assertEquals(baseSubscription.getEndDate(), null);
assertEquals(baseSubscription.getCurrentPriceList().getName(), PriceListSet.DEFAULT_PRICELIST_NAME);
assertEquals(baseSubscription.getCurrentPhase().getPhaseType(), PhaseType.EVERGREEN);
assertEquals(baseSubscription.getState(), EntitlementState.ACTIVE);
assertEquals(baseSubscription.getCurrentPlan().getName(), "shotgun-annual");
assertEquals(aoSubscription.getEndDate(), null);
assertEquals(aoSubscription.getCurrentPriceList().getName(), PriceListSet.DEFAULT_PRICELIST_NAME);
assertEquals(aoSubscription.getCurrentPhase().getPhaseType(), PhaseType.DISCOUNT);
assertEquals(aoSubscription.getState(), EntitlementState.ACTIVE);
assertEquals(aoSubscription.getCurrentPlan().getName(), "telescopic-scope-monthly");
origin: com.ning.billing/killbill-subscription

assertEquals(currentPhase.getPhaseType(), PhaseType.TRIAL);
assertListenerStatus();
currentPhase = subscription.getCurrentPhase();
assertNotNull(currentPhase);
assertEquals(currentPhase.getPhaseType(), PhaseType.DISCOUNT);
currentPhase = subscription.getCurrentPhase();
assertNotNull(currentPhase);
assertEquals(currentPhase.getPhaseType(), PhaseType.EVERGREEN);
origin: com.ning.billing/killbill-subscription

assertEquals(subscription.getCurrentPhase().getPhaseType(), PhaseType.EVERGREEN);
assertEquals(subscription.getState(), EntitlementState.ACTIVE);
assertEquals(subscription.getCurrentPlan().getName(), "assault-rifle-monthly");
assertEquals(subscription.getCurrentPriceList().getName(), PriceListSet.DEFAULT_PRICELIST_NAME);
assertEquals(subscription.getCurrentPhase().getPhaseType(), PhaseType.EVERGREEN);
assertEquals(subscription.getState(), EntitlementState.ACTIVE);
assertEquals(subscription.getCurrentPlan().getName(), "shotgun-annual");
origin: com.ning.billing/killbill-subscription

assertEquals(newBaseSubscription.getCurrentPhase().getPhaseType(), PhaseType.TRIAL);
origin: com.ning.billing/killbill-subscription

@Test(groups = "slow")
public void testCreateWithInitialPhase() throws SubscriptionBaseApiException {
  final DateTime init = clock.getUTCNow();
  final String productName = "Shotgun";
  final BillingPeriod term = BillingPeriod.MONTHLY;
  final String planSetName = PriceListSet.DEFAULT_PRICELIST_NAME;
  testListener.pushExpectedEvent(NextEvent.CREATE);
  final DefaultSubscriptionBase subscription = (DefaultSubscriptionBase) subscriptionInternalApi.createSubscription(bundle.getId(),
                                                           testUtil.getProductSpecifier(productName, planSetName, term, PhaseType.EVERGREEN), clock.getUTCNow(), internalCallContext);
  assertNotNull(subscription);
  assertEquals(subscription.getActiveVersion(), SubscriptionEvents.INITIAL_VERSION);
  //assertEquals(subscription.getAccount(), account.getId());
  assertEquals(subscription.getBundleId(), bundle.getId());
  testUtil.assertDateWithin(subscription.getStartDate(), init, clock.getUTCNow());
  testUtil.assertDateWithin(subscription.getBundleStartDate(), init, clock.getUTCNow());
  final Plan currentPlan = subscription.getCurrentPlan();
  assertNotNull(currentPlan);
  assertEquals(currentPlan.getProduct().getName(), productName);
  assertEquals(currentPlan.getProduct().getCategory(), ProductCategory.BASE);
  assertEquals(currentPlan.getBillingPeriod(), BillingPeriod.MONTHLY);
  final PlanPhase currentPhase = subscription.getCurrentPhase();
  assertNotNull(currentPhase);
  assertEquals(currentPhase.getPhaseType(), PhaseType.EVERGREEN);
  assertListenerStatus();
}
origin: com.ning.billing/killbill-subscription

assertEquals(currentPhase.getPhaseType(), PhaseType.TRIAL);
assertListenerStatus();
origin: com.ning.billing/killbill-subscription

assertTrue(subscription.getStartDate().compareTo(startDate) == 0);
assertEquals(subscription.getCurrentPriceList().getName(), PriceListSet.DEFAULT_PRICELIST_NAME);
assertEquals(subscription.getCurrentPhase().getPhaseType(), PhaseType.EVERGREEN);
assertEquals(subscription.getState(), EntitlementState.ACTIVE);
assertEquals(subscription.getCurrentPlan().getName(), "assault-rifle-annual");
origin: com.ning.billing/killbill-subscription

@Test(groups = "slow")
public void testCancelSubscriptionEOTWithNoChargeThroughDate() throws SubscriptionBaseApiException {
  final String prod = "Shotgun";
  final BillingPeriod term = BillingPeriod.MONTHLY;
  final String planSet = PriceListSet.DEFAULT_PRICELIST_NAME;
  // CREATE
  final DefaultSubscriptionBase subscription = testUtil.createSubscription(bundle, prod, term, planSet);
  PlanPhase trialPhase = subscription.getCurrentPhase();
  assertEquals(trialPhase.getPhaseType(), PhaseType.TRIAL);
  // NEXT PHASE
  final DateTime expectedPhaseTrialChange = TestSubscriptionHelper.addDuration(subscription.getStartDate(), trialPhase.getDuration());
  testUtil.checkNextPhaseChange(subscription, 1, expectedPhaseTrialChange);
  // MOVE TO NEXT PHASE
  testListener.pushExpectedEvent(NextEvent.PHASE);
  final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
  clock.addDeltaFromReality(it.toDurationMillis());
  assertListenerStatus();
  trialPhase = subscription.getCurrentPhase();
  assertEquals(trialPhase.getPhaseType(), PhaseType.EVERGREEN);
  testListener.pushExpectedEvent(NextEvent.CANCEL);
  // CANCEL
  subscription.cancel(callContext);
  assertListenerStatus();
  final PlanPhase currentPhase = subscription.getCurrentPhase();
  assertNull(currentPhase);
  testUtil.checkNextPhaseChange(subscription, 0, null);
  assertListenerStatus();
}
origin: com.ning.billing/killbill-subscription

assertEquals(currentPhase.getPhaseType(), PhaseType.TRIAL);
origin: com.ning.billing/killbill-junction

protected int calculateBcd(final SubscriptionBaseBundle bundle, final SubscriptionBase subscription, final EffectiveSubscriptionInternalEvent transition, final Account account, final InternalCallContext context)
    throws CatalogApiException, AccountApiException, SubscriptionBaseApiException {
  final Catalog catalog = catalogService.getFullCatalog();
  final Plan prevPlan = (transition.getPreviousPlan() != null) ? catalog.findPlan(transition.getPreviousPlan(), transition.getEffectiveTransitionTime(), transition.getSubscriptionStartDate()) : null;
  final Plan nextPlan = (transition.getNextPlan() != null) ? catalog.findPlan(transition.getNextPlan(), transition.getEffectiveTransitionTime(), transition.getSubscriptionStartDate()) : null;
  final Plan plan = (transition.getTransitionType() != SubscriptionBaseTransitionType.CANCEL) ? nextPlan : prevPlan;
  final Product product = plan.getProduct();
  final PlanPhase prevPhase = (transition.getPreviousPhase() != null) ? catalog.findPhase(transition.getPreviousPhase(), transition.getEffectiveTransitionTime(), transition.getSubscriptionStartDate()) : null;
  final PlanPhase nextPhase = (transition.getNextPhase() != null) ? catalog.findPhase(transition.getNextPhase(), transition.getEffectiveTransitionTime(), transition.getSubscriptionStartDate()) : null;
  final PlanPhase phase = (transition.getTransitionType() != SubscriptionBaseTransitionType.CANCEL) ? nextPhase : prevPhase;
  final BillingAlignment alignment = catalog.billingAlignment(
      new PlanPhaseSpecifier(product.getName(),
                  product.getCategory(),
                  phase.getBillingPeriod(),
                  transition.getNextPriceList(),
                  phase.getPhaseType()),
      transition.getRequestedTransitionTime());
  return calculateBcdForAlignment(alignment, bundle, subscription, account, catalog, plan, context);
}
com.ning.billing.catalog.apiPlanPhasegetPhaseType

Popular methods of PlanPhase

  • getName
  • getRecurringPrice
  • getBillingPeriod
  • getDuration
  • getFixedPrice
  • compliesWithLimits

Popular in Java

  • Parsing JSON documents to java classes using gson
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Option (scala)
  • 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