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
|
|
|
use Symfony\Component\HttpFoundation\Request as HttpRequest; |
16
|
|
|
|
17
|
|
|
class CompletePurchaseRequestTest extends TestCase |
18
|
|
|
{ |
19
|
|
|
private $request; |
20
|
|
|
|
21
|
|
|
private $purse = 'ec12345'; |
22
|
|
|
private $secret = '22SAD#-78G8sdf$88'; |
23
|
|
|
private $hash = '1d4d18e1eea386654e1af89e89f1a104'; // d41d8cd98f00b204e9800998ecf8427e 954f1176a05a5921118f49285beea2bb |
24
|
|
|
private $description = 'Test Transaction long description'; |
25
|
|
|
private $transactionId = '1SD672345A890sd'; |
26
|
|
|
private $transactionReference = 'sdfa1SD672345A8'; |
27
|
|
|
private $timestamp = '1454331086'; |
|
|
|
|
28
|
|
|
private $amount = '1465.01'; |
29
|
|
|
private $currency = 'USD'; |
|
|
|
|
30
|
|
|
private $testMode = true; |
31
|
|
|
|
32
|
|
|
public function setUp() |
33
|
|
|
{ |
34
|
|
|
parent::setUp(); |
35
|
|
|
|
36
|
|
|
$httpRequest = new HttpRequest([], [ |
37
|
|
|
'check_key' => $this->hash, |
38
|
|
|
'EPS_DESCRIPTION' => $this->description, |
39
|
|
|
'EPS_GUID' => $this->purse, |
40
|
|
|
'EPS_AMOUNT' => $this->amount, |
41
|
|
|
'EPS_TRID' => $this->transactionId, |
42
|
|
|
'EPS_ACCNUM' => $this->transactionReference, |
43
|
|
|
'EPS_GUID' => $this->purse, |
44
|
|
|
]); |
45
|
|
|
|
46
|
|
|
$this->request = new CompletePurchaseRequest($this->getHttpClient(), $httpRequest); |
47
|
|
|
$this->request->initialize([ |
48
|
|
|
'purse' => $this->purse, |
49
|
|
|
'secret' => $this->secret, |
50
|
|
|
'testMode' => $this->testMode, |
51
|
|
|
]); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
View Code Duplication |
public function testGetData() |
|
|
|
|
55
|
|
|
{ |
56
|
|
|
$data = $this->request->getData(); |
57
|
|
|
|
58
|
|
|
$this->assertSame($this->description, $data['EPS_DESCRIPTION']); |
59
|
|
|
$this->assertSame($this->transactionId, $data['EPS_TRID']); |
60
|
|
|
$this->assertSame($this->hash, $data['check_key']); |
61
|
|
|
$this->assertSame($this->amount, $data['EPS_AMOUNT']); |
62
|
|
|
$this->assertSame($this->purse, $data['EPS_GUID']); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function testSendData() |
66
|
|
|
{ |
67
|
|
|
$data = $this->request->getData(); |
68
|
|
|
$response = $this->request->sendData($data); |
69
|
|
|
$this->assertInstanceOf('Omnipay\ePayService\Message\CompletePurchaseResponse', $response); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
This check marks private properties in classes that are never used. Those properties can be removed.