| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public function sendData($data) |
||
| 18 | { |
||
| 19 | if ( empty($data['sessionId']) ) { |
||
| 20 | throw new InvalidRequestException('Session id is required'); |
||
| 21 | } |
||
| 22 | |||
| 23 | $sessionId = $data['sessionId']; |
||
| 24 | |||
| 25 | $headers = [ |
||
| 26 | 'Accept' => 'application/json', |
||
| 27 | 'Content-Type' => 'application/json', |
||
| 28 | 'Authorization' => 'Basic ' . $this->getAuthorization() |
||
| 29 | ]; |
||
| 30 | |||
| 31 | try { |
||
| 32 | $httpResponse = $this->httpClient->request('GET', $this->getEndpoint('sessions/' . $sessionId), $headers); |
||
| 33 | } catch (\Exception $exception) { |
||
| 34 | throw new InvalidRequestException($exception->getMessage()); |
||
| 35 | } |
||
| 36 | |||
| 37 | $transactionData = json_decode($httpResponse->getBody()->getContents(), true); |
||
| 38 | |||
| 39 | return $this->response = new CompletePurchaseResponse($this, $transactionData); |
||
| 40 | } |
||
| 41 | } |