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
The following commit(s) were added to refs/heads/develop by this push:
new 2092a9a91 FINERACT-2081: Chargeback reverse replay fails fix
2092a9a91 is described below
commit 2092a9a91187dd92615aa77ce4171ab7954b97a7
Author: Ruchi Dhamankar <[email protected]>
AuthorDate: Tue May 28 11:17:59 2024 +0530
FINERACT-2081: Chargeback reverse replay fails fix
---
.../impl/AdvancedPaymentScheduleTransactionProcessor.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java
index 2e0830012..9796c47fc 100644
---
a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java
+++
b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java
@@ -576,10 +576,23 @@ public class AdvancedPaymentScheduleTransactionProcessor
extends AbstractLoanRep
newLoanTransaction.getLoanTransactionToRepaymentScheduleMappings());
} else {
createNewTransaction(loanTransaction, newLoanTransaction,
changedTransactionDetail);
+
checkAndUpdateReplayedChargebackRelationWithReplayedTransaction(loanTransaction,
newLoanTransaction, ctx);
}
}
}
+ private void
checkAndUpdateReplayedChargebackRelationWithReplayedTransaction(LoanTransaction
loanTransaction,
+ LoanTransaction newLoanTransaction, TransactionCtx ctx) {
+ // if chargeback is getting reverse-replayed
+ // find replayed transaction with CHARGEBACK relation with reversed
chargeback transaction
+ // for replayed transaction, add relation to point to new Chargeback
transaction
+ if (loanTransaction.getTypeOf().isChargeback()) {
+ LoanTransaction originalTransaction =
findOriginalTransaction(newLoanTransaction, ctx);
+ originalTransaction.getLoanTransactionRelations()
+
.add(LoanTransactionRelation.linkToTransaction(originalTransaction,
newLoanTransaction, CHARGEBACK));
+ }
+ }
+
private void processSingleCharge(LoanCharge loanCharge, MonetaryCurrency
currency, List<LoanRepaymentScheduleInstallment> installments,
LocalDate disbursementDate) {
loanChargeProcessor.reprocess(currency, disbursementDate,
installments, loanCharge);