Validate requested execution date
The validation on the requested execution date has been added to give an example on how to add your own validations without writing any Java code.
As you can see in the script, first we check if the payment is an MT101. If so, we compare the requested execution date of the payment against the actual local date. If the requested execution date of the payment is more than 20 days in the future, handleWarning() method is called on the ClientPaymentValidator class.
There are two methods available on the ClientPaymentValidator class: handleWarning() and handleError(). Both take the same parameters as input:
An error code for which a corresponding translation is needed, prefixed with ‘error.’
The initiated ClientValidationException, which contains the list of validation errors
An optional java.util.List of parameters, needed to give extra information on the message to be translated
If the validation fails on the requested executed date, the user will be presented with a warning screen:
The user has two possibilities: press the Yes-button or the No-button. If the user presses the Yes-button, he accepts the validation errors and forces the payment to be persisted. If he presses the No-button, the payment will not be persisted and the user will be returned to the specific payment screen.