1 | <?php |
||
7 | class CompletePurchaseResponse extends AbstractResponse |
||
8 | { |
||
9 | |||
10 | const CANCELED_GATEWAY_CODE = 'Z6'; |
||
11 | |||
12 | const SUCCESS_CODE = '00'; |
||
13 | |||
14 | private $isSuccessful = null; |
||
15 | |||
16 | private $validator; |
||
17 | |||
18 | 10 | public function __construct(RequestInterface $request, $data) |
|
23 | |||
24 | 10 | public function isSuccessful() |
|
25 | { |
||
26 | 10 | if (is_null($this->isSuccessful)) { |
|
27 | 10 | $this->validator->validate(); |
|
28 | 5 | $this->isSuccessful = $this->checkSuccessStatus(); |
|
29 | 5 | if ($this->isSuccessful()) { |
|
30 | 4 | $this->validator->successValidate(); |
|
31 | } |
||
32 | } |
||
33 | 5 | return $this->isSuccessful; |
|
34 | } |
||
35 | |||
36 | 5 | private function checkSuccessStatus() |
|
40 | |||
41 | 2 | public function getTransactionReference() |
|
45 | |||
46 | 8 | public function getTransactionId() |
|
50 | |||
51 | 1 | public function getMessage() |
|
59 | |||
60 | 5 | public function getCode() |
|
67 | |||
68 | 1 | public function getGatewayAmount() |
|
72 | |||
73 | 8 | public function getGatewayAmountInteger() |
|
77 | |||
78 | 1 | public function getApprovedAmount() |
|
82 | |||
83 | /** |
||
84 | * Get currency returned from gateway |
||
85 | * @return null |
||
86 | */ |
||
87 | 8 | public function getGatewayNumericCurrency() |
|
91 | |||
92 | 1 | public function formatIntegerAmount($integerAmount) |
|
93 | { |
||
94 | 1 | return $this->getRequest()->getCurrency() |
|
95 | 1 | .' '.number_format( |
|
96 | 1 | $this->convertIntegerAmount($integerAmount), |
|
97 | 1 | $this->getRequest()->getCurrencyDecimalPlaces() |
|
98 | ); |
||
99 | } |
||
100 | |||
101 | 1 | public function convertIntegerAmount($integerAmount) |
|
105 | |||
106 | 1 | public function getCurrencyDecimalFactor() |
|
110 | |||
111 | 10 | public function hasSuccessCode($statusCode) |
|
115 | } |
||
116 |