Example #1
0
  public LocalDate determineOverdueSinceDateFrom(
      final List<LoanRepaymentScheduleInstallment> repaymentScheduleInstallments,
      final MonetaryCurrency currency,
      final LocalDate from) {

    LocalDate overdueSince = null;
    final Money totalOverdue =
        calculateTotalOverdueOn(repaymentScheduleInstallments, currency, from);
    if (totalOverdue.isGreaterThanZero()) {
      for (LoanRepaymentScheduleInstallment installment : repaymentScheduleInstallments) {
        if (installment.isOverdueOn(from)) {
          if (overdueSince == null || overdueSince.isAfter(installment.getDueDate())) {
            overdueSince = installment.getDueDate();
          }
        }
      }
    }

    return overdueSince;
  }