This is an automated email from the ASF dual-hosted git repository.

adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 141f17ecfc9615d849c5d5cc240712d360a2bfc0
Author: Jose Alberto Hernandez <[email protected]>
AuthorDate: Mon Aug 18 09:42:46 2025 -0500

    FINERACT-2330: Buy-Down fees adjustment Acct for non merchant product
---
 .../service/AccrualBasedAccountingProcessorForLoan.java    |  8 +++++---
 .../fineract/integrationtests/LoanBuyDownFeeTest.java      | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java
index 12b1e85d29..c518f00a60 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java
@@ -457,12 +457,14 @@ public class AccrualBasedAccountingProcessorForLoan 
implements AccountingProcess
         final BigDecimal amount = loanTransactionDTO.getAmount();
         final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
 
+        final AccrualAccountsForLoan debitAccountType = 
loanDTO.isMerchantBuyDownFee() ? AccrualAccountsForLoan.BUY_DOWN_EXPENSE
+                : AccrualAccountsForLoan.FUND_SOURCE;
         if (MathUtil.isGreaterThanZero(amount)) {
             // Mirror of Buy Down Fee entries (as per PS-2574 requirements)
-            // Debit: Deferred Income Liability, Credit: Buy Down Expense
+            // Debit: Deferred Income Liability, Credit: Buy Down Expense 
(merchant)
+            // Debit: Deferred Income Liability, Credit: Fund Source (non 
merchant)
             this.helper.createJournalEntriesForLoan(office, currencyCode, 
AccrualAccountsForLoan.DEFERRED_INCOME_LIABILITY.getValue(),
-                    AccrualAccountsForLoan.BUY_DOWN_EXPENSE.getValue(), 
loanProductId, paymentTypeId, loanId, transactionId,
-                    transactionDate, amount);
+                    debitAccountType.getValue(), loanProductId, paymentTypeId, 
loanId, transactionId, transactionDate, amount);
         }
     }
 
diff --git 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanBuyDownFeeTest.java
 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanBuyDownFeeTest.java
index 955a9f0f8e..e36fb78060 100644
--- 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanBuyDownFeeTest.java
+++ 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanBuyDownFeeTest.java
@@ -881,7 +881,7 @@ public class LoanBuyDownFeeTest extends 
BaseLoanIntegrationTest {
             loanTransactionHelper.approveLoan(loanId, 
approveLoanRequest(1000.0, "01 September 2024"));
             disburseLoan(loanId, BigDecimal.valueOf(1000.0), "01 September 
2024");
 
-            final Long buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 
400.0, "10 September 2024");
+            Long buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 400.0, 
"10 September 2024");
             assertNotNull(buyDownFeeTransactionId);
 
             verifyTransactions(loanId, //
@@ -902,6 +902,18 @@ public class LoanBuyDownFeeTest extends 
BaseLoanIntegrationTest {
             // Verify initial buy down fee (non merchant) reversed accounting 
entries
             verifyTRJournalEntries(buyDownFeeTransactionId, debit(fundSource, 
400.0), credit(deferredIncomeLiabilityAccount, 400.0),
                     credit(fundSource, 400.0), 
debit(deferredIncomeLiabilityAccount, 400.0));
+
+            buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 400.0, "10 
September 2024");
+            assertNotNull(buyDownFeeTransactionId);
+
+            // Buy Down Fee Adjustment (non merchant)
+            final PostLoansLoanIdTransactionsResponse 
buyDownFeeAdjustmentTransaction = 
loanTransactionHelper.buyDownFeeAdjustment(loanId,
+                    buyDownFeeTransactionId, "10 September 2024", 200.0);
+            assertNotNull(buyDownFeeAdjustmentTransaction);
+
+            // Verify buy down fee adjustment (non merchant)
+            
verifyTRJournalEntries(buyDownFeeAdjustmentTransaction.getResourceId(), 
debit(deferredIncomeLiabilityAccount, 200.0),
+                    credit(fundSource, 200.0));
         });
     }
 

Reply via email to