-
Notifications
You must be signed in to change notification settings - Fork 2.3k
block-loan-overpayment (FINERACT-1052) #1536
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
block-loan-overpayment (FINERACT-1052) #1536
Conversation
|
@vorburger @rrpawar96 I have done a functional test and this is working fine |
…in:io.swagger.core.v3.swagger-gradle-plugin.gradle.plugin to v2.1.6
|
@ptuomola if I understand this one correctly, this is "take II" of #1264, for FINERACT-1052. Would you like to (re)review this? |
…core.v3-swagger-annotations-2.x chore(deps): update dependency io.swagger.core.v3:swagger-annotations to v2.1.6
Better fix for SMTP Server Port (FINERACT-1070)
…tomcat-tomcat-9.x chore(deps): update dependency org.apache.tomcat:tomcat to v9.0.41
…jsonpath-json-path-2.x chore(deps): update dependency com.jayway.jsonpath:json-path to v2.5.0
…core.v3.swagger-gradle-plugin-io.swagger.core.v3.swagger-gradle-plugin.gradle.plugin-2.x chore(deps): update dependency io.swagger.core.v3.swagger-gradle-plugin:io.swagger.core.v3.swagger-gradle-plugin.gradle.plugin to v2.1.6
….user.email.invalid Improve error logging for failed user creation (FINERACT-1070)
| final Money totalRecoveryPaid = Money.of(loan.getCurrency(), loan.getSummary().getTotalRecoveryPaid()); | ||
|
|
||
| if (writtenOffBalance.isGreaterThanOrEqualTo(repaymentAmount.plus(totalRecoveryPaid)) && isAvoidLoanOverpaymentEnabled) { | ||
| outstandingBalance = writtenOffBalance; // transferring the writtenOff Balance to Outstanding for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... not quite sure I understand this. Seems that this code allows repayments to be used to pay written off amounts. Whilst this may be right (though should we not deduct the amount transferred from writtenOffBalance?), why/how is this linked to the functionality to stop overpayments?
In other words, why does turning off overpayments for loans also change how we handle written off balances?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ptuomola, yes, we are considering the written-off amounts because usually when
we repay the loan, it deducts from the outstanding-balance but,
when a user written-off the loan, the outstanding-balance straight away becomes 0.
because the exact same amount is transferred to the Written-off.
So that's why (when the block-overpayment flag is enabled.) we will be repaying the money until it gets equal to the written-off amounts(or outstanding-balance)
otherwise, if the flag is not enabled(default condition) it will not stop even after the amount gets equal and will continue to get overpaid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rrpawar96
thanks for sharing these details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@francisguchie @rrpawar96 :
"So that's why (when the block-overpayment flag is enabled.) we will be repaying the money until it gets equal to the written-off amounts(or outstanding-balance)" - Block overpayment flag is more than welcome as overpayment creates some issues. But this doesn't look good to me.
- A written off status loan should have an outstanding balance. Leads to state inconsistencies compared to ledger.
- If you are changing the loan status, you have to reverse any writeoff journal entries, post accruals till date, etc - not sure if this is the route you want to go to.
- If you want to continue doing recovery payments without going into overpayment, is this the right place in code to handle recovery repayments?
- In either case, you have to enhance the test to handle the impact of any change in this code snippet like explicitly state writeoff balance, verify if it's recovery repayment or writeoff reversal.
- Mayble also include the logic in test for the dry run you are doing. Ex:- Writeoff balance 1000, Total Recovery Repaid - 800, Repayment - 100. This IF condition is satisfied. But why should outstandingBalance become 1000 and not 100? Please correct me if I am wrong regarding assuming recovery repayments don't reduce writeoff balance.
…tless.gradle.plugin to v5.10.1
|
@avikganguly01 - I hope i understand your comments well please see my comments below for every bullet • A written off status loan should have an outstanding balance. Leads to state inconsistencies compared to ledger. • If you are changing the loan status, you have to reverse any write-off journal entries, post accruals till date, etc. - not sure if this is the route you want to go to. • If you want to continue doing recovery payments without going into overpayment, is this the right place in code to handle recovery repayments? • In either case, you have to enhance the test to handle the impact of any change in this code snippet like explicitly state write-off balance, verify if it's recovery repayment or write-off reversal. • Mayble also include the logic in test for the dry run you are doing. Ex:- Write-off balance 1000, Total Recovery Repaid - 800, Repayment - 100. This IF condition is satisfied. But why should outstanding Balance become 1000 and not 100? Please correct me if I am wrong regarding assuming recovery repayments don't reduce write-off balance. |
…tless.gradle.plugin to v5.10.2
…/francisguchie/fineract into FINERACT1052BlockLoanOverPayment
vorburger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOK, 81 commits.. somehow Git got confused. Try rebase, or start over.
I will close and open new PR for this |
|
Starting afresh for this take 2 |
FINERACT-1052
Description
#1264
Addressing the following comments from @ptuomola
Addressing these comments below
The current behaviour should be kept as the default - i.e. without a configuration present in the database, the same behaviour should remain (overpayments allowed)
The default configuration added to this should also keep the current behaviour as-is - i.e. the default Flyway script should create the configuration in such way that it allows overpayments
The existing integration tests should be kept-as is and they should continue to be used to test the current behaviour (i.e. overpayment allowed)
but Not able to answer this
We should create a new integration test (or multiple tests) to test the scenario where overpayments are not allowed. These tests should first set the flag to disable overpayments, then carry out the tests to confirm that overpayments fail in different scenarios, and then reset the flag back to enabling overpayments
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/api-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.