FINERACT-2107: Merchant issued refund linked to related interest refund

- on reversal reverse interest refund aswell
This commit is contained in:
adam.magyari
2024-10-30 13:16:29 +01:00
committed by Adam Saghy
parent b053c90009
commit 745dc80886
4 changed files with 103 additions and 1 deletions
@@ -2686,6 +2686,19 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
transactionForAdjustment.reverse(reversalExternalId);
transactionForAdjustment.manuallyAdjustedOrReversed();
if (transactionForAdjustment.getTypeOf().equals(LoanTransactionType.MERCHANT_ISSUED_REFUND)
|| transactionForAdjustment.getTypeOf().equals(LoanTransactionType.PAYOUT_REFUND)) {
getLoanTransactions().stream() //
.filter(LoanTransaction::isNotReversed)
.filter(loanTransaction -> loanTransaction.getLoanTransactionRelations().stream()
.anyMatch(relation -> relation.getRelationType().equals(LoanTransactionRelationTypeEnum.RELATED)
&& relation.getToTransaction().getId().equals(transactionForAdjustment.getId())))
.forEach(loanTransaction -> {
loanTransaction.reverse();
loanTransaction.manuallyAdjustedOrReversed();
});
}
if (isClosedWrittenOff()) {
// find write off transaction and reverse it
final LoanTransaction writeOffTransaction = findWriteOffTransaction();
@@ -23,7 +23,8 @@ public enum LoanTransactionRelationTypeEnum {
INVALID(0, "loanTransactionType.invalid"), //
CHARGEBACK(1, "loanTransactionRelationType.chargeback"), //
CHARGE_ADJUSTMENT(2, "loanTransactionRelationType.chargeAdjustment"), //
REPLAYED(3, "loanTransactionRelationType.replayed");
REPLAYED(3, "loanTransactionRelationType.replayed"), //
RELATED(4, "loanTransactionRelationType.related");
private final Integer value;
private final String code;