@@ 135-148 (lines=14) @@ | ||
132 | * |
|
133 | * @return array |
|
134 | */ |
|
135 | public function getDealerBalance() |
|
136 | { |
|
137 | try { |
|
138 | $response = $this->get('/SmartcallRestfulProxy/balance'); |
|
139 | ||
140 | return [ |
|
141 | 'status' => 'ok', |
|
142 | 'http_code' => $response->getStatusCode(), |
|
143 | 'body' => (string) $response->getBody(), |
|
144 | ]; |
|
145 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
146 | return $this->parseError($e); |
|
147 | } |
|
148 | } |
|
149 | ||
150 | /** |
|
151 | * Fetches the Dealer Balance from SmartCall. |
|
@@ 157-175 (lines=19) @@ | ||
154 | * |
|
155 | * @return array |
|
156 | */ |
|
157 | public function isDealerRegistered($msisdn) |
|
158 | { |
|
159 | try { |
|
160 | $response = $this->get( |
|
161 | sprintf( |
|
162 | '/SmartcallRestfulProxy/registered/%s', |
|
163 | $msisdn |
|
164 | ) |
|
165 | ); |
|
166 | ||
167 | return [ |
|
168 | 'status' => 'ok', |
|
169 | 'http_code' => $response->getStatusCode(), |
|
170 | 'body' => (string) $response->getBody(), |
|
171 | ]; |
|
172 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
173 | return $this->parseError($e); |
|
174 | } |
|
175 | } |
|
176 | ||
177 | /** |
|
178 | * Fetches the Product from SmartCall. |
|
@@ 186-204 (lines=19) @@ | ||
183 | * |
|
184 | * @return array |
|
185 | */ |
|
186 | public function getProduct($productId) |
|
187 | { |
|
188 | try { |
|
189 | $response = $this->get( |
|
190 | sprintf( |
|
191 | '/SmartcallRestfulProxy/product_js/%d', |
|
192 | $productId |
|
193 | ) |
|
194 | ); |
|
195 | ||
196 | return [ |
|
197 | 'status' => 'ok', |
|
198 | 'http_code' => $response->getStatusCode(), |
|
199 | 'body' => (string) $response->getBody(), |
|
200 | ]; |
|
201 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
202 | return $this->parseError($e); |
|
203 | } |
|
204 | } |
|
205 | ||
206 | /** |
|
207 | * Fetches the Product List from SmartCall. |
|
@@ 213-226 (lines=14) @@ | ||
210 | * |
|
211 | * @return array |
|
212 | */ |
|
213 | public function getProducts() |
|
214 | { |
|
215 | try { |
|
216 | $response = $this->get('/SmartcallRestfulProxy/all_networks_js'); |
|
217 | ||
218 | return [ |
|
219 | 'status' => 'ok', |
|
220 | 'http_code' => $response->getStatusCode(), |
|
221 | 'body' => (string) $response->getBody(), |
|
222 | ]; |
|
223 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
224 | return $this->parseError($e); |
|
225 | } |
|
226 | } |
|
227 | ||
228 | /** |
|
229 | * Fetches the details of the last transaction processed from SmartCall. |
|
@@ 235-248 (lines=14) @@ | ||
232 | * |
|
233 | * @return array |
|
234 | */ |
|
235 | public function getLastTransaction() |
|
236 | { |
|
237 | try { |
|
238 | $response = $this->get('/SmartcallRestfulProxy/last_transaction_js'); |
|
239 | ||
240 | return [ |
|
241 | 'status' => 'ok', |
|
242 | 'http_code' => $response->getStatusCode(), |
|
243 | 'body' => (string) $response->getBody(), |
|
244 | ]; |
|
245 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
246 | return $this->parseError($e); |
|
247 | } |
|
248 | } |
|
249 | ||
250 | /** |
|
251 | * Fetches the Product List by the specified network identifier from SmartCall. |
|
@@ 259-277 (lines=19) @@ | ||
256 | * |
|
257 | * @return array |
|
258 | */ |
|
259 | public function getProductsByNetwork($networkId) |
|
260 | { |
|
261 | try { |
|
262 | $response = $this->get( |
|
263 | sprintf( |
|
264 | '/SmartcallRestfulProxy/network_js/%d', |
|
265 | $networkId |
|
266 | ) |
|
267 | ); |
|
268 | ||
269 | return [ |
|
270 | 'status' => 'ok', |
|
271 | 'http_code' => $response->getStatusCode(), |
|
272 | 'body' => (string) $response->getBody(), |
|
273 | ]; |
|
274 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
275 | return $this->parseError($e); |
|
276 | } |
|
277 | } |
|
278 | ||
279 | /** |
|
280 | * Purchase a voucher or do a pinless recharge on SmartCall. |