@@ 289-321 (lines=33) @@ | ||
286 | * @param bool $pinless |
|
287 | * @param bool $sendSms |
|
288 | */ |
|
289 | public function prevend($dealerMsisdn, $clientReference, $smsRecipientMsisdn, $deviceId, $productId, $amount, $pinless, $sendSms) |
|
290 | { |
|
291 | try { |
|
292 | $response = $this->post( |
|
293 | '/webservice/smartload/prevend', |
|
294 | [ |
|
295 | 'headers' => [ |
|
296 | 'Authorization' => $this->bearerOrBasic(), |
|
297 | ], |
|
298 | 'json' => [ |
|
299 | 'smartloadId' => $dealerMsisdn, |
|
300 | 'clientReference' => $clientReference, |
|
301 | 'smsRecipientMsisdn' => $smsRecipientMsisdn, |
|
302 | 'deviceId' => $deviceId, |
|
303 | 'productId' => $productId, |
|
304 | 'amount' => $amount, |
|
305 | 'pinless' => $pinless, |
|
306 | 'sendSms' => $sendSms, |
|
307 | ], |
|
308 | ] |
|
309 | ); |
|
310 | ||
311 | return [ |
|
312 | 'status' => 'ok', |
|
313 | 'http_code' => $response->getStatusCode(), |
|
314 | 'body' => (string) $response->getBody(), |
|
315 | ]; |
|
316 | } catch (\GuzzleHttp\Exception\ClientException $e) { |
|
317 | return $this->clientError($e); |
|
318 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
319 | return $this->parseError($e); |
|
320 | } |
|
321 | } |
|
322 | ||
323 | /** |
|
324 | * Authenticate and retrieves the product information for the specified product id. |
|
@@ 371-403 (lines=33) @@ | ||
368 | * @param bool $pinless |
|
369 | * @param bool $sendSms |
|
370 | */ |
|
371 | public function recharge($dealerMsisdn, $clientReference, $smsRecipientMsisdn, $deviceId, $productId, $amount, $pinless, $sendSms) |
|
372 | { |
|
373 | try { |
|
374 | $response = $this->post( |
|
375 | '/webservice/smartload/recharges', |
|
376 | [ |
|
377 | 'headers' => [ |
|
378 | 'Authorization' => $this->bearerOrBasic(), |
|
379 | ], |
|
380 | 'json' => [ |
|
381 | 'smartloadId' => $dealerMsisdn, |
|
382 | 'clientReference' => $clientReference, |
|
383 | 'smsRecipientMsisdn' => $smsRecipientMsisdn, |
|
384 | 'deviceId' => $deviceId, |
|
385 | 'productId' => $productId, |
|
386 | 'amount' => $amount, |
|
387 | 'pinless' => $pinless, |
|
388 | 'sendSms' => $sendSms, |
|
389 | ], |
|
390 | ] |
|
391 | ); |
|
392 | ||
393 | return [ |
|
394 | 'status' => 'ok', |
|
395 | 'http_code' => $response->getStatusCode(), |
|
396 | 'body' => (string) $response->getBody(), |
|
397 | ]; |
|
398 | } catch (\GuzzleHttp\Exception\ClientException $e) { |
|
399 | return $this->clientError($e); |
|
400 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
401 | return $this->parseError($e); |
|
402 | } |
|
403 | } |
|
404 | ||
405 | /** |
|
406 | * Authenticate and checks if the provided ID (MSISDN) is registered with Smartload. |