JebronLames32 commented on code in PR #4522:
URL: https://github.com/apache/fineract/pull/4522#discussion_r2020129262


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -2877,7 +2877,7 @@ public CommandProcessingResult chargeOff(JsonCommand 
command) {
             throw new 
GeneralPlatformDomainRuleException("error.msg.loan.is.already.charged.off",
                     "Loan: " + loanId + " is already charged-off", loanId);
         }
-        if (DateUtils.isBefore(transactionDate, 
loan.getLastUserTransactionDate())) {
+        if (DateUtils.isBefore(transactionDate, 
loan.getLastNonReversedUserTransactionDate())) {

Review Comment:
   I think the function `loan.getLastUserTransactionDate()` is working fine. It 
is not considering reversed transactions and returning the last valid 
transaction date or the disbursement date if there is no valid user 
transaction. No change seems to be required as this is not the function causing 
the issue.
   
   On evaluating the result of the function loan.getLastUserTransactionDate()`:
   ![Screenshot from 2025-03-30 
16-45-07](https://github.com/user-attachments/assets/3138f88c-d7c6-459e-b32d-f8ed345db853)
   with the previous transactions being:
   
   ![Screenshot from 2025-03-30 
17-08-50](https://github.com/user-attachments/assets/37b95b19-d488-43dc-8e41-9f28acdcdcc4)
   
   
   The result seems to be right and is not considering reversed transactions
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to