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


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/transferfeechargeforloans/TransferFeeChargeForLoansTasklet.java:
##########
@@ -98,12 +122,28 @@ public RepeatStatus execute(StepContribution contribution, 
ChunkContext chunkCon
                         continue;
                     }
                     final boolean isExceptionForBalanceCheck = false;
-                    final AccountTransferDTO accountTransferDTO = new 
AccountTransferDTO(DateUtils.getBusinessLocalDate(),
-                            chargeData.getAmountOutstanding(), 
PortfolioAccountType.SAVINGS, PortfolioAccountType.LOAN,
-                            portfolioAccountData.getId(), 
chargeData.getLoanId(), "Loan Charge Payment", null, null, null, null,
-                            LoanTransactionType.CHARGE_PAYMENT.getValue(), 
chargeData.getId(), null,
-                            AccountTransferType.CHARGE_PAYMENT.getValue(), 
null, null, ExternalId.empty(), null, null, null,
-                            isRegularTransaction, isExceptionForBalanceCheck);
+                    BigDecimal amountWithTax = 
chargeData.getAmountOutstanding();
+                    if (loanCharge != null) {
+                        if (loanCharge.getCharge().getTaxGroup() != null && 
log.isInfoEnabled()) {
+                            log.info(
+                                    "Scheduled charge payment tax evaluation: 
loanId={}, loanChargeId={}, installmentNumber={}, txDate={}, baseAmount={}, 
applicableTaxComponents={}",
+                                    chargeData.getLoanId(), 
chargeData.getId(), null, DateUtils.getBusinessLocalDate(), amountWithTax,
+                                    
TaxUtils.getApplicableTaxComponentSummaries(loanCharge.getCharge().getTaxGroup(),
+                                            DateUtils.getBusinessLocalDate()));
+                        }
+                        amountWithTax = 
TaxUtils.calculateChargeAmountWithTax(amountWithTax, 
loanCharge.getCharge().getTaxGroup(),
+                                DateUtils.getBusinessLocalDate(), 
loanCharge.getLoan().getCurrency().getDigitsAfterDecimal());
+                        if (loanCharge.getCharge().getTaxGroup() != null && 
log.isInfoEnabled()) {
+                            log.info(
+                                    "Scheduled charge payment tax result: 
loanId={}, loanChargeId={}, installmentNumber={}, txDate={}, amountAfterTax={}",
+                                    chargeData.getLoanId(), 
chargeData.getId(), null, DateUtils.getBusinessLocalDate(), amountWithTax);
+                        }

Review Comment:
   Please remove this



##########
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));
+        }

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