Skip to content

FINERACT-2589: Fix repayment template to return next unpaid installment amount#5985

Open
AshharAhmadKhan wants to merge 1 commit into
apache:developfrom
AshharAhmadKhan:FINERACT-2589-fix-repayment-template-next-unpaid-installment
Open

FINERACT-2589: Fix repayment template to return next unpaid installment amount#5985
AshharAhmadKhan wants to merge 1 commit into
apache:developfrom
AshharAhmadKhan:FINERACT-2589-fix-repayment-template-next-unpaid-installment

Conversation

@AshharAhmadKhan

Copy link
Copy Markdown
Contributor

Fixes FINERACT-2589

Description

When a loan has been partially repaid, the repayment transaction template was always returning the amount of the first installment by sequence number, even if that installment was already fully paid. This caused the suggested repayment amount to show as zero for borrowers whose earliest installment had been satisfied.

The fix extracts the due amount expressions for principal, interest, fees, and penalties into named variables, then uses them in the ORDER BY clause to prioritize installments with any outstanding balance. Fully paid installments are pushed to the end, while the secondary sort by installment number is preserved to maintain correct ordering within each group.

…nt amount

Updated RepaymentTransactionTemplateMapper.schema() to order installments
by outstanding balance first, so partially paid loans return the correct
next unpaid installment amount instead of always defaulting to the earliest
installment by number.
@AshharAhmadKhan

Copy link
Copy Markdown
Contributor Author

@adamsaghy failure unrelated to my code. Please retrigger check when you get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant