Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@alberto-art3ch
Copy link
Contributor

Description

We were having an issue where the totalUnpaidPayableNotDueInterest in summary gets reset to 0 when a loan is charged off even though there were unrealized accruals available in that installment.

FINERACT-2405

Screenshot 2025-11-11 at 8 50 32 p m

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.

| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 546.14 | 24.69 | 0.0 | 10.0 | 580.83 | 308.59 | 308.59 | 0.0 | 272.24 |

@temp3
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this temp3 tag?

Copy link
Contributor

Choose a reason for hiding this comment

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

removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tag removed, thanks

Double totalUnpaidPayableNotDueInterestActual = loanDetailsResponse.body().getSummary().getTotalUnpaidPayableNotDueInterest()
.doubleValue();
assertThat(totalUnpaidPayableNotDueInterestActual)
.as(ErrorMessageHelper.wrongAmountInTotalUnpaidPayableDueInterest(totalUnpaidPayableNotDueInterestActual,
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is a little bit strange with the naming. So the method says wrongAmountInTotalUnpaidPayableDueInterest, but we are checking totalUnpaidPayableNotDueInterestActual and totalUnpaidPayableNotDueInterestExpected. Which one are we actually checking?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Method renamed to be more easy to understand the amount to be validated

@alberto-art3ch alberto-art3ch force-pushed the FINERACT-2405/totalUnpaidPayableNotDueInterest-resets-to-0-on-the-day-of-charge-off branch from 1837481 to f432d67 Compare November 13, 2025 14:20
@Override
public BigDecimal computeTotalUnpaidPayableDueInterestAmount(Collection<LoanSchedulePeriodData> periods, final LocalDate businessDate) {
return periods.stream().filter(period -> !period.isDownPaymentPeriod() && !businessDate.isBefore(period.getDueDate()))
return periods.stream().filter(period -> !period.isDownPaymentPeriod() && !period.getDueDate().isAfter(businessDate))
Copy link
Contributor

Choose a reason for hiding this comment

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

@alberto-art3ch This cannot be right... on the due date it shall be part of the unpaid, payable, due interest amount.

if (loan.isChargedOff() || loan.hasContractTerminationTransaction()) {
if (loan.isChargedOff()) {
return currentRepaymentPeriod.get().getInterestOutstanding(loan.getCurrency()).getAmount();
} else if (loan.hasContractTerminationTransaction()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@alberto-art3ch I think the same shall apply to contract termination. Charge-off and Contract termination is quite similar in this case.

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

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

Please see my questions.

@ruzeynalov ruzeynalov force-pushed the FINERACT-2405/totalUnpaidPayableNotDueInterest-resets-to-0-on-the-day-of-charge-off branch from 20714a3 to cf1aa62 Compare November 18, 2025 12:22
@alberto-art3ch alberto-art3ch force-pushed the FINERACT-2405/totalUnpaidPayableNotDueInterest-resets-to-0-on-the-day-of-charge-off branch 4 times, most recently from f082afe to 5a775c1 Compare November 19, 2025 03:25
@adamsaghy adamsaghy force-pushed the FINERACT-2405/totalUnpaidPayableNotDueInterest-resets-to-0-on-the-day-of-charge-off branch from 5a775c1 to 66d7145 Compare November 19, 2025 16:00
@adamsaghy adamsaghy force-pushed the FINERACT-2405/totalUnpaidPayableNotDueInterest-resets-to-0-on-the-day-of-charge-off branch from 66d7145 to 5d328c9 Compare November 19, 2025 16:46
@adamsaghy adamsaghy merged commit 47e8674 into apache:develop Nov 19, 2025
34 checks passed
@adamsaghy adamsaghy deleted the FINERACT-2405/totalUnpaidPayableNotDueInterest-resets-to-0-on-the-day-of-charge-off branch November 19, 2025 18:58
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.

4 participants