FINERACT-2181: Fix integration test / unify getLoanRepaymentScheduleDetail()
This commit is contained in:
+4
-4
@@ -215,8 +215,8 @@ public final class LoanApplicationValidator {
|
||||
}
|
||||
|
||||
validateLoanTermAndRepaidEveryValues(loan.getTermFrequency(), loan.getTermPeriodFrequencyType().getValue(),
|
||||
loan.repaymentScheduleDetail().getNumberOfRepayments(), loan.repaymentScheduleDetail().getRepayEvery(),
|
||||
loan.repaymentScheduleDetail().getRepaymentPeriodFrequencyType().getValue(), loan);
|
||||
loan.getLoanProductRelatedDetail().getNumberOfRepayments(), loan.getLoanProductRelatedDetail().getRepayEvery(),
|
||||
loan.getLoanProductRelatedDetail().getRepaymentPeriodFrequencyType().getValue(), loan);
|
||||
}
|
||||
|
||||
public void validateForModify(final Loan loan) {
|
||||
@@ -229,8 +229,8 @@ public final class LoanApplicationValidator {
|
||||
}
|
||||
|
||||
validateLoanTermAndRepaidEveryValues(loan.getTermFrequency(), loan.getTermPeriodFrequencyType().getValue(),
|
||||
loan.repaymentScheduleDetail().getNumberOfRepayments(), loan.repaymentScheduleDetail().getRepayEvery(),
|
||||
loan.repaymentScheduleDetail().getRepaymentPeriodFrequencyType().getValue(), loan);
|
||||
loan.getLoanProductRelatedDetail().getNumberOfRepayments(), loan.getLoanProductRelatedDetail().getRepayEvery(),
|
||||
loan.getLoanProductRelatedDetail().getRepaymentPeriodFrequencyType().getValue(), loan);
|
||||
}
|
||||
|
||||
public void validateForCreate(JsonCommand command) {
|
||||
|
||||
+5
-4
@@ -233,12 +233,13 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
case DAILY -> CalendarFrequencyType.DAILY;
|
||||
case WEEKLY -> CalendarFrequencyType.WEEKLY;
|
||||
case MONTHLY -> CalendarFrequencyType.MONTHLY;
|
||||
case SAME_AS_REPAYMENT_PERIOD -> CalendarFrequencyType.from(loan.repaymentScheduleDetail().getRepaymentPeriodFrequencyType());
|
||||
case SAME_AS_REPAYMENT_PERIOD ->
|
||||
CalendarFrequencyType.from(loan.getLoanProductRelatedDetail().getRepaymentPeriodFrequencyType());
|
||||
case INVALID -> CalendarFrequencyType.INVALID;
|
||||
};
|
||||
|
||||
if (recalculationFrequencyType == SAME_AS_REPAYMENT_PERIOD) {
|
||||
frequency = loan.repaymentScheduleDetail().getRepayEvery();
|
||||
frequency = loan.getLoanProductRelatedDetail().getRepayEvery();
|
||||
calendarStartDate = loan.getExpectedDisbursedOnLocalDate();
|
||||
if (updatedRepeatsOnDay == null) {
|
||||
updatedRepeatsOnDay = calendarStartDate.get(ChronoField.DAY_OF_WEEK);
|
||||
@@ -400,12 +401,12 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
}
|
||||
}
|
||||
} else {
|
||||
PeriodFrequencyType repaymentFrequencyType = loan.repaymentScheduleDetail().getRepaymentPeriodFrequencyType();
|
||||
PeriodFrequencyType repaymentFrequencyType = loan.getLoanProductRelatedDetail().getRepaymentPeriodFrequencyType();
|
||||
if (repaymentFrequencyType == PeriodFrequencyType.MONTHS) {
|
||||
final String title = "loan_schedule_" + loan.getId();
|
||||
final Integer typeId = CalendarType.COLLECTION.getValue();
|
||||
final CalendarFrequencyType calendarFrequencyType = CalendarFrequencyType.MONTHLY;
|
||||
final Integer interval = loan.repaymentScheduleDetail().getRepayEvery();
|
||||
final Integer interval = loan.getLoanProductRelatedDetail().getRepayEvery();
|
||||
LocalDate startDate = loan.getExpectedFirstRepaymentOnDate();
|
||||
if (startDate == null) {
|
||||
startDate = loan.getExpectedDisbursedOnLocalDate();
|
||||
|
||||
+1
-1
@@ -775,7 +775,7 @@ public class LoanAssemblerImpl implements LoanAssembler {
|
||||
changes.put(LoanApiConstants.fixedPrincipalPercentagePerInstallmentParamName, loan.getFixedPrincipalPercentagePerInstallment());
|
||||
}
|
||||
|
||||
final LoanProductRelatedDetail productRelatedDetail = loan.repaymentScheduleDetail();
|
||||
final LoanProductRelatedDetail productRelatedDetail = loan.getLoanProductRelatedDetail();
|
||||
if (loan.loanProduct().getLoanConfigurableAttributes() != null) {
|
||||
loanScheduleAssembler.updateProductRelatedDetails(productRelatedDetail, loan);
|
||||
}
|
||||
|
||||
+2
-2
@@ -249,7 +249,7 @@ public class LoanUtilService {
|
||||
// immediately after disbursement date,
|
||||
// need to have minimum number of days gap between disbursement
|
||||
// and first repayment date.
|
||||
final LoanProductRelatedDetail repaymentScheduleDetails = loan.repaymentScheduleDetail();
|
||||
final LoanProductRelatedDetail repaymentScheduleDetails = loan.getLoanProductRelatedDetail();
|
||||
// Not expecting to be null
|
||||
if (repaymentScheduleDetails != null) {
|
||||
final Integer repayEvery = repaymentScheduleDetails.getRepayEvery();
|
||||
@@ -273,7 +273,7 @@ public class LoanUtilService {
|
||||
|
||||
private LocalDate generateCalculatedRepaymentStartDate(final CalendarHistoryDataWrapper calendarHistoryDataWrapper,
|
||||
LocalDate actualDisbursementDate, Loan loan) {
|
||||
final LoanProductRelatedDetail repaymentScheduleDetails = loan.repaymentScheduleDetail();
|
||||
final LoanProductRelatedDetail repaymentScheduleDetails = loan.getLoanProductRelatedDetail();
|
||||
final WorkingDays workingDays = this.workingDaysRepository.findOne();
|
||||
LocalDate calculatedRepaymentsStartingFromDate = null;
|
||||
|
||||
|
||||
+3
-3
@@ -415,7 +415,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
regenerateScheduleOnDisbursement(command, loan, recalculateSchedule, scheduleGeneratorDTO, nextPossibleRepaymentDate,
|
||||
rescheduledRepaymentDate);
|
||||
boolean downPaymentEnabled = loan.repaymentScheduleDetail().isEnableDownPayment();
|
||||
boolean downPaymentEnabled = loan.getLoanProductRelatedDetail().isEnableDownPayment();
|
||||
if (loan.isInterestBearingAndInterestRecalculationEnabled() || downPaymentEnabled) {
|
||||
createAndSaveLoanScheduleArchive(loan, scheduleGeneratorDTO);
|
||||
}
|
||||
@@ -786,7 +786,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
final ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, recalculateFrom);
|
||||
regenerateScheduleOnDisbursement(command, loan, recalculateSchedule, scheduleGeneratorDTO, nextPossibleRepaymentDate,
|
||||
rescheduledRepaymentDate);
|
||||
boolean downPaymentEnabled = loan.repaymentScheduleDetail().isEnableDownPayment();
|
||||
boolean downPaymentEnabled = loan.getLoanProductRelatedDetail().isEnableDownPayment();
|
||||
if (loan.isInterestBearingAndInterestRecalculationEnabled() || downPaymentEnabled) {
|
||||
createAndSaveLoanScheduleArchive(loan, scheduleGeneratorDTO);
|
||||
}
|
||||
@@ -2340,7 +2340,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
loanDownPaymentTransactionValidator.validateAccountStatus(loan, LoanEvent.LOAN_EDIT_MULTI_DISBURSE_DATE);
|
||||
updateDisbursementDateAndAmountForTranche(loan, loanDisbursementDetails, command, changes, scheduleGeneratorDTO);
|
||||
} else {
|
||||
loan.repaymentScheduleDetail().setPrincipal(loan.getPrincipalAmountForRepaymentSchedule());
|
||||
loan.getLoanProductRelatedDetail().setPrincipal(loan.getPrincipalAmountForRepaymentSchedule());
|
||||
|
||||
if (loan.isCumulativeSchedule() && loan.isInterestBearingAndInterestRecalculationEnabled()) {
|
||||
loanScheduleService.regenerateRepaymentScheduleWithInterestRecalculation(loan, scheduleGeneratorDTO);
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ class LoanChargeWritePlatformServiceImplTest {
|
||||
when(chargeDefinition.getChargeTimeType()).thenReturn(SPECIFIED_DUE_DATE);
|
||||
when(chargeDefinition.getCurrencyCode()).thenReturn(CURRENCY_CODE);
|
||||
when(loanChargeAssembler.createNewFromJson(loan, chargeDefinition, jsonCommand)).thenReturn(loanCharge);
|
||||
when(loan.repaymentScheduleDetail()).thenReturn(loanRepaymentScheduleDetail);
|
||||
when(loan.getLoanProductRelatedDetail()).thenReturn(loanRepaymentScheduleDetail);
|
||||
when(loanRepaymentScheduleDetail.getLoanScheduleType()).thenReturn(LoanScheduleType.CUMULATIVE);
|
||||
when(loan.getLoanRepaymentScheduleDetail()).thenReturn(loanRepaymentScheduleDetail);
|
||||
when(loan.hasCurrencyCodeOf(CURRENCY_CODE)).thenReturn(true);
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ public class LoanDownPaymentHandlerServiceImplTest {
|
||||
|
||||
when(loanRepaymentRelatedDetail.getInstallmentAmountInMultiplesOf()).thenReturn(10);
|
||||
when(loanForProcessing.getLoanRepaymentScheduleDetail()).thenReturn(loanRepaymentRelatedDetail);
|
||||
when(loanForProcessing.repaymentScheduleDetail()).thenReturn(loanRepaymentRelatedDetail);
|
||||
when(loanForProcessing.getLoanProductRelatedDetail()).thenReturn(loanRepaymentRelatedDetail);
|
||||
when(loanRepaymentRelatedDetail.isInterestRecalculationEnabled()).thenReturn(true);
|
||||
when(loanForProcessing.isInterestBearingAndInterestRecalculationEnabled()).thenReturn(true);
|
||||
when(loanRepaymentRelatedDetail.getDisbursedAmountPercentageForDownPayment()).thenReturn(BigDecimal.valueOf(10));
|
||||
|
||||
Reference in New Issue
Block a user