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"
|
"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 delinquentFeeExpected = body.getDelinquent().getDelinquentFee();
|
||||||
BigDecimal delinquentPenaltyActual = loanAccountDataV1.getDelinquent().getDelinquentPenalty();
|
BigDecimal delinquentPenaltyActual = loanAccountDataV1.getDelinquent().getDelinquentPenalty();
|
||||||
BigDecimal delinquentPenaltyExpected = body.getDelinquent().getDelinquentPenalty();
|
BigDecimal delinquentPenaltyExpected = body.getDelinquent().getDelinquentPenalty();
|
||||||
|
Integer actualNoTermActual = loanAccountDataV1.getActualNoTerm();
|
||||||
|
Integer actualNoTermExpected = body.getActualNoTerm();
|
||||||
|
|
||||||
assertThat(idActual).isEqualTo(idExpected);
|
assertThat(idActual).isEqualTo(idExpected);
|
||||||
assertThat(statusIdActual).isEqualTo(statusIdExpected);
|
assertThat(statusIdActual).isEqualTo(statusIdExpected);
|
||||||
@@ -217,6 +219,7 @@ public class EventCheckHelper {
|
|||||||
assertThat(areBigDecimalValuesEqual(delinquentInterestActual, delinquentInterestExpected)).isTrue();
|
assertThat(areBigDecimalValuesEqual(delinquentInterestActual, delinquentInterestExpected)).isTrue();
|
||||||
assertThat(areBigDecimalValuesEqual(delinquentFeeActual, delinquentFeeExpected)).isTrue();
|
assertThat(areBigDecimalValuesEqual(delinquentFeeActual, delinquentFeeExpected)).isTrue();
|
||||||
assertThat(areBigDecimalValuesEqual(delinquentPenaltyActual, delinquentPenaltyExpected)).isTrue();
|
assertThat(areBigDecimalValuesEqual(delinquentPenaltyActual, delinquentPenaltyExpected)).isTrue();
|
||||||
|
assertThat(actualNoTermActual).isEqualTo(actualNoTermExpected);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|||||||
+1
@@ -104,6 +104,7 @@ public class LoanAccountData {
|
|||||||
private Integer termFrequency;
|
private Integer termFrequency;
|
||||||
private EnumOptionData termPeriodFrequencyType;
|
private EnumOptionData termPeriodFrequencyType;
|
||||||
private Integer numberOfRepayments;
|
private Integer numberOfRepayments;
|
||||||
|
private Integer actualNoTerm;
|
||||||
private Integer repaymentEvery;
|
private Integer repaymentEvery;
|
||||||
private Integer fixedLength;
|
private Integer fixedLength;
|
||||||
private EnumOptionData repaymentFrequencyType;
|
private EnumOptionData repaymentFrequencyType;
|
||||||
|
|||||||
+3
@@ -72,4 +72,7 @@ public interface LoanRepaymentScheduleInstallmentRepository
|
|||||||
""")
|
""")
|
||||||
List<LoanRepaymentScheduleInstallment> findByLoanId(@Param("loanId") Long loanId);
|
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 retrieveLoanReAgeTemplate(Long loanId);
|
||||||
|
|
||||||
LoanTransactionData retrieveLoanReAmortizationTemplate(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());
|
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);
|
final LoanAccountDataV1 result = mapper.map(data);
|
||||||
result.getDelinquent().setInstallmentDelinquencyBuckets(installmentsDelinquencyData);
|
result.getDelinquent().setInstallmentDelinquencyBuckets(installmentsDelinquencyData);
|
||||||
|
|
||||||
|
|||||||
+2
@@ -1024,6 +1024,8 @@ public class LoansApiResource {
|
|||||||
loanBasicDetails = loanBasicDetails.setMeeting(calendarData);
|
loanBasicDetails = loanBasicDetails.setMeeting(calendarData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
loanBasicDetails.setActualNoTerm(
|
||||||
|
loanReadPlatformService.countInstallmentsByLoanIdWhereIsAdditionalFalseAndIsDownPaymentFalse(resolvedLoanId));
|
||||||
Collection<InterestRatePeriodData> interestRatesPeriods = this.loanReadPlatformService
|
Collection<InterestRatePeriodData> interestRatesPeriods = this.loanReadPlatformService
|
||||||
.retrieveLoanInterestRatePeriodData(loanBasicDetails);
|
.retrieveLoanInterestRatePeriodData(loanBasicDetails);
|
||||||
Collection<LoanTransactionData> loanRepayments = null;
|
Collection<LoanTransactionData> loanRepayments = null;
|
||||||
|
|||||||
+2
@@ -1286,6 +1286,8 @@ final class LoansApiResourceSwagger {
|
|||||||
public StringEnumOptionData buyDownFeeStrategy;
|
public StringEnumOptionData buyDownFeeStrategy;
|
||||||
@Schema(example = "FEE")
|
@Schema(example = "FEE")
|
||||||
public StringEnumOptionData buyDownFeeIncomeType;
|
public StringEnumOptionData buyDownFeeIncomeType;
|
||||||
|
@Schema(example = "6")
|
||||||
|
public Integer actualNoTerm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "GetLoansResponse")
|
@Schema(description = "GetLoansResponse")
|
||||||
|
|||||||
+5
@@ -1796,6 +1796,11 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
|
|||||||
.reAmortizationInterestHandlingOptions(LoanReAmortizationInterestHandlingType.getValuesAsEnumOptionDataList()).build();
|
.reAmortizationInterestHandlingOptions(LoanReAmortizationInterestHandlingType.getValuesAsEnumOptionDataList()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer countInstallmentsByLoanIdWhereIsAdditionalFalseAndIsDownPaymentFalse(Long loanId) {
|
||||||
|
return loanRepaymentScheduleService.countInstallmentsByLoanIdWhereIsAdditionalFalseAndIsDownPaymentFalse(loanId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanTransactionData retrieveLoanChargeOffTemplate(final Long loanId) {
|
public LoanTransactionData retrieveLoanChargeOffTemplate(final Long loanId) {
|
||||||
|
|
||||||
|
|||||||
+5
@@ -60,6 +60,11 @@ public class LoanRepaymentScheduleService {
|
|||||||
isInterestRecalculationEnabled, loanScheduleType);
|
isInterestRecalculationEnabled, loanScheduleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer countInstallmentsByLoanIdWhereIsAdditionalFalseAndIsDownPaymentFalse(Long loanId) {
|
||||||
|
return Math.toIntExact(loanRepaymentScheduleInstallmentRepository
|
||||||
|
.countLoanRepaymentScheduleInstallmentsByLoan_IdAndAdditionalAndIsDownPayment(loanId, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
public LoanScheduleData extractLoanScheduleData(final List<LoanRepaymentScheduleInstallment> installments,
|
public LoanScheduleData extractLoanScheduleData(final List<LoanRepaymentScheduleInstallment> installments,
|
||||||
final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedLoanData, Collection<DisbursementData> disbursementData,
|
final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedLoanData, Collection<DisbursementData> disbursementData,
|
||||||
Collection<LoanTransactionRepaymentPeriodData> capitalizedIncomeData, boolean isInterestRecalculationEnabled,
|
Collection<LoanTransactionRepaymentPeriodData> capitalizedIncomeData, boolean isInterestRecalculationEnabled,
|
||||||
|
|||||||
Reference in New Issue
Block a user