FINERACT-2114: Reschedule validations enhancement
This commit is contained in:
+7
-3
@@ -94,9 +94,11 @@ public class ProgressiveLoanRescheduleRequestDataValidator implements LoanResche
|
|||||||
final LocalDate businessDate = DateUtils.getBusinessLocalDate();
|
final LocalDate businessDate = DateUtils.getBusinessLocalDate();
|
||||||
if (rescheduleFromDate != null) {
|
if (rescheduleFromDate != null) {
|
||||||
if (hasInterestRateChange && !rescheduleFromDate.isAfter(businessDate)) {
|
if (hasInterestRateChange && !rescheduleFromDate.isAfter(businessDate)) {
|
||||||
dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName).failWithCode(
|
throw new GeneralPlatformDomainRuleException(
|
||||||
"loan.reschedule.interest.rate.change.reschedule.from.date.should.be.in.future",
|
"loan.reschedule.interest.rate.change.reschedule.from.date.should.be.in.future",
|
||||||
"Loan Reschedule From date should be in the future.");
|
String.format("Loan Reschedule From date (%s) for Loan: %s should be in the future.", rescheduleFromDate,
|
||||||
|
loan.getId()),
|
||||||
|
loan.getId(), rescheduleFromDate);
|
||||||
}
|
}
|
||||||
if (hasInterestRateChange) {
|
if (hasInterestRateChange) {
|
||||||
validateInterestRateChangeRescheduleFromDate(loan, rescheduleFromDate);
|
validateInterestRateChangeRescheduleFromDate(loan, rescheduleFromDate);
|
||||||
@@ -154,7 +156,9 @@ public class ProgressiveLoanRescheduleRequestDataValidator implements LoanResche
|
|||||||
if (!rescheduleFromDate.isAfter(DateUtils.getBusinessLocalDate())) {
|
if (!rescheduleFromDate.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||||
throw new GeneralPlatformDomainRuleException(
|
throw new GeneralPlatformDomainRuleException(
|
||||||
"loan.reschedule.interest.rate.change.reschedule.from.date.should.be.in.future",
|
"loan.reschedule.interest.rate.change.reschedule.from.date.should.be.in.future",
|
||||||
"Loan Reschedule From date should be in the future.", rescheduleFromDate);
|
String.format("Loan Reschedule From date (%s) for Loan: %s should be in the future.", rescheduleFromDate,
|
||||||
|
loan.getId()),
|
||||||
|
loan.getId(), rescheduleFromDate);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
installment = loan.getRepaymentScheduleInstallment(rescheduleFromDate);
|
installment = loan.getRepaymentScheduleInstallment(rescheduleFromDate);
|
||||||
|
|||||||
+8
@@ -282,6 +282,14 @@ public class LoanRescheduleRequestTest extends BaseLoanIntegrationTest {
|
|||||||
new PostLoansLoanIdRequest().actualDisbursementDate("15 February 2023").dateFormat(DATETIME_PATTERN)
|
new PostLoansLoanIdRequest().actualDisbursementDate("15 February 2023").dateFormat(DATETIME_PATTERN)
|
||||||
.transactionAmount(BigDecimal.valueOf(500.00)).locale("en"));
|
.transactionAmount(BigDecimal.valueOf(500.00)).locale("en"));
|
||||||
|
|
||||||
|
exception = assertThrows(CallFailedRuntimeException.class,
|
||||||
|
() -> loanRescheduleRequestHelper
|
||||||
|
.createLoanRescheduleRequest(new PostCreateRescheduleLoansRequest().loanId(loanResponse.get().getLoanId())
|
||||||
|
.dateFormat(DATETIME_PATTERN).locale("en").submittedOnDate("15 February 2023")
|
||||||
|
.newInterestRate(BigDecimal.ONE).rescheduleReasonId(1L).rescheduleFromDate("15 February 2023")));
|
||||||
|
assertEquals(403, exception.getResponse().code());
|
||||||
|
assertTrue(exception.getMessage().contains("loan.reschedule.interest.rate.change.reschedule.from.date.should.be.in.future"));
|
||||||
|
|
||||||
rescheduleResponse.set(loanRescheduleRequestHelper.createLoanRescheduleRequest(new PostCreateRescheduleLoansRequest()
|
rescheduleResponse.set(loanRescheduleRequestHelper.createLoanRescheduleRequest(new PostCreateRescheduleLoansRequest()
|
||||||
.loanId(loanResponse.get().getLoanId()).dateFormat(DATETIME_PATTERN).locale("en").submittedOnDate("15 February 2023")
|
.loanId(loanResponse.get().getLoanId()).dateFormat(DATETIME_PATTERN).locale("en").submittedOnDate("15 February 2023")
|
||||||
.newInterestRate(BigDecimal.ONE).rescheduleReasonId(1L).rescheduleFromDate("16 February 2023")));
|
.newInterestRate(BigDecimal.ONE).rescheduleReasonId(1L).rescheduleFromDate("16 February 2023")));
|
||||||
|
|||||||
Reference in New Issue
Block a user