Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FINERACT-1981: Pay-off does not consider the overdue installments #4132

Conversation

kulminsky
Copy link
Contributor

Description

Pay-off calculation logic needs to be fixed to not only consider the payable details of the current period, but must add all the past due installments outstanding balances as well

Ignore if these details are present on the associated Apache Fineract JIRA ticket.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per https://github.com/apache/fineract/#pull-requests

  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.

  • Create/update unit or integration tests for verifying the changes made.

  • Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.

  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes

  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

@@ -281,7 +281,7 @@ public OutstandingAmountsDTO calculatePrepaymentAmount(MonetaryCurrency currency
.interest(result.getPayableInterest());

installments.forEach(installment -> amounts //
.plusFeeCharges(installment.getFeeChargesOutstanding(currency))
.plusInterest(installment.getInterestOutstanding(currency)).plusFeeCharges(installment.getFeeChargesOutstanding(currency))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only consider the outstanding interest from past due installment. During pay-off / prepayment we dont want the customer to pay future interests.

@kulminsky kulminsky force-pushed the FINERACT-1981/pay_off_doesnt_consider_the_overdue_installments branch from 5f21568 to 164215b Compare October 29, 2024 12:53
@@ -280,6 +280,9 @@ public OutstandingAmountsDTO calculatePrepaymentAmount(MonetaryCurrency currency
.principal(result.getOutstandingBalance()) //
.interest(result.getPayableInterest());

installments.stream().filter(installment -> installment.getDueDate().isBefore(onDate) || installment.getDueDate().isEqual(onDate))
Copy link
Contributor

@adamsaghy adamsaghy Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid the || installment.getDueDate().isEqual(onDate) is still incorrect as if the onDate is on the same day as the installment due date, that means that is the "actual" installment and we already calculated the payable interest for the actual installment, so this way we would consider it twice...

@kulminsky kulminsky force-pushed the FINERACT-1981/pay_off_doesnt_consider_the_overdue_installments branch from 164215b to 4e38547 Compare October 29, 2024 13:53
@adamsaghy adamsaghy merged commit f92290b into apache:develop Oct 29, 2024
9 checks passed
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.

2 participants