| @@ 296-324 (lines=29) @@ | ||
| 293 | * |
|
| 294 | * @return array |
|
| 295 | */ |
|
| 296 | public function prevendProduct($productId, $amount, $msisdn, $deviceId, $clientRef, $pinless, $sendSms) |
|
| 297 | { |
|
| 298 | try { |
|
| 299 | $response = $this->post( |
|
| 300 | sprintf( |
|
| 301 | '/SmartcallRestfulProxy/prevend_js/%s', |
|
| 302 | $clientRef |
|
| 303 | ), |
|
| 304 | [ |
|
| 305 | 'json' => [ |
|
| 306 | 'amount' => $amount, |
|
| 307 | 'deviceId' => $deviceId, |
|
| 308 | 'pinless' => $pinless, |
|
| 309 | 'productId' => $productId, |
|
| 310 | 'sendSms' => $sendSms, |
|
| 311 | 'smsRecipientMsisdn' => $msisdn, |
|
| 312 | ], |
|
| 313 | ] |
|
| 314 | ); |
|
| 315 | ||
| 316 | return [ |
|
| 317 | 'status' => 'ok', |
|
| 318 | 'http_code' => $response->getStatusCode(), |
|
| 319 | 'body' => (string) $response->getBody(), |
|
| 320 | ]; |
|
| 321 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 322 | return $this->parseError($e); |
|
| 323 | } |
|
| 324 | } |
|
| 325 | ||
| 326 | /** |
|
| 327 | * Purchase a voucher or do a pinless recharge on SmartCall. |
|
| @@ 341-369 (lines=29) @@ | ||
| 338 | * |
|
| 339 | * @return array |
|
| 340 | */ |
|
| 341 | public function purchaseProduct($productId, $amount, $msisdn, $deviceId, $clientRef, $pinless, $sendSms) |
|
| 342 | { |
|
| 343 | try { |
|
| 344 | $response = $this->post( |
|
| 345 | sprintf( |
|
| 346 | '/SmartcallRestfulProxy/recharge_js/%s', |
|
| 347 | $clientRef |
|
| 348 | ), |
|
| 349 | [ |
|
| 350 | 'json' => [ |
|
| 351 | 'amount' => $amount, |
|
| 352 | 'deviceId' => $deviceId, |
|
| 353 | 'pinless' => $pinless, |
|
| 354 | 'productId' => $productId, |
|
| 355 | 'sendSms' => $sendSms, |
|
| 356 | 'smsRecipientMsisdn' => $msisdn, |
|
| 357 | ], |
|
| 358 | ] |
|
| 359 | ); |
|
| 360 | ||
| 361 | return [ |
|
| 362 | 'status' => 'ok', |
|
| 363 | 'http_code' => $response->getStatusCode(), |
|
| 364 | 'body' => (string) $response->getBody(), |
|
| 365 | ]; |
|
| 366 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 367 | return $this->parseError($e); |
|
| 368 | } |
|
| 369 | } |
|
| 370 | ||
| 371 | /** |
|
| 372 | * Searches SmartCall for a specified transaction using a specified key and string to search |
|