| 1 | <?php |
||
| 7 | class Response |
||
| 8 | { |
||
| 9 | public $okay; |
||
| 10 | public $body; |
||
| 11 | public $forApi; |
||
| 12 | public $messages = []; |
||
| 13 | |||
| 14 | 3 | private function parsePaystackResponse() |
|
| 15 | { |
||
| 16 | 3 | $resp = \json_decode($this->body); |
|
| 17 | |||
| 18 | 3 | if (json_last_error() !== JSON_ERROR_NONE || !property_exists($resp, 'status') || !$resp->status) { |
|
| 19 | 2 | throw new ApiException( |
|
| 20 | "Paystack Request failed with response: '" . |
||
| 21 | 2 | (((json_last_error() === JSON_ERROR_NONE) && property_exists($resp, 'message')) ? $resp->message : $this->body) . "'." |
|
| 22 | 2 | ); |
|
| 23 | } |
||
| 24 | |||
| 25 | 1 | return $resp; |
|
| 26 | } |
||
| 27 | |||
| 28 | 2 | private function implodedMessages() |
|
| 32 | |||
| 33 | 6 | public function wrapUp() |
|
| 47 | } |
||
| 48 |