FINERACT-2412: full term tranche - get loan API changes & add to LoanAccountDataV1 (events)
This commit is contained in:
@@ -853,6 +853,14 @@
|
||||
"items": "org.apache.fineract.avro.loan.v1.OriginatorDetailsV1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"default": null,
|
||||
"name": "actualNoTerm",
|
||||
"type": [
|
||||
"null",
|
||||
"int"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+3
@@ -201,6 +201,8 @@ public class EventCheckHelper {
|
||||
BigDecimal delinquentFeeExpected = body.getDelinquent().getDelinquentFee();
|
||||
BigDecimal delinquentPenaltyActual = loanAccountDataV1.getDelinquent().getDelinquentPenalty();
|
||||
BigDecimal delinquentPenaltyExpected = body.getDelinquent().getDelinquentPenalty();
|
||||
Integer actualNoTermActual = loanAccountDataV1.getActualNoTerm();
|
||||
Integer actualNoTermExpected = body.getActualNoTerm();
|
||||
|
||||
assertThat(idActual).isEqualTo(idExpected);
|
||||
assertThat(statusIdActual).isEqualTo(statusIdExpected);
|
||||
@@ -217,6 +219,7 @@ public class EventCheckHelper {
|
||||
assertThat(areBigDecimalValuesEqual(delinquentInterestActual, delinquentInterestExpected)).isTrue();
|
||||
assertThat(areBigDecimalValuesEqual(delinquentFeeActual, delinquentFeeExpected)).isTrue();
|
||||
assertThat(areBigDecimalValuesEqual(delinquentPenaltyActual, delinquentPenaltyExpected)).isTrue();
|
||||
assertThat(actualNoTermActual).isEqualTo(actualNoTermExpected);
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
+1
@@ -104,6 +104,7 @@ public class LoanAccountData {
|
||||
private Integer termFrequency;
|
||||
private EnumOptionData termPeriodFrequencyType;
|
||||
private Integer numberOfRepayments;
|
||||
private Integer actualNoTerm;
|
||||
private Integer repaymentEvery;
|
||||
private Integer fixedLength;
|
||||
private EnumOptionData repaymentFrequencyType;
|
||||
|
||||
+3
@@ -72,4 +72,7 @@ public interface LoanRepaymentScheduleInstallmentRepository
|
||||
""")
|
||||
List<LoanRepaymentScheduleInstallment> findByLoanId(@Param("loanId") Long loanId);
|
||||
|
||||
long countLoanRepaymentScheduleInstallmentsByLoan_IdAndAdditionalAndIsDownPayment(Long loanId, boolean additional,
|
||||
boolean isDownPayment);
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -168,4 +168,6 @@ public interface LoanReadPlatformService {
|
||||
LoanTransactionData retrieveLoanReAgeTemplate(Long loanId);
|
||||
|
||||
LoanTransactionData retrieveLoanReAmortizationTemplate(Long loanId);
|
||||
|
||||
Integer countInstallmentsByLoanIdWhereIsAdditionalFalseAndIsDownPaymentFalse(Long loanId);
|
||||
}
|
||||
|
||||
+4
@@ -102,6 +102,10 @@ public class LoanBusinessEventSerializer extends AbstractBusinessEventWithCustom
|
||||
data.setLoanTermVariations(activeLoanTermVariations.stream().map(LoanTermVariations::toData).toList());
|
||||
}
|
||||
|
||||
Integer actualNoTerms = Math.toIntExact(
|
||||
event.get().getRepaymentScheduleInstallments().stream().filter(i -> !i.isAdditional() && !i.isDownPayment()).count());
|
||||
data.setActualNoTerm(actualNoTerms);
|
||||
|
||||
final LoanAccountDataV1 result = mapper.map(data);
|
||||
result.getDelinquent().setInstallmentDelinquencyBuckets(installmentsDelinquencyData);
|
||||
|
||||
|
||||
+2
@@ -1024,6 +1024,8 @@ public class LoansApiResource {
|
||||
loanBasicDetails = loanBasicDetails.setMeeting(calendarData);
|
||||
}
|
||||
}
|
||||
loanBasicDetails.setActualNoTerm(
|
||||
loanReadPlatformService.countInstallmentsByLoanIdWhereIsAdditionalFalseAndIsDownPaymentFalse(resolvedLoanId));
|
||||
Collection<InterestRatePeriodData> interestRatesPeriods = this.loanReadPlatformService
|
||||
.retrieveLoanInterestRatePeriodData(loanBasicDetails);
|
||||
Collection<LoanTransactionData> loanRepayments = null;
|
||||
|
||||
+2
@@ -1286,6 +1286,8 @@ final class LoansApiResourceSwagger {
|
||||
public StringEnumOptionData buyDownFeeStrategy;
|
||||
@Schema(example = "FEE")
|
||||
public StringEnumOptionData buyDownFeeIncomeType;
|
||||
@Schema(example = "6")
|
||||
public Integer actualNoTerm;
|
||||
}
|
||||
|
||||
@Schema(description = "GetLoansResponse")
|
||||
|
||||
+5
@@ -1796,6 +1796,11 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
|
||||
.reAmortizationInterestHandlingOptions(LoanReAmortizationInterestHandlingType.getValuesAsEnumOptionDataList()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer countInstallmentsByLoanIdWhereIsAdditionalFalseAndIsDownPaymentFalse(Long loanId) {
|
||||
return loanRepaymentScheduleService.countInstallmentsByLoanIdWhereIsAdditionalFalseAndIsDownPaymentFalse(loanId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoanTransactionData retrieveLoanChargeOffTemplate(final Long loanId) {
|
||||
|
||||
|
||||
+5
@@ -60,6 +60,11 @@ public class LoanRepaymentScheduleService {
|
||||
isInterestRecalculationEnabled, loanScheduleType);
|
||||
}
|
||||
|
||||
public Integer countInstallmentsByLoanIdWhereIsAdditionalFalseAndIsDownPaymentFalse(Long loanId) {
|
||||
return Math.toIntExact(loanRepaymentScheduleInstallmentRepository
|
||||
.countLoanRepaymentScheduleInstallmentsByLoan_IdAndAdditionalAndIsDownPayment(loanId, false, false));
|
||||
}
|
||||
|
||||
public LoanScheduleData extractLoanScheduleData(final List<LoanRepaymentScheduleInstallment> installments,
|
||||
final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedLoanData, Collection<DisbursementData> disbursementData,
|
||||
Collection<LoanTransactionRepaymentPeriodData> capitalizedIncomeData, boolean isInterestRecalculationEnabled,
|
||||
|
||||
Reference in New Issue
Block a user