FINERACT-2065: Fix schedule handling with higher fixed length value than Loan term
This commit is contained in:
committed by
Adam Saghy
parent
5ad63752c9
commit
35bdbccd2e
+13
-4
@@ -69,6 +69,7 @@ public final class LoanApplicationTerms {
|
|||||||
private final Integer repaymentEvery;
|
private final Integer repaymentEvery;
|
||||||
private final PeriodFrequencyType repaymentPeriodFrequencyType;
|
private final PeriodFrequencyType repaymentPeriodFrequencyType;
|
||||||
|
|
||||||
|
private long variationDays = 0L;
|
||||||
private final Integer fixedLength;
|
private final Integer fixedLength;
|
||||||
private final Integer nthDay;
|
private final Integer nthDay;
|
||||||
|
|
||||||
@@ -1845,16 +1846,16 @@ public final class LoanApplicationTerms {
|
|||||||
}
|
}
|
||||||
switch (repaymentPeriodFrequencyType) {
|
switch (repaymentPeriodFrequencyType) {
|
||||||
case DAYS:
|
case DAYS:
|
||||||
maxDateForFixedLength = startDate.plusDays(fixedLength);
|
maxDateForFixedLength = startDate.plusDays(fixedLength + variationDays);
|
||||||
break;
|
break;
|
||||||
case WEEKS:
|
case WEEKS:
|
||||||
maxDateForFixedLength = startDate.plusWeeks(fixedLength);
|
maxDateForFixedLength = startDate.plusWeeks(fixedLength + variationDays);
|
||||||
break;
|
break;
|
||||||
case MONTHS:
|
case MONTHS:
|
||||||
maxDateForFixedLength = startDate.plusMonths(fixedLength);
|
maxDateForFixedLength = startDate.plusMonths(fixedLength + variationDays);
|
||||||
break;
|
break;
|
||||||
case YEARS:
|
case YEARS:
|
||||||
maxDateForFixedLength = startDate.plusYears(fixedLength);
|
maxDateForFixedLength = startDate.plusYears(fixedLength + variationDays);
|
||||||
break;
|
break;
|
||||||
case INVALID:
|
case INVALID:
|
||||||
break;
|
break;
|
||||||
@@ -1871,4 +1872,12 @@ public final class LoanApplicationTerms {
|
|||||||
: getSubmittedOnDate();
|
: getSubmittedOnDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLastPeriod(final Integer periodNumber) {
|
||||||
|
return getNumberOfRepayments().equals(periodNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateVariationDays(final long daysToAdd) {
|
||||||
|
this.variationDays += daysToAdd;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -91,8 +91,8 @@ public abstract class AbstractProgressiveLoanScheduleGenerator implements LoanSc
|
|||||||
boolean isNextRepaymentAvailable = true;
|
boolean isNextRepaymentAvailable = true;
|
||||||
|
|
||||||
while (!scheduleParams.getOutstandingBalance().isZero()) {
|
while (!scheduleParams.getOutstandingBalance().isZero()) {
|
||||||
scheduleParams.setActualRepaymentDate(getScheduledDateGenerator()
|
scheduleParams.setActualRepaymentDate(getScheduledDateGenerator().generateNextRepaymentDate(
|
||||||
.generateNextRepaymentDate(scheduleParams.getActualRepaymentDate(), loanApplicationTerms, isFirstRepayment));
|
scheduleParams.getActualRepaymentDate(), loanApplicationTerms, isFirstRepayment, scheduleParams.getPeriodNumber()));
|
||||||
AdjustedDateDetailsDTO adjustedDateDetailsDTO = getScheduledDateGenerator()
|
AdjustedDateDetailsDTO adjustedDateDetailsDTO = getScheduledDateGenerator()
|
||||||
.adjustRepaymentDate(scheduleParams.getActualRepaymentDate(), loanApplicationTerms, holidayDetailDTO);
|
.adjustRepaymentDate(scheduleParams.getActualRepaymentDate(), loanApplicationTerms, holidayDetailDTO);
|
||||||
scheduleParams.setActualRepaymentDate(adjustedDateDetailsDTO.getChangedActualRepaymentDate());
|
scheduleParams.setActualRepaymentDate(adjustedDateDetailsDTO.getChangedActualRepaymentDate());
|
||||||
@@ -601,6 +601,7 @@ public abstract class AbstractProgressiveLoanScheduleGenerator implements LoanSc
|
|||||||
LoanTermVariationsData loanTermVariationsData = loanApplicationTerms.getLoanTermVariations().nextDueDateVariation();
|
LoanTermVariationsData loanTermVariationsData = loanApplicationTerms.getLoanTermVariations().nextDueDateVariation();
|
||||||
if (DateUtils.isEqual(modifiedScheduledDueDate, loanTermVariationsData.getTermVariationApplicableFrom())) {
|
if (DateUtils.isEqual(modifiedScheduledDueDate, loanTermVariationsData.getTermVariationApplicableFrom())) {
|
||||||
modifiedScheduledDueDate = loanTermVariationsData.getDateValue();
|
modifiedScheduledDueDate = loanTermVariationsData.getDateValue();
|
||||||
|
loanApplicationTerms.updateVariationDays(DateUtils.getDifferenceInDays(scheduledDueDate, modifiedScheduledDueDate));
|
||||||
if (!loanTermVariationsData.isSpecificToInstallment()) {
|
if (!loanTermVariationsData.isSpecificToInstallment()) {
|
||||||
scheduleParams.setActualRepaymentDate(modifiedScheduledDueDate);
|
scheduleParams.setActualRepaymentDate(modifiedScheduledDueDate);
|
||||||
loanApplicationTerms.setNewScheduledDueDateStart(modifiedScheduledDueDate);
|
loanApplicationTerms.setNewScheduledDueDateStart(modifiedScheduledDueDate);
|
||||||
|
|||||||
+14
-4
@@ -103,10 +103,20 @@ public class DefaultScheduledDateGenerator implements ScheduledDateGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final LocalDate maxDateForFixedLength = loanApplicationTerms.calculateMaxDateForFixedLength();
|
return dueRepaymentPeriodDate;
|
||||||
// Fixed Length validation
|
}
|
||||||
if (maxDateForFixedLength != null && DateUtils.isAfter(dueRepaymentPeriodDate, maxDateForFixedLength)) {
|
|
||||||
dueRepaymentPeriodDate = maxDateForFixedLength;
|
@Override
|
||||||
|
public LocalDate generateNextRepaymentDate(LocalDate lastRepaymentDate, LoanApplicationTerms loanApplicationTerms,
|
||||||
|
final boolean isFirstRepayment, final Integer periodNumber) {
|
||||||
|
LocalDate dueRepaymentPeriodDate = generateNextRepaymentDate(lastRepaymentDate, loanApplicationTerms, isFirstRepayment);
|
||||||
|
|
||||||
|
// Fixed Length validation only for Last Installment
|
||||||
|
if (loanApplicationTerms.isLastPeriod(periodNumber)) {
|
||||||
|
final LocalDate maxDateForFixedLength = loanApplicationTerms.calculateMaxDateForFixedLength();
|
||||||
|
if (maxDateForFixedLength != null && dueRepaymentPeriodDate.compareTo(maxDateForFixedLength) != 0) {
|
||||||
|
dueRepaymentPeriodDate = maxDateForFixedLength;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return dueRepaymentPeriodDate;
|
return dueRepaymentPeriodDate;
|
||||||
|
|||||||
+3
@@ -34,6 +34,9 @@ public interface ScheduledDateGenerator {
|
|||||||
|
|
||||||
LocalDate generateNextRepaymentDate(LocalDate lastRepaymentDate, LoanApplicationTerms loanApplicationTerms, boolean isFirstRepayment);
|
LocalDate generateNextRepaymentDate(LocalDate lastRepaymentDate, LoanApplicationTerms loanApplicationTerms, boolean isFirstRepayment);
|
||||||
|
|
||||||
|
LocalDate generateNextRepaymentDate(LocalDate lastRepaymentDate, LoanApplicationTerms loanApplicationTerms, boolean isFirstRepayment,
|
||||||
|
Integer periodNumber);
|
||||||
|
|
||||||
AdjustedDateDetailsDTO adjustRepaymentDate(LocalDate dueRepaymentPeriodDate, LoanApplicationTerms loanApplicationTerms,
|
AdjustedDateDetailsDTO adjustRepaymentDate(LocalDate dueRepaymentPeriodDate, LoanApplicationTerms loanApplicationTerms,
|
||||||
HolidayDetailDTO holidayDetailDTO);
|
HolidayDetailDTO holidayDetailDTO);
|
||||||
|
|
||||||
|
|||||||
+192
@@ -3819,6 +3819,198 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UC133: Advanced payment allocation with higher Fixed Length for 50 days than Loan Term for 45 days (3 repayments
|
||||||
|
// every 15 days)
|
||||||
|
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||||
|
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||||
|
// 2. Submit Loan and approve
|
||||||
|
// 3. Disburse
|
||||||
|
// 4. Validate Repayment Schedule
|
||||||
|
@Test
|
||||||
|
public void uc133() {
|
||||||
|
final String operationDate = "22 November 2023";
|
||||||
|
runAt(operationDate, () -> {
|
||||||
|
final Integer fixedLength = 50; // 50 days
|
||||||
|
final Integer repaymentFrequencyType = RepaymentFrequencyType.DAYS;
|
||||||
|
final Integer numberOfRepayments = 3;
|
||||||
|
|
||||||
|
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||||
|
|
||||||
|
PostLoanProductsRequest product = createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
|
||||||
|
.numberOfRepayments(numberOfRepayments).repaymentEvery(15).repaymentFrequencyType(repaymentFrequencyType.longValue())
|
||||||
|
.fixedLength(fixedLength);
|
||||||
|
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(product);
|
||||||
|
|
||||||
|
PostLoansRequest applicationRequest = applyLoanRequest(clientId, loanProductResponse.getResourceId(), "22 November 2023",
|
||||||
|
1000.0, numberOfRepayments)
|
||||||
|
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY);
|
||||||
|
|
||||||
|
PostLoansResponse loanResponse = loanTransactionHelper.applyLoan(applicationRequest);
|
||||||
|
|
||||||
|
loanTransactionHelper.approveLoan(loanResponse.getLoanId(),
|
||||||
|
new PostLoansLoanIdRequest().approvedLoanAmount(BigDecimal.valueOf(1000)).dateFormat(DATETIME_PATTERN)
|
||||||
|
.approvedOnDate("22 November 2023").locale("en"));
|
||||||
|
|
||||||
|
loanTransactionHelper.disburseLoan(loanResponse.getLoanId(),
|
||||||
|
new PostLoansLoanIdRequest().actualDisbursementDate("22 November 2023").dateFormat(DATETIME_PATTERN)
|
||||||
|
.transactionAmount(BigDecimal.valueOf(100.0)).locale("en"));
|
||||||
|
|
||||||
|
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
|
||||||
|
LOG.info("Loan {} {}", loanDetails.getTimeline().getActualDisbursementDate(), loanDetails.getRepaymentSchedule().getPeriods()
|
||||||
|
.get(loanDetails.getRepaymentSchedule().getPeriods().size() - 1).getDueDate());
|
||||||
|
assertEquals(
|
||||||
|
Utils.getDifferenceInDays(loanDetails.getTimeline().getActualDisbursementDate(), loanDetails.getRepaymentSchedule()
|
||||||
|
.getPeriods().get(loanDetails.getRepaymentSchedule().getPeriods().size() - 1).getDueDate()),
|
||||||
|
fixedLength.longValue());
|
||||||
|
assertEquals(loanDetails.getNumberOfRepayments(), numberOfRepayments);
|
||||||
|
assertTrue(loanDetails.getStatus().getActive());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// UC134: Advanced payment allocation with Fixed Length for 119 days and Loan Term for 120 days (4 repayments every
|
||||||
|
// 30
|
||||||
|
// days) and Reschedule
|
||||||
|
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||||
|
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||||
|
// 2. Submit Loan and approve
|
||||||
|
// 3. Disburse
|
||||||
|
// 4. Validate Repayment Schedule
|
||||||
|
// 5. ReSchedule
|
||||||
|
@Test
|
||||||
|
public void uc134() {
|
||||||
|
final String operationDate = "1 January 2024";
|
||||||
|
runAt(operationDate, () -> {
|
||||||
|
final Integer fixedLength = 119; // 120 days
|
||||||
|
final Integer repaymentFrequencyType = RepaymentFrequencyType.DAYS;
|
||||||
|
final Integer numberOfRepayments = 4;
|
||||||
|
|
||||||
|
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||||
|
PostLoanProductsRequest product = createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
|
||||||
|
.numberOfRepayments(numberOfRepayments).repaymentEvery(30).fixedLength(fixedLength);
|
||||||
|
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(product);
|
||||||
|
PostLoansRequest applicationRequest = applyLoanRequest(clientId, loanProductResponse.getResourceId(), operationDate, 1000.0,
|
||||||
|
numberOfRepayments);
|
||||||
|
|
||||||
|
applicationRequest = applicationRequest.numberOfRepayments(numberOfRepayments).loanTermFrequency(120)
|
||||||
|
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY).repaymentEvery(30);
|
||||||
|
|
||||||
|
PostLoansResponse loanResponse = loanTransactionHelper.applyLoan(applicationRequest);
|
||||||
|
|
||||||
|
loanTransactionHelper.approveLoan(loanResponse.getLoanId(), new PostLoansLoanIdRequest()
|
||||||
|
.approvedLoanAmount(BigDecimal.valueOf(1000)).dateFormat(DATETIME_PATTERN).approvedOnDate(operationDate).locale("en"));
|
||||||
|
|
||||||
|
loanTransactionHelper.disburseLoan(loanResponse.getLoanId(), new PostLoansLoanIdRequest().actualDisbursementDate(operationDate)
|
||||||
|
.dateFormat(DATETIME_PATTERN).transactionAmount(BigDecimal.valueOf(1000.0)).locale("en"));
|
||||||
|
|
||||||
|
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
|
||||||
|
validateLoanSummaryBalances(loanDetails, 1000.0, 0.0, 1000.0, 0.0, null);
|
||||||
|
validateRepaymentPeriod(loanDetails, 1, LocalDate.of(2024, 1, 31), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 2, LocalDate.of(2024, 3, 1), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 3, LocalDate.of(2024, 3, 31), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 4, LocalDate.of(2024, 4, 29), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
assertTrue(loanDetails.getStatus().getActive());
|
||||||
|
assertEquals(loanDetails.getNumberOfRepayments(), numberOfRepayments);
|
||||||
|
assertEquals(
|
||||||
|
Utils.getDifferenceInDays(loanDetails.getTimeline().getActualDisbursementDate(), loanDetails.getRepaymentSchedule()
|
||||||
|
.getPeriods().get(loanDetails.getRepaymentSchedule().getPeriods().size() - 1).getDueDate()),
|
||||||
|
fixedLength.longValue());
|
||||||
|
|
||||||
|
PostCreateRescheduleLoansResponse rescheduleLoansResponse = loanRescheduleRequestHelper
|
||||||
|
.createLoanRescheduleRequest(new PostCreateRescheduleLoansRequest().loanId(loanDetails.getId()).locale("en")
|
||||||
|
.dateFormat(DATETIME_PATTERN).rescheduleReasonId(1L).rescheduleFromDate("1 March 2024")
|
||||||
|
.adjustedDueDate("15 March 2024").submittedOnDate("16 January 2024"));
|
||||||
|
|
||||||
|
loanRescheduleRequestHelper.approveLoanRescheduleRequest(rescheduleLoansResponse.getResourceId(),
|
||||||
|
new PostUpdateRescheduleLoansRequest().approvedOnDate("16 January 2024").locale("en").dateFormat(DATETIME_PATTERN));
|
||||||
|
|
||||||
|
loanDetails = loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
|
||||||
|
validateLoanSummaryBalances(loanDetails, 1000.0, 0.0, 1000.0, 0.0, null);
|
||||||
|
validateRepaymentPeriod(loanDetails, 1, LocalDate.of(2024, 1, 31), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 2, LocalDate.of(2024, 3, 15), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 3, LocalDate.of(2024, 4, 14), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 4, LocalDate.of(2024, 5, 13), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
assertTrue(loanDetails.getStatus().getActive());
|
||||||
|
assertEquals(loanDetails.getNumberOfRepayments(), numberOfRepayments);
|
||||||
|
assertEquals(
|
||||||
|
Utils.getDifferenceInDays(loanDetails.getTimeline().getActualDisbursementDate(), loanDetails.getRepaymentSchedule()
|
||||||
|
.getPeriods().get(loanDetails.getRepaymentSchedule().getPeriods().size() - 1).getDueDate()),
|
||||||
|
fixedLength.longValue() + 14); // Days in Reschedule
|
||||||
|
assertTrue(loanDetails.getStatus().getActive());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// UC135: Advanced payment allocation with Fixed Length for 119 days and Loan Term for 120 days (4 repayments every
|
||||||
|
// 30
|
||||||
|
// days) and Reschedule
|
||||||
|
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||||
|
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||||
|
// 2. Submit Loan and approve
|
||||||
|
// 3. Disburse
|
||||||
|
// 4. Validate Repayment Schedule
|
||||||
|
// 5. ReSchedule Last installment
|
||||||
|
@Test
|
||||||
|
public void uc135() {
|
||||||
|
final String operationDate = "1 January 2024";
|
||||||
|
runAt(operationDate, () -> {
|
||||||
|
final Integer fixedLength = 119; // 120 days
|
||||||
|
final Integer repaymentFrequencyType = RepaymentFrequencyType.DAYS;
|
||||||
|
final Integer numberOfRepayments = 4;
|
||||||
|
|
||||||
|
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||||
|
PostLoanProductsRequest product = createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
|
||||||
|
.numberOfRepayments(numberOfRepayments).repaymentEvery(30).fixedLength(fixedLength);
|
||||||
|
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(product);
|
||||||
|
PostLoansRequest applicationRequest = applyLoanRequest(clientId, loanProductResponse.getResourceId(), operationDate, 1000.0,
|
||||||
|
numberOfRepayments);
|
||||||
|
|
||||||
|
applicationRequest = applicationRequest.numberOfRepayments(numberOfRepayments).loanTermFrequency(120)
|
||||||
|
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY).repaymentEvery(30);
|
||||||
|
|
||||||
|
PostLoansResponse loanResponse = loanTransactionHelper.applyLoan(applicationRequest);
|
||||||
|
|
||||||
|
loanTransactionHelper.approveLoan(loanResponse.getLoanId(), new PostLoansLoanIdRequest()
|
||||||
|
.approvedLoanAmount(BigDecimal.valueOf(1000)).dateFormat(DATETIME_PATTERN).approvedOnDate(operationDate).locale("en"));
|
||||||
|
|
||||||
|
loanTransactionHelper.disburseLoan(loanResponse.getLoanId(), new PostLoansLoanIdRequest().actualDisbursementDate(operationDate)
|
||||||
|
.dateFormat(DATETIME_PATTERN).transactionAmount(BigDecimal.valueOf(1000.0)).locale("en"));
|
||||||
|
|
||||||
|
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
|
||||||
|
validateLoanSummaryBalances(loanDetails, 1000.0, 0.0, 1000.0, 0.0, null);
|
||||||
|
validateRepaymentPeriod(loanDetails, 1, LocalDate.of(2024, 1, 31), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 2, LocalDate.of(2024, 3, 1), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 3, LocalDate.of(2024, 3, 31), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 4, LocalDate.of(2024, 4, 29), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
assertTrue(loanDetails.getStatus().getActive());
|
||||||
|
assertEquals(loanDetails.getNumberOfRepayments(), numberOfRepayments);
|
||||||
|
assertEquals(
|
||||||
|
Utils.getDifferenceInDays(loanDetails.getTimeline().getActualDisbursementDate(), loanDetails.getRepaymentSchedule()
|
||||||
|
.getPeriods().get(loanDetails.getRepaymentSchedule().getPeriods().size() - 1).getDueDate()),
|
||||||
|
fixedLength.longValue());
|
||||||
|
|
||||||
|
PostCreateRescheduleLoansResponse rescheduleLoansResponse = loanRescheduleRequestHelper
|
||||||
|
.createLoanRescheduleRequest(new PostCreateRescheduleLoansRequest().loanId(loanDetails.getId()).locale("en")
|
||||||
|
.dateFormat(DATETIME_PATTERN).rescheduleReasonId(1L).rescheduleFromDate("29 April 2024")
|
||||||
|
.adjustedDueDate("5 May 2024").submittedOnDate("16 January 2024"));
|
||||||
|
|
||||||
|
loanRescheduleRequestHelper.approveLoanRescheduleRequest(rescheduleLoansResponse.getResourceId(),
|
||||||
|
new PostUpdateRescheduleLoansRequest().approvedOnDate("16 January 2024").locale("en").dateFormat(DATETIME_PATTERN));
|
||||||
|
|
||||||
|
loanDetails = loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
|
||||||
|
validateLoanSummaryBalances(loanDetails, 1000.0, 0.0, 1000.0, 0.0, null);
|
||||||
|
validateRepaymentPeriod(loanDetails, 1, LocalDate.of(2024, 1, 31), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 2, LocalDate.of(2024, 3, 1), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 3, LocalDate.of(2024, 3, 31), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
validateRepaymentPeriod(loanDetails, 4, LocalDate.of(2024, 5, 5), 250.0, 0.0, 250.0, 0.0, 0.0);
|
||||||
|
assertTrue(loanDetails.getStatus().getActive());
|
||||||
|
assertEquals(loanDetails.getNumberOfRepayments(), numberOfRepayments);
|
||||||
|
assertEquals(
|
||||||
|
Utils.getDifferenceInDays(loanDetails.getTimeline().getActualDisbursementDate(), loanDetails.getRepaymentSchedule()
|
||||||
|
.getPeriods().get(loanDetails.getRepaymentSchedule().getPeriods().size() - 1).getDueDate()),
|
||||||
|
fixedLength.longValue() + 6); // Days in Reschedule
|
||||||
|
assertTrue(loanDetails.getStatus().getActive());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static List<PaymentAllocationOrder> getPaymentAllocationOrder(PaymentAllocationType... paymentAllocationTypes) {
|
private static List<PaymentAllocationOrder> getPaymentAllocationOrder(PaymentAllocationType... paymentAllocationTypes) {
|
||||||
AtomicInteger integer = new AtomicInteger(1);
|
AtomicInteger integer = new AtomicInteger(1);
|
||||||
return Arrays.stream(paymentAllocationTypes).map(pat -> {
|
return Arrays.stream(paymentAllocationTypes).map(pat -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user