hochstrasserio / wirecard

A PHP library for making payments through the Wirecard payment gateway
MIT License
25 stars 12 forks source link

Provide helper class for sending requests #7

Closed CHH closed 8 years ago

CHH commented 9 years ago

Provide a lightweight helper class to make sending requests more convenient. But do not bundle any code to send HTTP requests. This helper class should simply allow to plug Guzzle or HttpAdapter into it, and send requests using one of these libraries. No dependency should be added.

Example:

<?php

$guzzle = new GuzzleHttp\Client;
$context = new Hochstrasser\Wirecard\Context([
  'customer_id' => 'D200411',
  'secret' => '…',
  'language' => 'de',
  'shop_id' => 'qmore',
]);

$helper = new Hochstrasser\Wirecard\WirecardHelper($guzzle, $context);
$response = $helper->send(InitDataStorageRequest::withOrderIdentAndReturnUrl(…));
CHH commented 8 years ago

Added in fa02b0c0c5f5ecba3e4566408435b070e83df9f0