1 | <?php |
||
10 | class AcceptNotificationResponse extends AbstractResponse implements NotificationInterface |
||
11 | { |
||
12 | /** |
||
13 | * Create an instance of Accept Notification response. |
||
14 | * |
||
15 | * @param \Omnipay\Common\Message\RequestInterface $request |
||
16 | * @param array $data |
||
17 | * @return void |
||
|
|||
18 | * |
||
19 | * @throws \Omnipay\Common\Exception\InvalidResponseException |
||
20 | */ |
||
21 | 4 | public function __construct(RequestInterface $request, $data) |
|
22 | { |
||
23 | 4 | parent::__construct($request, $data); |
|
24 | |||
25 | 4 | if ($this->hasUnsupportedType()) { |
|
26 | 1 | throw new InvalidResponseException('Only macro/EMA payment callbacks are accepted'); |
|
27 | } |
||
28 | |||
29 | 3 | if ($this->isSuccessful()) { |
|
30 | 1 | echo 'OK'; |
|
31 | } |
||
32 | 3 | } |
|
33 | |||
34 | /** |
||
35 | * Determine the response has unsupported type. |
||
36 | * |
||
37 | * @return bool |
||
38 | */ |
||
39 | 4 | protected function hasUnsupportedType() |
|
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 1 | public function getTransactionReference() |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 3 | public function getTransactionStatus() |
|
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | 1 | public function getMessage() |
|
74 | |||
75 | /** |
||
76 | * Determine test mode is on. |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | 1 | public function isTestMode() |
|
84 | |||
85 | /** |
||
86 | * {@inheritdoc} |
||
87 | */ |
||
88 | 3 | public function isSuccessful() |
|
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | 3 | public function getCode() |
|
100 | |||
101 | /** |
||
102 | * Return the value from data or null. |
||
103 | * |
||
104 | * @param string $name |
||
105 | * @return string |
||
106 | */ |
||
107 | 4 | protected function getDataValueOrNull($name) |
|
111 | } |
||
112 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.