@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 Subscription findActiveSubscriptionFor(String subscriberNumber, String programName) { return allSubscriptions.findActiveSubscriptionFor(subscriberNumber, programName); }