Aman-Mittal commented on code in PR #5362:
URL: https://github.com/apache/fineract/pull/5362#discussion_r2717436980


##########
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())
 {

Review Comment:
   standingInstructionType == null || 
!StandingInstructionType.fromInt(standingInstructionType).isDuesAmoutTransfer() 
   
   You are using this logic in repeatedly throughout the code change i think 
you can extract this into a helper function



-- 
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]

Reply via email to