adrianmacneil/omnipay — pull request #19 by adrianmacneil (2013-02-21 16:14:40+00:00)
Title: Refactor requests (Omnipay v0.8)

This is going to be v0.8 in case anyone is interested.

Basically, I have refactored each of the requests into a separate class. Each Request knows how to turn itself into a useful array of data, which is then sent by the Gateway and turned into a Response.

This makes the simplest example only slightly longer:

$response = $gateway->purchase(['amount' => 1000, 'card' => $formData])->send();

Note the extra `send()` method. The `purchase()` method now only returns a Request object, which you can manipulate before sending. This makes Requests much easier to unit test, and makes everything much more flexible. It means you can do cool things like this:

$response = $gateway->purchase()->setAmount(1000)->setCard($formData)->send();

Any thoughts are welcome.