public static String phaseName(final String planName, final PhaseType phasetype) { return planName + "-" + phasetype.toString().toLowerCase(); }
public static String planName(final String phaseName) throws CatalogApiException { for (final PhaseType type : PhaseType.values()) { if (phaseName.endsWith(type.toString().toLowerCase())) { return phaseName.substring(0, phaseName.length() - type.toString().length() - 1); } } throw new CatalogApiException(ErrorCode.CAT_BAD_PHASE_NAME, phaseName); }
errors.add(new ValidationError(String.format("Phase %s of plan %s has a recurring price but no billing period", type.toString(), plan.getName()), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString())); errors.add(new ValidationError(String.format("Phase %s of plan %s has a recurring price but no billing period", type.toString(), plan.getName()), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString())); type.toString(), plan.getName(), BillingPeriod.NO_BILLING_PERIOD), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString())); type.toString(), plan.getName()), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString())); type.toString(), plan.getName()), catalog.getCatalogURI(), DefaultPlanPhase.class, type.toString()));
UUID.randomUUID().toString(), SubscriptionBaseTransitionType.CREATE.toString(), PhaseType.DISCOUNT.toString(), auditLogs); final SubscriptionJson entitlementJsonWithEvents = new SubscriptionJson(accountId, bundleId, subscriptionId, externalKey,
final PhaseJson phaseJson = new PhaseJson(phase.getPhaseType().toString(), prices); phases.add(phaseJson);
@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()); }
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()); }
phase = thePhase.getPhaseType().toString(); } else { phase = null;
private SubscriptionBaseEvent createSubscriptionEvent(final DateTime effectiveDate, final String productName, final PhaseType phaseType, final ApiEventType apiEventType, final long activeVersion) { final ApiEventBuilder eventBuilder = new ApiEventBuilder(); eventBuilder.setEffectiveDate(effectiveDate); eventBuilder.setEventPlan(productName); eventBuilder.setEventPlanPhase(productName + "-" + phaseType.toString().toLowerCase()); eventBuilder.setEventPriceList(priceList); // We don't really use the following but the code path requires it eventBuilder.setRequestedDate(effectiveDate); eventBuilder.setFromDisk(true); eventBuilder.setActiveVersion(activeVersion); return new ApiEventBase(eventBuilder.setEventType(apiEventType)); }
phase = currentPhase.getPhaseType().toString(); } else { phase = null;