Conditions | 4 |
Paths | 2 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
24 | 3 | public function sendData($data) |
|
25 | { |
||
26 | // if we have a valid API response and a result key, let's get more detail about the transaction |
||
27 | 3 | if (isset($data['ResponseCode']) && $data['ResponseCode'] == 0 && isset($data['ResultKey'])) { |
|
28 | // submit request with the returned result key |
||
29 | 2 | $httpResponse = $this->httpClient->request( |
|
30 | 2 | 'GET', |
|
31 | 2 | $this->getEndpoint()."/".$data['ResultKey'], |
|
32 | 2 | ['Authorization' => $this->getAuthHeader()] |
|
33 | ); |
||
34 | 2 | // get response data |
|
35 | $responseData = json_decode($httpResponse->getBody()->getContents(), true); |
||
36 | 2 | $data = array_merge($data, $responseData['TxnResp']); |
|
37 | 2 | } |
|
38 | return $this->response = new CompletePurchaseResponse($this, $data); |
||
39 | 3 | } |
|
40 | } |
||
41 |