juriansluiman / SlmIdealPayment

Payment module for Dutch iDEAL payments
Other
9 stars 5 forks source link

Change from SocketAdapter to CurlAdapter for platform independency #20

Open markdegrootnl opened 9 years ago

markdegrootnl commented 9 years ago

The Zend SocketAdapter is configured to use CA certificates from /etc/ssl/certs but this does not work on OS X or Windows. Is there a way to use the CurlAdapter for the requests?

juriansluiman commented 9 years ago

At this moment this is not possible without copying the factory to a custom one and make your changes.

The best way is to take out the HTTP client and make it its own service; then remove the adapter part. In these two lines, the adapter can be removed and the options can be set directly. During the creating of SlmIdealPayment, that was not possible, but now you can simply do this:

$httpClient->setOptions([ /* ... */]);
$client->setHttpClient($httpClient);

This will pass on all adapter options when the request is sent.

Can you do a PR for this? So:

  1. Make the HTTP service a standalone entry in the SM (SlmIdealPayment\Http\Client or something)
  2. Remove the static link to a specific adapter
  3. Perhaps we can introduce another option in the configuration: http_adapter for a string of the adapter name and rename ssl_options to http_options (a BC break, but we're still beta and I think that's OK).