FINERACT-1724: Show reverted charge-off transactions

This commit is contained in:
Adam Saghy
2023-03-27 08:57:57 +02:00
committed by Arnold Gálovics
parent b40e700cc6
commit 1eab0fe1bd
3 changed files with 8 additions and 0 deletions
@@ -690,6 +690,8 @@ final class LoansApiResourceSwagger {
public boolean creditBalanceRefund;
@Schema(example = "false")
public boolean chargeAdjustment;
@Schema(example = "false")
public boolean chargeoff;
}
static final class GetLoansLoanIdPaymentDetailData {
@@ -2806,6 +2806,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
businessEventNotifierService.notifyPreBusinessEvent(new LoanUndoChargeOffBusinessEvent(chargedOffTransaction));
chargedOffTransaction.reverse();
chargedOffTransaction.manuallyAdjustedOrReversed();
loan.liftChargeOff();
loanTransactionRepository.saveAndFlush(chargedOffTransaction);
saveLoanWithDataIntegrityViolationChecks(loan);
@@ -7083,6 +7083,11 @@ public class ClientLoanIntegrationTest {
assertNull(loanDetails.getSummary().getChargeOffReason());
assertNull(loanDetails.getTimeline().getChargedOffOnDate());
GetLoansLoanIdTransactions undoChargeOffTransaction = loanDetails.getTransactions()
.get(loanDetails.getTransactions().size() - 1);
assertTrue(undoChargeOffTransaction.getType().getChargeoff());
assertTrue(undoChargeOffTransaction.getManuallyReversed());
exception = assertThrows(CallFailedRuntimeException.class, () -> {
errorLoanTransactionHelper.undoChargeOffLoan((long) loanID, new PostLoansLoanIdTransactionsRequest());
});