Even if next catalog plan does not have an effectiveDateForExistingSubscriptions, a future plan still could and is ignored if we do not keep looking for one. Change loop to keep looking through all catalog versions to catch this scenario.
@@ -623,7 +623,8 @@ public class DefaultSubscriptionBase extends EntityBase implements SubscriptionB
// Iterate through all more recent version of the catalog to find possible effectiveDateForExistingSubscriptions transition for this Plan
Plan nextPlan = catalog.getNextPlanVersion(currentPlan);
- while (nextPlan != null && nextPlan.getEffectiveDateForExistingSubscriptions() != null) {
+ while (nextPlan != null ) {
+ if ( nextPlan.getEffectiveDateForExistingSubscriptions() != null) {
final DateTime nextEffectiveDate = new DateTime(nextPlan.getEffectiveDateForExistingSubscriptions()).toDateTime(DateTimeZone.UTC);
final PlanPhase nextPlanPhase = nextPlan.findPhase(planPhase.getName());
@@ -632,6 +633,7 @@ public class DefaultSubscriptionBase extends EntityBase implements SubscriptionB
final SubscriptionBillingEvent newBillingTransition = new DefaultSubscriptionBillingEvent(SubscriptionBaseTransitionType.CHANGE, nextPlan, nextPlanPhase, nextEffectiveDate,
cur.getTotalOrdering(), cur.getNextBillingCycleDayLocal(), catalogEffectiveDateForNextPlan);
candidatesCatalogChangeEvents.add(newBillingTransition);
+ }
nextPlan = catalog.getNextPlanVersion(nextPlan);
}
}
