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