Well, it depends on the current state of your code.
I will try to follow this:
1) try to extract the same confirmation code and, possibly, pack it as separate functions / modules, etc., just call the function for verification, do not put the verification code in the validator
2) with this you can create a master validator as an integral part of validators, sub-steps for validation validation in action classes and build a large validator that will launch all these small steps, and will not work if one of the subtasks fails (but first, evaluate, if this is not redundant in your case, most likely it will just end the refactoring here if your check is not so complicated)
3), then given this pattern, if your validation logic changes frequently, you can try to put the configuration of the composite code outside the code. If you have access to control inversion tools, such as the Spring Framework, you can create a composite from an XML configuration, not from code. This has the advantage, since your change requires verification, you do not need to rebuild the project to make changes and separate the business logic from the code.
source share