FINERACT-1981: Reverse Interest Refund transaction not allowed directly

This commit is contained in:
Jose Alberto Hernandez
2024-11-27 17:43:08 +01:00
committed by Adam Saghy
parent 4956bdd574
commit 1ef9c0f4bb
2 changed files with 73 additions and 3 deletions
@@ -1412,19 +1412,24 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
new LoanAdjustTransactionBusinessEvent(new LoanAdjustTransactionBusinessEvent.Data(transactionToAdjust)));
if (this.accountTransfersReadPlatformService.isAccountTransfer(transactionId, PortfolioAccountType.LOAN)) {
throw new PlatformServiceUnavailableException("error.msg.loan.transfer.transaction.update.not.allowed",
"Loan transaction:" + transactionId + " update not allowed as it involves in account transfer", transactionId);
"Loan transaction: " + transactionId + " update not allowed as it involves in account transfer", transactionId);
}
if (loan.isClosedWrittenOff()) {
throw new PlatformServiceUnavailableException("error.msg.loan.written.off.update.not.allowed",
"Loan transaction:" + transactionId + " update not allowed as loan status is written off", transactionId);
"Loan transaction: " + transactionId + " update not allowed as loan status is written off", transactionId);
}
if (transactionToAdjust.hasChargebackLoanTransactionRelations()) {
throw new PlatformServiceUnavailableException("error.msg.loan.transaction.update.not.allowed",
"Loan transaction:" + transactionId + " update not allowed as loan transaction is linked to other transactions",
"Loan transaction: " + transactionId + " update not allowed as loan transaction is linked to other transactions",
transactionId);
}
if (transactionToAdjust.isInterestRefund()) {
throw new PlatformServiceUnavailableException("error.msg.loan.transaction.update.not.allowed",
"Interest refund transaction: " + transactionId + " cannot be reversed or adjusted directly", transactionId);
}
final LocalDate transactionDate = command.localDateValueOfParameterNamed("transactionDate");
final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed("transactionAmount");
final ExternalId txnExternalId = externalIdFactory.createFromCommand(command, LoanApiConstants.externalIdParameterName);