diff --git a/Gateway/Http/Client/Card/CreateClient.php b/Gateway/Http/Client/Card/CreateClient.php index ac289a7..5e01dfc 100644 --- a/Gateway/Http/Client/Card/CreateClient.php +++ b/Gateway/Http/Client/Card/CreateClient.php @@ -61,6 +61,8 @@ public function placeRequest(TransferInterface $transferObject) { $request = $transferObject->getBody(); + $denied = 0; + $responseBody = $this->api->sendPostRequest( $transferObject, 'v2/payments', @@ -68,11 +70,16 @@ public function placeRequest(TransferInterface $transferObject) ); $status = isset($responseBody['payment_id']) ? 1 : 0; - $denied = ($responseBody['status'] !== 'DENIED') ? 1 : 0; + + if (isset($responseBody['status'])) { + if ($responseBody['status'] === 'DENIED') { + $denied = 1; + } + } $response = array_merge( [ - self::RESULT_CODE => (!$denied) ? $status : 0, + self::RESULT_CODE => ($denied) ? 0 : $status, self::EXT_ORD_ID => isset($responseBody['payment_id']) ? $responseBody['payment_id'] : null, ], $responseBody