private DateTime addOrRemoveDuration(final DateTime input, final Duration duration, final boolean add) { return add ? input.plus(duration.toJodaPeriod()) : input.minus(duration.toJodaPeriod()); } }
private Period getReevaluationInterval(final OverdueStateSet overdueStateSet, final OverdueState nextOverdueState) throws OverdueException { try { if (nextOverdueState.isClearState()) { return overdueStateSet.getInitialReevaluationInterval(); } else { return nextOverdueState.getAutoReevaluationInterval().toJodaPeriod(); } } catch (final OverdueApiException e) { if (e.getCode() == ErrorCode.OVERDUE_NO_REEVALUATION_INTERVAL.getCode()) { return null; } else { throw new OverdueException(e); } } }
private DateTime addOrRemoveDuration(final DateTime input, final Duration duration, final boolean add) { return add ? input.plus(duration.toJodaPeriod()) : input.minus(duration.toJodaPeriod()); } }
private Period getReevaluationInterval(final OverdueStateSet overdueStateSet, final OverdueState nextOverdueState) throws OverdueException { try { if (nextOverdueState.isClearState()) { return overdueStateSet.getInitialReevaluationInterval(); } else { return nextOverdueState.getAutoReevaluationInterval().toJodaPeriod(); } } catch (final OverdueApiException e) { if (e.getCode() == ErrorCode.OVERDUE_NO_REEVALUATION_INTERVAL.getCode()) { return null; } else { throw new OverdueException(e); } } }
public OverdueStateJson(final OverdueState overdueState, final PaymentConfig paymentConfig) { this.name = overdueState.getName(); this.externalMessage = overdueState.getExternalMessage(); // TODO this is broken if the per tenant system property was updated, but should we really return that in the OverdueState ? this.daysBetweenPaymentRetries = paymentConfig.getPaymentFailureRetryDays(null); this.isDisableEntitlementAndChangesBlocked = overdueState.isDisableEntitlementAndChangesBlocked(); this.isBlockChanges = overdueState.isBlockChanges(); this.isClearState = overdueState.isClearState(); Period reevaluationIntervalPeriod = null; try { reevaluationIntervalPeriod = overdueState.getAutoReevaluationInterval().toJodaPeriod(); } catch (final OverdueApiException ignored) { } if (reevaluationIntervalPeriod != null) { this.reevaluationIntervalDays = reevaluationIntervalPeriod.getDays(); } else { this.reevaluationIntervalDays = null; } }
public OverdueStateConfigJson(final OverdueState input) { this.name = input.getName(); this.isClearState = input.isClearState(); this.condition = input.getOverdueCondition() != null ? new OverdueConditionJson(input.getOverdueCondition()) : null; this.externalMessage = input.getExternalMessage(); this.isBlockChanges = input.isBlockChanges(); this.isDisableEntitlement = input.isDisableEntitlementAndChangesBlocked(); this.subscriptionCancellationPolicy = input.getOverdueCancellationPolicy(); Integer tmpAutoReevaluationIntervalDays = null; try { tmpAutoReevaluationIntervalDays = input.getAutoReevaluationInterval().toJodaPeriod().getDays(); } catch (final OverdueApiException e) { } finally { this.autoReevaluationIntervalDays = tmpAutoReevaluationIntervalDays; } }