FINERACT-1958-Configuration-extending-schedule-with-downpayment
This commit is contained in:
committed by
Adam Saghy
parent
4b02527561
commit
233cb5af57
+2
@@ -1080,6 +1080,8 @@ final class LoansApiResourceSwagger {
|
||||
public BigDecimal disbursedAmountPercentageForDownPayment;
|
||||
@Schema(example = "false")
|
||||
public Boolean enableAutoRepaymentForDownPayment;
|
||||
@Schema(example = "false")
|
||||
public Boolean disableScheduleExtensionForDownPayment;
|
||||
}
|
||||
|
||||
@Schema(description = "GetLoansResponse")
|
||||
|
||||
+7
-3
@@ -259,6 +259,7 @@ public class LoanAccountData {
|
||||
private Boolean enableDownPayment;
|
||||
private BigDecimal disbursedAmountPercentageForDownPayment;
|
||||
private Boolean enableAutoRepaymentForDownPayment;
|
||||
private Boolean disableScheduleExtensionForDownPayment;
|
||||
|
||||
public static LoanAccountData importInstanceIndividual(EnumOptionData loanTypeEnumOption, Long clientId, Long productId,
|
||||
Long loanOfficerId, LocalDate submittedOnDate, Long fundId, BigDecimal principal, Integer numberOfRepayments,
|
||||
@@ -661,7 +662,8 @@ public class LoanAccountData {
|
||||
final BigDecimal topupAmount, final boolean isEqualAmortization, final BigDecimal fixedPrincipalPercentagePerInstallment,
|
||||
final DelinquencyRangeData delinquencyRange, final boolean disallowExpectedDisbursements, final boolean fraud,
|
||||
LocalDate lastClosedBusinessDate, LocalDate overpaidOnDate, final boolean chargedOff, final boolean enableDownPayment,
|
||||
final BigDecimal disbursedAmountPercentageForDownPayment, final boolean enableAutoRepaymentForDownPayment) {
|
||||
final BigDecimal disbursedAmountPercentageForDownPayment, final boolean enableAutoRepaymentForDownPayment,
|
||||
final boolean disableScheduleExtensionForDownPayment) {
|
||||
|
||||
final CollectionData delinquent = CollectionData.template();
|
||||
|
||||
@@ -703,7 +705,8 @@ public class LoanAccountData {
|
||||
.setDelinquencyRange(delinquencyRange).setDisallowExpectedDisbursements(disallowExpectedDisbursements).setFraud(fraud)
|
||||
.setLastClosedBusinessDate(lastClosedBusinessDate).setOverpaidOnDate(overpaidOnDate).setChargedOff(chargedOff)
|
||||
.setEnableDownPayment(enableDownPayment).setDisbursedAmountPercentageForDownPayment(disbursedAmountPercentageForDownPayment)
|
||||
.setEnableAutoRepaymentForDownPayment(enableAutoRepaymentForDownPayment);
|
||||
.setEnableAutoRepaymentForDownPayment(enableAutoRepaymentForDownPayment)
|
||||
.setDisableScheduleExtensionForDownPayment(disableScheduleExtensionForDownPayment);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -790,7 +793,8 @@ public class LoanAccountData {
|
||||
.setFraud(acc.fraud).setLastClosedBusinessDate(acc.getLastClosedBusinessDate()).setOverpaidOnDate(acc.overpaidOnDate)
|
||||
.setChargedOff(acc.chargedOff).setEnableDownPayment(acc.enableDownPayment)
|
||||
.setDisbursedAmountPercentageForDownPayment(acc.disbursedAmountPercentageForDownPayment)
|
||||
.setEnableAutoRepaymentForDownPayment(acc.enableAutoRepaymentForDownPayment);
|
||||
.setEnableAutoRepaymentForDownPayment(acc.enableAutoRepaymentForDownPayment)
|
||||
.setDisableScheduleExtensionForDownPayment(acc.disableScheduleExtensionForDownPayment);
|
||||
}
|
||||
|
||||
public static LoanAccountData associationsAndTemplate(final LoanAccountData acc, final Collection<LoanProductData> productOptions,
|
||||
|
||||
+6
-1
@@ -462,10 +462,14 @@ public class LoanScheduleAssembler {
|
||||
final boolean isDownPaymentEnabled = loanProduct.getLoanProductRelatedDetail().isEnableDownPayment();
|
||||
BigDecimal disbursedAmountPercentageForDownPayment = null;
|
||||
boolean isAutoRepaymentForDownPaymentEnabled = false;
|
||||
boolean isScheduleExtensionForDownPaymentDisabled = false;
|
||||
if (isDownPaymentEnabled) {
|
||||
disbursedAmountPercentageForDownPayment = loanProduct.getLoanProductRelatedDetail()
|
||||
.getDisbursedAmountPercentageForDownPayment();
|
||||
isAutoRepaymentForDownPaymentEnabled = loanProduct.getLoanProductRelatedDetail().isEnableAutoRepaymentForDownPayment();
|
||||
isScheduleExtensionForDownPaymentDisabled = loanProduct.getLoanProductRelatedDetail()
|
||||
.isDisableScheduleExtensionForDownPayment();
|
||||
|
||||
}
|
||||
return LoanApplicationTerms.assembleFrom(applicationCurrency, loanTermFrequency, loanTermPeriodFrequencyType, numberOfRepayments,
|
||||
repaymentEvery, repaymentPeriodFrequencyType, nthDay, weekDayType, amortizationMethod, interestMethod,
|
||||
@@ -480,7 +484,8 @@ public class LoanScheduleAssembler {
|
||||
loanTermVariations, isInterestChargedFromDateSameAsDisbursalDateEnabled, numberOfDays, isSkipMeetingOnFirstDay, detailDTO,
|
||||
allowCompoundingOnEod, isEqualAmortization, isInterestToBeRecoveredFirstWhenGreaterThanEMI,
|
||||
fixedPrincipalPercentagePerInstallment, isPrincipalCompoundingDisabledForOverdueLoans, isDownPaymentEnabled,
|
||||
disbursedAmountPercentageForDownPayment, isAutoRepaymentForDownPaymentEnabled, repaymentStartDateType, submittedOnDate);
|
||||
disbursedAmountPercentageForDownPayment, isAutoRepaymentForDownPaymentEnabled, repaymentStartDateType, submittedOnDate,
|
||||
isScheduleExtensionForDownPaymentDisabled);
|
||||
}
|
||||
|
||||
private CalendarInstance createCalendarForSameAsRepayment(final Integer repaymentEvery,
|
||||
|
||||
+3
-2
@@ -697,7 +697,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
|
||||
+ " lp.can_use_for_topup as canUseForTopup, l.is_topup as isTopup, topup.closure_loan_id as closureLoanId, "
|
||||
+ " l.total_recovered_derived as totalRecovered, topuploan.account_no as closureLoanAccountNo, "
|
||||
+ " topup.topup_amount as topupAmount, l.last_closed_business_date as lastClosedBusinessDate,l.overpaidon_date as overpaidOnDate, "
|
||||
+ " l.is_charged_off as isChargedOff, l.charge_off_reason_cv_id as chargeOffReasonId, codec.code_value as chargeOffReason, l.charged_off_on_date as chargedOffOnDate, l.enable_down_payment as enableDownPayment, l.disbursed_amount_percentage_for_down_payment as disbursedAmountPercentageForDownPayment, l.enable_auto_repayment_for_down_payment as enableAutoRepaymentForDownPayment,"
|
||||
+ " l.is_charged_off as isChargedOff, l.charge_off_reason_cv_id as chargeOffReasonId, codec.code_value as chargeOffReason, l.charged_off_on_date as chargedOffOnDate, l.enable_down_payment as enableDownPayment, l.disbursed_amount_percentage_for_down_payment as disbursedAmountPercentageForDownPayment, l.enable_auto_repayment_for_down_payment as enableAutoRepaymentForDownPayment, l.disable_schedule_extension_for_down_payment as disableScheduleExtensionForDownPayment,"
|
||||
+ " cobu.username as chargedOffByUsername, cobu.firstname as chargedOffByFirstname, cobu.lastname as chargedOffByLastname "
|
||||
+ " from m_loan l" //
|
||||
+ " join m_product_loan lp on lp.id = l.product_id" //
|
||||
@@ -1044,6 +1044,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
|
||||
final boolean enableDownPayment = rs.getBoolean("enableDownPayment");
|
||||
final BigDecimal disbursedAmountPercentageForDownPayment = rs.getBigDecimal("disbursedAmountPercentageForDownPayment");
|
||||
final boolean enableAutoRepaymentForDownPayment = rs.getBoolean("enableAutoRepaymentForDownPayment");
|
||||
final boolean disableScheduleExtensionForDownPayment = rs.getBoolean("disableScheduleExtensionForDownPayment");
|
||||
|
||||
return LoanAccountData.basicLoanDetails(id, accountNo, status, externalId, clientId, clientAccountNo, clientName,
|
||||
clientOfficeId, clientExternalId, groupData, loanType, loanProductId, loanProductName, loanProductDescription,
|
||||
@@ -1061,7 +1062,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
|
||||
canUseForTopup, isTopup, closureLoanId, closureLoanAccountNo, topupAmount, isEqualAmortization,
|
||||
fixedPrincipalPercentagePerInstallment, delinquencyRange, disallowExpectedDisbursements, isFraud,
|
||||
lastClosedBusinessDate, overpaidOnDate, isChargedOff, enableDownPayment, disbursedAmountPercentageForDownPayment,
|
||||
enableAutoRepaymentForDownPayment);
|
||||
enableAutoRepaymentForDownPayment, disableScheduleExtensionForDownPayment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -116,7 +116,7 @@ public class LoanProductsApiResource {
|
||||
LoanApiConstants.fixedPrincipalPercentagePerInstallmentParamName, LoanProductConstants.DUE_DAYS_FOR_REPAYMENT_EVENT,
|
||||
LoanProductConstants.OVER_DUE_DAYS_FOR_REPAYMENT_EVENT, LoanProductConstants.ENABLE_DOWN_PAYMENT,
|
||||
LoanProductConstants.DISBURSED_AMOUNT_PERCENTAGE_DOWN_PAYMENT, LoanProductConstants.ENABLE_AUTO_REPAYMENT_DOWN_PAYMENT,
|
||||
LoanProductConstants.REPAYMENT_START_DATE_TYPE));
|
||||
LoanProductConstants.REPAYMENT_START_DATE_TYPE, LoanProductConstants.DISABLE_SCHEDULE_EXTENSION_FOR_DOWN_PAYMENT));
|
||||
|
||||
private static final Set<String> PRODUCT_MIX_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList("productId", "productName", "restrictedProducts", "allowedProducts", "productOptions"));
|
||||
@@ -151,7 +151,7 @@ public class LoanProductsApiResource {
|
||||
@Operation(summary = "Create a Loan Product", description = "Depending of the Accounting Rule (accountingRule) selected, additional fields with details of the appropriate Ledger Account identifiers would need to be passed in.\n"
|
||||
+ "\n" + "Refer MifosX Accounting Specs Draft for more details regarding the significance of the selected accounting rule\n\n"
|
||||
+ "Mandatory Fields: name, shortName, currencyCode, digitsAfterDecimal, inMultiplesOf, principal, numberOfRepayments, repaymentEvery, repaymentFrequencyType, interestRatePerPeriod, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, transactionProcessingStrategyCode, accountingRule, isInterestRecalculationEnabled, daysInYearType, daysInMonthType\n\n"
|
||||
+ "Optional Fields: inArrearsTolerance, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, graceOnArrearsAgeing, charges, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, includeInBorrowerCycle, useBorrowerCycle,principalVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle, multiDisburseLoan,maxTrancheCount, outstandingLoanBalance,overdueDaysForNPA,holdGuaranteeFunds, principalThresholdForLastInstalment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf, allowAttributeOverrides, allowPartialPeriodInterestCalcualtion,dueDaysForRepaymentEvent,overDueDaysForRepaymentEvent,enableDownPayment,disbursedAmountPercentageDownPayment,enableAutoRepaymentForDownPayment,repaymentStartDateType\n\n"
|
||||
+ "Optional Fields: inArrearsTolerance, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, graceOnArrearsAgeing, charges, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, includeInBorrowerCycle, useBorrowerCycle,principalVariationsForBorrowerCycle, numberOfRepaymentVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle, multiDisburseLoan,maxTrancheCount, outstandingLoanBalance,overdueDaysForNPA,holdGuaranteeFunds, principalThresholdForLastInstalment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf, allowAttributeOverrides, allowPartialPeriodInterestCalcualtion,dueDaysForRepaymentEvent,overDueDaysForRepaymentEvent,enableDownPayment,disbursedAmountPercentageDownPayment,enableAutoRepaymentForDownPayment,repaymentStartDateType,disableScheduleExtensionForDownPayment\n\n"
|
||||
+ "Additional Mandatory Fields for Cash(2) based accounting: fundSourceAccountId, loanPortfolioAccountId, interestOnLoanAccountId, incomeFromFeeAccountId, incomeFromPenaltyAccountId, writeOffAccountId, transfersInSuspenseAccountId, overpaymentLiabilityAccountId\n\n"
|
||||
+ "Additional Mandatory Fields for periodic (3) and upfront (4)accrual accounting: fundSourceAccountId, loanPortfolioAccountId, interestOnLoanAccountId, incomeFromFeeAccountId, incomeFromPenaltyAccountId, writeOffAccountId, receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId, transfersInSuspenseAccountId, overpaymentLiabilityAccountId\n\n"
|
||||
+ "Additional Mandatory Fields if interest recalculation is enabled(true): interestRecalculationCompoundingMethod, rescheduleStrategyMethod, recalculationRestFrequencyType\n\n"
|
||||
|
||||
+6
@@ -164,6 +164,8 @@ final class LoanProductsApiResourceSwagger {
|
||||
public Boolean enableAutoRepaymentForDownPayment;
|
||||
@Schema(example = "1")
|
||||
public Integer repaymentStartDateType;
|
||||
@Schema(example = "false")
|
||||
public Boolean disableScheduleExtensionForDownPayment;
|
||||
|
||||
// Interest Recalculation
|
||||
@Schema(example = "false")
|
||||
@@ -1250,6 +1252,8 @@ final class LoanProductsApiResourceSwagger {
|
||||
@Schema(example = "false")
|
||||
public Boolean enableAutoRepaymentForDownPayment;
|
||||
public GetLoanProductsRepaymentStartDateType repaymentStartDateType;
|
||||
@Schema(example = "false")
|
||||
public Boolean disableScheduleExtensionForDownPayment;
|
||||
}
|
||||
|
||||
@Schema(description = "PutLoanProductsProductIdRequest")
|
||||
@@ -1380,6 +1384,8 @@ final class LoanProductsApiResourceSwagger {
|
||||
public Boolean enableAutoRepaymentForDownPayment;
|
||||
@Schema(example = "1")
|
||||
public Integer repaymentStartDateType;
|
||||
@Schema(example = "false")
|
||||
public Boolean disableScheduleExtensionForDownPayment;
|
||||
|
||||
// Interest Recalculation
|
||||
@Schema(example = "false")
|
||||
|
||||
+13
-5
@@ -203,6 +203,7 @@ public class LoanProductData implements Serializable {
|
||||
private final boolean enableDownPayment;
|
||||
private final BigDecimal disbursedAmountPercentageForDownPayment;
|
||||
private final boolean enableAutoRepaymentForDownPayment;
|
||||
private final boolean disableScheduleExtensionForDownPayment;
|
||||
|
||||
/**
|
||||
* Used when returning lookup information about loan product for dropdowns.
|
||||
@@ -297,6 +298,7 @@ public class LoanProductData implements Serializable {
|
||||
final Collection<AdvancedPaymentData> paymentAllocation = null;
|
||||
final boolean enableAutoRepaymentForDownPayment = false;
|
||||
final EnumOptionData repaymentStartDateType = null;
|
||||
final boolean disableScheduleExtensionForDownPayment = false;
|
||||
|
||||
return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
|
||||
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
|
||||
@@ -316,7 +318,7 @@ public class LoanProductData implements Serializable {
|
||||
syncExpectedWithDisbursementDate, canUseForTopup, isEqualAmortization, rateOptions, rates, isRatesEnabled,
|
||||
fixedPrincipalPercentagePerInstallment, delinquencyBucketOptions, delinquencyBucket, dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment,
|
||||
paymentAllocation, repaymentStartDateType);
|
||||
paymentAllocation, repaymentStartDateType, disableScheduleExtensionForDownPayment);
|
||||
|
||||
}
|
||||
|
||||
@@ -411,6 +413,7 @@ public class LoanProductData implements Serializable {
|
||||
final boolean enableAutoRepaymentForDownPayment = false;
|
||||
final Collection<AdvancedPaymentData> paymentAllocation = null;
|
||||
final EnumOptionData repaymentStartDateType = null;
|
||||
final boolean disableScheduleExtensionForDownPayment = false;
|
||||
|
||||
return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
|
||||
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
|
||||
@@ -430,7 +433,7 @@ public class LoanProductData implements Serializable {
|
||||
syncExpectedWithDisbursementDate, canUseForTopup, isEqualAmortization, rateOptions, rates, isRatesEnabled,
|
||||
fixedPrincipalPercentagePerInstallment, delinquencyBucketOptions, delinquencyBucket, dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment,
|
||||
paymentAllocation, repaymentStartDateType);
|
||||
paymentAllocation, repaymentStartDateType, disableScheduleExtensionForDownPayment);
|
||||
|
||||
}
|
||||
|
||||
@@ -532,6 +535,7 @@ public class LoanProductData implements Serializable {
|
||||
final boolean enableAutoRepaymentForDownPayment = false;
|
||||
final Collection<AdvancedPaymentData> paymentAllocation = null;
|
||||
final EnumOptionData repaymentStartDateType = LoanEnumerations.repaymentStartDateType(RepaymentStartDateType.DISBURSEMENT_DATE);
|
||||
final boolean disableScheduleExtensionForDownPayment = false;
|
||||
|
||||
return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
|
||||
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
|
||||
@@ -551,7 +555,7 @@ public class LoanProductData implements Serializable {
|
||||
syncExpectedWithDisbursementDate, canUseForTopup, isEqualAmortization, rateOptions, rates, isRatesEnabled,
|
||||
fixedPrincipalPercentagePerInstallment, delinquencyBucketOptions, delinquencyBucket, dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment,
|
||||
paymentAllocation, repaymentStartDateType);
|
||||
paymentAllocation, repaymentStartDateType, disableScheduleExtensionForDownPayment);
|
||||
|
||||
}
|
||||
|
||||
@@ -647,6 +651,7 @@ public class LoanProductData implements Serializable {
|
||||
final boolean enableAutoRepaymentForDownPayment = false;
|
||||
final Collection<AdvancedPaymentData> paymentAllocation = null;
|
||||
final EnumOptionData repaymentStartDateType = LoanEnumerations.repaymentStartDateType(RepaymentStartDateType.DISBURSEMENT_DATE);
|
||||
final boolean disableScheduleExtensionForDownPayment = false;
|
||||
|
||||
return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
|
||||
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
|
||||
@@ -666,7 +671,7 @@ public class LoanProductData implements Serializable {
|
||||
syncExpectedWithDisbursementDate, canUseForTopup, isEqualAmortization, rateOptions, rates, isRatesEnabled,
|
||||
fixedPrincipalPercentagePerInstallment, delinquencyBucketOptions, delinquencyBucket, dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment,
|
||||
paymentAllocation, repaymentStartDateType);
|
||||
paymentAllocation, repaymentStartDateType, disableScheduleExtensionForDownPayment);
|
||||
}
|
||||
|
||||
public static LoanProductData withAccountingDetails(final LoanProductData productData, final Map<String, Object> accountingMappings,
|
||||
@@ -714,7 +719,8 @@ public class LoanProductData implements Serializable {
|
||||
final DelinquencyBucketData delinquencyBucket, final Integer dueDaysForRepaymentEvent,
|
||||
final Integer overDueDaysForRepaymentEvent, final boolean enableDownPayment,
|
||||
final BigDecimal disbursedAmountPercentageForDownPayment, final boolean enableAutoRepaymentForDownPayment,
|
||||
final Collection<AdvancedPaymentData> paymentAllocation, final EnumOptionData repaymentStartDateType) {
|
||||
final Collection<AdvancedPaymentData> paymentAllocation, final EnumOptionData repaymentStartDateType,
|
||||
final boolean disableScheduleExtensionForDownPayment) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.shortName = shortName;
|
||||
@@ -841,6 +847,7 @@ public class LoanProductData implements Serializable {
|
||||
this.advancedPaymentAllocationTransactionTypes = null;
|
||||
this.advancedPaymentAllocationFutureInstallmentAllocationRules = null;
|
||||
this.advancedPaymentAllocationTypes = null;
|
||||
this.disableScheduleExtensionForDownPayment = disableScheduleExtensionForDownPayment;
|
||||
}
|
||||
|
||||
public LoanProductData(final LoanProductData productData, final Collection<ChargeData> chargeOptions,
|
||||
@@ -1004,6 +1011,7 @@ public class LoanProductData implements Serializable {
|
||||
this.advancedPaymentAllocationTransactionTypes = advancedPaymentAllocationTransactionTypes;
|
||||
this.advancedPaymentAllocationFutureInstallmentAllocationRules = advancedPaymentAllocationFutureInstallmentAllocationRules;
|
||||
this.advancedPaymentAllocationTypes = advancedPaymentAllocationTypes;
|
||||
this.disableScheduleExtensionForDownPayment = productData.disableScheduleExtensionForDownPayment;
|
||||
}
|
||||
|
||||
private Collection<ChargeData> nullIfEmpty(final Collection<ChargeData> charges) {
|
||||
|
||||
+39
-1
@@ -162,7 +162,8 @@ public final class LoanProductDataValidator {
|
||||
LoanProductConstants.OVER_APPLIED_NUMBER, LoanProductConstants.DELINQUENCY_BUCKET_PARAM_NAME,
|
||||
LoanProductConstants.DUE_DAYS_FOR_REPAYMENT_EVENT, LoanProductConstants.OVER_DUE_DAYS_FOR_REPAYMENT_EVENT,
|
||||
LoanProductConstants.ENABLE_DOWN_PAYMENT, LoanProductConstants.DISBURSED_AMOUNT_PERCENTAGE_DOWN_PAYMENT,
|
||||
LoanProductConstants.ENABLE_AUTO_REPAYMENT_DOWN_PAYMENT, LoanProductConstants.REPAYMENT_START_DATE_TYPE));
|
||||
LoanProductConstants.ENABLE_AUTO_REPAYMENT_DOWN_PAYMENT, LoanProductConstants.REPAYMENT_START_DATE_TYPE,
|
||||
LoanProductConstants.DISABLE_SCHEDULE_EXTENSION_FOR_DOWN_PAYMENT));
|
||||
|
||||
private static final String[] SUPPORTED_LOAN_CONFIGURABLE_ATTRIBUTES = { LoanProductConstants.amortizationTypeParamName,
|
||||
LoanProductConstants.interestTypeParamName, LoanProductConstants.transactionProcessingStrategyCodeParamName,
|
||||
@@ -753,6 +754,7 @@ public final class LoanProductDataValidator {
|
||||
.validateForBooleanValue();
|
||||
validateDownPaymentPercentage(enableDownPayment, baseDataValidator, element);
|
||||
validateAutoRepaymentForDownPayment(enableDownPayment, baseDataValidator, element);
|
||||
validateScheduleExtensionForDownPayment(enableDownPayment, baseDataValidator, element, null);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.REPAYMENT_START_DATE_TYPE, element)) {
|
||||
@@ -765,6 +767,41 @@ public final class LoanProductDataValidator {
|
||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||
}
|
||||
|
||||
private void validateScheduleExtensionForDownPayment(Boolean enableDownPayment, DataValidatorBuilder baseDataValidator,
|
||||
JsonElement element, final LoanProduct loanProduct) {
|
||||
|
||||
Boolean multiDisburseLoan = null;
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME, element)) {
|
||||
multiDisburseLoan = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME,
|
||||
element);
|
||||
} else if (loanProduct != null) {
|
||||
multiDisburseLoan = loanProduct.isMultiDisburseLoan();
|
||||
}
|
||||
|
||||
if (multiDisburseLoan != null && multiDisburseLoan) {
|
||||
if (enableDownPayment) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.DISABLE_SCHEDULE_EXTENSION_FOR_DOWN_PAYMENT, element)) {
|
||||
final Boolean disableScheduleExtensionForDownPayment = this.fromApiJsonHelper
|
||||
.extractBooleanNamed(LoanProductConstants.DISABLE_SCHEDULE_EXTENSION_FOR_DOWN_PAYMENT, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.DISABLE_SCHEDULE_EXTENSION_FOR_DOWN_PAYMENT)
|
||||
.value(disableScheduleExtensionForDownPayment).ignoreIfNull().validateForBooleanValue();
|
||||
}
|
||||
} else {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.DISABLE_SCHEDULE_EXTENSION_FOR_DOWN_PAYMENT, element)) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.DISABLE_SCHEDULE_EXTENSION_FOR_DOWN_PAYMENT).failWithCode(
|
||||
"supported.only.for.multi.disburse.loan.with.enable.down.payment.true",
|
||||
"Disable repayment schedule extension for down-payment is supported only for multi disburse loan with enable down-payment true");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.DISABLE_SCHEDULE_EXTENSION_FOR_DOWN_PAYMENT, element)) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.DISABLE_SCHEDULE_EXTENSION_FOR_DOWN_PAYMENT).failWithCode(
|
||||
"supported.only.for.multi.disburse.loan.with.enable.down.payment.true",
|
||||
"Disable repayment schedule extension for down-payment is supported only for multi disburse loan with enable down-payment true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateAutoRepaymentForDownPayment(Boolean enableDownPayment, DataValidatorBuilder baseDataValidator,
|
||||
JsonElement element) {
|
||||
if (enableDownPayment) {
|
||||
@@ -1685,6 +1722,7 @@ public final class LoanProductDataValidator {
|
||||
.validateForBooleanValue();
|
||||
validateDownPaymentPercentage(enableDownPayment, baseDataValidator, element);
|
||||
validateAutoRepaymentForDownPayment(enableDownPayment, baseDataValidator, element);
|
||||
validateScheduleExtensionForDownPayment(enableDownPayment, baseDataValidator, element, loanProduct);
|
||||
}
|
||||
|
||||
Integer repaymentStartDateType = loanProduct.getRepaymentStartDateType().getValue();
|
||||
|
||||
+3
-1
@@ -230,6 +230,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
||||
+ "lp.days_in_month_enum as daysInMonth, lp.days_in_year_enum as daysInYear, lp.interest_recalculation_enabled as isInterestRecalculationEnabled, "
|
||||
+ "lp.can_define_fixed_emi_amount as canDefineInstallmentAmount, lp.instalment_amount_in_multiples_of as installmentAmountInMultiplesOf, "
|
||||
+ "lp.due_days_for_repayment_event as dueDaysForRepaymentEvent, lp.overdue_days_for_repayment_event as overDueDaysForRepaymentEvent, lp.enable_down_payment as enableDownPayment, lp.disbursed_amount_percentage_for_down_payment as disbursedAmountPercentageForDownPayment, lp.enable_auto_repayment_for_down_payment as enableAutoRepaymentForDownPayment, lp.repayment_start_date_type_enum as repaymentStartDateType, "
|
||||
+ "lp.disable_schedule_extension_for_down_payment as disableScheduleExtensionForDownPayment, "
|
||||
+ "lpr.pre_close_interest_calculation_strategy as preCloseInterestCalculationStrategy, "
|
||||
+ "lpr.id as lprId, lpr.product_id as productId, lpr.compound_type_enum as compoundType, lpr.reschedule_strategy_enum as rescheduleStrategy, "
|
||||
+ "lpr.rest_frequency_type_enum as restFrequencyEnum, lpr.rest_frequency_interval as restFrequencyInterval, "
|
||||
@@ -366,6 +367,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
||||
final boolean enableAutoRepaymentForDownPayment = rs.getBoolean("enableAutoRepaymentForDownPayment");
|
||||
final Integer repaymentStartDateTypeId = JdbcSupport.getInteger(rs, "repaymentStartDateType");
|
||||
final EnumOptionData repaymentStartDateType = LoanEnumerations.repaymentStartDateType(repaymentStartDateTypeId);
|
||||
final boolean disableScheduleExtensionForDownPayment = rs.getBoolean("disableScheduleExtensionForDownPayment");
|
||||
|
||||
String status = "";
|
||||
if (closeDate != null && closeDate.isBefore(DateUtils.getBusinessLocalDate())) {
|
||||
@@ -523,7 +525,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
||||
maximumGap, syncExpectedWithDisbursementDate, canUseForTopup, isEqualAmortization, rateOptions, this.rates,
|
||||
isRatesEnabled, fixedPrincipalPercentagePerInstallment, delinquencyBucketOptions, delinquencyBucket,
|
||||
dueDaysForRepaymentEvent, overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageForDownPayment,
|
||||
enableAutoRepaymentForDownPayment, advancedPaymentData, repaymentStartDateType);
|
||||
enableAutoRepaymentForDownPayment, advancedPaymentData, repaymentStartDateType, disableScheduleExtensionForDownPayment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user