@Override public void stopByUser(String subscriberNumber, ProgramType programType) { Subscription subscription = validation.validateSubscriptionToStop(subscriberNumber, programType); if (subscription != null) { subscription.setStatus(SubscriptionStatus.EXPIRED); for (ISubscriptionFlowProcess process : asList(campaign, persistence)) { if (process.stopByUser(subscription)) continue; break; } } }
Subscription rollOverSubscriptionFrom(Subscription subscription) { return subscription != null ? new Subscription( subscription.getSubscriber(), subscription.rollOverProgramType(), SubscriptionStatus.ACTIVE, new WeekAndDay( new Week(subscription.rollOverProgramType().getMinWeek()), new DateUtils().today()), DateUtil.now()) .updateCycleInfo(programMessageCycle) : null; }
@Override public void stopExpired(Subscription subscription) { subscription.setStatus(SubscriptionStatus.EXPIRED); for (ISubscriptionFlowProcess process : asList(campaign, persistence)) { if (process.stopExpired(subscription)) continue; break; } }
@Override public void start(Subscription subscription) { subscription.updateCycleInfo(programMessageCycle); for (ISubscriptionFlowProcess process : asList(validation, persistence, campaign)) { if (process.startFor(subscription)) continue; break; } }
@Override public void rollOverByEvent(Subscription subscription) { if (!subscription.canRollOff()) stopExpired(subscription); else performRollOver(subscription); }