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

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

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

origin: com.ning.billing/killbill-junction

private void checkFirstEvent(final SortedSet<BillingEvent> events, final Plan nextPlan,
               final int BCD, final UUID id, final DateTime time, final PlanPhase nextPhase, final String desc) throws CatalogApiException {
  Assert.assertEquals(events.size(), 1);
  checkEvent(events.first(), nextPlan, BCD, id, time, nextPhase, desc, nextPhase.getFixedPrice(), nextPhase.getRecurringPrice());
}
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-jaxrs

public PlanDetailJson(final Listing listing) {
  final Plan plan = listing.getPlan();
  if (plan == null) {
    this.productName = null;
    this.planName = null;
    this.billingPeriod = null;
    this.finalPhasePrice = ImmutableList.<PriceJson>of();
  } else {
    this.productName = plan.getProduct() == null ? null : plan.getProduct().getName();
    this.planName = plan.getName();
    this.billingPeriod = plan.getBillingPeriod();
    if (plan.getFinalPhase() == null || plan.getFinalPhase().getRecurringPrice() == null || plan.getFinalPhase().getRecurringPrice().getPrices() == null) {
      this.finalPhasePrice = ImmutableList.<PriceJson>of();
    } else {
      this.finalPhasePrice = Lists.transform(ImmutableList.<Price>copyOf(plan.getFinalPhase().getRecurringPrice().getPrices()),
                          new Function<Price, PriceJson>() {
                            @Override
                            public PriceJson apply(final Price price) {
                              try {
                                return new PriceJson(price);
                              } catch (CurrencyValueNull e) {
                                return new PriceJson(price.getCurrency().toString(), BigDecimal.ZERO);
                              }
                            }
                          });
    }
  }
  this.priceListName = listing.getPriceList() == null ? null : listing.getPriceList().getName();
}
origin: com.ning.billing/killbill-jaxrs

for (final PlanPhase phase : plan.getAllPhases()) {
  final List<PriceJson> prices = new LinkedList<PriceJson>();
  if (phase.getRecurringPrice() != null) {
    for (final Price price : phase.getRecurringPrice().getPrices()) {
      prices.add(new PriceJson(price));
origin: com.ning.billing/killbill-jaxrs

  @Test(groups = "fast")
  public void testFromListing() throws Exception {
    final Product product = Mockito.mock(Product.class);
    Mockito.when(product.getName()).thenReturn(UUID.randomUUID().toString());

    final InternationalPrice price = Mockito.mock(InternationalPrice.class);
    final PlanPhase planPhase = Mockito.mock(PlanPhase.class);
    Mockito.when(planPhase.getRecurringPrice()).thenReturn(price);

    final Plan plan = Mockito.mock(Plan.class);
    Mockito.when(plan.getProduct()).thenReturn(product);
    Mockito.when(plan.getName()).thenReturn(UUID.randomUUID().toString());
    Mockito.when(plan.getBillingPeriod()).thenReturn(BillingPeriod.QUARTERLY);
    Mockito.when(plan.getFinalPhase()).thenReturn(planPhase);

    final PriceList priceList = Mockito.mock(PriceList.class);
    Mockito.when(priceList.getName()).thenReturn(UUID.randomUUID().toString());

    final Listing listing = Mockito.mock(Listing.class);
    Mockito.when(listing.getPlan()).thenReturn(plan);
    Mockito.when(listing.getPriceList()).thenReturn(priceList);

    final PlanDetailJson planDetailJason = new PlanDetailJson(listing);
    Assert.assertEquals(planDetailJason.getProductName(), plan.getProduct().getName());
    Assert.assertEquals(planDetailJason.getPlanName(), plan.getName());
    Assert.assertEquals(planDetailJason.getBillingPeriod(), plan.getBillingPeriod());
    Assert.assertEquals(planDetailJason.getPriceListName(), priceList.getName());
    Assert.assertEquals(planDetailJason.getFinalPhasePrice().size(), 0);
  }
}
origin: com.ning.billing/killbill-catalog

final Plan newSubPlan3 = vc.findPlan("pistol-monthly", dt3, dt3);
Assert.assertEquals(newSubPlan1.getAllPhases()[1].getRecurringPrice().getPrice(Currency.USD), new BigDecimal("1.0"));
Assert.assertEquals(newSubPlan2.getAllPhases()[1].getRecurringPrice().getPrice(Currency.USD), new BigDecimal("2.0"));
Assert.assertEquals(newSubPlan214.getAllPhases()[1].getRecurringPrice().getPrice(Currency.USD), new BigDecimal("2.0"));
Assert.assertEquals(newSubPlan3.getAllPhases()[1].getRecurringPrice().getPrice(Currency.USD), new BigDecimal("3.0"));
final Plan exSubPlan3 = vc.findPlan("pistol-monthly", dt3, dt1);
Assert.assertEquals(exSubPlan2.getAllPhases()[1].getRecurringPrice().getPrice(Currency.USD), new BigDecimal("1.0"));
Assert.assertEquals(exSubPlan214.getAllPhases()[1].getRecurringPrice().getPrice(Currency.USD), new BigDecimal("2.0"));
Assert.assertEquals(exSubPlan3.getAllPhases()[1].getRecurringPrice().getPrice(Currency.USD), new BigDecimal("2.0"));
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-invoice

private BillingEvent createBillingEvent(final UUID subscriptionId, final UUID bundleId, final LocalDate startDate,
                    final Plan plan, final PlanPhase planPhase, final int billCycleDayLocal) throws CatalogApiException {
  final SubscriptionBase sub = createSubscription(subscriptionId, bundleId);
  final Currency currency = Currency.USD;
  return invoiceUtil.createMockBillingEvent(null, sub, startDate.toDateTimeAtStartOfDay(), plan, planPhase,
                       planPhase.getFixedPrice() == null ? null : planPhase.getFixedPrice().getPrice(currency),
                       planPhase.getRecurringPrice() == null ? null : planPhase.getRecurringPrice().getPrice(currency),
                       currency, planPhase.getBillingPeriod(),
                       billCycleDayLocal, BillingModeType.IN_ADVANCE, "Test", 1L, SubscriptionBaseTransitionType.CREATE);
}
origin: com.ning.billing/killbill-junction

@Test(groups = "fast")
public void testBillingEventsWithBlock() throws CatalogApiException, AccountApiException {
  final Plan nextPlan = catalog.findPlan("PickupTrialEvergreen10USD", clock.getUTCNow());
  final PlanPhase nextPhase = nextPlan.getAllPhases()[1];
  final DateTime now = createSubscriptionCreationEvent(nextPlan, nextPhase);
  final Account account = createAccount(32);
  blockingStateDao.setBlockingState(new DefaultBlockingState(bunId, BlockingStateType.SUBSCRIPTION_BUNDLE,  DISABLED_BUNDLE, "test", true, true, true, now.plusDays(1)), clock, internalCallContext);
  blockingStateDao.setBlockingState(new DefaultBlockingState(bunId, BlockingStateType.SUBSCRIPTION_BUNDLE, CLEAR_BUNDLE, "test", false, false, false, now.plusDays(2)), clock, internalCallContext);
  final SortedSet<BillingEvent> events = billingInternalApi.getBillingEventsForAccountAndUpdateAccountBCD(account.getId(), internalCallContext);
  Assert.assertEquals(events.size(), 3);
  final Iterator<BillingEvent> it = events.iterator();
  checkEvent(it.next(), nextPlan, account.getBillCycleDayLocal(), subId, now, nextPhase, SubscriptionBaseTransitionType.CREATE.toString(), nextPhase.getFixedPrice(), nextPhase.getRecurringPrice());
  checkEvent(it.next(), nextPlan, account.getBillCycleDayLocal(), subId, now.plusDays(1), nextPhase, SubscriptionBaseTransitionType.START_BILLING_DISABLED.toString(), null, null);
  checkEvent(it.next(), nextPlan, account.getBillCycleDayLocal(), subId, now.plusDays(2), nextPhase, SubscriptionBaseTransitionType.END_BILLING_DISABLED.toString(), nextPhase.getFixedPrice(), nextPhase.getRecurringPrice());
}
origin: com.ning.billing/killbill-analytics

if (thePhase.getRecurringPrice() != null) {
    tmpPrice = thePhase.getRecurringPrice().getPrice(USD);
  } catch (CatalogApiException e) {
    tmpPrice = new BigDecimal(0);
origin: com.ning.billing/killbill-analytics

if (currentPhase.getRecurringPrice() != null) {
    tmpPrice = currentPhase.getRecurringPrice().getPrice(USD);
  } catch (CatalogApiException e) {
    tmpPrice = new BigDecimal(0);
origin: com.ning.billing/killbill-junction

public DefaultBillingEvent(final Account account, final EffectiveSubscriptionInternalEvent transition, final SubscriptionBase subscription, final int billCycleDayLocal, final Currency currency, final Catalog catalog) throws CatalogApiException {
  this.account = account;
  this.billCycleDayLocal = billCycleDayLocal;
  this.subscription = subscription;
  effectiveDate = transition.getEffectiveTransitionTime();
  final String planPhaseName = (transition.getTransitionType() != SubscriptionBaseTransitionType.CANCEL) ?
      transition.getNextPhase() : transition.getPreviousPhase();
  planPhase = (planPhaseName != null) ? catalog.findPhase(planPhaseName, transition.getEffectiveTransitionTime(), transition.getSubscriptionStartDate()) : null;
  final String planName = (transition.getTransitionType() != SubscriptionBaseTransitionType.CANCEL) ?
      transition.getNextPlan() : transition.getPreviousPlan();
  plan = (planName != null) ? catalog.findPlan(planName, transition.getEffectiveTransitionTime(), transition.getSubscriptionStartDate()) : null;
  final String nextPhaseName = transition.getNextPhase();
  final PlanPhase nextPhase = (nextPhaseName != null) ? catalog.findPhase(nextPhaseName, transition.getEffectiveTransitionTime(), transition.getSubscriptionStartDate()) : null;
  final String prevPhaseName = transition.getPreviousPhase();
  final PlanPhase prevPhase = (prevPhaseName != null) ? catalog.findPhase(prevPhaseName, transition.getEffectiveTransitionTime(), transition.getSubscriptionStartDate()) : null;
  fixedPrice = (nextPhase != null && nextPhase.getFixedPrice() != null) ? nextPhase.getFixedPrice().getPrice(currency) : null;
  recurringPrice = (nextPhase != null && nextPhase.getRecurringPrice() != null) ? nextPhase.getRecurringPrice().getPrice(currency) : null;
  this.currency = currency;
  description = transition.getTransitionType().toString();
  billingModeType = BillingModeType.IN_ADVANCE;
  billingPeriod = (transition.getTransitionType() != SubscriptionBaseTransitionType.CANCEL) ?
      nextPhase.getBillingPeriod() : prevPhase.getBillingPeriod();
  type = transition.getTransitionType();
  totalOrdering = transition.getTotalOrdering();
  timeZone = account.getTimeZone();
}
com.ning.billing.catalog.apiPlanPhasegetRecurringPrice

Popular methods of PlanPhase

  • getName
  • getPhaseType
  • getBillingPeriod
  • getDuration
  • getFixedPrice
  • compliesWithLimits

Popular in Java

  • Start an intent from android
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • scheduleAtFixedRate (Timer)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top Vim plugins
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