| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * ePayService driver for Omnipay PHP payment library | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @link      https://github.com/hiqdev/omnipay-epayservice | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @package   omnipay-epayservice | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @license   MIT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | namespace Omnipay\ePayService\Message; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Omnipay\Tests\TestCase; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | class CompletePurchaseResponseTest extends TestCase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     private $request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     private $purse                  = 'ec12345'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     private $secret                 = '22SAD#-78G8sdf$88'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     private $hash                   = '1d4d18e1eea386654e1af89e89f1a104'; // d41d8cd98f00b204e9800998ecf8427e 954f1176a05a5921118f49285beea2bb | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     private $description            = 'Test Transaction long description'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     private $transactionId          = '1SD672345A890sd'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     private $transactionReference   = 'sdfa1SD672345A8'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     private $timestamp              = '1454331086'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     private $amount                 = '1465.01'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     private $currency               = 'USD'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     private $testMode               = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     public function setUp() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         parent::setUp(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         $this->request = new CompletePurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         $this->request->initialize([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |             'purse'     => $this->purse, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             'secret'    => $this->secret, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |             'testMode'  => $this->testMode, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     public function testInvalidHashException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         $this->setExpectedException('Omnipay\Common\Exception\InvalidResponseException', 'Invalid hash'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         new CompletePurchaseResponse($this->request, [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |             'description'           => $this->description, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |             'purse'                 => $this->purse, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |             'secret'                => $this->secret, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |             'testMode'              => $this->testMode, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 54 |  |  |     public function testSuccess() | 
            
                                                        
            
                                    
            
            
                | 55 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 56 |  |  |         $response = new CompletePurchaseResponse($this->request, [ | 
            
                                                        
            
                                    
            
            
                | 57 |  |  |             'testMode'              => $this->testMode, | 
            
                                                        
            
                                    
            
            
                | 58 |  |  |             'check_key'             => $this->hash, | 
            
                                                        
            
                                    
            
            
                | 59 |  |  |             'EPS_DESCRIPTION'       => $this->description, | 
            
                                                        
            
                                    
            
            
                | 60 |  |  |             'EPS_GUID'              => $this->purse, | 
            
                                                        
            
                                    
            
            
                | 61 |  |  |             'EPS_AMOUNT'            => $this->amount, | 
            
                                                        
            
                                    
            
            
                | 62 |  |  |             'EPS_TRID'              => $this->transactionId, | 
            
                                                        
            
                                    
            
            
                | 63 |  |  |             'EPS_ACCNUM'            => $this->transactionReference, | 
            
                                                        
            
                                    
            
            
                | 64 |  |  |         ]); | 
            
                                                        
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 66 |  |  |         $this->assertTrue($response->isSuccessful()); | 
            
                                                        
            
                                    
            
            
                | 67 |  |  |         $this->assertSame($this->transactionId,         $response->getTransactionId()); | 
            
                                                        
            
                                    
            
            
                | 68 |  |  |         $this->assertSame($this->transactionReference,  $response->getTransactionReference()); | 
            
                                                        
            
                                    
            
            
                | 69 |  |  |         $this->assertSame($this->amount,                $response->getAmount()); | 
            
                                                        
            
                                    
            
            
                | 70 |  |  |         $this->assertSame($this->hash,                  $response->getHash()); | 
            
                                                        
            
                                    
            
            
                | 71 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 72 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 73 |  |  |  | 
            
                        
This check marks private properties in classes that are never used. Those properties can be removed.