Abhishek6122008 commented on code in PR #6817:
URL: https://github.com/apache/fineract/pull/6817#discussion_r4474154646


##########
fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularInterestPoster.java:
##########
@@ -132,21 +135,20 @@ private void batchUpdateJournalEntries(final 
List<SavingsAccountData> savingsAcc
                     if (savingsAccountData.getGlAccountIdForSavingsControl() 
!= 0
                             && 
savingsAccountData.getGlAccountIdForInterestOnSavings() != 0) {
                         OffsetDateTime auditDatetime = 
DateUtils.getAuditOffsetDateTime();
-                        BigDecimal amount = 
savingsAccountTransactionData.getAmount();
-                        // interest posted to an overdrawn account pays down 
the overdraft first, as in the accounting
-                        // processors; the debit side is the same for both 
parts
-                        final BigDecimal overdraftAmount = 
savingsAccountTransactionData.getTransactionType().isInterestPosting()
-                                ? 
savingsAccountTransactionData.getOverdraftAmount()
-                                : null;
-                        if (MathUtil.isGreaterThanZero(overdraftAmount)) {
+                        if 
(savingsAccountTransactionData.getTransactionType().isInterestPosting()) {
+                            // booked from the same rules as a manual posting 
in the accounting processors
+                            for (final Leg leg : 
SavingsInterestPostingLegs.legsFor(
+                                    
savingsAccountData.isCashBasedAccountingEnabledOnSavingsProduct(),
+                                    savingsAccountTransactionData.getAmount(), 
savingsAccountTransactionData.getOverdraftAmount())) {
+                                addJournalEntryPair(paramsForGLInsertion, 
savingsAccountData, savingsAccountTransactionData,
+                                        glAccountId(savingsAccountData, 
leg.accountTypeToDebit()),
+                                        glAccountId(savingsAccountData, 
leg.accountTypeToCredit()), leg.amount(), currencyCode, userId,
+                                        auditDatetime);
+                            }
+                        } else {

Review Comment:
   Good catch. The branch now books only overdraft interest, and any other type 
fails with a clear IllegalStateException, with a unit test. #6614 books 
withholding tax in its own branch, so it isn't affected, but one of the two 
will need a rebase.



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