| @@ 229-256 (lines=28) @@ | ||
| 226 | * |
|
| 227 | * @return array |
|
| 228 | */ |
|
| 229 | public function cashup($dealerMsisdn, $start, $end) |
|
| 230 | { |
|
| 231 | try { |
|
| 232 | $response = $this->post( |
|
| 233 | '/webservice/smartload/cashup', |
|
| 234 | [ |
|
| 235 | 'headers' => [ |
|
| 236 | 'Authorization' => $this->bearerOrBasic(), |
|
| 237 | ], |
|
| 238 | 'json' => [ |
|
| 239 | 'smartloadId' => $dealerMsisdn, |
|
| 240 | 'startDate' => $start, |
|
| 241 | 'endDate' => $end, |
|
| 242 | ], |
|
| 243 | ] |
|
| 244 | ); |
|
| 245 | ||
| 246 | return [ |
|
| 247 | 'status' => 'ok', |
|
| 248 | 'http_code' => $response->getStatusCode(), |
|
| 249 | 'body' => (string) $response->getBody(), |
|
| 250 | ]; |
|
| 251 | } catch (\GuzzleHttp\Exception\ClientException $e) { |
|
| 252 | return $this->clientError($e); |
|
| 253 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 254 | return $this->parseError($e); |
|
| 255 | } |
|
| 256 | } |
|
| 257 | ||
| 258 | /** |
|
| 259 | * Authenticate and retrieves the dealer balance in Rands. |
|
| @@ 342-370 (lines=29) @@ | ||
| 339 | * |
|
| 340 | * @return array |
|
| 341 | */ |
|
| 342 | public function fundstransfer($fromDealerMsisdn, $toDealerMsisdn, $amount, $sendSms) |
|
| 343 | { |
|
| 344 | try { |
|
| 345 | $response = $this->post( |
|
| 346 | '/webservice/smartload/fundstransfer', |
|
| 347 | [ |
|
| 348 | 'headers' => [ |
|
| 349 | 'Authorization' => $this->bearerOrBasic(), |
|
| 350 | ], |
|
| 351 | 'json' => [ |
|
| 352 | 'sourceSmartloadId' => $fromDealerMsisdn, |
|
| 353 | 'recipientSmartloadId' => $toDealerMsisdn, |
|
| 354 | 'amount' => $amount, |
|
| 355 | 'sendSms' => $sendSms, |
|
| 356 | ], |
|
| 357 | ] |
|
| 358 | ); |
|
| 359 | ||
| 360 | return [ |
|
| 361 | 'status' => 'ok', |
|
| 362 | 'http_code' => $response->getStatusCode(), |
|
| 363 | 'body' => (string) $response->getBody(), |
|
| 364 | ]; |
|
| 365 | } catch (\GuzzleHttp\Exception\ClientException $e) { |
|
| 366 | return $this->clientError($e); |
|
| 367 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 368 | return $this->parseError($e); |
|
| 369 | } |
|
| 370 | } |
|
| 371 | ||
| 372 | /** |
|
| 373 | * Authenticate and retrieves a list of all available networks. |
|