protected void installInvoiceNotifier() { if (config.isEmailNotificationsEnabled()) { bind(InvoiceNotifier.class).to(EmailInvoiceNotifier.class).asEagerSingleton(); } else { bind(InvoiceNotifier.class).to(NullInvoiceNotifier.class).asEagerSingleton(); } }
private void validateTargetDate(final LocalDate targetDate) throws InvoiceApiException { final int maximumNumberOfMonths = config.getNumberOfMonthsInFuture(); if (Months.monthsBetween(clock.getUTCToday(), targetDate).getMonths() > maximumNumberOfMonths) { throw new InvoiceApiException(ErrorCode.INVOICE_TARGET_DATE_TOO_FAR_IN_THE_FUTURE, targetDate.toString()); } }