Skip to content

Conversation

@alberto-art3ch
Copy link
Contributor

…iples of setting

Description

When a Loan with Down payment (auto) transaction was ignoring installment multiples of configuration, so this was not paying the full amount

FINERACT-1971

Screenshot 2024-04-22 at 7 59 36 a m
  • Loan Transactions
Screenshot 2024-04-22 at 8 02 29 a 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Something does not add up here...
First installment is 3
2nd and 3rd are 2
4th is 3 again.

For 1st one 2.5 is the calculated but it does using force HALF_UP rounding (i guess it is hardcoded somewhere), however for 2nd and 3rd it is does not using HALF_UP, i guess it comes from a configuration which is not HALF_UP..

Please make sure all calculation is using the some rounding to avoid these situations.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are there clear tests for this? I think we cannot have ambiguous rounding results so tests need to capture what is expected @alberto-art3ch .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jdailey There are few places using the Rounding Mode fixed, fortunately almost all are related to DownPayment and now are being fixed in this PR. There are other two that I raised a ticket and we can fix these two too. Thanks

@alberto-art3ch alberto-art3ch force-pushed the fix/loan_autodownpayment_installmentmultiplesof branch from aab2062 to 14c5606 Compare April 23, 2024 19:55
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont think profile do anything here..l its a static method...part of the class... :/
Also MoneyHelper has not much to do with configuration rounding mode.

Would you mind moving this logic into the ConfigurationDomainService without the profile annotation? The profile annotation do absolutely nothing here...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Money helper init the rounding variable the first time with X value, so If you change the GC with the API or the database directly, this new value is not used until you restart Fineract

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, but still the annotation can be removed, it is meaningless here

Copy link
Contributor

@adamsaghy adamsaghy Apr 25, 2024

Choose a reason for hiding this comment

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

also please either change the method name, as it is not reset the rounding mode, its fetching it via configuraiton service again, or change the implementation to set the roundingMode to NULL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Annotation and method renamed

Copy link
Contributor

Choose a reason for hiding this comment

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

How can the down payment installment be 3 with HALF_DOWN rounding where 10 / 4 = 2.5 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! This is fixed and now we are testing Half Down and Up to have different values

@alberto-art3ch alberto-art3ch force-pushed the fix/loan_autodownpayment_installmentmultiplesof branch 4 times, most recently from 4dafdd6 to 53e8128 Compare April 29, 2024 12:55
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.

LGTM

@alberto-art3ch alberto-art3ch force-pushed the fix/loan_autodownpayment_installmentmultiplesof branch from 53e8128 to 227164a Compare May 3, 2024 06:51
Copy link
Contributor

Choose a reason for hiding this comment

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

This will fail! the disbursement installment cannot be 0!

Please make sure it contains the correct amounts! (1250 in this example)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! file updated and tests passed

@alberto-art3ch alberto-art3ch force-pushed the fix/loan_autodownpayment_installmentmultiplesof branch 4 times, most recently from 0fc5836 to 8ea1b66 Compare May 7, 2024 07:26
@alberto-art3ch alberto-art3ch force-pushed the fix/loan_autodownpayment_installmentmultiplesof branch from 8ea1b66 to 739c4ce Compare May 7, 2024 08:08
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.

LGTM

@adamsaghy adamsaghy merged commit 849790e into apache:develop May 7, 2024
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