1 | <?php |
||
17 | class WebhookNotification extends AbstractRequest implements NotificationInterface, ResponseInterface |
||
18 | { |
||
19 | /** |
||
20 | * @inheritDoc |
||
21 | */ |
||
22 | public function __construct(ClientInterface $httpClient, HttpRequest $httpRequest) |
||
28 | |||
29 | /** |
||
30 | * ResponseInterface implemented so that we can return self here for any legacy support that uses send() |
||
31 | */ |
||
32 | public function sendData($data) |
||
36 | |||
37 | /** |
||
38 | * Get the authorisation code if available. |
||
39 | * |
||
40 | * @return null|string |
||
41 | */ |
||
42 | public function getTransactionReference() |
||
46 | |||
47 | /** |
||
48 | * Was the transaction successful? |
||
49 | * |
||
50 | * @return string Transaction status, one of {@link NotificationInterface::STATUS_COMPLETED}, |
||
51 | * {@link NotificationInterface::STATUS_PENDING}, or {@link NotificationInterface::STATUS_FAILED}. |
||
52 | */ |
||
53 | public function getTransactionStatus() |
||
68 | |||
69 | /** |
||
70 | * Get the merchant response message if available. |
||
71 | * |
||
72 | * @return null|string |
||
73 | */ |
||
74 | public function getMessage() |
||
78 | |||
79 | public function getData() |
||
83 | |||
84 | /** |
||
85 | * Get the original request which generated this response |
||
86 | * |
||
87 | * @return RequestInterface |
||
88 | */ |
||
89 | public function getRequest() |
||
93 | |||
94 | /** |
||
95 | * Is the response successful? |
||
96 | * |
||
97 | * @return boolean |
||
98 | */ |
||
99 | public function isSuccessful() |
||
103 | |||
104 | /** |
||
105 | * Does the response require a redirect? |
||
106 | * |
||
107 | * @return boolean |
||
108 | */ |
||
109 | public function isRedirect() |
||
113 | |||
114 | /** |
||
115 | * Is the transaction cancelled by the user? |
||
116 | * |
||
117 | * @return boolean |
||
118 | */ |
||
119 | public function isCancelled() |
||
123 | |||
124 | /** |
||
125 | * Response code |
||
126 | * |
||
127 | * @return null|string A response code from the payment gateway |
||
128 | */ |
||
129 | public function getCode() |
||
133 | |||
134 | /** |
||
135 | * Get the card type if available. |
||
136 | * |
||
137 | * @return null|string |
||
138 | */ |
||
139 | public function getCardType() |
||
143 | } |
||
144 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: