| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function sendData($data) |
||
| 32 | { |
||
| 33 | if ( !$data['sessionId'] ) { |
||
| 34 | throw new InvalidRequestException('Session id is required'); |
||
| 35 | } |
||
| 36 | |||
| 37 | $sessionId = $data['sessionId']; |
||
| 38 | |||
| 39 | $headers = [ |
||
| 40 | 'Accept' => 'application/json', |
||
| 41 | 'Content-Type' => 'application/json', |
||
| 42 | 'Authorization' => 'Basic ' . $this->getAuthorization() |
||
| 43 | ]; |
||
| 44 | |||
| 45 | try { |
||
| 46 | $httpResponse = $this->httpClient->request('GET', $this->getEndpoint('sessions/' . $sessionId), $headers); |
||
| 47 | } catch (\Exception $exception) { |
||
| 48 | throw new InvalidRequestException($exception->getMessage()); |
||
| 49 | } |
||
| 50 | |||
| 51 | $transactionData = json_decode($httpResponse->getBody()->getContents(), true); |
||
| 52 | |||
| 53 | return $this->response = new CompletePurchaseResponse($this, $transactionData); |
||
| 54 | } |
||
| 56 |