1 | <?php |
||
16 | class ApiCore |
||
17 | { |
||
18 | /** |
||
19 | * @var Core |
||
20 | */ |
||
21 | private $engine; |
||
22 | /** |
||
23 | * @var bool |
||
24 | */ |
||
25 | public $bulk = false; |
||
26 | /** |
||
27 | * @var Mpesa |
||
28 | */ |
||
29 | public $mpesaRepository; |
||
30 | |||
31 | /** |
||
32 | * ApiCore constructor. |
||
33 | * |
||
34 | * @param Core $engine |
||
35 | * @param Mpesa $mpesa |
||
36 | */ |
||
37 | 2 | public function __construct(Core $engine, Mpesa $mpesa) |
|
42 | |||
43 | /** |
||
44 | * @param string $number |
||
45 | * @param bool $strip_plus |
||
46 | * @return string |
||
47 | */ |
||
48 | 1 | protected function formatPhoneNumber($number, $strip_plus = true): string |
|
65 | |||
66 | /** |
||
67 | * @param array $body |
||
68 | * @param string $endpoint |
||
69 | * @return \Psr\Http\Message\ResponseInterface |
||
70 | * @throws \Samerior\MobileMoney\Mpesa\Exceptions\MpesaException |
||
71 | * @throws \Exception |
||
72 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
73 | */ |
||
74 | 1 | private function makeRequest($body, $endpoint) |
|
88 | |||
89 | /** |
||
90 | * @param array $body |
||
91 | * @param string $endpoint |
||
92 | * @return mixed |
||
93 | * @throws MpesaException |
||
94 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
95 | */ |
||
96 | 1 | public function sendRequest($body, $endpoint) |
|
110 | |||
111 | /** |
||
112 | * @param ClientException $exception |
||
113 | * @return MpesaException |
||
114 | */ |
||
115 | private function generateException(ClientException $exception): MpesaException |
||
119 | } |
||
120 |