Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
33 | 3 | public function handle(array $args) : array |
|
34 | { |
||
35 | 3 | $response = $this->chargeByToken($args); |
|
36 | |||
37 | 3 | $this->verifyResponse($response); |
|
38 | |||
39 | 2 | $res = json_decode($response->getBody(), true); |
|
40 | |||
41 | 2 | if (strcmp($res['data']['gateway_response'], self::SUCCESS_MESSAGE) !== 0) { |
|
42 | 1 | throw new TransactionVerficationFailedException( |
|
43 | 1 | "The transaction was not successful" |
|
44 | ); |
||
45 | } |
||
46 | |||
47 | 1 | return $res['data']; |
|
48 | } |
||
49 | |||
58 |