ongoworks/reaction-paypal — pull request #1 by aldeed (2014-06-25 22:54:11+00:00)
Title: Form validation, submission, and error handling fixes

I've fixed or improved a few things here:

* Rather than using a form submit event handler, the submission code is now in an autoform onSubmit hook. The old way, the submit code was actually running regardless of whether the form was valid or not. This way the form data is definitely valid.
* I added a regEx validator for the cardholder name because PayPal requires both first and last name, so the regEx validates that it is two words separated by exactly one space.
* I added a `handlePaypalSubmitError` and call out to it to handle errors. In my testing, I was getting various errors back from PayPal API in a variety of object formats, so this function smoothes out all that and displays a nice error to the user.
* AutoForm now has `beginSubmit` and `endSubmit` hooks, so I'm using those to do the UI stuff, like disabling the form and showing "submitting". They run synchronously, though, so I have some extra checking and handling that makes it work asynchronously, where all code paths ultimately call out to the `uiEnd` function.
* Payment alert is now hidden when you begin resubmission.
* I added a link on the admin paypal settings form that allows them to get the id/secret if they don't have it yet.

I think the rest is the same. I wasn't able to test with a successful payment because I kept getting 500 internal server errors back from the paypal API. I'm hoping that was just a transient thing. It has worked for me in the past.