FINERACT-821 Made changes to enforce ConstantName Checkstyle (3)
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
52fa7a9832
commit
dae424da1a
+4
-4
@@ -33,8 +33,8 @@ public class CalendarHelper {
|
||||
private static final String BASE_URL = "/fineract-provider/api/v1/";
|
||||
private static final String PARENT_ENTITY_NAME = "groups/";
|
||||
private static final String ENITY_NAME = "/calendars";
|
||||
private static final String CENTER__ENTITY = "centers/";
|
||||
private static final String EDIT__CALENDAR = "editcalendarbasedonmeetingdates/";
|
||||
private static final String CENTER_ENTITY = "centers/";
|
||||
private static final String EDIT_CALENDAR = "editcalendarbasedonmeetingdates/";
|
||||
|
||||
public static Integer createMeetingCalendarForGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final Integer groupId, final String startDate, final String frequency, final String interval, final String repeatsOnDay) {
|
||||
@@ -95,7 +95,7 @@ public class CalendarHelper {
|
||||
|
||||
LOG.info("---------------------------------CREATING A MEETING CALENDAR FOR THE GROUP------------------------------");
|
||||
|
||||
final String CALENDAR_RESOURCE_URL = BASE_URL + CENTER__ENTITY + groupId + ENITY_NAME + "?" + Utils.TENANT_IDENTIFIER;
|
||||
final String CALENDAR_RESOURCE_URL = BASE_URL + CENTER_ENTITY + groupId + ENITY_NAME + "?" + Utils.TENANT_IDENTIFIER;
|
||||
|
||||
LOG.info("{}",CALENDAR_RESOURCE_URL);
|
||||
|
||||
@@ -108,7 +108,7 @@ public class CalendarHelper {
|
||||
|
||||
LOG.info("---------------------------------UPADATING A MEETING CALENDAR FOR THE CENTER------------------------------");
|
||||
|
||||
final String CALENDAR_RESOURCE_URL = BASE_URL + CENTER__ENTITY + centerId + ENITY_NAME + "/" + calendarID + "?"
|
||||
final String CALENDAR_RESOURCE_URL = BASE_URL + CENTER_ENTITY + centerId + ENITY_NAME + "/" + calendarID + "?"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
|
||||
LOG.info("{}",CALENDAR_RESOURCE_URL);
|
||||
|
||||
+31
-31
@@ -71,11 +71,11 @@ public class ChargesHelper {
|
||||
private static final Integer CHARGE_FEE_FREQUENCY_MONTHS = 2;
|
||||
private static final Integer CHARGE_FEE_FREQUENCY_YEARS = 3;
|
||||
|
||||
private final static boolean active = true;
|
||||
private final static boolean ACTIVE = true;
|
||||
private final static boolean PENALTY = true;
|
||||
private final static String amount = "100";
|
||||
private final static String currencyCode = "USD";
|
||||
public final static String feeOnMonthDay = "04 March";
|
||||
private final static String AMOUNT = "100";
|
||||
private final static String CURRENCY_CODE = "USD";
|
||||
public final static String FEE_ON_MONTH_DAY = "04 March";
|
||||
private final static String MONTH_DAY_FORMAT = "dd MMM";
|
||||
|
||||
public static String getSavingsSpecifiedDueDateJSON() {
|
||||
@@ -88,15 +88,15 @@ public class ChargesHelper {
|
||||
}
|
||||
|
||||
public static String getSavingsActivationFeeJSON() {
|
||||
return getSavingsJSON(amount, currencyCode, ChargeTimeType.SAVINGS_ACTIVATION);
|
||||
return getSavingsJSON(AMOUNT, CURRENCY_CODE, ChargeTimeType.SAVINGS_ACTIVATION);
|
||||
}
|
||||
|
||||
public static String getSavingsNoActivityFeeJSON() {
|
||||
return getSavingsJSON(amount, currencyCode, ChargeTimeType.SAVINGS_NOACTIVITY_FEE);
|
||||
return getSavingsJSON(AMOUNT, CURRENCY_CODE, ChargeTimeType.SAVINGS_NOACTIVITY_FEE);
|
||||
}
|
||||
|
||||
public static String getSavingsWithdrawalFeeJSON() {
|
||||
return getSavingsJSON(amount, currencyCode, ChargeTimeType.WITHDRAWAL_FEE);
|
||||
return getSavingsJSON(AMOUNT, CURRENCY_CODE, ChargeTimeType.WITHDRAWAL_FEE);
|
||||
}
|
||||
|
||||
public static String getSavingsJSON(String amount, String currencyCode, ChargeTimeType timeType) {
|
||||
@@ -109,7 +109,7 @@ public class ChargesHelper {
|
||||
|
||||
public static String getSavingsAnnualFeeJSON() {
|
||||
final HashMap<String, Object> map = populateDefaultsForSavings();
|
||||
map.put("feeOnMonthDay", ChargesHelper.feeOnMonthDay);
|
||||
map.put("feeOnMonthDay", ChargesHelper.FEE_ON_MONTH_DAY);
|
||||
map.put("chargeTimeType", CHARGE_ANNUAL_FEE);
|
||||
String chargesCreateJson = new Gson().toJson(map);
|
||||
LOG.info("{}", chargesCreateJson);
|
||||
@@ -118,7 +118,7 @@ public class ChargesHelper {
|
||||
|
||||
public static String getSavingsMonthlyFeeJSON() {
|
||||
final HashMap<String, Object> map = populateDefaultsForSavings();
|
||||
map.put("feeOnMonthDay", ChargesHelper.feeOnMonthDay);
|
||||
map.put("feeOnMonthDay", ChargesHelper.FEE_ON_MONTH_DAY);
|
||||
map.put("chargeTimeType", CHARGE_MONTHLY_FEE);
|
||||
map.put("feeInterval", 2);
|
||||
String chargesCreateJson = new Gson().toJson(map);
|
||||
@@ -144,12 +144,12 @@ public class ChargesHelper {
|
||||
}
|
||||
|
||||
public static HashMap<String, Object> populateDefaultsForSavings() {
|
||||
return populateDefaultsForSavings(amount, currencyCode);
|
||||
return populateDefaultsForSavings(AMOUNT, CURRENCY_CODE);
|
||||
}
|
||||
|
||||
public static HashMap<String, Object> populateDefaultsForSavings(String amount, String currencyCode) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("active", ChargesHelper.active);
|
||||
map.put("active", ChargesHelper.ACTIVE);
|
||||
map.put("amount", amount);
|
||||
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_SAVINGS);
|
||||
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
|
||||
@@ -161,7 +161,7 @@ public class ChargesHelper {
|
||||
}
|
||||
|
||||
public static String getLoanDisbursementJSON() {
|
||||
return getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.amount);
|
||||
return getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT);
|
||||
}
|
||||
|
||||
public static String getLoanDisbursementJSON(final Integer chargeCalculationType, final String amount) {
|
||||
@@ -187,7 +187,7 @@ public class ChargesHelper {
|
||||
}
|
||||
|
||||
public static String getLoanSpecifiedDueDateJSON() {
|
||||
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.amount,
|
||||
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT,
|
||||
ChargesHelper.PENALTY);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public class ChargesHelper {
|
||||
}
|
||||
|
||||
public static String getLoanSpecifiedDueDateWithAccountTransferJSON() {
|
||||
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.amount,
|
||||
return getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT,
|
||||
ChargesHelper.PENALTY, ChargesHelper.CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ public class ChargesHelper {
|
||||
}
|
||||
|
||||
public static String getLoanInstallmentFeeJSON() {
|
||||
return getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.amount,
|
||||
return getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, ChargesHelper.AMOUNT,
|
||||
ChargesHelper.PENALTY);
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ public class ChargesHelper {
|
||||
map.put("chargePaymentMode", ChargesHelper.CHARGE_PAYMENT_MODE_REGULAR);
|
||||
map.put("chargeTimeType", CHARGE_OVERDUE_INSTALLMENT_FEE);
|
||||
map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_MONTHS);
|
||||
map.put("feeOnMonthDay", ChargesHelper.feeOnMonthDay);
|
||||
map.put("feeOnMonthDay", ChargesHelper.FEE_ON_MONTH_DAY);
|
||||
map.put("feeInterval", 2);
|
||||
String chargesCreateJson = new Gson().toJson(map);
|
||||
LOG.info("{}", chargesCreateJson);
|
||||
@@ -301,11 +301,11 @@ public class ChargesHelper {
|
||||
|
||||
public static HashMap<String, Object> populateDefaultsForLoan() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("active", ChargesHelper.active);
|
||||
map.put("amount", ChargesHelper.amount);
|
||||
map.put("active", ChargesHelper.ACTIVE);
|
||||
map.put("amount", ChargesHelper.AMOUNT);
|
||||
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_LOAN);
|
||||
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
|
||||
map.put("currencyCode", ChargesHelper.currencyCode);
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("monthDayFormat", ChargesHelper.MONTH_DAY_FORMAT);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Loans_", 6));
|
||||
@@ -314,12 +314,12 @@ public class ChargesHelper {
|
||||
|
||||
public static HashMap<String, Object> populateDefaultsClientCharge() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("active", ChargesHelper.active);
|
||||
map.put("amount", ChargesHelper.amount);
|
||||
map.put("active", ChargesHelper.ACTIVE);
|
||||
map.put("amount", ChargesHelper.AMOUNT);
|
||||
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_CLIENT);
|
||||
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
|
||||
map.put("chargeTimeType", ChargesHelper.CHARGE_SPECIFIED_DUE_DATE);
|
||||
map.put("currencyCode", ChargesHelper.currencyCode);
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("monthDayFormat", ChargesHelper.MONTH_DAY_FORMAT);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_client_", 8));
|
||||
@@ -328,12 +328,12 @@ public class ChargesHelper {
|
||||
|
||||
public static HashMap<String, Object> populateDefaultsShareActivationCharge() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("active", ChargesHelper.active);
|
||||
map.put("amount", ChargesHelper.amount);
|
||||
map.put("active", ChargesHelper.ACTIVE);
|
||||
map.put("amount", ChargesHelper.AMOUNT);
|
||||
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_SHARES);
|
||||
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
|
||||
map.put("chargeTimeType", ChargesHelper.SHAREACCOUNT_ACTIVATION);
|
||||
map.put("currencyCode", ChargesHelper.currencyCode);
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Share_Activation_", 8));
|
||||
return map;
|
||||
@@ -341,12 +341,12 @@ public class ChargesHelper {
|
||||
|
||||
public static HashMap<String, Object> populateDefaultsSharePurchaseFlatCharge() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("active", ChargesHelper.active);
|
||||
map.put("amount", ChargesHelper.amount);
|
||||
map.put("active", ChargesHelper.ACTIVE);
|
||||
map.put("amount", ChargesHelper.AMOUNT);
|
||||
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_SHARES);
|
||||
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
|
||||
map.put("chargeTimeType", ChargesHelper.SHARE_PURCHASE);
|
||||
map.put("currencyCode", ChargesHelper.currencyCode);
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Share_Purchase_", 8));
|
||||
return map;
|
||||
@@ -354,12 +354,12 @@ public class ChargesHelper {
|
||||
|
||||
public static HashMap<String, Object> populateDefaultsShareRedeemFlatCharge() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("active", ChargesHelper.active);
|
||||
map.put("amount", ChargesHelper.amount);
|
||||
map.put("active", ChargesHelper.ACTIVE);
|
||||
map.put("amount", ChargesHelper.AMOUNT);
|
||||
map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_SHARES);
|
||||
map.put("chargeCalculationType", ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT);
|
||||
map.put("chargeTimeType", ChargesHelper.SHARE_REDEEM);
|
||||
map.put("currencyCode", ChargesHelper.currencyCode);
|
||||
map.put("currencyCode", ChargesHelper.CURRENCY_CODE);
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("name", Utils.randomNameGenerator("Charge_Share_Redeem_", 8));
|
||||
return map;
|
||||
|
||||
+6
-6
@@ -98,7 +98,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
||||
|
||||
private final PaginationHelper<CenterData> paginationHelper = new PaginationHelper<>();
|
||||
private final PaginationParametersDataValidator paginationParametersDataValidator;
|
||||
private final static Set<String> supportedOrderByValues = new HashSet<>(Arrays.asList("id", "name", "officeId", "officeName"));
|
||||
private final static Set<String> SUPPORTED_ORDER_BY_VALUES = new HashSet<>(Arrays.asList("id", "name", "officeId", "officeName"));
|
||||
|
||||
@Autowired
|
||||
public CenterReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource,
|
||||
@@ -172,7 +172,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
||||
return extraCriteria.toString();
|
||||
}
|
||||
|
||||
private static final String sqlQuery = "g.id as id, g.account_no as accountNo, g.external_id as externalId, g.display_name as name, "
|
||||
private static final String SQL_QUERY = "g.id as id, g.account_no as accountNo, g.external_id as externalId, g.display_name as name, "
|
||||
+ "g.office_id as officeId, o.name as officeName, " //
|
||||
+ "g.staff_id as staffId, s.display_name as staffName, " //
|
||||
+ "g.status_enum as statusEnum, g.activation_date as activationDate, " //
|
||||
@@ -194,7 +194,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
||||
|
||||
public CenterDataMapper() {
|
||||
|
||||
this.schemaSql = sqlQuery;
|
||||
this.schemaSql = SQL_QUERY;
|
||||
}
|
||||
|
||||
public String schema() {
|
||||
@@ -320,7 +320,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
||||
|
||||
public GroupDataMapper() {
|
||||
|
||||
this.schemaSql = sqlQuery;
|
||||
this.schemaSql = SQL_QUERY;
|
||||
}
|
||||
|
||||
public String schema() {
|
||||
@@ -372,7 +372,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
||||
@Override
|
||||
public Page<CenterData> retrievePagedAll(final SearchParameters searchParameters, final PaginationParameters parameters) {
|
||||
|
||||
this.paginationParametersDataValidator.validateParameterValues(parameters, supportedOrderByValues, "audits");
|
||||
this.paginationParametersDataValidator.validateParameterValues(parameters, SUPPORTED_ORDER_BY_VALUES, "audits");
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
final String hierarchy = currentUser.getOffice().getHierarchy();
|
||||
final String hierarchySearchString = hierarchy + "%";
|
||||
@@ -411,7 +411,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
||||
@Override
|
||||
public Collection<CenterData> retrieveAll(SearchParameters searchParameters, PaginationParameters parameters) {
|
||||
if (parameters!=null) {
|
||||
this.paginationParametersDataValidator.validateParameterValues(parameters, supportedOrderByValues, "audits");
|
||||
this.paginationParametersDataValidator.validateParameterValues(parameters, SUPPORTED_ORDER_BY_VALUES, "audits");
|
||||
}
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
final String hierarchy = currentUser.getOffice().getHierarchy();
|
||||
|
||||
+2
-2
@@ -254,7 +254,7 @@ public class LoansApiResource {
|
||||
"inArrearsTolerance", "termFrequency", "termPeriodFrequencyType", "numberOfRepayments", "repaymentEvery",
|
||||
"interestRatePerPeriod", "annualInterestRate", "repaymentFrequencyType", "transactionProcessingStrategyId",
|
||||
"transactionProcessingStrategyName", "interestRateFrequencyType", "amortizationType", "interestType",
|
||||
"interestCalculationPeriodType", LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, "expectedFirstRepaymentOnDate",
|
||||
"interestCalculationPeriodType", LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, "expectedFirstRepaymentOnDate",
|
||||
"graceOnPrincipalPayment", "recurringMoratoriumOnPrincipalPeriods", "graceOnInterestPayment", "graceOnInterestCharged", "interestChargedFromDate", "timeline",
|
||||
"totalFeeChargesAtDisbursement", "summary", "repaymentSchedule", "transactions", "charges", "collateral", "guarantors",
|
||||
"meeting", "productOptions", "amortizationTypeOptions", "interestTypeOptions", "interestCalculationPeriodTypeOptions",
|
||||
@@ -264,7 +264,7 @@ public class LoansApiResource {
|
||||
"syncDisbursementWithMeeting", "loanCounter", "loanProductCounter", "notes", "accountLinkingOptions", "linkedAccount",
|
||||
"interestRateDifferential", "isFloatingInterestRate", "interestRatesPeriods", LoanApiConstants.canUseForTopup,
|
||||
LoanApiConstants.isTopup, LoanApiConstants.loanIdToClose, LoanApiConstants.topupAmount, LoanApiConstants.clientActiveLoanOptions,
|
||||
LoanApiConstants.datatables, LoanProductConstants.ratesParamName));
|
||||
LoanApiConstants.datatables, LoanProductConstants.RATES_PARAM_NAME));
|
||||
|
||||
private final Set<String> LOAN_APPROVAL_DATA_PARAMETERS = new HashSet<>(Arrays.asList("approvalDate", "approvalAmount"));
|
||||
final Set<String> GLIM_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(Arrays.asList("glimId","groupId", "clientId","parentLoanAccountNo","parentPrincipalAmount",
|
||||
|
||||
+2
-2
@@ -213,7 +213,7 @@ public class LoanScheduleAssembler {
|
||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod
|
||||
.fromInt(interestCalculationPeriodType);
|
||||
Boolean allowPartialPeriodInterestCalcualtion = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, element);
|
||||
LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, element);
|
||||
if (allowPartialPeriodInterestCalcualtion == null) {
|
||||
allowPartialPeriodInterestCalcualtion = loanProduct.getLoanProductRelatedDetail().isAllowPartialPeriodInterestCalcualtion();
|
||||
}
|
||||
@@ -317,7 +317,7 @@ public class LoanScheduleAssembler {
|
||||
.isInterestChargedFromDateSameAsDisbursementDate();
|
||||
|
||||
final Integer graceOnArrearsAgeing = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName, element);
|
||||
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, element);
|
||||
|
||||
// other
|
||||
final BigDecimal inArrearsTolerance = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed("inArrearsTolerance", element);
|
||||
|
||||
+3
-3
@@ -55,7 +55,7 @@ public final class CalculateLoanScheduleQueryFromApiJsonHelper {
|
||||
LoanApiConstants.loanTermFrequencyTypeParameterName, LoanApiConstants.repaymentFrequencyTypeParameterName,
|
||||
LoanApiConstants.amortizationTypeParameterName, LoanApiConstants.interestTypeParameterName,
|
||||
LoanApiConstants.interestCalculationPeriodTypeParameterName,
|
||||
LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, LoanApiConstants.interestRateFrequencyTypeParameterName,
|
||||
LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, LoanApiConstants.interestRateFrequencyTypeParameterName,
|
||||
LoanApiConstants.disbursementDateParameterName, LoanApiConstants.repaymentsStartingFromDateParameterName,
|
||||
LoanApiConstants.graceOnPrincipalPaymentParameterName, LoanApiConstants.graceOnInterestPaymentParameterName,
|
||||
LoanApiConstants.graceOnInterestChargedParameterName, LoanApiConstants.interestChargedFromDateParameterName,
|
||||
@@ -64,11 +64,11 @@ public final class CalculateLoanScheduleQueryFromApiJsonHelper {
|
||||
LoanApiConstants.collateralParameterName, LoanApiConstants.syncDisbursementWithMeetingParameterName,
|
||||
LoanApiConstants.linkAccountIdParameterName, LoanApiConstants.disbursementDataParameterName,
|
||||
LoanApiConstants.emiAmountParameterName, LoanApiConstants.maxOutstandingBalanceParameterName,
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName, LoanApiConstants.createStandingInstructionAtDisbursementParameterName,
|
||||
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, LoanApiConstants.createStandingInstructionAtDisbursementParameterName,
|
||||
LoanApiConstants.isFloatingInterestRateParameterName, LoanApiConstants.interestRateDifferentialParameterName,
|
||||
LoanApiConstants.repaymentFrequencyNthDayTypeParameterName, LoanApiConstants.repaymentFrequencyDayOfWeekTypeParameterName,
|
||||
LoanApiConstants.isTopup, LoanApiConstants.loanIdToClose, LoanApiConstants.datatables, LoanApiConstants.isEqualAmortizationParam,
|
||||
LoanProductConstants.ratesParamName));
|
||||
LoanProductConstants.RATES_PARAM_NAME));
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
|
||||
+17
-17
@@ -69,7 +69,7 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
LoanApiConstants.interestRatePerPeriodParameterName, LoanApiConstants.amortizationTypeParameterName,
|
||||
LoanApiConstants.interestTypeParameterName, LoanApiConstants.isFloatingInterestRate, LoanApiConstants.interestRateDifferential,
|
||||
LoanApiConstants.interestCalculationPeriodTypeParameterName,
|
||||
LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, LoanApiConstants.interestRateFrequencyTypeParameterName,
|
||||
LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, LoanApiConstants.interestRateFrequencyTypeParameterName,
|
||||
LoanApiConstants.disbursementDateParameterName, LoanApiConstants.repaymentsStartingFromDateParameterName,
|
||||
LoanApiConstants.graceOnPrincipalPaymentParameterName,
|
||||
LoanApiConstants.graceOnInterestPaymentParameterName,
|
||||
@@ -90,8 +90,8 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
LoanApiConstants.syncDisbursementWithMeetingParameterName,// optional
|
||||
LoanApiConstants.linkAccountIdParameterName, LoanApiConstants.disbursementDataParameterName,
|
||||
LoanApiConstants.emiAmountParameterName, LoanApiConstants.maxOutstandingBalanceParameterName,
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName, LoanApiConstants.createStandingInstructionAtDisbursementParameterName,
|
||||
LoanApiConstants.isTopup, LoanApiConstants.loanIdToClose, LoanApiConstants.datatables, LoanApiConstants.isEqualAmortizationParam,LoanProductConstants.ratesParamName,
|
||||
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, LoanApiConstants.createStandingInstructionAtDisbursementParameterName,
|
||||
LoanApiConstants.isTopup, LoanApiConstants.loanIdToClose, LoanApiConstants.datatables, LoanApiConstants.isEqualAmortizationParam,LoanProductConstants.RATES_PARAM_NAME,
|
||||
LoanApiConstants.applicationId, // glim specific
|
||||
LoanApiConstants.lastApplication)); // glim specific
|
||||
|
||||
@@ -334,8 +334,8 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
baseDataValidator.reset().parameter("graceOnInterestCharged").value(graceOnInterestCharged).zeroOrPositiveAmount();
|
||||
|
||||
final Integer graceOnArrearsAgeing = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.graceOnArrearsAgeingParameterName).value(graceOnArrearsAgeing)
|
||||
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME).value(graceOnArrearsAgeing)
|
||||
.zeroOrPositiveAmount();
|
||||
|
||||
final String interestChargedFromDateParameterName = "interestChargedFromDate";
|
||||
@@ -545,9 +545,9 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
}
|
||||
|
||||
boolean isEqualAmortization = existingLoanApplication.getLoanProductRelatedDetail().isEqualAmortization();
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.isEqualAmortizationParam, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.isEqualAmortizationParam, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.isEqualAmortizationParam).value(isEqualAmortization).ignoreIfNull()
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM).value(isEqualAmortization).ignoreIfNull()
|
||||
.validateForBooleanValue();
|
||||
if (isEqualAmortization && loanProduct.isInterestRecalculationEnabled()) { throw new EqualAmortizationUnsupportedFeatureException(
|
||||
"interest.recalculation", "interest recalculation"); }
|
||||
@@ -782,10 +782,10 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
baseDataValidator.reset().parameter("graceOnInterestCharged").value(graceOnInterestCharged).zeroOrPositiveAmount();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.graceOnArrearsAgeingParameterName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, element)) {
|
||||
final Integer graceOnArrearsAgeing = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.graceOnArrearsAgeingParameterName).value(graceOnArrearsAgeing)
|
||||
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME).value(graceOnArrearsAgeing)
|
||||
.zeroOrPositiveAmount();
|
||||
}
|
||||
|
||||
@@ -1207,15 +1207,15 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
.fromInt(interestCalculationPeriodType);
|
||||
boolean considerPartialPeriodUpdates = interestCalculationPeriodMethod.isDaily() ? interestCalculationPeriodMethod.isDaily()
|
||||
: loanProduct.getLoanProductRelatedDetail().isAllowPartialPeriodInterestCalcualtion();
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, element)) {
|
||||
final Boolean considerPartialInterestEnabled = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName)
|
||||
LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME)
|
||||
.value(considerPartialInterestEnabled).notNull().isOneOfTheseValues(true, false);
|
||||
boolean considerPartialPeriods = considerPartialInterestEnabled == null ? false : considerPartialInterestEnabled;
|
||||
if (interestCalculationPeriodMethod.isDaily()) {
|
||||
if (considerPartialPeriods) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName)
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME)
|
||||
.failWithCode("not.supported.for.daily.calcualtions");
|
||||
}
|
||||
} else {
|
||||
@@ -1225,12 +1225,12 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
|
||||
if (!considerPartialPeriodUpdates) {
|
||||
if (loanProduct.isInterestRecalculationEnabled()) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.isInterestRecalculationEnabledParameterName)
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME)
|
||||
.failWithCode("not.supported.for.selected.interest.calcualtion.type");
|
||||
}
|
||||
|
||||
if (loanProduct.isMultiDisburseLoan()) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.multiDisburseLoanParameterName)
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME)
|
||||
.failWithCode("not.supported.for.selected.interest.calcualtion.type");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1018,7 +1018,7 @@ public void checkForProductMixRestrictions(final Loan loan) {
|
||||
}
|
||||
|
||||
//Changes to modify loan rates.
|
||||
if (command.hasParameter(LoanProductConstants.ratesParamName)) {
|
||||
if (command.hasParameter(LoanProductConstants.RATES_PARAM_NAME)) {
|
||||
existingLoanApplication.updateLoanRates(rateAssembler.fromParsedJson(command.parsedJson()));
|
||||
}
|
||||
|
||||
@@ -1200,7 +1200,7 @@ public void checkForProductMixRestrictions(final Loan loan) {
|
||||
|
||||
if (productRelatedDetail.isInterestRecalculationEnabled()) {
|
||||
this.fromApiJsonDeserializer.validateLoanForInterestRecalculation(existingLoanApplication);
|
||||
if (changes.containsKey(LoanProductConstants.isInterestRecalculationEnabledParameterName)) {
|
||||
if (changes.containsKey(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME)) {
|
||||
createAndPersistCalendarInstanceForInterestRecalculation(existingLoanApplication);
|
||||
|
||||
}
|
||||
|
||||
+49
-49
@@ -22,66 +22,66 @@ import java.math.BigDecimal;
|
||||
|
||||
public interface LoanProductConstants {
|
||||
|
||||
public static final String useBorrowerCycleParameterName = "useBorrowerCycle";
|
||||
public static final String USE_BORROWER_CYCLE_PARAMETER_NAME = "useBorrowerCycle";
|
||||
|
||||
public static final String principalVariationsForBorrowerCycleParameterName = "principalVariationsForBorrowerCycle";
|
||||
public static final String interestRateVariationsForBorrowerCycleParameterName = "interestRateVariationsForBorrowerCycle";
|
||||
public static final String numberOfRepaymentVariationsForBorrowerCycleParameterName = "numberOfRepaymentVariationsForBorrowerCycle";
|
||||
public static final String PRINCIPAL_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME = "principalVariationsForBorrowerCycle";
|
||||
public static final String INTEREST_RATE_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME = "interestRateVariationsForBorrowerCycle";
|
||||
public static final String NUMBER_OF_REPAYMENT_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME = "numberOfRepaymentVariationsForBorrowerCycle";
|
||||
|
||||
public static final String defaultValueParameterName = "defaultValue";
|
||||
public static final String minValueParameterName = "minValue";
|
||||
public static final String maxValueParameterName = "maxValue";
|
||||
public static final String valueConditionTypeParamName = "valueConditionType";
|
||||
public static final String borrowerCycleNumberParamName = "borrowerCycleNumber";
|
||||
public static final String borrowerCycleIdParameterName = "id";
|
||||
public static final String DEFAULT_VALUE_PARAMETER_NAME = "defaultValue";
|
||||
public static final String MIN_VALUE_PARAMETER_NAME = "minValue";
|
||||
public static final String MAX_VALUE_PARAMETER_NAME = "maxValue";
|
||||
public static final String VALUE_CONDITION_TYPE_PARAM_NAME = "valueConditionType";
|
||||
public static final String BORROWER_CYCLE_NUMBER_PARAM_NAME = "borrowerCycleNumber";
|
||||
public static final String BORROWER_CYCLE_ID_PARAMETER_NAME = "id";
|
||||
|
||||
public static final String principalPerCycleParameterName = "principalPerCycle";
|
||||
public static final String minPrincipalPerCycleParameterName = "minPrincipalPerCycle";
|
||||
public static final String maxPrincipalPerCycleParameterName = "maxPrincipalPerCycle";
|
||||
public static final String principalValueUsageConditionParamName = "principalValueUsageCondition";
|
||||
public static final String principalCycleNumbersParamName = "principalCycleNumbers";
|
||||
public static final String PRINCIPAL_PER_CYCLE_PARAMETER_NAME = "principalPerCycle";
|
||||
public static final String MIN_PRINCIPAL_PER_CYCLE_PARAMETER_NAME = "minPrincipalPerCycle";
|
||||
public static final String MAX_PRINCIPAL_PER_CYCLE_PARAMETER_NAME = "maxPrincipalPerCycle";
|
||||
public static final String PRINCIPAL_VALUE_USAGE_CONDITION_PARAM_NAME = "principalValueUsageCondition";
|
||||
public static final String PRINCIPAL_CYCLE_NUMBERS_PARAM_NAME = "principalCycleNumbers";
|
||||
|
||||
public static final String numberOfRepaymentsPerCycleParameterName = "numberOfRepaymentsPerCycle";
|
||||
public static final String minNumberOfRepaymentsPerCycleParameterName = "minNumberOfRepaymentsPerCycle";
|
||||
public static final String maxNumberOfRepaymentsPerCycleParameterName = "maxNumberOfRepaymentsPerCycle";
|
||||
public static final String repaymentValueUsageConditionParamName = "repaymentValueUsageCondition";
|
||||
public static final String repaymentCycleNumberParamName = "repaymentCycleNumber";
|
||||
public static final String NUMBER_OF_REPAYMENTS_PER_CYCLE_PARAMETER_NAME = "numberOfRepaymentsPerCycle";
|
||||
public static final String MIN_NUMBER_OF_REPAYMENTS_PER_CYCLE_PARAMETER_NAME = "minNumberOfRepaymentsPerCycle";
|
||||
public static final String MAX_NUMBER_OF_REPAYMENTS_PER_CYCLE_PARAMETER_NAME = "maxNumberOfRepaymentsPerCycle";
|
||||
public static final String REPAYMENT_VALUE_USAGE_CONDITION_PARAM_NAME = "repaymentValueUsageCondition";
|
||||
public static final String REPAYMENT_CYCLE_NUMBER_PARAM_NAME = "repaymentCycleNumber";
|
||||
|
||||
public static final String interestRatePerPeriodPerCycleParameterName = "interestRatePerPeriodPerCycle";
|
||||
public static final String minInterestRatePerPeriodPerCycleParameterName = "minInterestRatePerPeriodPerCycle";
|
||||
public static final String maxInterestRatePerPeriodPerCycleParameterName = "maxInterestRatePerPeriodPerCycle";
|
||||
public static final String interestRateValueUsageConditionParamName = "interestRateValueUsageCondition";
|
||||
public static final String interestRateCycleNumberParamName = "interestRateCycleNumber";
|
||||
public static final String INTEREST_RATE_PER_PERIOD_PER_CYCLE_PARAMETER_NAME = "interestRatePerPeriodPerCycle";
|
||||
public static final String MIN_INTEREST_RATE_PER_PERIOD_PER_CYCLE_PARAMETER_NAME = "minInterestRatePerPeriodPerCycle";
|
||||
public static final String MAX_INTEREST_RATE_PER_PERIOD_PER_CYCLE_PARAMETER_NAME = "maxInterestRatePerPeriodPerCycle";
|
||||
public static final String INTEREST_RATE_VALUE_USAGE_CONDITION_PARAM_NAME = "interestRateValueUsageCondition";
|
||||
public static final String INTEREST_RATE_CYCLE_NUMBER_PARAM_NAME = "interestRateCycleNumber";
|
||||
|
||||
public static final String principal = "principal";
|
||||
public static final String minPrincipal = "minPrincipal";
|
||||
public static final String maxPrincipal = "maxPrincipalValue";
|
||||
public static final String PRINCIPAL = "principal";
|
||||
public static final String MIN_PRINCIPAL = "minPrincipal";
|
||||
public static final String MAX_PRINCIPAL = "maxPrincipalValue";
|
||||
|
||||
public static final String interestRatePerPeriod = "interestRatePerPeriod";
|
||||
public static final String minInterestRatePerPeriod = "minInterestRatePerPeriod";
|
||||
public static final String maxInterestRatePerPeriod = "maxInterestRatePerPeriod";
|
||||
public static final String INTEREST_RATE_PER_PERIOD = "interestRatePerPeriod";
|
||||
public static final String MIN_INTEREST_RATE_PER_PERIOD = "minInterestRatePerPeriod";
|
||||
public static final String MAX_INTEREST_RATE_PER_PERIOD = "maxInterestRatePerPeriod";
|
||||
|
||||
public static final String numberOfRepayments = "numberOfRepayments";
|
||||
public static final String minNumberOfRepayments = "minNumberOfRepayments";
|
||||
public static final String maxNumberOfRepayments = "maxNumberOfRepayments";
|
||||
public static final String NUMBER_OF_REPAYMENTS = "numberOfRepayments";
|
||||
public static final String MIN_NUMBER_OF_REPAYMENTS = "minNumberOfRepayments";
|
||||
public static final String MAX_NUMBER_OF_REPAYMENTS = "maxNumberOfRepayments";
|
||||
|
||||
public static final String VALUE_CONDITION_END_WITH_ERROR = "condition.type.must.end.with.greterthan";
|
||||
public static final String VALUE_CONDITION_START_WITH_ERROR = "condition.type.must.start.with.equal";
|
||||
public static final String shortName = "shortName";
|
||||
public static final String SHORT_NAME = "shortName";
|
||||
|
||||
public static final String multiDisburseLoanParameterName = "multiDisburseLoan";
|
||||
public static final String maxTrancheCountParameterName = "maxTrancheCount";
|
||||
public static final String outstandingLoanBalanceParameterName = "outstandingLoanBalance";
|
||||
public static final String MULTI_DISBURSE_LOAN_PARAMETER_NAME = "multiDisburseLoan";
|
||||
public static final String MAX_TRANCHE_COUNT_PARAMETER_NAME = "maxTrancheCount";
|
||||
public static final String OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME = "outstandingLoanBalance";
|
||||
|
||||
public static final String graceOnArrearsAgeingParameterName = "graceOnArrearsAgeing";
|
||||
public static final String overdueDaysForNPAParameterName = "overdueDaysForNPA";
|
||||
public static final String minimumDaysBetweenDisbursalAndFirstRepayment = "minimumDaysBetweenDisbursalAndFirstRepayment";
|
||||
public static final String accountMovesOutOfNPAOnlyOnArrearsCompletionParamName = "accountMovesOutOfNPAOnlyOnArrearsCompletion";
|
||||
public static final String GRACE_ON_ARREARS_AGEING_PARAMETER_NAME = "graceOnArrearsAgeing";
|
||||
public static final String OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME = "overdueDaysForNPA";
|
||||
public static final String MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT = "minimumDaysBetweenDisbursalAndFirstRepayment";
|
||||
public static final String ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME = "accountMovesOutOfNPAOnlyOnArrearsCompletion";
|
||||
|
||||
// Interest recalculation related
|
||||
public static final String isInterestRecalculationEnabledParameterName = "isInterestRecalculationEnabled";
|
||||
public static final String daysInYearTypeParameterName = "daysInYearType";
|
||||
public static final String daysInMonthTypeParameterName = "daysInMonthType";
|
||||
public static final String IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME = "isInterestRecalculationEnabled";
|
||||
public static final String DAYS_IN_YEAR_TYPE_PARAMETER_NAME = "daysInYearType";
|
||||
public static final String DAYS_IN_MONTH_TYPE_PARAMETER_NAME = "daysInMonthType";
|
||||
public static final String interestRecalculationCompoundingMethodParameterName = "interestRecalculationCompoundingMethod";
|
||||
public static final String rescheduleStrategyMethodParameterName = "rescheduleStrategyMethod";
|
||||
public static final String recalculationRestFrequencyTypeParameterName = "recalculationRestFrequencyType";
|
||||
@@ -128,12 +128,12 @@ public interface LoanProductConstants {
|
||||
public static final String maximumGapBetweenInstallments = "maximumGap" ;
|
||||
|
||||
|
||||
public static final String allowPartialPeriodInterestCalcualtionParamName = "allowPartialPeriodInterestCalcualtion";
|
||||
public static final String ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME = "allowPartialPeriodInterestCalcualtion";
|
||||
|
||||
public static final String canUseForTopup = "canUseForTopup";
|
||||
public static final String CAN_USE_FOR_TOPUP = "canUseForTopup";
|
||||
|
||||
public static final String isEqualAmortizationParam = "isEqualAmortization";
|
||||
public static final String IS_EQUAL_AMORTIZATION_PARAM = "isEqualAmortization";
|
||||
|
||||
public static final String ratesParamName = "rates";
|
||||
public static final String RATES_PARAM_NAME = "rates";
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -98,15 +98,15 @@ public class LoanProductsApiResource {
|
||||
"minNumberOfRepayments", "maxNumberOfRepayments", "repaymentEvery", "repaymentFrequencyType", "graceOnPrincipalPayment", "recurringMoratoriumOnPrincipalPeriods",
|
||||
"graceOnInterestPayment", "graceOnInterestCharged", "interestRatePerPeriod", "minInterestRatePerPeriod",
|
||||
"maxInterestRatePerPeriod", "interestRateFrequencyType", "annualInterestRate", "amortizationType", "interestType",
|
||||
"interestCalculationPeriodType", LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, "inArrearsTolerance",
|
||||
"interestCalculationPeriodType", LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, "inArrearsTolerance",
|
||||
"transactionProcessingStrategyId", "transactionProcessingStrategyName", "charges", "accountingRule", "externalId",
|
||||
"accountingMappings", "paymentChannelToFundSourceMappings", "fundOptions", "paymentTypeOptions", "currencyOptions",
|
||||
"repaymentFrequencyTypeOptions", "interestRateFrequencyTypeOptions", "amortizationTypeOptions", "interestTypeOptions",
|
||||
"interestCalculationPeriodTypeOptions", "transactionProcessingStrategyOptions", "chargeOptions", "accountingOptions",
|
||||
"accountingRuleOptions", "accountingMappingOptions", "floatingRateOptions", "isLinkedToFloatingInterestRates",
|
||||
"floatingRatesId", "interestRateDifferential", "minDifferentialLendingRate", "defaultDifferentialLendingRate",
|
||||
"maxDifferentialLendingRate", "isFloatingInterestRateCalculationAllowed", LoanProductConstants.canUseForTopup, LoanProductConstants.isEqualAmortizationParam,
|
||||
LoanProductConstants.ratesParamName));
|
||||
"maxDifferentialLendingRate", "isFloatingInterestRateCalculationAllowed", LoanProductConstants.CAN_USE_FOR_TOPUP, LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM,
|
||||
LoanProductConstants.RATES_PARAM_NAME));
|
||||
|
||||
private final Set<String> PRODUCT_MIX_DATA_PARAMETERS = new HashSet<>(Arrays.asList("productId", "productName", "restrictedProducts",
|
||||
"allowedProducts", "productOptions"));
|
||||
|
||||
+110
-110
@@ -193,7 +193,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
final List<Rate> productRates) {
|
||||
|
||||
final String name = command.stringValueOfParameterNamed("name");
|
||||
final String shortName = command.stringValueOfParameterNamed(LoanProductConstants.shortName);
|
||||
final String shortName = command.stringValueOfParameterNamed(LoanProductConstants.SHORT_NAME);
|
||||
final String description = command.stringValueOfParameterNamed("description");
|
||||
final String currencyCode = command.stringValueOfParameterNamed("currencyCode");
|
||||
final Integer digitsAfterDecimal = command.integerValueOfParameterNamed("digitsAfterDecimal");
|
||||
@@ -208,7 +208,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
final InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.fromInt(command
|
||||
.integerValueOfParameterNamed("interestCalculationPeriodType"));
|
||||
final boolean allowPartialPeriodInterestCalcualtion = command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName);
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME);
|
||||
final AmortizationMethod amortizationMethod = AmortizationMethod.fromInt(command.integerValueOfParameterNamed("amortizationType"));
|
||||
final PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.fromInt(command
|
||||
.integerValueOfParameterNamed("repaymentFrequencyType"));
|
||||
@@ -263,7 +263,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
final Integer graceOnInterestPayment = command.integerValueOfParameterNamed("graceOnInterestPayment");
|
||||
final Integer graceOnInterestCharged = command.integerValueOfParameterNamed("graceOnInterestCharged");
|
||||
final Integer minimumDaysBetweenDisbursalAndFirstRepayment = command
|
||||
.integerValueOfParameterNamed(LoanProductConstants.minimumDaysBetweenDisbursalAndFirstRepayment);
|
||||
.integerValueOfParameterNamed(LoanProductConstants.MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT);
|
||||
|
||||
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(command.integerValueOfParameterNamed("accountingRule"));
|
||||
final boolean includeInBorrowerCycle = command.booleanPrimitiveValueOfParameterNamed("includeInBorrowerCycle");
|
||||
@@ -272,7 +272,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
final LocalDate closeDate = command.localDateValueOfParameterNamed("closeDate");
|
||||
final String externalId = command.stringValueOfParameterNamedAllowingNull("externalId");
|
||||
|
||||
final boolean useBorrowerCycle = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.useBorrowerCycleParameterName);
|
||||
final boolean useBorrowerCycle = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME);
|
||||
final Set<LoanProductBorrowerCycleVariations> loanProductBorrowerCycleVariations = new HashSet<>();
|
||||
|
||||
if (useBorrowerCycle) {
|
||||
@@ -280,26 +280,26 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
final boolean multiDisburseLoan = command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.multiDisburseLoanParameterName);
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME);
|
||||
Integer maxTrancheCount = null;
|
||||
BigDecimal outstandingLoanBalance = null;
|
||||
if (multiDisburseLoan) {
|
||||
outstandingLoanBalance = command.bigDecimalValueOfParameterNamed(LoanProductConstants.outstandingLoanBalanceParameterName);
|
||||
maxTrancheCount = command.integerValueOfParameterNamed(LoanProductConstants.maxTrancheCountParameterName);
|
||||
outstandingLoanBalance = command.bigDecimalValueOfParameterNamed(LoanProductConstants.OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME);
|
||||
maxTrancheCount = command.integerValueOfParameterNamed(LoanProductConstants.MAX_TRANCHE_COUNT_PARAMETER_NAME);
|
||||
}
|
||||
|
||||
final Integer graceOnArrearsAgeing = command.integerValueOfParameterNamed(LoanProductConstants.graceOnArrearsAgeingParameterName);
|
||||
final Integer graceOnArrearsAgeing = command.integerValueOfParameterNamed(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME);
|
||||
|
||||
final Integer overdueDaysForNPA = command.integerValueOfParameterNamed(LoanProductConstants.overdueDaysForNPAParameterName);
|
||||
final Integer overdueDaysForNPA = command.integerValueOfParameterNamed(LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME);
|
||||
|
||||
// Interest recalculation settings
|
||||
final boolean isInterestRecalculationEnabled = command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.isInterestRecalculationEnabledParameterName);
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME);
|
||||
final DaysInMonthType daysInMonthType = DaysInMonthType.fromInt(command
|
||||
.integerValueOfParameterNamed(LoanProductConstants.daysInMonthTypeParameterName));
|
||||
.integerValueOfParameterNamed(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME));
|
||||
|
||||
final DaysInYearType daysInYearType = DaysInYearType.fromInt(command
|
||||
.integerValueOfParameterNamed(LoanProductConstants.daysInYearTypeParameterName));
|
||||
.integerValueOfParameterNamed(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME));
|
||||
|
||||
LoanProductInterestRecalculationDetails interestRecalculationSettings = null;
|
||||
|
||||
@@ -328,7 +328,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
: LoanProductConstants.DEFAULT_PRINCIPAL_THRESHOLD_FOR_SINGLE_DISBURSE_LOAN;
|
||||
}
|
||||
final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion = command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName);
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME);
|
||||
final boolean canDefineEmiAmount = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.canDefineEmiAmountParamName);
|
||||
final Integer installmentAmountInMultiplesOf = command
|
||||
.integerValueOfParameterNamed(LoanProductConstants.installmentAmountInMultiplesOfParamName);
|
||||
@@ -336,12 +336,12 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
final boolean syncExpectedWithDisbursementDate = command.booleanPrimitiveValueOfParameterNamed("syncExpectedWithDisbursementDate");
|
||||
|
||||
|
||||
final boolean canUseForTopup = command.parameterExists(LoanProductConstants.canUseForTopup)
|
||||
? command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.canUseForTopup)
|
||||
final boolean canUseForTopup = command.parameterExists(LoanProductConstants.CAN_USE_FOR_TOPUP)
|
||||
? command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.CAN_USE_FOR_TOPUP)
|
||||
: false;
|
||||
|
||||
final boolean isEqualAmortization = command.parameterExists(LoanProductConstants.isEqualAmortizationParam) ? command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.isEqualAmortizationParam) : false;
|
||||
final boolean isEqualAmortization = command.parameterExists(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM) ? command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM) : false;
|
||||
|
||||
return new LoanProduct(fund, loanTransactionProcessingStrategy, name, shortName, description, currency, principal, minPrincipal,
|
||||
maxPrincipal, interestRatePerPeriod, minInterestRatePerPeriod, maxInterestRatePerPeriod, interestFrequencyType,
|
||||
@@ -389,7 +389,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
private static void assembleInterestRateVariations(final JsonCommand command,
|
||||
final Set<LoanProductBorrowerCycleVariations> loanProductBorrowerCycleVariations) {
|
||||
assembleVaritions(command, loanProductBorrowerCycleVariations, LoanProductParamType.INTERESTRATE.getValue(),
|
||||
LoanProductConstants.interestRateVariationsForBorrowerCycleParameterName);
|
||||
LoanProductConstants.INTEREST_RATE_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME);
|
||||
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
private static void assembleRepaymentVariations(final JsonCommand command,
|
||||
final Set<LoanProductBorrowerCycleVariations> loanProductBorrowerCycleVariations) {
|
||||
assembleVaritions(command, loanProductBorrowerCycleVariations, LoanProductParamType.REPAYMENT.getValue(),
|
||||
LoanProductConstants.numberOfRepaymentVariationsForBorrowerCycleParameterName);
|
||||
LoanProductConstants.NUMBER_OF_REPAYMENT_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME);
|
||||
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
private static void assemblePrincipalVariations(final JsonCommand command,
|
||||
final Set<LoanProductBorrowerCycleVariations> loanProductBorrowerCycleVariations) {
|
||||
assembleVaritions(command, loanProductBorrowerCycleVariations, LoanProductParamType.PRINCIPAL.getValue(),
|
||||
LoanProductConstants.principalVariationsForBorrowerCycleParameterName);
|
||||
LoanProductConstants.PRINCIPAL_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME);
|
||||
}
|
||||
|
||||
private static void assembleVaritions(final JsonCommand command,
|
||||
@@ -428,27 +428,27 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
BigDecimal maxValue = null;
|
||||
Integer cycleNumber = null;
|
||||
Integer valueUsageCondition = null;
|
||||
if (jsonObject.has(LoanProductConstants.defaultValueParameterName)
|
||||
&& jsonObject.get(LoanProductConstants.defaultValueParameterName).isJsonPrimitive()) {
|
||||
defaultValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.defaultValueParameterName).getAsBigDecimal();
|
||||
if (jsonObject.has(LoanProductConstants.DEFAULT_VALUE_PARAMETER_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.DEFAULT_VALUE_PARAMETER_NAME).isJsonPrimitive()) {
|
||||
defaultValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.DEFAULT_VALUE_PARAMETER_NAME).getAsBigDecimal();
|
||||
}
|
||||
if (jsonObject.has(LoanProductConstants.minValueParameterName)
|
||||
&& jsonObject.get(LoanProductConstants.minValueParameterName).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.minValueParameterName).getAsString())) {
|
||||
minValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.minValueParameterName).getAsBigDecimal();
|
||||
if (jsonObject.has(LoanProductConstants.MIN_VALUE_PARAMETER_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.MIN_VALUE_PARAMETER_NAME).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.MIN_VALUE_PARAMETER_NAME).getAsString())) {
|
||||
minValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.MIN_VALUE_PARAMETER_NAME).getAsBigDecimal();
|
||||
}
|
||||
if (jsonObject.has(LoanProductConstants.maxValueParameterName)
|
||||
&& jsonObject.get(LoanProductConstants.maxValueParameterName).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.maxValueParameterName).getAsString())) {
|
||||
maxValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.maxValueParameterName).getAsBigDecimal();
|
||||
if (jsonObject.has(LoanProductConstants.MAX_VALUE_PARAMETER_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.MAX_VALUE_PARAMETER_NAME).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.MAX_VALUE_PARAMETER_NAME).getAsString())) {
|
||||
maxValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.MAX_VALUE_PARAMETER_NAME).getAsBigDecimal();
|
||||
}
|
||||
if (jsonObject.has(LoanProductConstants.borrowerCycleNumberParamName)
|
||||
&& jsonObject.get(LoanProductConstants.borrowerCycleNumberParamName).isJsonPrimitive()) {
|
||||
cycleNumber = jsonObject.getAsJsonPrimitive(LoanProductConstants.borrowerCycleNumberParamName).getAsInt();
|
||||
if (jsonObject.has(LoanProductConstants.BORROWER_CYCLE_NUMBER_PARAM_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.BORROWER_CYCLE_NUMBER_PARAM_NAME).isJsonPrimitive()) {
|
||||
cycleNumber = jsonObject.getAsJsonPrimitive(LoanProductConstants.BORROWER_CYCLE_NUMBER_PARAM_NAME).getAsInt();
|
||||
}
|
||||
if (jsonObject.has(LoanProductConstants.valueConditionTypeParamName)
|
||||
&& jsonObject.get(LoanProductConstants.valueConditionTypeParamName).isJsonPrimitive()) {
|
||||
valueUsageCondition = jsonObject.getAsJsonPrimitive(LoanProductConstants.valueConditionTypeParamName).getAsInt();
|
||||
if (jsonObject.has(LoanProductConstants.VALUE_CONDITION_TYPE_PARAM_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.VALUE_CONDITION_TYPE_PARAM_NAME).isJsonPrimitive()) {
|
||||
valueUsageCondition = jsonObject.getAsJsonPrimitive(LoanProductConstants.VALUE_CONDITION_TYPE_PARAM_NAME).getAsInt();
|
||||
}
|
||||
LoanProductBorrowerCycleVariations borrowerCycleVariations = new LoanProductBorrowerCycleVariations(cycleNumber,
|
||||
paramType, valueUsageCondition, minValue, maxValue, defaultValue);
|
||||
@@ -463,11 +463,11 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(20);
|
||||
List<Long> variationIds = fetchAllVariationIds();
|
||||
updateBorrowerCycleVaritions(command, LoanProductParamType.PRINCIPAL.getValue(),
|
||||
LoanProductConstants.principalVariationsForBorrowerCycleParameterName, actualChanges, variationIds);
|
||||
LoanProductConstants.PRINCIPAL_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME, actualChanges, variationIds);
|
||||
updateBorrowerCycleVaritions(command, LoanProductParamType.INTERESTRATE.getValue(),
|
||||
LoanProductConstants.interestRateVariationsForBorrowerCycleParameterName, actualChanges, variationIds);
|
||||
LoanProductConstants.INTEREST_RATE_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME, actualChanges, variationIds);
|
||||
updateBorrowerCycleVaritions(command, LoanProductParamType.REPAYMENT.getValue(),
|
||||
LoanProductConstants.numberOfRepaymentVariationsForBorrowerCycleParameterName, actualChanges, variationIds);
|
||||
LoanProductConstants.NUMBER_OF_REPAYMENT_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME, actualChanges, variationIds);
|
||||
for (Long id : variationIds) {
|
||||
this.borrowerCycleVariations.remove(fetchLoanProductBorrowerCycleVariationById(id));
|
||||
}
|
||||
@@ -496,32 +496,32 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
Integer cycleNumber = null;
|
||||
Integer valueUsageCondition = null;
|
||||
Long id = null;
|
||||
if (jsonObject.has(LoanProductConstants.defaultValueParameterName)
|
||||
&& jsonObject.get(LoanProductConstants.defaultValueParameterName).isJsonPrimitive()) {
|
||||
defaultValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.defaultValueParameterName).getAsBigDecimal();
|
||||
if (jsonObject.has(LoanProductConstants.DEFAULT_VALUE_PARAMETER_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.DEFAULT_VALUE_PARAMETER_NAME).isJsonPrimitive()) {
|
||||
defaultValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.DEFAULT_VALUE_PARAMETER_NAME).getAsBigDecimal();
|
||||
}
|
||||
if (jsonObject.has(LoanProductConstants.minValueParameterName)
|
||||
&& jsonObject.get(LoanProductConstants.minValueParameterName).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.minValueParameterName).getAsString())) {
|
||||
minValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.minValueParameterName).getAsBigDecimal();
|
||||
if (jsonObject.has(LoanProductConstants.MIN_VALUE_PARAMETER_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.MIN_VALUE_PARAMETER_NAME).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.MIN_VALUE_PARAMETER_NAME).getAsString())) {
|
||||
minValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.MIN_VALUE_PARAMETER_NAME).getAsBigDecimal();
|
||||
}
|
||||
if (jsonObject.has(LoanProductConstants.maxValueParameterName)
|
||||
&& jsonObject.get(LoanProductConstants.maxValueParameterName).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.maxValueParameterName).getAsString())) {
|
||||
maxValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.maxValueParameterName).getAsBigDecimal();
|
||||
if (jsonObject.has(LoanProductConstants.MAX_VALUE_PARAMETER_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.MAX_VALUE_PARAMETER_NAME).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.MAX_VALUE_PARAMETER_NAME).getAsString())) {
|
||||
maxValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.MAX_VALUE_PARAMETER_NAME).getAsBigDecimal();
|
||||
}
|
||||
if (jsonObject.has(LoanProductConstants.borrowerCycleNumberParamName)
|
||||
&& jsonObject.get(LoanProductConstants.borrowerCycleNumberParamName).isJsonPrimitive()) {
|
||||
cycleNumber = jsonObject.getAsJsonPrimitive(LoanProductConstants.borrowerCycleNumberParamName).getAsInt();
|
||||
if (jsonObject.has(LoanProductConstants.BORROWER_CYCLE_NUMBER_PARAM_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.BORROWER_CYCLE_NUMBER_PARAM_NAME).isJsonPrimitive()) {
|
||||
cycleNumber = jsonObject.getAsJsonPrimitive(LoanProductConstants.BORROWER_CYCLE_NUMBER_PARAM_NAME).getAsInt();
|
||||
}
|
||||
if (jsonObject.has(LoanProductConstants.valueConditionTypeParamName)
|
||||
&& jsonObject.get(LoanProductConstants.valueConditionTypeParamName).isJsonPrimitive()) {
|
||||
valueUsageCondition = jsonObject.getAsJsonPrimitive(LoanProductConstants.valueConditionTypeParamName).getAsInt();
|
||||
if (jsonObject.has(LoanProductConstants.VALUE_CONDITION_TYPE_PARAM_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.VALUE_CONDITION_TYPE_PARAM_NAME).isJsonPrimitive()) {
|
||||
valueUsageCondition = jsonObject.getAsJsonPrimitive(LoanProductConstants.VALUE_CONDITION_TYPE_PARAM_NAME).getAsInt();
|
||||
}
|
||||
if (jsonObject.has(LoanProductConstants.borrowerCycleIdParameterName)
|
||||
&& jsonObject.get(LoanProductConstants.borrowerCycleIdParameterName).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.borrowerCycleIdParameterName).getAsString())) {
|
||||
id = jsonObject.getAsJsonPrimitive(LoanProductConstants.borrowerCycleIdParameterName).getAsLong();
|
||||
if (jsonObject.has(LoanProductConstants.BORROWER_CYCLE_ID_PARAMETER_NAME)
|
||||
&& jsonObject.get(LoanProductConstants.BORROWER_CYCLE_ID_PARAMETER_NAME).isJsonPrimitive()
|
||||
&& StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.BORROWER_CYCLE_ID_PARAMETER_NAME).getAsString())) {
|
||||
id = jsonObject.getAsJsonPrimitive(LoanProductConstants.BORROWER_CYCLE_ID_PARAMETER_NAME).getAsLong();
|
||||
}
|
||||
LoanProductBorrowerCycleVariations borrowerCycleVariations = new LoanProductBorrowerCycleVariations(cycleNumber,
|
||||
paramType, valueUsageCondition, minValue, maxValue, defaultValue);
|
||||
@@ -790,7 +790,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
this.name = newValue;
|
||||
}
|
||||
|
||||
final String shortNameParamName = LoanProductConstants.shortName;
|
||||
final String shortNameParamName = LoanProductConstants.SHORT_NAME;
|
||||
if (command.isChangeInStringParameterNamed(shortNameParamName, this.shortName)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(shortNameParamName);
|
||||
actualChanges.put(shortNameParamName, newValue);
|
||||
@@ -839,9 +839,9 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
this.includeInBorrowerCycle = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.useBorrowerCycleParameterName, this.useBorrowerCycle)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.useBorrowerCycleParameterName);
|
||||
actualChanges.put(LoanProductConstants.useBorrowerCycleParameterName, newValue);
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME, this.useBorrowerCycle)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME);
|
||||
actualChanges.put(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME, newValue);
|
||||
this.useBorrowerCycle = newValue;
|
||||
}
|
||||
|
||||
@@ -894,18 +894,18 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
}
|
||||
loanProducTrancheDetails.update(command, actualChanges, localeAsInput);
|
||||
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.overdueDaysForNPAParameterName, this.overdueDaysForNPA)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.overdueDaysForNPAParameterName);
|
||||
actualChanges.put(LoanProductConstants.overdueDaysForNPAParameterName, newValue);
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME, this.overdueDaysForNPA)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME);
|
||||
actualChanges.put(LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME, newValue);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
this.overdueDaysForNPA = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.minimumDaysBetweenDisbursalAndFirstRepayment,
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT,
|
||||
this.minimumDaysBetweenDisbursalAndFirstRepayment)) {
|
||||
final Integer newValue = command
|
||||
.integerValueOfParameterNamed(LoanProductConstants.minimumDaysBetweenDisbursalAndFirstRepayment);
|
||||
actualChanges.put(LoanProductConstants.minimumDaysBetweenDisbursalAndFirstRepayment, newValue);
|
||||
.integerValueOfParameterNamed(LoanProductConstants.MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT);
|
||||
actualChanges.put(LoanProductConstants.MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT, newValue);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
this.minimumDaysBetweenDisbursalAndFirstRepayment = newValue;
|
||||
}
|
||||
@@ -921,7 +921,7 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
* Update interest recalculation settings
|
||||
*/
|
||||
final boolean isInterestRecalculationEnabledChanged = actualChanges
|
||||
.containsKey(LoanProductConstants.isInterestRecalculationEnabledParameterName);
|
||||
.containsKey(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME);
|
||||
|
||||
if (isInterestRecalculationEnabledChanged) {
|
||||
if (this.isInterestRecalculationEnabled()) {
|
||||
@@ -1008,11 +1008,11 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
if (command.parsedJson().getAsJsonObject().getAsJsonObject(LoanProductConstants.allowAttributeOverridesParamName)
|
||||
.getAsJsonPrimitive(LoanProductConstants.graceOnArrearsAgeingParameterName).getAsBoolean() != this.loanConfigurableAttributes
|
||||
.getAsJsonPrimitive(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME).getAsBoolean() != this.loanConfigurableAttributes
|
||||
.getGraceOnArrearsAgingBoolean()) {
|
||||
this.loanConfigurableAttributes.setGraceOnArrearsAgeing(command.parsedJson().getAsJsonObject()
|
||||
.getAsJsonObject(LoanProductConstants.allowAttributeOverridesParamName)
|
||||
.getAsJsonPrimitive(LoanProductConstants.graceOnArrearsAgeingParameterName).getAsBoolean());
|
||||
.getAsJsonPrimitive(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME).getAsBoolean());
|
||||
}
|
||||
} else {
|
||||
this.loanConfigurableAttributes = LoanProductConfigurableAttributes.populateDefaultsForConfigurableAttributes();
|
||||
@@ -1045,11 +1045,11 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
actualChanges.put(LoanProductConstants.principalThresholdForLastInstallmentParamName, newValue);
|
||||
this.principalThresholdForLastInstallment = newValue;
|
||||
}
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName,
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME,
|
||||
this.accountMovesOutOfNPAOnlyOnArrearsCompletion)) {
|
||||
final boolean newValue = command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName);
|
||||
actualChanges.put(LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName, newValue);
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME);
|
||||
actualChanges.put(LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME, newValue);
|
||||
this.accountMovesOutOfNPAOnlyOnArrearsCompletion = newValue;
|
||||
}
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.canDefineEmiAmountParamName, this.canDefineInstallmentAmount)) {
|
||||
@@ -1066,16 +1066,16 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
this.installmentAmountInMultiplesOf = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.canUseForTopup, this.canUseForTopup)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.canUseForTopup);
|
||||
actualChanges.put(LoanProductConstants.canUseForTopup, newValue);
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.CAN_USE_FOR_TOPUP, this.canUseForTopup)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.CAN_USE_FOR_TOPUP);
|
||||
actualChanges.put(LoanProductConstants.CAN_USE_FOR_TOPUP, newValue);
|
||||
this.canUseForTopup = newValue;
|
||||
}
|
||||
|
||||
if (command.hasParameter(LoanProductConstants.ratesParamName)) {
|
||||
final JsonArray jsonArray = command.arrayOfParameterNamed(LoanProductConstants.ratesParamName);
|
||||
if (command.hasParameter(LoanProductConstants.RATES_PARAM_NAME)) {
|
||||
final JsonArray jsonArray = command.arrayOfParameterNamed(LoanProductConstants.RATES_PARAM_NAME);
|
||||
if (jsonArray != null) {
|
||||
actualChanges.put(LoanProductConstants.ratesParamName, command.jsonFragment(LoanProductConstants.ratesParamName));
|
||||
actualChanges.put(LoanProductConstants.RATES_PARAM_NAME, command.jsonFragment(LoanProductConstants.RATES_PARAM_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1236,29 +1236,29 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
|
||||
public Map<String, BigDecimal> fetchBorrowerCycleVariationsForCycleNumber(final Integer cycleNumber) {
|
||||
Map<String, BigDecimal> borrowerCycleVariations = new HashMap<>();
|
||||
borrowerCycleVariations.put(LoanProductConstants.principal, this.loanProductRelatedDetail.getPrincipal().getAmount());
|
||||
borrowerCycleVariations.put(LoanProductConstants.interestRatePerPeriod,
|
||||
borrowerCycleVariations.put(LoanProductConstants.PRINCIPAL, this.loanProductRelatedDetail.getPrincipal().getAmount());
|
||||
borrowerCycleVariations.put(LoanProductConstants.INTEREST_RATE_PER_PERIOD,
|
||||
this.loanProductRelatedDetail.getNominalInterestRatePerPeriod());
|
||||
if (this.loanProductRelatedDetail.getNumberOfRepayments() != null) {
|
||||
borrowerCycleVariations.put(LoanProductConstants.numberOfRepayments,
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_INTEREST_RATE_PER_PERIOD,
|
||||
BigDecimal.valueOf(this.loanProductRelatedDetail.getNumberOfRepayments()));
|
||||
}
|
||||
|
||||
if (this.loanProductMinMaxConstraints != null) {
|
||||
borrowerCycleVariations.put(LoanProductConstants.minPrincipal, this.loanProductMinMaxConstraints.getMinPrincipal());
|
||||
borrowerCycleVariations.put(LoanProductConstants.maxPrincipal, this.loanProductMinMaxConstraints.getMaxPrincipal());
|
||||
borrowerCycleVariations.put(LoanProductConstants.minInterestRatePerPeriod,
|
||||
borrowerCycleVariations.put(LoanProductConstants.MIN_PRINCIPAL, this.loanProductMinMaxConstraints.getMinPrincipal());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_PRINCIPAL, this.loanProductMinMaxConstraints.getMaxPrincipal());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MIN_INTEREST_RATE_PER_PERIOD,
|
||||
this.loanProductMinMaxConstraints.getMinNominalInterestRatePerPeriod());
|
||||
borrowerCycleVariations.put(LoanProductConstants.maxInterestRatePerPeriod,
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_INTEREST_RATE_PER_PERIOD,
|
||||
this.loanProductMinMaxConstraints.getMaxNominalInterestRatePerPeriod());
|
||||
|
||||
if (this.loanProductMinMaxConstraints.getMinNumberOfRepayments() != null) {
|
||||
borrowerCycleVariations.put(LoanProductConstants.minNumberOfRepayments,
|
||||
borrowerCycleVariations.put(LoanProductConstants.MIN_NUMBER_OF_REPAYMENTS,
|
||||
BigDecimal.valueOf(this.loanProductMinMaxConstraints.getMinNumberOfRepayments()));
|
||||
}
|
||||
|
||||
if (this.loanProductMinMaxConstraints.getMaxNumberOfRepayments() != null) {
|
||||
borrowerCycleVariations.put(LoanProductConstants.maxNumberOfRepayments,
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_NUMBER_OF_REPAYMENTS,
|
||||
BigDecimal.valueOf(this.loanProductMinMaxConstraints.getMaxNumberOfRepayments()));
|
||||
}
|
||||
}
|
||||
@@ -1271,21 +1271,21 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
&& cycleVariation.getValueConditionType().equals(LoanProductValueConditionType.EQUAL)) {
|
||||
switch (cycleVariation.getParamType()) {
|
||||
case PRINCIPAL:
|
||||
borrowerCycleVariations.put(LoanProductConstants.principal, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.minPrincipal, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.maxPrincipal, cycleVariation.getMaxValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.PRINCIPAL, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MIN_PRINCIPAL, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_PRINCIPAL, cycleVariation.getMaxValue());
|
||||
principalCycleUsed = cycleVariation.getBorrowerCycleNumber();
|
||||
break;
|
||||
case INTERESTRATE:
|
||||
borrowerCycleVariations.put(LoanProductConstants.interestRatePerPeriod, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.minInterestRatePerPeriod, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.maxInterestRatePerPeriod, cycleVariation.getMaxValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.INTEREST_RATE_PER_PERIOD, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MIN_INTEREST_RATE_PER_PERIOD, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_INTEREST_RATE_PER_PERIOD, cycleVariation.getMaxValue());
|
||||
interestCycleUsed = cycleVariation.getBorrowerCycleNumber();
|
||||
break;
|
||||
case REPAYMENT:
|
||||
borrowerCycleVariations.put(LoanProductConstants.numberOfRepayments, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.minNumberOfRepayments, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.maxNumberOfRepayments, cycleVariation.getMaxValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_INTEREST_RATE_PER_PERIOD, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MIN_NUMBER_OF_REPAYMENTS, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_NUMBER_OF_REPAYMENTS, cycleVariation.getMaxValue());
|
||||
repaymentCycleUsed = cycleVariation.getBorrowerCycleNumber();
|
||||
break;
|
||||
default:
|
||||
@@ -1296,25 +1296,25 @@ public class LoanProduct extends AbstractPersistableCustom {
|
||||
switch (cycleVariation.getParamType()) {
|
||||
case PRINCIPAL:
|
||||
if (principalCycleUsed < cycleVariation.getBorrowerCycleNumber()) {
|
||||
borrowerCycleVariations.put(LoanProductConstants.principal, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.minPrincipal, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.maxPrincipal, cycleVariation.getMaxValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.PRINCIPAL, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MIN_PRINCIPAL, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_PRINCIPAL, cycleVariation.getMaxValue());
|
||||
principalCycleUsed = cycleVariation.getBorrowerCycleNumber();
|
||||
}
|
||||
break;
|
||||
case INTERESTRATE:
|
||||
if (interestCycleUsed < cycleVariation.getBorrowerCycleNumber()) {
|
||||
borrowerCycleVariations.put(LoanProductConstants.interestRatePerPeriod, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.minInterestRatePerPeriod, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.maxInterestRatePerPeriod, cycleVariation.getMaxValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.INTEREST_RATE_PER_PERIOD, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MIN_INTEREST_RATE_PER_PERIOD, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_INTEREST_RATE_PER_PERIOD, cycleVariation.getMaxValue());
|
||||
interestCycleUsed = cycleVariation.getBorrowerCycleNumber();
|
||||
}
|
||||
break;
|
||||
case REPAYMENT:
|
||||
if (repaymentCycleUsed < cycleVariation.getBorrowerCycleNumber()) {
|
||||
borrowerCycleVariations.put(LoanProductConstants.numberOfRepayments, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.minNumberOfRepayments, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.maxNumberOfRepayments, cycleVariation.getMaxValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_INTEREST_RATE_PER_PERIOD, cycleVariation.getDefaultValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MIN_NUMBER_OF_REPAYMENTS, cycleVariation.getMinValue());
|
||||
borrowerCycleVariations.put(LoanProductConstants.MAX_NUMBER_OF_REPAYMENTS, cycleVariation.getMaxValue());
|
||||
repaymentCycleUsed = cycleVariation.getBorrowerCycleNumber();
|
||||
}
|
||||
break;
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
|
||||
LoanProductConstants.interestCalculationPeriodTypeParamName,
|
||||
LoanProductConstants.inArrearsToleranceParamName, LoanProductConstants.repaymentEveryParamName,
|
||||
LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName,
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName};
|
||||
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME};
|
||||
|
||||
public static LoanProductConfigurableAttributes createFrom(JsonCommand command) {
|
||||
|
||||
@@ -93,7 +93,7 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom
|
||||
.getAsJsonPrimitive(LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName).getAsBoolean();
|
||||
final Boolean graceOnArrearsAging = command.parsedJson().getAsJsonObject()
|
||||
.getAsJsonObject(LoanProductConstants.allowAttributeOverridesParamName)
|
||||
.getAsJsonPrimitive(LoanProductConstants.graceOnArrearsAgeingParameterName).getAsBoolean();
|
||||
.getAsJsonPrimitive(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME).getAsBoolean();
|
||||
|
||||
return new LoanProductConfigurableAttributes(amortization, interestMethod, transactionProcessingStrategy, interestCalcPeriod,
|
||||
arrearsTolerance, repaymentEvery, graceOnPrincipalAndInterestPayment, graceOnArrearsAging);
|
||||
|
||||
+18
-18
@@ -423,11 +423,11 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
this.interestCalculationPeriodMethod = InterestCalculationPeriodMethod.fromInt(newValue);
|
||||
}
|
||||
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName,
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME,
|
||||
this.allowPartialPeriodInterestCalcualtion)) {
|
||||
final boolean newValue = command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName);
|
||||
actualChanges.put(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, newValue);
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME);
|
||||
actualChanges.put(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, newValue);
|
||||
this.allowPartialPeriodInterestCalcualtion = newValue;
|
||||
}
|
||||
|
||||
@@ -467,38 +467,38 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
this.graceOnInterestCharged = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.graceOnArrearsAgeingParameterName, this.graceOnArrearsAgeing)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.graceOnArrearsAgeingParameterName);
|
||||
actualChanges.put(LoanProductConstants.graceOnArrearsAgeingParameterName, newValue);
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, this.graceOnArrearsAgeing)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME);
|
||||
actualChanges.put(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, newValue);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
this.graceOnArrearsAgeing = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.daysInMonthTypeParameterName, this.daysInMonthType)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.daysInMonthTypeParameterName);
|
||||
actualChanges.put(LoanProductConstants.daysInMonthTypeParameterName, newValue);
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.DAYS_IN_MONTH_TYPE_PARAMETER_NAME, this.daysInMonthType)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.DAYS_IN_MONTH_TYPE_PARAMETER_NAME);
|
||||
actualChanges.put(LoanProductConstants.DAYS_IN_MONTH_TYPE_PARAMETER_NAME, newValue);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
this.daysInMonthType = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.daysInYearTypeParameterName, this.daysInYearType)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.daysInYearTypeParameterName);
|
||||
actualChanges.put(LoanProductConstants.daysInYearTypeParameterName, newValue);
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME, this.daysInYearType)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME);
|
||||
actualChanges.put(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME, newValue);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
this.daysInYearType = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.isInterestRecalculationEnabledParameterName,
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME,
|
||||
this.isInterestRecalculationEnabled)) {
|
||||
final boolean newValue = command
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.isInterestRecalculationEnabledParameterName);
|
||||
actualChanges.put(LoanProductConstants.isInterestRecalculationEnabledParameterName, newValue);
|
||||
.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME);
|
||||
actualChanges.put(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME, newValue);
|
||||
this.isInterestRecalculationEnabled = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.isEqualAmortizationParam, this.isEqualAmortization)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.isEqualAmortizationParam);
|
||||
actualChanges.put(LoanProductConstants.isEqualAmortizationParam, newValue);
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, this.isEqualAmortization)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM);
|
||||
actualChanges.put(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, newValue);
|
||||
this.isEqualAmortization = newValue;
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -48,25 +48,25 @@ public class LoanProductTrancheDetails {
|
||||
}
|
||||
|
||||
public void update(final JsonCommand command, final Map<String, Object> actualChanges, final String localeAsInput) {
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.multiDisburseLoanParameterName, this.multiDisburseLoan)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.multiDisburseLoanParameterName);
|
||||
actualChanges.put(LoanProductConstants.multiDisburseLoanParameterName, newValue);
|
||||
if (command.isChangeInBooleanParameterNamed(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME, this.multiDisburseLoan)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME);
|
||||
actualChanges.put(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME, newValue);
|
||||
this.multiDisburseLoan = newValue;
|
||||
}
|
||||
|
||||
if (this.multiDisburseLoan) {
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.maxTrancheCountParameterName, this.maxTrancheCount)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.maxTrancheCountParameterName);
|
||||
actualChanges.put(LoanProductConstants.maxTrancheCountParameterName, newValue);
|
||||
if (command.isChangeInIntegerParameterNamed(LoanProductConstants.MAX_TRANCHE_COUNT_PARAMETER_NAME, this.maxTrancheCount)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.MAX_TRANCHE_COUNT_PARAMETER_NAME);
|
||||
actualChanges.put(LoanProductConstants.MAX_TRANCHE_COUNT_PARAMETER_NAME, newValue);
|
||||
this.maxTrancheCount = newValue;
|
||||
}
|
||||
|
||||
if (command.isChangeInBigDecimalParameterNamed(LoanProductConstants.outstandingLoanBalanceParameterName,
|
||||
if (command.isChangeInBigDecimalParameterNamed(LoanProductConstants.OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME,
|
||||
this.outstandingLoanBalance)) {
|
||||
final BigDecimal newValue = command
|
||||
.bigDecimalValueOfParameterNamed(LoanProductConstants.outstandingLoanBalanceParameterName);
|
||||
actualChanges.put(LoanProductConstants.outstandingLoanBalanceParameterName, newValue);
|
||||
actualChanges.put(LoanProductConstants.outstandingLoanBalanceParameterName, localeAsInput);
|
||||
.bigDecimalValueOfParameterNamed(LoanProductConstants.OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME);
|
||||
actualChanges.put(LoanProductConstants.OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME, newValue);
|
||||
actualChanges.put(LoanProductConstants.OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME, localeAsInput);
|
||||
this.outstandingLoanBalance = newValue;
|
||||
}
|
||||
} else {
|
||||
|
||||
+120
-120
@@ -64,7 +64,7 @@ public final class LoanProductDataValidator {
|
||||
"currencyCode", "digitsAfterDecimal", "inMultiplesOf", "principal", "minPrincipal", "maxPrincipal", "repaymentEvery",
|
||||
"numberOfRepayments", "minNumberOfRepayments", "maxNumberOfRepayments", "repaymentFrequencyType", "interestRatePerPeriod",
|
||||
"minInterestRatePerPeriod", "maxInterestRatePerPeriod", "interestRateFrequencyType", "amortizationType", "interestType",
|
||||
"interestCalculationPeriodType", LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, "inArrearsTolerance",
|
||||
"interestCalculationPeriodType", LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, "inArrearsTolerance",
|
||||
"transactionProcessingStrategyId", "graceOnPrincipalPayment", "recurringMoratoriumOnPrincipalPeriods", "graceOnInterestPayment", "graceOnInterestCharged", "charges",
|
||||
"accountingRule", "includeInBorrowerCycle", "startDate", "closeDate", "externalId", "isLinkedToFloatingInterestRates",
|
||||
"floatingRatesId", "interestRateDifferential", "minDifferentialLendingRate", "defaultDifferentialLendingRate",
|
||||
@@ -78,14 +78,14 @@ public final class LoanProductDataValidator {
|
||||
LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
LoanProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(),
|
||||
LoanProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(), LoanProductConstants.useBorrowerCycleParameterName,
|
||||
LoanProductConstants.principalVariationsForBorrowerCycleParameterName,
|
||||
LoanProductConstants.interestRateVariationsForBorrowerCycleParameterName,
|
||||
LoanProductConstants.numberOfRepaymentVariationsForBorrowerCycleParameterName, LoanProductConstants.shortName,
|
||||
LoanProductConstants.multiDisburseLoanParameterName, LoanProductConstants.outstandingLoanBalanceParameterName,
|
||||
LoanProductConstants.maxTrancheCountParameterName, LoanProductConstants.graceOnArrearsAgeingParameterName,
|
||||
LoanProductConstants.overdueDaysForNPAParameterName, LoanProductConstants.isInterestRecalculationEnabledParameterName,
|
||||
LoanProductConstants.daysInYearTypeParameterName, LoanProductConstants.daysInMonthTypeParameterName,
|
||||
LoanProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(), LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.PRINCIPAL_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.INTEREST_RATE_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.NUMBER_OF_REPAYMENT_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME, LoanProductConstants.SHORT_NAME,
|
||||
LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME, LoanProductConstants.OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME,
|
||||
LoanProductConstants.MAX_TRANCHE_COUNT_PARAMETER_NAME, LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME,
|
||||
LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME, LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME,
|
||||
LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME, LoanProductConstants.DAYS_IN_MONTH_TYPE_PARAMETER_NAME,
|
||||
LoanProductConstants.rescheduleStrategyMethodParameterName,
|
||||
LoanProductConstants.interestRecalculationCompoundingMethodParameterName,
|
||||
LoanProductConstants.recalculationRestFrequencyIntervalParameterName,
|
||||
@@ -93,10 +93,10 @@ public final class LoanProductDataValidator {
|
||||
LoanProductConstants.recalculationCompoundingFrequencyIntervalParameterName,
|
||||
LoanProductConstants.recalculationCompoundingFrequencyTypeParameterName,
|
||||
LoanProductConstants.isArrearsBasedOnOriginalScheduleParamName,
|
||||
LoanProductConstants.minimumDaysBetweenDisbursalAndFirstRepayment, LoanProductConstants.mandatoryGuaranteeParamName,
|
||||
LoanProductConstants.MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT, LoanProductConstants.mandatoryGuaranteeParamName,
|
||||
LoanProductConstants.holdGuaranteeFundsParamName, LoanProductConstants.minimumGuaranteeFromGuarantorParamName,
|
||||
LoanProductConstants.minimumGuaranteeFromOwnFundsParamName, LoanProductConstants.principalThresholdForLastInstallmentParamName,
|
||||
LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName, LoanProductConstants.canDefineEmiAmountParamName,
|
||||
LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME, LoanProductConstants.canDefineEmiAmountParamName,
|
||||
LoanProductConstants.installmentAmountInMultiplesOfParamName,
|
||||
LoanProductConstants.preClosureInterestCalculationStrategyParamName, LoanProductConstants.allowAttributeOverridesParamName,
|
||||
LoanProductConstants.allowVariableInstallmentsParamName, LoanProductConstants.minimumGapBetweenInstallments,
|
||||
@@ -106,15 +106,15 @@ public final class LoanProductDataValidator {
|
||||
LoanProductConstants.recalculationRestFrequencyWeekdayParamName,
|
||||
LoanProductConstants.recalculationRestFrequencyNthDayParamName, LoanProductConstants.recalculationRestFrequencyOnDayParamName,
|
||||
LoanProductConstants.isCompoundingToBePostedAsTransactionParamName, LoanProductConstants.allowCompoundingOnEodParamName,
|
||||
LoanProductConstants.canUseForTopup, LoanProductConstants.isEqualAmortizationParam,
|
||||
LoanProductConstants.ratesParamName));
|
||||
LoanProductConstants.CAN_USE_FOR_TOPUP, LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM,
|
||||
LoanProductConstants.RATES_PARAM_NAME));
|
||||
|
||||
private static final String[] supportedloanConfigurableAttributes = {LoanProductConstants.amortizationTypeParamName,
|
||||
LoanProductConstants.interestTypeParamName, LoanProductConstants.transactionProcessingStrategyIdParamName,
|
||||
LoanProductConstants.interestCalculationPeriodTypeParamName,
|
||||
LoanProductConstants.inArrearsToleranceParamName, LoanProductConstants.repaymentEveryParamName,
|
||||
LoanProductConstants.graceOnPrincipalAndInterestPaymentParamName,
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName};
|
||||
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME};
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@@ -137,8 +137,8 @@ public final class LoanProductDataValidator {
|
||||
final String name = this.fromApiJsonHelper.extractStringNamed("name", element);
|
||||
baseDataValidator.reset().parameter("name").value(name).notBlank().notExceedingLengthOf(100);
|
||||
|
||||
final String shortName = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.shortName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.shortName).value(shortName).notBlank().notExceedingLengthOf(4);
|
||||
final String shortName = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.SHORT_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.SHORT_NAME).value(shortName).notBlank().notExceedingLengthOf(4);
|
||||
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed("description", element);
|
||||
baseDataValidator.reset().parameter("description").value(description).notExceedingLengthOf(500);
|
||||
@@ -149,16 +149,16 @@ public final class LoanProductDataValidator {
|
||||
}
|
||||
|
||||
boolean isEqualAmortization = false;
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.isEqualAmortizationParam, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.isEqualAmortizationParam, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.isEqualAmortizationParam).value(isEqualAmortization).ignoreIfNull()
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM).value(isEqualAmortization).ignoreIfNull()
|
||||
.validateForBooleanValue();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.minimumDaysBetweenDisbursalAndFirstRepayment, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT, element)) {
|
||||
final Long minimumDaysBetweenDisbursalAndFirstRepayment = this.fromApiJsonHelper.extractLongNamed(
|
||||
LoanProductConstants.minimumDaysBetweenDisbursalAndFirstRepayment, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.minimumDaysBetweenDisbursalAndFirstRepayment)
|
||||
LoanProductConstants.MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.MINIMUM_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT)
|
||||
.value(minimumDaysBetweenDisbursalAndFirstRepayment).ignoreIfNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
@@ -280,42 +280,42 @@ public final class LoanProductDataValidator {
|
||||
baseDataValidator.reset().parameter("graceOnInterestCharged").value(graceOnInterestCharged).zeroOrPositiveAmount();
|
||||
|
||||
final Integer graceOnArrearsAgeing = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.graceOnArrearsAgeingParameterName).value(graceOnArrearsAgeing)
|
||||
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME).value(graceOnArrearsAgeing)
|
||||
.integerZeroOrGreater();
|
||||
|
||||
final Integer overdueDaysForNPA = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(
|
||||
LoanProductConstants.overdueDaysForNPAParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.overdueDaysForNPAParameterName).value(overdueDaysForNPA)
|
||||
LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME).value(overdueDaysForNPA)
|
||||
.integerZeroOrGreater();
|
||||
|
||||
/**
|
||||
* { @link DaysInYearType }
|
||||
*/
|
||||
final Integer daysInYearType = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.daysInYearTypeParameterName,
|
||||
final Integer daysInYearType = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME,
|
||||
element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.daysInYearTypeParameterName).value(daysInYearType).notNull()
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME).value(daysInYearType).notNull()
|
||||
.isOneOfTheseValues(1, 360, 364, 365);
|
||||
|
||||
/**
|
||||
* { @link DaysInMonthType }
|
||||
*/
|
||||
final Integer daysInMonthType = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.daysInMonthTypeParameterName,
|
||||
final Integer daysInMonthType = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.DAYS_IN_MONTH_TYPE_PARAMETER_NAME,
|
||||
element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.daysInMonthTypeParameterName).value(daysInMonthType).notNull()
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.DAYS_IN_MONTH_TYPE_PARAMETER_NAME).value(daysInMonthType).notNull()
|
||||
.isOneOfTheseValues(1, 30);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME, element)) {
|
||||
Boolean npaChangeConfig = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName)
|
||||
LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME)
|
||||
.value(npaChangeConfig).notNull().isOneOfTheseValues(true, false);
|
||||
}
|
||||
|
||||
// Interest recalculation settings
|
||||
final Boolean isInterestRecalculationEnabled = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
LoanProductConstants.isInterestRecalculationEnabledParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.isInterestRecalculationEnabledParameterName)
|
||||
LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME)
|
||||
.value(isInterestRecalculationEnabled).notNull().isOneOfTheseValues(true, false);
|
||||
|
||||
if (isInterestRecalculationEnabled != null) {
|
||||
@@ -621,10 +621,10 @@ public final class LoanProductDataValidator {
|
||||
.value(receivablePenaltyAccountId).notNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.useBorrowerCycleParameterName, element)) {
|
||||
final Boolean useBorrowerCycle = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.useBorrowerCycleParameterName,
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME, element)) {
|
||||
final Boolean useBorrowerCycle = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.useBorrowerCycleParameterName).value(useBorrowerCycle).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME).value(useBorrowerCycle).ignoreIfNull()
|
||||
.validateForBooleanValue();
|
||||
if (useBorrowerCycle) {
|
||||
validateBorrowerCycleVariations(element, baseDataValidator);
|
||||
@@ -639,10 +639,10 @@ public final class LoanProductDataValidator {
|
||||
|
||||
validatePartialPeriodSupport(interestCalculationPeriodType, baseDataValidator, element, null);
|
||||
|
||||
if(this.fromApiJsonHelper.parameterExists(LoanProductConstants.canUseForTopup, element)){
|
||||
final Boolean canUseForTopup = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.canUseForTopup,
|
||||
if(this.fromApiJsonHelper.parameterExists(LoanProductConstants.CAN_USE_FOR_TOPUP, element)){
|
||||
final Boolean canUseForTopup = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.CAN_USE_FOR_TOPUP,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.canUseForTopup).value(canUseForTopup).validateForBooleanValue();
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.CAN_USE_FOR_TOPUP).value(canUseForTopup).validateForBooleanValue();
|
||||
}
|
||||
|
||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||
@@ -653,8 +653,8 @@ public final class LoanProductDataValidator {
|
||||
&& this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.allowVariableInstallmentsParamName, element)) {
|
||||
|
||||
boolean isEqualAmortization = false;
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.isEqualAmortizationParam, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.isEqualAmortizationParam, element);
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element);
|
||||
}
|
||||
if (isEqualAmortization) { throw new EqualAmortizationUnsupportedFeatureException("variable.installment",
|
||||
"variable installment"); }
|
||||
@@ -733,30 +733,30 @@ public final class LoanProductDataValidator {
|
||||
|
||||
private void validateMultiDisburseLoanData(final DataValidatorBuilder baseDataValidator, final JsonElement element) {
|
||||
Boolean multiDisburseLoan = false;
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.multiDisburseLoanParameterName, element)) {
|
||||
multiDisburseLoan = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.multiDisburseLoanParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.multiDisburseLoanParameterName).value(multiDisburseLoan)
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME, element)) {
|
||||
multiDisburseLoan = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME).value(multiDisburseLoan)
|
||||
.ignoreIfNull().validateForBooleanValue();
|
||||
}
|
||||
|
||||
boolean isEqualAmortization = false;
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.isEqualAmortizationParam, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.isEqualAmortizationParam, element);
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element);
|
||||
}
|
||||
if (isEqualAmortization && multiDisburseLoan) { throw new EqualAmortizationUnsupportedFeatureException("tranche.disbursal",
|
||||
"tranche disbursal"); }
|
||||
|
||||
if (multiDisburseLoan) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.outstandingLoanBalanceParameterName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME, element)) {
|
||||
final BigDecimal outstandingLoanBalance = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
|
||||
LoanProductConstants.outstandingLoanBalanceParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.outstandingLoanBalanceParameterName).value(outstandingLoanBalance)
|
||||
LoanProductConstants.OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.OUTSTANDING_LOAN_BALANCE_PARAMETER_NAME).value(outstandingLoanBalance)
|
||||
.ignoreIfNull().zeroOrPositiveAmount();
|
||||
}
|
||||
|
||||
final Integer maxTrancheCount = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.maxTrancheCountParameterName,
|
||||
final Integer maxTrancheCount = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.MAX_TRANCHE_COUNT_PARAMETER_NAME,
|
||||
element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.maxTrancheCountParameterName).value(maxTrancheCount).notNull()
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.MAX_TRANCHE_COUNT_PARAMETER_NAME).value(maxTrancheCount).notNull()
|
||||
.integerGreaterThanZero();
|
||||
|
||||
final Integer interestType = this.fromApiJsonHelper.extractIntegerNamed("interestType", element, Locale.getDefault());
|
||||
@@ -963,9 +963,9 @@ public final class LoanProductDataValidator {
|
||||
baseDataValidator.reset().parameter("name").value(name).notBlank().notExceedingLengthOf(100);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.shortName, element)) {
|
||||
final String shortName = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.shortName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.shortName).value(shortName).notBlank().notExceedingLengthOf(4);
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.SHORT_NAME, element)) {
|
||||
final String shortName = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.SHORT_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.SHORT_NAME).value(shortName).notBlank().notExceedingLengthOf(4);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists("description", element)) {
|
||||
@@ -1080,17 +1080,17 @@ public final class LoanProductDataValidator {
|
||||
baseDataValidator.reset().parameter("graceOnInterestCharged").value(graceOnInterestCharged).zeroOrPositiveAmount();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.graceOnArrearsAgeingParameterName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, element)) {
|
||||
final Integer graceOnArrearsAgeing = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(
|
||||
LoanProductConstants.graceOnArrearsAgeingParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.graceOnArrearsAgeingParameterName).value(graceOnArrearsAgeing)
|
||||
LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.GRACE_ON_ARREARS_AGEING_PARAMETER_NAME).value(graceOnArrearsAgeing)
|
||||
.integerZeroOrGreater();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.overdueDaysForNPAParameterName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME, element)) {
|
||||
final Integer overdueDaysForNPA = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(
|
||||
LoanProductConstants.overdueDaysForNPAParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.overdueDaysForNPAParameterName).value(overdueDaysForNPA)
|
||||
LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.OVERDUE_DAYS_FOR_NPA_PARAMETER_NAME).value(overdueDaysForNPA)
|
||||
.integerZeroOrGreater();
|
||||
}
|
||||
|
||||
@@ -1115,43 +1115,43 @@ public final class LoanProductDataValidator {
|
||||
/**
|
||||
* { @link DaysInYearType }
|
||||
*/
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.daysInYearTypeParameterName, element)) {
|
||||
final Integer daysInYearType = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.daysInYearTypeParameterName,
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME, element)) {
|
||||
final Integer daysInYearType = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME,
|
||||
element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.daysInYearTypeParameterName).value(daysInYearType).notNull()
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME).value(daysInYearType).notNull()
|
||||
.isOneOfTheseValues(1, 360, 364, 365);
|
||||
}
|
||||
|
||||
/**
|
||||
* { @link DaysInMonthType }
|
||||
*/
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.daysInMonthTypeParameterName, element)) {
|
||||
final Integer daysInMonthType = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.daysInMonthTypeParameterName,
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.DAYS_IN_YEAR_TYPE_PARAMETER_NAME, element)) {
|
||||
final Integer daysInMonthType = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.DAYS_IN_MONTH_TYPE_PARAMETER_NAME,
|
||||
element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.daysInMonthTypeParameterName).value(daysInMonthType).notNull()
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.DAYS_IN_MONTH_TYPE_PARAMETER_NAME).value(daysInMonthType).notNull()
|
||||
.isOneOfTheseValues(1, 30);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME, element)) {
|
||||
Boolean npaChangeConfig = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.accountMovesOutOfNPAOnlyOnArrearsCompletionParamName)
|
||||
LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.ACCOUNT_MOVES_OUT_OF_NPA_ONLY_ON_ARREARS_COMPLETION_PARAM_NAME)
|
||||
.value(npaChangeConfig).notNull().isOneOfTheseValues(true, false);
|
||||
}
|
||||
|
||||
boolean isEqualAmortization = loanProduct.isEqualAmortization();
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.isEqualAmortizationParam, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.isEqualAmortizationParam, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.isEqualAmortizationParam).value(isEqualAmortization).ignoreIfNull()
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element)) {
|
||||
isEqualAmortization = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM).value(isEqualAmortization).ignoreIfNull()
|
||||
.validateForBooleanValue();
|
||||
}
|
||||
|
||||
// Interest recalculation settings
|
||||
Boolean isInterestRecalculationEnabled = loanProduct.isInterestRecalculationEnabled();
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.isInterestRecalculationEnabledParameterName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME, element)) {
|
||||
isInterestRecalculationEnabled = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
LoanProductConstants.isInterestRecalculationEnabledParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.isInterestRecalculationEnabledParameterName)
|
||||
LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME)
|
||||
.value(isInterestRecalculationEnabled).notNull().isOneOfTheseValues(true, false);
|
||||
}
|
||||
|
||||
@@ -1472,10 +1472,10 @@ public final class LoanProductDataValidator {
|
||||
|
||||
validateMinMaxConstraints(element, baseDataValidator, loanProduct);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.useBorrowerCycleParameterName, element)) {
|
||||
final Boolean useBorrowerCycle = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.useBorrowerCycleParameterName,
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME, element)) {
|
||||
final Boolean useBorrowerCycle = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.useBorrowerCycleParameterName).value(useBorrowerCycle).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.USE_BORROWER_CYCLE_PARAMETER_NAME).value(useBorrowerCycle).ignoreIfNull()
|
||||
.validateForBooleanValue();
|
||||
if (useBorrowerCycle) {
|
||||
validateBorrowerCycleVariations(element, baseDataValidator);
|
||||
@@ -1490,10 +1490,10 @@ public final class LoanProductDataValidator {
|
||||
|
||||
validatePartialPeriodSupport(interestCalculationPeriodType, baseDataValidator, element, loanProduct);
|
||||
|
||||
if(this.fromApiJsonHelper.parameterExists(LoanProductConstants.canUseForTopup, element)){
|
||||
final Boolean canUseForTopup = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.canUseForTopup,
|
||||
if(this.fromApiJsonHelper.parameterExists(LoanProductConstants.CAN_USE_FOR_TOPUP, element)){
|
||||
final Boolean canUseForTopup = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.CAN_USE_FOR_TOPUP,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.canUseForTopup).value(canUseForTopup).validateForBooleanValue();
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.CAN_USE_FOR_TOPUP).value(canUseForTopup).validateForBooleanValue();
|
||||
}
|
||||
|
||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||
@@ -1590,8 +1590,8 @@ public final class LoanProductDataValidator {
|
||||
BigDecimal maxPrincipalAmount = null;
|
||||
if (this.fromApiJsonHelper.parameterExists(principalParameterName, element)) {
|
||||
principalAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(principalParameterName, element);
|
||||
minPrincipalAmount = minmaxValues.get(LoanProductConstants.minPrincipal);
|
||||
maxPrincipalAmount = minmaxValues.get(LoanProductConstants.maxPrincipal);
|
||||
minPrincipalAmount = minmaxValues.get(LoanProductConstants.MIN_PRINCIPAL);
|
||||
maxPrincipalAmount = minmaxValues.get(LoanProductConstants.MAX_PRINCIPAL);
|
||||
}
|
||||
|
||||
if ((minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) > 0)
|
||||
@@ -1612,11 +1612,11 @@ public final class LoanProductDataValidator {
|
||||
Integer numberOfRepayments = null;
|
||||
if (this.fromApiJsonHelper.parameterExists(numberOfRepaymentsParameterName, element)) {
|
||||
numberOfRepayments = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(numberOfRepaymentsParameterName, element);
|
||||
if (minmaxValues.get(LoanProductConstants.minNumberOfRepayments) != null) {
|
||||
minNumberOfRepayments = minmaxValues.get(LoanProductConstants.minNumberOfRepayments).intValueExact();
|
||||
if (minmaxValues.get(LoanProductConstants.MIN_NUMBER_OF_REPAYMENTS) != null) {
|
||||
minNumberOfRepayments = minmaxValues.get(LoanProductConstants.MIN_NUMBER_OF_REPAYMENTS).intValueExact();
|
||||
}
|
||||
if (minmaxValues.get(LoanProductConstants.maxNumberOfRepayments) != null) {
|
||||
maxNumberOfRepayments = minmaxValues.get(LoanProductConstants.maxNumberOfRepayments).intValueExact();
|
||||
if (minmaxValues.get(LoanProductConstants.MAX_NUMBER_OF_REPAYMENTS) != null) {
|
||||
maxNumberOfRepayments = minmaxValues.get(LoanProductConstants.MAX_NUMBER_OF_REPAYMENTS).intValueExact();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1639,8 +1639,8 @@ public final class LoanProductDataValidator {
|
||||
BigDecimal maxInterestRatePerPeriod = null;
|
||||
if (this.fromApiJsonHelper.parameterExists(interestRatePerPeriodParameterName, element)) {
|
||||
interestRatePerPeriod = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(interestRatePerPeriodParameterName, element);
|
||||
minInterestRatePerPeriod = minmaxValues.get(LoanProductConstants.minInterestRatePerPeriod);
|
||||
maxInterestRatePerPeriod = minmaxValues.get(LoanProductConstants.maxInterestRatePerPeriod);
|
||||
minInterestRatePerPeriod = minmaxValues.get(LoanProductConstants.MIN_INTEREST_RATE_PER_PERIOD);
|
||||
maxInterestRatePerPeriod = minmaxValues.get(LoanProductConstants.MAX_INTEREST_RATE_PER_PERIOD);
|
||||
}
|
||||
if (maxInterestRatePerPeriod != null) {
|
||||
if (minInterestRatePerPeriod != null) {
|
||||
@@ -1867,28 +1867,28 @@ public final class LoanProductDataValidator {
|
||||
|
||||
private void validateBorrowerCyclePrincipalVariations(final JsonElement element, final DataValidatorBuilder baseDataValidator) {
|
||||
|
||||
validateBorrowerCycleVariations(element, baseDataValidator, LoanProductConstants.principalVariationsForBorrowerCycleParameterName,
|
||||
LoanProductConstants.principalPerCycleParameterName, LoanProductConstants.minPrincipalPerCycleParameterName,
|
||||
LoanProductConstants.maxPrincipalPerCycleParameterName, LoanProductConstants.principalValueUsageConditionParamName,
|
||||
LoanProductConstants.principalCycleNumbersParamName);
|
||||
validateBorrowerCycleVariations(element, baseDataValidator, LoanProductConstants.PRINCIPAL_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.PRINCIPAL_PER_CYCLE_PARAMETER_NAME, LoanProductConstants.MIN_PRINCIPAL_PER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.MIN_PRINCIPAL_PER_CYCLE_PARAMETER_NAME, LoanProductConstants.PRINCIPAL_VALUE_USAGE_CONDITION_PARAM_NAME,
|
||||
LoanProductConstants.PRINCIPAL_CYCLE_NUMBERS_PARAM_NAME);
|
||||
}
|
||||
|
||||
private void validateBorrowerCycleRepaymentVariations(final JsonElement element, final DataValidatorBuilder baseDataValidator) {
|
||||
validateBorrowerCycleVariations(element, baseDataValidator,
|
||||
LoanProductConstants.numberOfRepaymentVariationsForBorrowerCycleParameterName,
|
||||
LoanProductConstants.numberOfRepaymentsPerCycleParameterName,
|
||||
LoanProductConstants.minNumberOfRepaymentsPerCycleParameterName,
|
||||
LoanProductConstants.maxNumberOfRepaymentsPerCycleParameterName,
|
||||
LoanProductConstants.repaymentValueUsageConditionParamName, LoanProductConstants.repaymentCycleNumberParamName);
|
||||
LoanProductConstants.NUMBER_OF_REPAYMENT_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.NUMBER_OF_REPAYMENTS_PER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.MIN_NUMBER_OF_REPAYMENTS_PER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.MAX_NUMBER_OF_REPAYMENTS_PER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.REPAYMENT_VALUE_USAGE_CONDITION_PARAM_NAME, LoanProductConstants.REPAYMENT_CYCLE_NUMBER_PARAM_NAME);
|
||||
}
|
||||
|
||||
private void validateBorrowerCycleInterestVariations(final JsonElement element, final DataValidatorBuilder baseDataValidator) {
|
||||
validateBorrowerCycleVariations(element, baseDataValidator,
|
||||
LoanProductConstants.interestRateVariationsForBorrowerCycleParameterName,
|
||||
LoanProductConstants.interestRatePerPeriodPerCycleParameterName,
|
||||
LoanProductConstants.minInterestRatePerPeriodPerCycleParameterName,
|
||||
LoanProductConstants.maxInterestRatePerPeriodPerCycleParameterName,
|
||||
LoanProductConstants.interestRateValueUsageConditionParamName, LoanProductConstants.interestRateCycleNumberParamName);
|
||||
LoanProductConstants.INTEREST_RATE_VARIATIONS_FOR_BORROWER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.INTEREST_RATE_PER_PERIOD_PER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.MIN_INTEREST_RATE_PER_PERIOD_PER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.MAX_INTEREST_RATE_PER_PERIOD_PER_CYCLE_PARAMETER_NAME,
|
||||
LoanProductConstants.INTEREST_RATE_VALUE_USAGE_CONDITION_PARAM_NAME, LoanProductConstants.INTEREST_RATE_VALUE_USAGE_CONDITION_PARAM_NAME);
|
||||
}
|
||||
|
||||
private void validateBorrowerCycleVariations(final JsonElement element, final DataValidatorBuilder baseDataValidator,
|
||||
@@ -1905,16 +1905,16 @@ public final class LoanProductDataValidator {
|
||||
do {
|
||||
final JsonObject jsonObject = variationArray.get(i).getAsJsonObject();
|
||||
|
||||
BigDecimal defaultValue = this.fromApiJsonHelper.extractBigDecimalNamed(LoanProductConstants.defaultValueParameterName,
|
||||
BigDecimal defaultValue = this.fromApiJsonHelper.extractBigDecimalNamed(LoanProductConstants.DEFAULT_VALUE_PARAMETER_NAME,
|
||||
jsonObject, locale);
|
||||
BigDecimal minValue = this.fromApiJsonHelper.extractBigDecimalNamed(LoanProductConstants.minValueParameterName,
|
||||
BigDecimal minValue = this.fromApiJsonHelper.extractBigDecimalNamed(LoanProductConstants.MIN_VALUE_PARAMETER_NAME,
|
||||
jsonObject, locale);
|
||||
BigDecimal maxValue = this.fromApiJsonHelper.extractBigDecimalNamed(LoanProductConstants.maxValueParameterName,
|
||||
BigDecimal maxValue = this.fromApiJsonHelper.extractBigDecimalNamed(LoanProductConstants.MAX_VALUE_PARAMETER_NAME,
|
||||
jsonObject, locale);
|
||||
Integer cycleNumber = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.borrowerCycleNumberParamName,
|
||||
Integer cycleNumber = this.fromApiJsonHelper.extractIntegerNamed(LoanProductConstants.BORROWER_CYCLE_NUMBER_PARAM_NAME,
|
||||
jsonObject, locale);
|
||||
Integer valueUsageCondition = this.fromApiJsonHelper.extractIntegerNamed(
|
||||
LoanProductConstants.valueConditionTypeParamName, jsonObject, locale);
|
||||
LoanProductConstants.VALUE_CONDITION_TYPE_PARAM_NAME, jsonObject, locale);
|
||||
|
||||
baseDataValidator.reset().parameter(defaultParameterName).value(defaultValue).notBlank();
|
||||
if (minValue != null) {
|
||||
@@ -2033,15 +2033,15 @@ public final class LoanProductDataValidator {
|
||||
.fromInt(interestCalculationPeriodType);
|
||||
boolean considerPartialPeriodUpdates = interestCalculationPeriodMethod.isDaily();
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, element)) {
|
||||
final Boolean considerPartialInterestEnabled = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName)
|
||||
LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME)
|
||||
.value(considerPartialInterestEnabled).notNull().isOneOfTheseValues(true, false);
|
||||
final boolean considerPartialPeriods = considerPartialInterestEnabled == null ? false : considerPartialInterestEnabled;
|
||||
if (interestCalculationPeriodMethod.isDaily()) {
|
||||
if (considerPartialPeriods) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName)
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.ALLOW_PARTIAL_PERIOD_INTEREST_CALCUALTION_PARAM_NAME)
|
||||
.failWithCode("not.supported.for.daily.calcualtions");
|
||||
}
|
||||
} else {
|
||||
@@ -2051,26 +2051,26 @@ public final class LoanProductDataValidator {
|
||||
|
||||
if (!considerPartialPeriodUpdates) {
|
||||
Boolean isInterestRecalculationEnabled = null;
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.isInterestRecalculationEnabledParameterName, element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME, element)) {
|
||||
isInterestRecalculationEnabled = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
LoanProductConstants.isInterestRecalculationEnabledParameterName, element);
|
||||
LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME, element);
|
||||
} else if (loanProduct != null) {
|
||||
isInterestRecalculationEnabled = loanProduct.isInterestRecalculationEnabled();
|
||||
}
|
||||
if (isInterestRecalculationEnabled != null && isInterestRecalculationEnabled) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.isInterestRecalculationEnabledParameterName)
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.IS_INTEREST_RECALCULATION_ENABLED_PARAMETER_NAME)
|
||||
.failWithCode("not.supported.for.selected.interest.calcualtion.type");
|
||||
}
|
||||
|
||||
Boolean multiDisburseLoan = null;
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.multiDisburseLoanParameterName, element)) {
|
||||
multiDisburseLoan = this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.multiDisburseLoanParameterName,
|
||||
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) {
|
||||
isInterestRecalculationEnabled = loanProduct.isMultiDisburseLoan();
|
||||
}
|
||||
if (multiDisburseLoan != null && multiDisburseLoan) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.multiDisburseLoanParameterName)
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.MULTI_DISBURSE_LOAN_PARAMETER_NAME)
|
||||
.failWithCode("not.supported.for.selected.interest.calcualtion.type");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -243,11 +243,11 @@ public class LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro
|
||||
.updateLoanProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType());
|
||||
changes.putAll(accountingMappingChanges);
|
||||
|
||||
if (changes.containsKey(LoanProductConstants.ratesParamName)) {
|
||||
if (changes.containsKey(LoanProductConstants.RATES_PARAM_NAME)) {
|
||||
final List<Rate> productRates = assembleListOfProductRates(command);
|
||||
final boolean updated = product.updateRates(productRates);
|
||||
if (!updated) {
|
||||
changes.remove(LoanProductConstants.ratesParamName);
|
||||
changes.remove(LoanProductConstants.RATES_PARAM_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -52,10 +52,10 @@ public class RateAssembler {
|
||||
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||
final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
|
||||
|
||||
if (topLevelJsonElement.has(LoanProductConstants.ratesParamName) && topLevelJsonElement
|
||||
.get(LoanProductConstants.ratesParamName)
|
||||
if (topLevelJsonElement.has(LoanProductConstants.RATES_PARAM_NAME) && topLevelJsonElement
|
||||
.get(LoanProductConstants.RATES_PARAM_NAME)
|
||||
.isJsonArray()) {
|
||||
final JsonArray array = topLevelJsonElement.get(LoanProductConstants.ratesParamName)
|
||||
final JsonArray array = topLevelJsonElement.get(LoanProductConstants.RATES_PARAM_NAME)
|
||||
.getAsJsonArray();
|
||||
List<Long> idList = new ArrayList<>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user