You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ar...@apache.org on 2025/10/06 17:59:25 UTC

(fineract) branch develop updated: FINERACT-2387: Fix zero amount reversed transaction creation issue

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new e0e4415727 FINERACT-2387: Fix zero amount reversed transaction creation issue
e0e4415727 is described below

commit e0e4415727af43d6987b38cc8353ae0997616408
Author: Adam Saghy <ad...@gmail.com>
AuthorDate: Mon Oct 6 09:43:15 2025 +0200

    FINERACT-2387: Fix zero amount reversed transaction creation issue
---
 ...ReplayedTransactionBusinessEventServiceImpl.java |  4 +++-
 .../ReprocessLoanTransactionsServiceImpl.java       | 21 +++++++++++----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceImpl.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceImpl.java
index e82d3bd6b0..fe1737c8a6 100644
--- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceImpl.java
+++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReplayedTransactionBusinessEventServiceImpl.java
@@ -47,7 +47,9 @@ public class ReplayedTransactionBusinessEventServiceImpl implements ReplayedTran
 
                 if (oldTransaction != null) {
                     final LoanAdjustTransactionBusinessEvent.Data data = new LoanAdjustTransactionBusinessEvent.Data(oldTransaction);
-                    data.setNewTransactionDetail(newTransaction);
+                    if (newTransaction.isNotReversed()) {
+                        data.setNewTransactionDetail(newTransaction);
+                    }
                     businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(data));
                 }
             }
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReprocessLoanTransactionsServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReprocessLoanTransactionsServiceImpl.java
index b35e1c0253..4b73229378 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReprocessLoanTransactionsServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReprocessLoanTransactionsServiceImpl.java
@@ -195,16 +195,17 @@ public class ReprocessLoanTransactionsServiceImpl implements ReprocessLoanTransa
         for (TransactionChangeData change : changedTransactionDetail.getTransactionChanges()) {
             final LoanTransaction newTransaction = change.getNewTransaction();
             final LoanTransaction oldTransaction = change.getOldTransaction();
-
-            loanAccountService.saveLoanTransactionWithDataIntegrityViolationChecks(newTransaction);
-
-            // Create journal entries for new transaction
-            loanJournalEntryPoster.postJournalEntriesForLoanTransaction(newTransaction, false, false);
-            if (oldTransaction == null && (newTransaction.isAccrual() || newTransaction.isAccrualAdjustment())) {
-                final LoanTransactionBusinessEvent businessEvent = newTransaction.isAccrual()
-                        ? new LoanAccrualTransactionCreatedBusinessEvent(newTransaction)
-                        : new LoanAccrualAdjustmentTransactionBusinessEvent(newTransaction);
-                businessEventNotifierService.notifyPostBusinessEvent(businessEvent);
+            if (newTransaction.isNotReversed()) {
+                loanAccountService.saveLoanTransactionWithDataIntegrityViolationChecks(newTransaction);
+
+                // Create journal entries for new transaction
+                loanJournalEntryPoster.postJournalEntriesForLoanTransaction(newTransaction, false, false);
+                if (oldTransaction == null && (newTransaction.isAccrual() || newTransaction.isAccrualAdjustment())) {
+                    final LoanTransactionBusinessEvent businessEvent = newTransaction.isAccrual()
+                            ? new LoanAccrualTransactionCreatedBusinessEvent(newTransaction)
+                            : new LoanAccrualAdjustmentTransactionBusinessEvent(newTransaction);
+                    businessEventNotifierService.notifyPostBusinessEvent(businessEvent);
+                }
             }
 
             if (oldTransaction != null) {