コード例 #1
0
 public function testValidateSignature()
 {
     $response = new CompletePurchaseresponse($this->getMockRequest(), array('status' => 'OK', 'pid' => '123456'));
     $data = array('pid' => '123456', 'id' => '123456', 'email' => 'test@test', 'operation_status' => 'completed');
     $data['signature'] = hash('sha256', $data['pid'] . $data['id'] . $data['operation_status'] . $data['email']);
     $this->assertSame('OK', $response->validateSignature($data));
 }
コード例 #2
0
 public function testCompletePurchaseFailure()
 {
     $response = new CompletePurchaseresponse($this->getMockRequest(), array('chargetotal' => '110.00', 'response_hash' => '0dfe9e4b3c6306343926207a8814a48f72087cc7', 'status' => 'DECLINED', 'oid' => 'abc1234', 'txndatetime' => '2013:09:27-16:00:19', 'approval_code' => 'N:05:DECLINED'));
     $this->assertFalse($response->isSuccessful());
     $this->assertFalse($response->isRedirect());
     $this->assertSame('abc1234', $response->getTransactionReference());
     $this->assertSame('DECLINED', $response->getMessage());
 }
コード例 #3
0
 public function testCompletePurchaseInvalid()
 {
     $response = new CompletePurchaseresponse($this->getMockRequest(), array());
     $this->assertFalse($response->isSuccessful());
     $this->assertFalse($response->isRedirect());
     $this->assertNull($response->getTransactionReference());
     $this->assertNull($response->getMessage());
 }
コード例 #4
0
 public function testConstruct()
 {
     $response = new CompletePurchaseresponse($this->getMockRequest(), array('order_number' => 'abc123'));
     $this->assertTrue($response->isSuccessful());
     $this->assertFalse($response->isRedirect());
     $this->assertSame('abc123', $response->getTransactionReference());
     $this->assertNull($response->getMessage());
 }