Example #1
0
 public function testPurchaseFailure()
 {
     $httpResponse = $this->getMockHttpResponse('PurchaseFailure.txt');
     $response = new Response($this->getMockRequest(), $httpResponse->getBody());
     $this->assertFalse($response->isSuccessful());
     $this->assertSame('', $response->getTransactionReference());
     $this->assertSame('Input variable errors', $response->getMessage());
 }
Example #2
0
 public function testRedirect()
 {
     $httpResponse = $this->getMockHttpResponse('PurchaseRedirect.txt');
     $request = m::mock('\\Omnipay\\Common\\Message\\AbstractRequest');
     $request->shouldReceive('getReturnUrl')->once()->andReturn('http://store.example.com/');
     $response = new Response($request, $httpResponse->getBody());
     $this->assertTrue($response->isRedirect());
     $this->assertSame('POST', $response->getRedirectMethod());
     $this->assertSame('http://some.redirect.com/', $response->getRedirectUrl());
     $expectedData = array('PaReq' => 'Some PaREQ', 'TermUrl' => 'http://store.example.com/', 'MD' => '130215141054377801316798');
     $this->assertEquals($expectedData, $response->getRedirectData());
 }