Skip to content

Commit

Permalink
FINERACT-2150: disbursement not allowed on charged-off loan
Browse files Browse the repository at this point in the history
  • Loading branch information
magyari-adam authored and adamsaghy committed Nov 25, 2024
1 parent 0c7ef32 commit 4e3bcbf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,9 @@ public void validateDisbursement(JsonCommand command, boolean isAccountTransfer,
validateLoanClientIsActive(loan);
validateLoanGroupIsActive(loan);

if (loan.isChargedOff() && DateUtils.isBefore(actualDisbursementDate, loan.getChargedOffOnDate())) {
throw new GeneralPlatformDomainRuleException("error.msg.transaction.date.cannot.be.earlier.than.charge.off.date", "Loan: "
+ loan.getId()
+ " backdated transaction is not allowed. Transaction date cannot be earlier than the charge-off date of the loan",
loan.getId());
if (loan.isChargedOff()) {
throw new GeneralPlatformDomainRuleException("error.msg.loan.disbursal.not.allowed.on.charged.off",
"Loan: " + loan.getId() + " disbursement is not allowed on charged-off loan.");
}

boolean isSingleDisburseLoan = !loan.getLoanProduct().isMultiDisburseLoan();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6362,7 +6362,15 @@ public void chargeOff() {
.locale("en").dateFormat(DATETIME_PATTERN));
});
assertEquals(403, exception.getResponse().code());
assertTrue(exception.getMessage().contains("error.msg.transaction.date.cannot.be.earlier.than.charge.off.date"));
assertTrue(exception.getMessage().contains("error.msg.loan.disbursal.not.allowed.on.charged.off"));

exception = assertThrows(CallFailedRuntimeException.class, () -> {
errorLoanTransactionHelper.disburseLoan((long) loanID,
new PostLoansLoanIdRequest().actualDisbursementDate("7 September 2022").transactionAmount(new BigDecimal("10"))
.locale("en").dateFormat(DATETIME_PATTERN));
});
assertEquals(403, exception.getResponse().code());
assertTrue(exception.getMessage().contains("error.msg.loan.disbursal.not.allowed.on.charged.off"));

LOAN_TRANSACTION_HELPER.makeLoanRepayment((long) loanID, new PostLoansLoanIdTransactionsRequest().dateFormat(DATETIME_PATTERN)
.transactionDate("07 September 2022").locale("en").transactionAmount(5000.0));
Expand Down

0 comments on commit 4e3bcbf

Please sign in to comment.