Add validate api action for ContributionPage.submit #12829
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Extends existing validate action to provide specific support for the ContributionPage.submit action
Before
calling
does not check if the parameters are valid for the form
After
The above checks the parameters are valid for the form
Technical Details
@colemanw @mattwire the intent of this is to be able to support a flow like the new paypal method where the user is redirected offsite to authorise the order before the form is submitted. It's important to check the data is valid first - e.g they haven't entered as amount below the minimum and if they have entered yes to recurring they have also entered other details.
This is a first step. It seems to me that in order to be able to validate at the js level we need to be able to test the input against the formRule function. I can see quite a lot of appropriate extension & tidy up work but have kept this to the minimum
Comments
I am open to doing this on the api v4 rather than v3 if it makes sense.