adamsaghy commented on code in PR #6285:
URL: https://github.com/apache/fineract/pull/6285#discussion_r3934039988


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeWritePlatformServiceImpl.java:
##########
@@ -667,6 +669,23 @@ public CommandProcessingResult payLoanCharge(final Long 
loanId, Long loanChargeI
             amount = chargePerInstallment.getAmountOutstanding();
         }
 
+        // Loan-charge payments should transfer the tax-inclusive amount, the 
same way disbursement-time
+        // charge collection and charge application transactions do.
+        final LocalDate effectiveTransactionDate = transactionDate != null ? 
transactionDate : DateUtils.getBusinessLocalDate();
+        final TaxGroup taxGroup = loanCharge.getCharge().getTaxGroup();
+        if (taxGroup != null && log.isInfoEnabled()) {
+            log.info(
+                    "Charge payment tax evaluation: loanId={}, 
loanChargeId={}, installmentNumber={}, txDate={}, baseAmount={}, 
applicableTaxComponents={}",
+                    loanId, loanChargeId, loanInstallmentNumber, 
effectiveTransactionDate, amount,
+                    TaxUtils.getApplicableTaxComponentSummaries(taxGroup, 
effectiveTransactionDate));
+        }
+        amount = TaxUtils.calculateChargeAmountWithTax(amount, taxGroup, 
effectiveTransactionDate,
+                loan.getCurrency().getDigitsAfterDecimal());
+        if (taxGroup != null && log.isInfoEnabled()) {
+            log.info("Charge payment tax result: loanId={}, loanChargeId={}, 
installmentNumber={}, txDate={}, amountAfterTax={}", loanId,
+                    loanChargeId, loanInstallmentNumber, 
effectiveTransactionDate, amount);
+        }

Review Comment:
   Please remove this



##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -487,7 +488,19 @@ public CommandProcessingResult disburseLoan(final Long 
loanId, final JsonCommand
         for (final LoanCharge loanCharge : loanCharges) {
             if (loanCharge.isDueAtDisbursement() && 
loanCharge.getChargePaymentMode().isPaymentModeAccountTransfer()
                     && loanCharge.isChargePending()) {
-                disBuLoanCharges.put(loanCharge.getId(), 
loanCharge.amountOutstanding());
+                if (loanCharge.getCharge().getTaxGroup() != null && 
log.isInfoEnabled()) {
+                    log.info(
+                            "Disbursement charge tax evaluation: loanId={}, 
loanChargeId={}, txDate={}, baseAmount={}, applicableTaxComponents={}",
+                            loanId, loanCharge.getId(), 
actualDisbursementDate, loanCharge.amountOutstanding(),
+                            
TaxUtils.getApplicableTaxComponentSummaries(loanCharge.getCharge().getTaxGroup(),
 actualDisbursementDate));
+                }

Review Comment:
   Please remove this



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