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