public function testProPurchaseFailure() { $httpResponse = $this->getMockHttpResponse('ProPurchaseFailure.txt'); $response = new Response($this->getMockRequest(), $httpResponse->getBody()); $this->assertFalse($response->isSuccessful()); $this->assertNull($response->getTransactionReference()); $this->assertSame('This transaction cannot be processed. Please enter a valid credit card expiration year.', $response->getMessage()); }
public function __construct(RequestInterface $request, $data) { parent::__construct($request, $data); $payments = array(); foreach ($this->data as $key => $value) { if ($this->isSuccessful() && preg_match('/(L_)?(?<key>[A-Za-z]+)(?<n>[0-9]+)/', $key, $matches)) { $payments[$matches['n']][$matches['key']] = $value; unset($this->data[$key]); } } $this->data['payments'] = $payments; }