Aman-Mittal commented on code in PR #5362:
URL: https://github.com/apache/fineract/pull/5362#discussion_r2717468056
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java:
##########
@@ -151,21 +155,26 @@ public void validateForCreate(final JsonCommand command) {
if (frequencyType.isMonthly() || frequencyType.isYearly()) {
final MonthDay monthDay = this.fromApiJsonHelper
.extractMonthDayNamed(StandingInstructionApiConstants.recurrenceOnMonthDayParamName,
element);
-
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceOnMonthDayParamName).value(monthDay)
- .notNull();
+
+ if (standingInstructionType == null ||
!StandingInstructionType.fromInt(standingInstructionType).isDuesAmoutTransfer())
{
+
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceOnMonthDayParamName).value(monthDay)
+ .notNull();
+ }
}
}
final Integer recurrenceInterval = this.fromApiJsonHelper
.extractIntegerNamed(StandingInstructionApiConstants.recurrenceIntervalParamName,
element, Locale.getDefault());
if (isPeriodic) {
-
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceIntervalParamName).value(recurrenceInterval)
- .notNull();
-
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceFrequencyParamName).value(recurrenceFrequency)
- .notNull();
+ if (standingInstructionType == null ||
!StandingInstructionType.fromInt(standingInstructionType).isDuesAmoutTransfer())
{
+
baseDataValidator.reset().parameter(StandingInstructionApiConstants.recurrenceIntervalParamName).value(recurrenceInterval)
Review Comment:
This seems a little bit complicated. and if conditions can be merged, also
of there is any business rule that is implemented make sure to document that
helper function
**Business rules should be explicit and self-documenting**
while the Github Action is not run here is a pro tip you can run the check
on your forked repo and add testcase for more coverage
--
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]