You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "somasorosdpc (via GitHub)" <gi...@apache.org> on 2025/09/08 12:25:29 UTC

[PR] WIP: FINERACT-2324: remove fetch all transactions from cob jobs [fineract]

somasorosdpc opened a new pull request, #5019:
URL: https://github.com/apache/fineract/pull/5019

   ## Description
   
   Describe the changes made and why they were made.
   
   Ignore if these details are present on the associated [Apache Fineract JIRA ticket](https://github.com/apache/fineract/pull/1284).
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Write the commit message as per https://github.com/apache/fineract/#pull-requests
   - [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
   - [ ] Create/update unit or integration tests for verifying the changes made.
   - [ ] Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
   - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the developer mailing list for guidance, if required.)
   
   FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.
   


-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] WIP: FINERACT-2324: remove fetch all transactions from cob jobs [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5019:
URL: https://github.com/apache/fineract/pull/5019#discussion_r2387912158


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java:
##########
@@ -546,12 +547,21 @@ private List<LoanTransaction> getMergedTransactionList(List<LoanTransaction> tra
     protected void createNewTransaction(LoanTransaction loanTransaction, LoanTransaction newLoanTransaction,
             ChangedTransactionDetail changedTransactionDetail) {
         loanChargeValidator.validateRepaymentTypeTransactionNotBeforeAChargeRefund(loanTransaction.getLoan(), loanTransaction, "reversed");
+
+        // Save external ID before clearing it to check if this was a user-initiated transaction
+        ExternalId originalExternalId = loanTransaction.getExternalId();
+
         loanTransaction.reverse();
         loanTransaction.updateExternalId(null);
         newLoanTransaction.copyLoanTransactionRelations(loanTransaction.getLoanTransactionRelations());
-        // Adding Replayed relation from newly created transaction to reversed transaction
-        newLoanTransaction.getLoanTransactionRelations().add(
-                LoanTransactionRelation.linkToTransaction(newLoanTransaction, loanTransaction, LoanTransactionRelationTypeEnum.REPLAYED));
+
+        // Create REPLAYED relation for user-initiated transactions (those with external IDs)
+        // This distinguishes legitimate business operations from internal processing artifacts
+        if (originalExternalId != null) {

Review Comment:
   external id has not much to do whether it is business operation or internal processing... not necessarily enabled external id for loan transactions...



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] WIP: FINERACT-2324: remove fetch all transactions from cob jobs [fineract]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #5019: WIP: FINERACT-2324: remove fetch all transactions from cob jobs
URL: https://github.com/apache/fineract/pull/5019


-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] WIP: FINERACT-2324: remove fetch all transactions from cob jobs [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5019:
URL: https://github.com/apache/fineract/pull/5019#discussion_r2387927602


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ReprocessLoanTransactionsServiceImpl.java:
##########
@@ -208,8 +209,12 @@ private void handleChangedDetail(final ChangedTransactionDetail changedTransacti
 
             if (oldTransaction != null) {
                 loanAccountTransfersService.updateLoanTransaction(oldTransaction.getId(), newTransaction);
-                // Create reversal journal entries for old transaction if it exists (reverse-replay scenario)
-                loanJournalEntryPoster.postJournalEntriesForLoanTransaction(oldTransaction, false, false);
+                // Only create reversal journal entries for old transaction if the old transaction is not already

Review Comment:
   Are you sure? I dont recall any reported bug whether something was incorrectly or double accounted.



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] WIP: FINERACT-2324: remove fetch all transactions from cob jobs [fineract]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5019:
URL: https://github.com/apache/fineract/pull/5019#issuecomment-3470794006

   This pull request seems to be stale.  Are you still planning to work on it?  We will automatically close it in 30 days.


-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] WIP: FINERACT-2324: remove fetch all transactions from cob jobs [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5019:
URL: https://github.com/apache/fineract/pull/5019#discussion_r2387918092


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionRelationReadService.java:
##########
@@ -76,4 +81,41 @@ public List<LoanTransactionRelation> fetchLoanTransactionRelationFrom(final List
         return queryToExecute.getResultList();
     }
 
+    /**
+     * Determines if a transaction relation should be included in the API response.
+     *
+     * Filters out REPLAYED relations that are created during internal processing (e.g., accrual activities) but
+     * includes REPLAYED relations that are part of legitimate business operations (e.g., reverse-replay scenarios from
+     * backdated transactions).
+     *
+     * @param relation
+     *            the transaction relation to evaluate
+     * @return true if the relation should be included, false otherwise
+     */
+    private boolean shouldIncludeRelation(LoanTransactionRelation relation) {
+        LoanTransactionRelationTypeEnum relationType = relation.getRelationType();
+
+        // Always include non-REPLAYED relations
+        if (relationType != LoanTransactionRelationTypeEnum.REPLAYED) {
+            return true;
+        }
+
+        // For REPLAYED relations, include only those that are part of legitimate business operations

Review Comment:
   why do we need this? i am not fully understand the reasoning behind. Having external id or not has nothing to do with reverse-replay scenarios...



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org