@Override public void retainOrRollOver( String subscriberNumber, boolean retainExistingChildCareSubscription) { Subscription pregnancyProgramWaitingForRollOver = allSubscriptions.findBy( subscriberNumber, ProgramType.PREGNANCY, WAITING_FOR_ROLLOVER_RESPONSE); Subscription existingChildCare = allSubscriptions.findActiveSubscriptionFor(subscriberNumber, ProgramType.CHILDCARE); if (retainExistingChildCareSubscription) { for (ISubscriptionFlowProcess process : asList(validation, campaign, persistence)) { if (!process.retainExistingChildCare(pregnancyProgramWaitingForRollOver, existingChildCare)) break; } } else { for (ISubscriptionFlowProcess process : asList(validation, campaign, persistence)) { if (!process.rollOverToNewChildCareProgram( pregnancyProgramWaitingForRollOver, rollOverSubscriptionFrom(pregnancyProgramWaitingForRollOver), existingChildCare)) break; } } }
@Override public List<Subscription> activeSubscriptions(String subscriberNumber) { return allSubscriptions.getAllActiveSubscriptionsForSubscriber(subscriberNumber); }
@Override public Subscription findActiveSubscriptionFor(String subscriberNumber, String programName) { return allSubscriptions.findActiveSubscriptionFor(subscriberNumber, programName); }