FINERACT-2081: Chargeback reverse replay fails fix

This commit is contained in:
Ruchi Dhamankar
2024-05-29 11:23:01 +02:00
committed by Adam Saghy
parent 620f60c650
commit 2092a9a911
@@ -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);