| @@ 103-130 (lines=28) @@ | ||
| 100 | * |
|
| 101 | * @return array |
|
| 102 | */ |
|
| 103 | public function cashup($dealerMsisdn, $start, $end) |
|
| 104 | { |
|
| 105 | try { |
|
| 106 | $response = $this->post( |
|
| 107 | '/webservice/smartload/cashup', |
|
| 108 | [ |
|
| 109 | 'headers' => [ |
|
| 110 | 'Authorization' => $this->bearerOrBasic(), |
|
| 111 | ], |
|
| 112 | 'json' => [ |
|
| 113 | 'smartloadId' => $dealerMsisdn, |
|
| 114 | 'startDate' => $start, |
|
| 115 | 'endDate' => $end, |
|
| 116 | ], |
|
| 117 | ] |
|
| 118 | ); |
|
| 119 | ||
| 120 | return [ |
|
| 121 | 'status' => 'ok', |
|
| 122 | 'http_code' => $response->getStatusCode(), |
|
| 123 | 'body' => (string) $response->getBody(), |
|
| 124 | ]; |
|
| 125 | } catch (\GuzzleHttp\Exception\ClientException $e) { |
|
| 126 | return $this->clientError($e); |
|
| 127 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 128 | return $this->parseError($e); |
|
| 129 | } |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * Authenticate and request current day cashup report. |
|
| @@ 180-208 (lines=29) @@ | ||
| 177 | * |
|
| 178 | * @return array |
|
| 179 | */ |
|
| 180 | public function fundstransfer($fromDealerMsisdn, $toDealerMsisdn, $amount, $sendSms) |
|
| 181 | { |
|
| 182 | try { |
|
| 183 | $response = $this->post( |
|
| 184 | '/webservice/smartload/fundstransfer', |
|
| 185 | [ |
|
| 186 | 'headers' => [ |
|
| 187 | 'Authorization' => $this->bearerOrBasic(), |
|
| 188 | ], |
|
| 189 | 'json' => [ |
|
| 190 | 'sourceSmartloadId' => $fromDealerMsisdn, |
|
| 191 | 'recipientSmartloadId' => $toDealerMsisdn, |
|
| 192 | 'amount' => $amount, |
|
| 193 | 'sendSms' => $sendSms, |
|
| 194 | ], |
|
| 195 | ] |
|
| 196 | ); |
|
| 197 | ||
| 198 | return [ |
|
| 199 | 'status' => 'ok', |
|
| 200 | 'http_code' => $response->getStatusCode(), |
|
| 201 | 'body' => (string) $response->getBody(), |
|
| 202 | ]; |
|
| 203 | } catch (\GuzzleHttp\Exception\ClientException $e) { |
|
| 204 | return $this->clientError($e); |
|
| 205 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 206 | return $this->parseError($e); |
|
| 207 | } |
|
| 208 | } |
|
| 209 | ||
| 210 | /** |
|
| 211 | * Authenticate and retrieves a list of all available networks. |
|