adamsaghy commented on code in PR #4025:
URL: https://github.com/apache/fineract/pull/4025#discussion_r1719968831
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java:
##########
@@ -1042,7 +1043,27 @@ private void validateInterestRecalculationParams(final
JsonElement element, fina
final Integer rescheduleStrategyMethod = this.fromApiJsonHelper
.extractIntegerNamed(LoanProductConstants.rescheduleStrategyMethodParameterName,
element, Locale.getDefault());
baseDataValidator.reset().parameter(LoanProductConstants.rescheduleStrategyMethodParameterName).value(rescheduleStrategyMethod)
- .notNull().inMinMaxRange(1, 3);
+ .notNull().inMinMaxRange(1, 4);
+ final LoanRescheduleStrategyMethod loanRescheduleStrategyMethod =
LoanRescheduleStrategyMethod
+ .fromInt(rescheduleStrategyMethod);
+
+ String loanScheduleType = LoanScheduleType.CUMULATIVE.toString();
+ if
(fromApiJsonHelper.parameterExists(LoanProductConstants.LOAN_SCHEDULE_TYPE,
element)) {
+ loanScheduleType =
fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_TYPE,
element);
+ }
+ if
(LoanScheduleType.CUMULATIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
+ &&
LoanRescheduleStrategyMethod.ADJUST_LAST_UNPAID_PERIOD.equals(loanRescheduleStrategyMethod))
{
+
baseDataValidator.reset().parameter(LoanProductConstants.rescheduleStrategyMethodParameterName).failWithCode(
+
"reschedule.strategy.method.not.supported.for.loan.schedule.type.cumulative",
+ "Adjust last, unpaid period is only supported for
Progressive loan schedule type");
+ }
+
+ if
(LoanScheduleType.PROGRESSIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
+ &&
!LoanRescheduleStrategyMethod.ADJUST_LAST_UNPAID_PERIOD.equals(loanRescheduleStrategyMethod))
{
+
baseDataValidator.reset().parameter(LoanProductConstants.rescheduleStrategyMethodParameterName).failWithCode(
+
"reschedule.strategy.method.not.supported.for.loan.schedule.type.progressive",
+ "Reschedule strategy type is not supported for
Progressive loan schedule type");
Review Comment:
Would you mind to rework the error message to contains which reschedule
strategy is not supported?
Example:
- "Reduce EMI amount" reschedule strategy type is not supported for
Progressive loan schedule type
I would be more descriptive if we are telling which strategy is not supported
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]