This is probably never gonna reach the top of your list, but here you go. I discovered while trying to unit test an addon I'm writing for GetPaid, that it's very hard to unit test the checkout ajax callback. The reason is that the Wordpress unit test case for testing Ajax calls, quite sensibly and correctly prevents the script from dying when wp_send_json_* is called by registering a custom die handler that throws an exception instead, and is meant to be caught by the test case. However GetPaid's checkout process catches the base Exception class, which makes it impossible for a custom die handler to gracefully stop the ajax action without killing the script.
Given that you already have a custom GetPaid_Payment_Exception used in places, I suggest you change all other places that throw the base Exception class to throw GetPaid_Payment_Exception instead and only catch GetPaid_Payment_Exception and not other Exceptions. This is also good practice I believe, since unexpected exceptions that may result from other code shouldn't be caught by you.
This is probably never gonna reach the top of your list, but here you go. I discovered while trying to unit test an addon I'm writing for GetPaid, that it's very hard to unit test the checkout ajax callback. The reason is that the Wordpress unit test case for testing Ajax calls, quite sensibly and correctly prevents the script from dying when
wp_send_json_*is called by registering a custom die handler that throws an exception instead, and is meant to be caught by the test case. However GetPaid's checkout process catches the baseExceptionclass, which makes it impossible for a custom die handler to gracefully stop the ajax action without killing the script.Given that you already have a custom
GetPaid_Payment_Exceptionused in places, I suggest you change all other places that throw the baseExceptionclass to throwGetPaid_Payment_Exceptioninstead and only catchGetPaid_Payment_Exceptionand not other Exceptions. This is also good practice I believe, since unexpected exceptions that may result from other code shouldn't be caught by you.