josehernandezfintecheandomx commented on code in PR #2633:
URL: https://github.com/apache/fineract/pull/2633#discussion_r991211812


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -1330,14 +1330,21 @@ private void updateLoanSummaryDerivedFields() {
             this.totalOverpaid = null;
         } else {
             final Money overpaidBy = calculateTotalOverpayment();
-            this.totalOverpaid = overpaidBy.getAmountDefaultedToNullIfZero();
+            this.totalOverpaid = null;
+            Money credits = Money.zero(getCurrency());
+            Money debits = Money.zero(getCurrency());
+            if (!overpaidBy.isLessThanZero()) {
+                this.totalOverpaid = 
overpaidBy.getAmountDefaultedToNullIfZero();
+            } else {
+                credits = overpaidBy.plus(getTotalChargebacks());

Review Comment:
   This is when you have an overpaid amount, the charge back will not take the 
amount from principal completed first, that will be from the overpaid amount, 
and that will happen when overpaid is less than zero



-- 
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