AshharAhmadKhan opened a new pull request, #6372: URL: https://github.com/apache/fineract/pull/6372
See https://issues.apache.org/jira/browse/FINERACT-2802 Additional installments (isAdditional()==true) are excluded from ProgressiveLoanInterestScheduleModel.repaymentPeriods() and therefore cannot be looked up by raw from/due dates. Two call sites in AdvancedPaymentScheduleTransactionProcessor were passing additional installments' dates directly to getPeriodInterestTillDate(), which called findRepaymentPeriodByFromAndDueDate().orElseThrow() and crashed with NoSuchElementException. A second, previously-unguarded lookup was found one level deeper in ProgressiveEMICalculator#recalculateScheduleModelTillDate(): a target date falling inside an additional installment's range is neither before the first disbursement nor after the maturity date, so findRepaymentPeriod(targetDate).orElseThrow() also threw an unwrapped NoSuchElementException, even after the two call-site guards below were added, since this method runs earlier in the call chain. Fix: - handleAccelerateMaturityDate(): add !currentInstallment.isAdditional() guard before the getPeriodInterestTillDate() call. - handleZeroInterestChargeOff(): add !installment.isAdditional() to the stream filter before the getPeriodInterestTillDate() call. - ProgressiveEMICalculator.getPeriodInterestTillDate(): harden the bare orElseThrow() to throw LoanTransactionProcessingException with a descriptive message. - ProgressiveEMICalculator.recalculateScheduleModelTillDate(): harden a second, previously-unguarded orElseThrow() the same way. Reproducer: unit tests in AdvancedPaymentScheduleTransactionProcessorTest and ProgressiveEMICalculatorTest. Related: https://issues.apache.org/jira/browse/FINERACT-2790 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
