Skip to content

FINERACT-2520: Add disbursement charges to total repayment expected in progressive loan schedule#5592

Open
Wiki05 wants to merge 1 commit intoapache:developfrom
Wiki05:fix/FINERACT-2520
Open

FINERACT-2520: Add disbursement charges to total repayment expected in progressive loan schedule#5592
Wiki05 wants to merge 1 commit intoapache:developfrom
Wiki05:fix/FINERACT-2520

Conversation

@Wiki05
Copy link

@Wiki05 Wiki05 commented Mar 6, 2026

Description

This PR fixes FINERACT-2520 where disbursement charges were missing from the total repayment expected in the progressive loan schedule.

Changes

Updated ProgressiveLoanScheduleGenerator.java to explicitly add chargesDueAtTimeOfDisbursement to the scheduleParams.totalRepaymentExpected after the main repayment loop.

Impact
Ensures the final schedule model correctly reflects all initial charges, matching the logic used in cumulative loan models.

Checklist

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

  • Write the commit message as per our guidelines
  • 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 our 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
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.

Your assigned reviewer(s) will follow our guidelines for code reviews.

@airajena
Copy link
Contributor

airajena commented Mar 6, 2026

@Wiki05 hii, somthing went wrong while the push, 3000+ file changes (+5 ,-1,135,822), please check, also make sure to sign your commits.

@Wiki05 Wiki05 force-pushed the fix/FINERACT-2520 branch from a342c5a to 091cc1c Compare March 6, 2026 16:25
@Wiki05
Copy link
Author

Wiki05 commented Mar 6, 2026

@Wiki05 hii, somthing went wrong while the push, 3000+ file changes (+5 ,-1,135,822), please check, also make sure to sign your commits.

Hi @airajena , thank you for pointing that out! I've reset my branch and force-pushed a clean version. It now shows only 1 file changed and includes the commit sign-off as requested. Please let me know if it looks good now!

scheduleParams.incrementPeriodNumber();
}

// Fix for FINERACT-2520: Ensure disbursement charges are added to total expected repayment
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not add such comments in the code unless required, this helps to keep code readable. These fixes comments/explaination of changes belong to PR description.

Copy link
Author

Choose a reason for hiding this comment

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

Understood @airajena , I've removed the comment from the code now.

@Wiki05 Wiki05 force-pushed the fix/FINERACT-2520 branch from 091cc1c to 7ef3b98 Compare March 6, 2026 16:40

if (chargesDueAtTimeOfDisbursement.compareTo(BigDecimal.ZERO) > 0) {
scheduleParams.addTotalRepaymentExpected(Money.of(currency, chargesDueAtTimeOfDisbursement, mc));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi Can you add a unit test covering this case for coverage?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @Aman-Mittal , I've added a new unit test to LoanScheduleGeneratorTest.java that verifies the inclusion of disbursement charges in the total repayment. Please let me know if it looks good now!

@Wiki05 Wiki05 force-pushed the fix/FINERACT-2520 branch from 7ef3b98 to f0eff02 Compare March 6, 2026 17:18
@airajena
Copy link
Contributor

airajena commented Mar 6, 2026

please run ./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest as pre commit checks so ci checks don't fail

@Wiki05 Wiki05 force-pushed the fix/FINERACT-2520 branch from f0eff02 to 9621f01 Compare March 6, 2026 17:40
@Wiki05
Copy link
Author

Wiki05 commented Mar 6, 2026

please run ./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest as pre commit checks so ci checks don't fail

I have successfully run spotlessJavaApply locally using Java 21. I've amended the commit and force-pushed the formatted code.

@Wiki05 Wiki05 force-pushed the fix/FINERACT-2520 branch from 9621f01 to a77bb35 Compare March 6, 2026 18:10
@Wiki05
Copy link
Author

Wiki05 commented Mar 7, 2026

Hi @Aman-Mittal , @airajena, I see that test-core-4 failed in the PostgreSQL/MySQL CI runs. I'm analyzing the logs to see if it's a decimal precision issue in the new unit test. I'll push a fix as soon as I identify the exact mismatch.

@airajena
Copy link
Contributor

airajena commented Mar 7, 2026

Hi @Aman-Mittal , @airajena, I see that test-core-4 failed in the PostgreSQL/MySQL CI runs. I'm analyzing the logs to see if it's a decimal precision issue in the new unit test. I'll push a fix as soon as I identify the exact mismatch.

please refer: Error: 1 unsigned commit(s). See CONTRIBUTING.md#signing-your-commits

@Wiki05 Wiki05 force-pushed the fix/FINERACT-2520 branch 2 times, most recently from dabd9b1 to 3639349 Compare March 7, 2026 08:12
@Wiki05
Copy link
Author

Wiki05 commented Mar 7, 2026

Hi @Aman-Mittal , @airajena, I see that test-core-4 failed in the PostgreSQL/MySQL CI runs. I'm analyzing the logs to see if it's a decimal precision issue in the new unit test. I'll push a fix as soon as I identify the exact mismatch.

please refer: Error: 1 unsigned commit(s). See CONTRIBUTING.md#signing-your-commits

Thank you for catching that! I've amended the commit with the -s flag to ensure it is properly signed. I've also included the decimal precision fix (stripTrailingZeros()) in this same commit to address the test-core-4 failure

@Wiki05 Wiki05 force-pushed the fix/FINERACT-2520 branch 2 times, most recently from 8556d23 to 1a70750 Compare March 7, 2026 12:55
Signed-off-by: Wiki05 <vigneshdev1022@gmail.com>
Signed-off-by: Vignesh <vigneshdev1022@gmail.com>
@Wiki05 Wiki05 force-pushed the fix/FINERACT-2520 branch from 1a70750 to 2cefb6a Compare March 7, 2026 14:06
@Wiki05
Copy link
Author

Wiki05 commented Mar 7, 2026

Hi @airajena , @Aman-Mittal . I have updated my GitHub primary email to match my local Git config and re-signed the commit using the -s flag. I have also implemented the stripTrailingZeros() precision fix in the unit test, which should resolve the previous test-core-4 failures. The PR is now ready for the automated checks to run.

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.

3 participants