akDeveloper/Aktive-Merchant — pull request #19 by scottgifford (2012-01-27 05:48:32+00:00)
Title: Aktive-Merchant additions to documentation, interface definitions, etc.

Hello Andreas,

I am using Aktive-Merchant for a fairly large project which will support multiple gateways within the same application (it supports many storefronts, and they will each have their own merchant configuration). In order to do this, I had to understand Aktive-Merchant fairly well, and also ensure that the interface is the same across merchants, so I can be sure that code tested with one merchants will work the same with another. I then spent some time documenting what I learned about these various interfaces in phpDoc.

To do this, I broke the various features merchants had out into PHP interfaces, then declared the interfaces in the merchant gateway classes. This means we can quickly tell at compile-time that the interfaces are implemented consistently, and also makes it easier to find documentation for interface methods.

I spent a little time double-checking the error handling, and trying to be very consistent about returning a response object with $resp->success() false if the request is declined because of something under the user's control, while an exception is thrown in case of any other sort of error. I also created a simple new exception class Merchant_Billing_Exception so that merchant-related exceptions can be caught at higher-levels in the code independently of other exceptions. I also added a little bit of error checking around calls to curl, and changed the default to require that the SSL certificate be from a valid CA (otherwise SSL provides no real security).

I hope some or all of these changes are useful to you. Please let me know if any of them require changes to be integrated back into the main codebase.

If you'd like to discuss feel free to email me at sgifford@suspectclass.com.

Thanks! This is great code, I've been enjoying working with it!