1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* ePayService driver for the Omnipay PHP payment processing 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\Common\Exception\InvalidResponseException; |
15
|
|
|
use Omnipay\Common\Message\AbstractResponse; |
16
|
|
|
use Omnipay\Common\Message\RequestInterface; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* ePayService Complete Purchase Response. |
20
|
|
|
*/ |
21
|
|
|
class CompletePurchaseResponse extends AbstractResponse |
22
|
|
|
{ |
23
|
|
|
public function __construct(RequestInterface $request, $data) |
24
|
|
|
{ |
25
|
|
|
$this->request = $request; |
26
|
|
|
$this->data = $data; |
27
|
|
|
|
28
|
|
|
if ($this->getHash() !== $this->calculateHash()) { |
29
|
|
|
throw new InvalidResponseException('Invalid hash'); |
30
|
|
|
} |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function getHash() |
34
|
|
|
{ |
35
|
|
|
return strtolower($this->data['check_key']); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function calculateHash() |
39
|
|
|
{ |
40
|
|
|
return md5($this->data['EPS_AMOUNT'] . $this->data['EPS_GUID'] . $this->data['secret']); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function isSuccessful() |
44
|
|
|
{ |
45
|
|
|
return true; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function getTransactionId() |
49
|
|
|
{ |
50
|
|
|
return $this->data['EPS_TRID']; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getTransactionReference() |
54
|
|
|
{ |
55
|
|
|
return $this->data['EPS_ACCNUM']; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getAmount() |
59
|
|
|
{ |
60
|
|
|
return $this->data['EPS_AMOUNT']; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getTestMode() |
64
|
|
|
{ |
65
|
|
|
return (bool) $this->data['testMode']; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|