| @@ 68-81 (lines=14) @@ | ||
| 65 | * |
|
| 66 | * @return array |
|
| 67 | */ |
|
| 68 | public function getDealerBalance() |
|
| 69 | { |
|
| 70 | try { |
|
| 71 | $response = $this->get('/SmartcallRestfulProxy/balance'); |
|
| 72 | ||
| 73 | return [ |
|
| 74 | 'status' => 'ok', |
|
| 75 | 'http_code' => $response->getStatusCode(), |
|
| 76 | 'body' => (string) $response->getBody(), |
|
| 77 | ]; |
|
| 78 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 79 | return $this->parseError($e); |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Fetches the Dealer Balance from SmartCall. |
|
| @@ 90-108 (lines=19) @@ | ||
| 87 | * |
|
| 88 | * @return array |
|
| 89 | */ |
|
| 90 | public function isDealerRegistered($msisdn) |
|
| 91 | { |
|
| 92 | try { |
|
| 93 | $response = $this->get( |
|
| 94 | sprintf( |
|
| 95 | '/SmartcallRestfulProxy/registered/%s', |
|
| 96 | $msisdn |
|
| 97 | ) |
|
| 98 | ); |
|
| 99 | ||
| 100 | return [ |
|
| 101 | 'status' => 'ok', |
|
| 102 | 'http_code' => $response->getStatusCode(), |
|
| 103 | 'body' => (string) $response->getBody(), |
|
| 104 | ]; |
|
| 105 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 106 | return $this->parseError($e); |
|
| 107 | } |
|
| 108 | } |
|
| 109 | ||
| 110 | /** |
|
| 111 | * Fetches the Product from SmartCall. |
|
| @@ 119-137 (lines=19) @@ | ||
| 116 | * |
|
| 117 | * @return array |
|
| 118 | */ |
|
| 119 | public function getProduct($productId) |
|
| 120 | { |
|
| 121 | try { |
|
| 122 | $response = $this->get( |
|
| 123 | sprintf( |
|
| 124 | '/SmartcallRestfulProxy/product_js/%d', |
|
| 125 | $productId |
|
| 126 | ) |
|
| 127 | ); |
|
| 128 | ||
| 129 | return [ |
|
| 130 | 'status' => 'ok', |
|
| 131 | 'http_code' => $response->getStatusCode(), |
|
| 132 | 'body' => (string) $response->getBody(), |
|
| 133 | ]; |
|
| 134 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 135 | return $this->parseError($e); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Fetches the Product List from SmartCall. |
|
| @@ 146-159 (lines=14) @@ | ||
| 143 | * |
|
| 144 | * @return array |
|
| 145 | */ |
|
| 146 | public function getProducts() |
|
| 147 | { |
|
| 148 | try { |
|
| 149 | $response = $this->get('/SmartcallRestfulProxy/all_networks_js'); |
|
| 150 | ||
| 151 | return [ |
|
| 152 | 'status' => 'ok', |
|
| 153 | 'http_code' => $response->getStatusCode(), |
|
| 154 | 'body' => (string) $response->getBody(), |
|
| 155 | ]; |
|
| 156 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 157 | return $this->parseError($e); |
|
| 158 | } |
|
| 159 | } |
|
| 160 | ||
| 161 | /** |
|
| 162 | * Fetches the details of the last transaction processed from SmartCall. |
|
| @@ 168-181 (lines=14) @@ | ||
| 165 | * |
|
| 166 | * @return array |
|
| 167 | */ |
|
| 168 | public function getLastTransaction() |
|
| 169 | { |
|
| 170 | try { |
|
| 171 | $response = $this->get('/SmartcallRestfulProxy/last_transaction_js'); |
|
| 172 | ||
| 173 | return [ |
|
| 174 | 'status' => 'ok', |
|
| 175 | 'http_code' => $response->getStatusCode(), |
|
| 176 | 'body' => (string) $response->getBody(), |
|
| 177 | ]; |
|
| 178 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 179 | return $this->parseError($e); |
|
| 180 | } |
|
| 181 | } |
|
| 182 | ||
| 183 | /** |
|
| 184 | * Fetches the Product List by the specified network identifier from SmartCall. |
|
| @@ 192-210 (lines=19) @@ | ||
| 189 | * |
|
| 190 | * @return array |
|
| 191 | */ |
|
| 192 | public function getProductsByNetwork($networkId) |
|
| 193 | { |
|
| 194 | try { |
|
| 195 | $response = $this->get( |
|
| 196 | sprintf( |
|
| 197 | '/SmartcallRestfulProxy/network_js/%d', |
|
| 198 | $networkId |
|
| 199 | ) |
|
| 200 | ); |
|
| 201 | ||
| 202 | return [ |
|
| 203 | 'status' => 'ok', |
|
| 204 | 'http_code' => $response->getStatusCode(), |
|
| 205 | 'body' => (string) $response->getBody(), |
|
| 206 | ]; |
|
| 207 | } catch (\GuzzleHttp\Exception\ServerException $e) { |
|
| 208 | return $this->parseError($e); |
|
| 209 | } |
|
| 210 | } |
|
| 211 | ||
| 212 | /** |
|
| 213 | * Purchase a voucher or do a pinless recharge on SmartCall. |
|