FINERACT-2399: Add global config to block transactions on closed/overpaid loans#5349
Conversation
|
Please dont forget to run |
00f29ec to
7a00cba
Compare
|
Please dont forget to run |
Thanks for the reminder! Just a quick clarification: Is it sufficient to run these checks specifically on the modules I've modified (e.g., ./gradlew :integration-tests:spotlessApply ...), or do you require them to be run on the entire project root? Running them on the root seems to trigger issues in unrelated modules. |
Its just easier to run this as i shared and fix all places ;) |
7a00cba to
b28f4e5
Compare
adamsaghy
left a comment
There was a problem hiding this comment.
Credit Balance Refund txn cannot be blocked! That is for handle overpaid status correctly!
| <sql> | ||
| SELECT SETVAL('c_configuration_id_seq', COALESCE(MAX(id), 0)+1, false ) FROM c_configuration; | ||
| </sql> |
There was a problem hiding this comment.
I dont think we need this. Are you sure this should be here?
adamsaghy
left a comment
There was a problem hiding this comment.
Please add proper testing to ensure correct behavior!
ebb2fc9 to
eac6fa3
Compare
Done |
7c54556 to
28ca56a
Compare
28ca56a to
fb8055a
Compare
|
fb8055a to
02a1d21
Compare
fixed |
02a1d21 to
326bee7
Compare
adamsaghy
left a comment
There was a problem hiding this comment.
You are missing a great number of transactions here.
Probably an approach which prevents:
- any new monetary transactions (repayment, refund, reage, etc.)
Reversal of existing transactions are allowed.
326bee7 to
19cfb82
Compare
Thanks for the review. I’ve addressed the requested changes and force-pushed the branch. |
|
@airajena Please rebase again (sorry... we are a high number of PRs nowadays). |
I understand, no worries, I will check everyday for rebasing and merge conflicts for my PRs, will keep them clean |
19cfb82 to
e836d79
Compare
b9f857d to
29368d4
Compare
29368d4 to
bddedee
Compare
|
@airajena Please rebase |
|
|
||
| final Long loanId = command.getLoanId(); | ||
| Loan loan = this.loanAssembler.assembleFrom(loanId); | ||
| loanTransactionValidator.validateLoanNotClosedOrOverpaidForTransactions(loan, LoanTransactionType.INTEREST_PAYMENT_WAIVER); |
There was a problem hiding this comment.
We dont need to call multiple times the loanTransactionValidator. Lets do the necessary checks in loanTransactionValidator.validateLoanTransactionInterestPaymentWaiver
| changes.put(LoanApiConstants.externalIdParameterName, txnExternalId); | ||
| } | ||
| Loan loan = this.loanAssembler.assembleFrom(loanId); | ||
| loanTransactionValidator.validateLoanNotClosedOrOverpaidForTransactions(loan, repaymentTransactionType); |
| for (final SingleRepaymentCommand singleLoanRepaymentCommand : repaymentCommand) { | ||
| if (singleLoanRepaymentCommand != null) { | ||
| final Loan loan = this.loanAssembler.assembleFrom(singleLoanRepaymentCommand.getLoanId()); | ||
| loanTransactionValidator.validateLoanNotClosedOrOverpaidForTransactions(loan, LoanTransactionType.REPAYMENT); |
|
|
||
| Loan loan = this.loanAssembler.assembleFrom(loanId); | ||
| checkClientOrGroupActive(loan); | ||
| loanTransactionValidator.validateLoanNotClosedOrOverpaidForTransactions(loan, LoanTransactionType.WAIVE_INTEREST); |
| changes.put(LoanApiConstants.externalIdParameterName, txnExternalId); | ||
|
|
||
| Loan loan = this.loanAssembler.assembleFrom(loanId); | ||
| loanTransactionValidator.validateLoanNotClosedOrOverpaidForTransactions(loan, loanTransactionType); |
adamsaghy
left a comment
There was a problem hiding this comment.
All transaction types were covered?
bddedee to
3826e11
Compare
yes — all monetary transaction types are covered now, |
|
@airajena Please rebase this PR. |
3826e11 to
eb5f136
Compare
done |
Description
Fixes FINERACT-2399
This PR adds a new global configuration
block-transactions-on-closed-overpaid-loansthat allows organizations to prevent monetary transactions on loan accounts with closed or overpaid status.Problem
Currently, Fineract allows monetary transactions (repayments, refunds, charges, etc.) on loans that are in closed or overpaid status. This can cause:
Solution
Added a global configuration toggle: