1 | <?php |
||
19 | class Cbs |
||
20 | { |
||
21 | /** |
||
22 | * Issue Secret Key from CBS. |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $secretKey; |
||
26 | |||
27 | /** |
||
28 | * Issue Client ID from CBS. |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $clientId; |
||
32 | |||
33 | /** |
||
34 | * Issue URL from CBS. |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $baseUrl; |
||
38 | |||
39 | /** |
||
40 | * Issue Revenue Head from CBS. |
||
41 | * @var int |
||
42 | */ |
||
43 | protected $revenueHeads; |
||
44 | |||
45 | /** |
||
46 | * Issue Category ID from CBS Admin. |
||
47 | * @var int |
||
48 | */ |
||
49 | protected $categoryId; |
||
50 | |||
51 | /** |
||
52 | * Response from requests made to CBS. |
||
53 | * @var mixed |
||
54 | */ |
||
55 | protected $response; |
||
56 | |||
57 | /** |
||
58 | * Hashed Key. |
||
59 | * @var mixed |
||
60 | */ |
||
61 | protected $signature; |
||
62 | |||
63 | /** |
||
64 | * Payment Url - CBS payment page. |
||
65 | * @var string |
||
66 | */ |
||
67 | protected $url; |
||
68 | |||
69 | /** |
||
70 | * Response from CBS. |
||
71 | * @var mixed |
||
72 | */ |
||
73 | protected $invoice = []; |
||
74 | |||
75 | /** |
||
76 | * Instance of Client. |
||
77 | * @var Client |
||
78 | */ |
||
79 | protected $client; |
||
80 | |||
81 | public function __construct() |
||
87 | |||
88 | public function setUrl() |
||
92 | |||
93 | /** |
||
94 | * Get secret key from CBS config file. |
||
95 | */ |
||
96 | public function setConstant() |
||
103 | |||
104 | protected function checkConstant() |
||
122 | |||
123 | protected function setSignature($amount, $callback) |
||
131 | |||
132 | /** |
||
133 | * Set options for making the Client request. |
||
134 | */ |
||
135 | private function setRequestOptions() |
||
147 | |||
148 | /** |
||
149 | * @param $relativeUri |
||
150 | * @param string $method |
||
151 | * @param array $body |
||
152 | * |
||
153 | * @return \Infinitypaul\Cbs\Cbs |
||
154 | * @throws \Infinitypaul\Cbs\Exceptions\NotSetException |
||
155 | */ |
||
156 | private function setHttpResponse($relativeUri, $method, $body = []) |
||
168 | |||
169 | private function getResponse() |
||
173 | |||
174 | |||
175 | protected function setUser($data){ |
||
195 | |||
196 | /** |
||
197 | * Initiate a payment request to Cbs |
||
198 | * Included the option to pass the payload to this method for situations |
||
199 | * when the payload is built on the fly (not passed to the controller from a view). |
||
200 | * |
||
201 | * @param array $data |
||
202 | * |
||
203 | * @return \Infinitypaul\Cbs\Cbs |
||
204 | * @throws \Infinitypaul\Cbs\Exceptions\NotSetException |
||
205 | */ |
||
206 | public function generateInvoice($data) |
||
237 | |||
238 | /** |
||
239 | * Set the invoice data from the callback response. |
||
240 | * |
||
241 | * @param array $data |
||
242 | * |
||
243 | * @return \Infinitypaul\Cbs\Cbs |
||
244 | * @throws \Infinitypaul\Cbs\Exceptions\NotSetException |
||
245 | */ |
||
246 | public function setInvoice($data = []) |
||
253 | |||
254 | /** |
||
255 | * Get the invoice data from the callback response. |
||
256 | */ |
||
257 | public function getData() |
||
261 | |||
262 | /** |
||
263 | * Get the invoice payment url from the callback response. |
||
264 | */ |
||
265 | public function redirectNow() |
||
269 | |||
270 | /** |
||
271 | * Compute Mac Address. |
||
272 | * |
||
273 | * @param $invoiceNumber |
||
274 | * @param $paymentRef |
||
275 | * @param $amount |
||
276 | * |
||
277 | * |
||
278 | * @param $RequestReference |
||
279 | * |
||
280 | * @return string |
||
281 | */ |
||
282 | protected function computeMac($invoiceNumber, $paymentRef, $amount, $RequestReference) |
||
288 | |||
289 | /** |
||
290 | * Get Payment details if the transaction was verified successfully. |
||
291 | * |
||
292 | * @throws \Infinitypaul\Cbs\Exceptions\InvalidPostException |
||
293 | */ |
||
294 | public function getPaymentData() |
||
303 | } |
||
304 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: