FINERACT-1806: Charge-off validation
This commit is contained in:
committed by
Arnold Gálovics
parent
83de7652e6
commit
0928fb5136
+5
@@ -2729,6 +2729,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
"Loan: " + loanId + " charge-off cannot be executed. User transaction was found after the charge-off transaction date!",
|
"Loan: " + loanId + " charge-off cannot be executed. User transaction was found after the charge-off transaction date!",
|
||||||
loanId);
|
loanId);
|
||||||
}
|
}
|
||||||
|
if (transactionDate.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||||
|
final String errorMessage = "The transaction date cannot be in the future.";
|
||||||
|
throw new GeneralPlatformDomainRuleException("error.msg.loan.transaction.cannot.be.a.future.date", errorMessage,
|
||||||
|
transactionDate);
|
||||||
|
}
|
||||||
if (loan.isInterestBearing()) {
|
if (loan.isInterestBearing()) {
|
||||||
throw new GeneralPlatformDomainRuleException("error.msg.loan.is.interest.bearing",
|
throw new GeneralPlatformDomainRuleException("error.msg.loan.is.interest.bearing",
|
||||||
"Loan: " + loanId + " Charge-off is not allowed. Loan Account is interest bearing", loanId);
|
"Loan: " + loanId + " Charge-off is not allowed. Loan Account is interest bearing", loanId);
|
||||||
|
|||||||
+8
@@ -7003,6 +7003,14 @@ public class ClientLoanIntegrationTest {
|
|||||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoanWithTransactionAmount("03 September 2022", loanID, "1000");
|
loanStatusHashMap = this.loanTransactionHelper.disburseLoanWithTransactionAmount("03 September 2022", loanID, "1000");
|
||||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||||
|
|
||||||
|
exception = assertThrows(CallFailedRuntimeException.class, () -> {
|
||||||
|
this.loanTransactionHelper.chargeOffLoan((long) loanID,
|
||||||
|
new PostLoansLoanIdTransactionsRequest().transactionDate("1 October 2022").locale("en").dateFormat("dd MMMM yyyy")
|
||||||
|
.chargeOffReasonId((long) chargeOffReasonId));
|
||||||
|
});
|
||||||
|
assertEquals(403, exception.getResponse().code());
|
||||||
|
assertTrue(exception.getMessage().contains("error.msg.loan.transaction.cannot.be.a.future.date"));
|
||||||
|
|
||||||
GetLoansLoanIdResponse loanDetails = this.loanTransactionHelper.getLoanDetails((long) loanID);
|
GetLoansLoanIdResponse loanDetails = this.loanTransactionHelper.getLoanDetails((long) loanID);
|
||||||
assertTrue(loanDetails.getStatus().getActive());
|
assertTrue(loanDetails.getStatus().getActive());
|
||||||
assertEquals(2000.0, loanDetails.getSummary().getTotalOutstanding());
|
assertEquals(2000.0, loanDetails.getSummary().getTotalOutstanding());
|
||||||
|
|||||||
Reference in New Issue
Block a user