diff --git a/src/ComfortPay/Message/ChargeRequest.php b/src/ComfortPay/Message/ChargeRequest.php index 8c15a4a..15b7389 100644 --- a/src/ComfortPay/Message/ChargeRequest.php +++ b/src/ComfortPay/Message/ChargeRequest.php @@ -207,17 +207,24 @@ public function sendData($data) // here is an error example: // SOAP-ENV:ReceiverdoCardTransactionImplFile135950051190 if ($sf->faultcode == 'SOAP-ENV:Receiver') { - return $this->response = new CardTransactionResponse($this, [ - 'transactionId' => false, - 'transactionStatus' => false, - 'transactionApproval' => false, - ]); + $lastResponse = $client->__getLastResponse(); + $xml = new \SimpleXMLElement($lastResponse); + $path = $xml->xpath('//errorCode'); + if ($path && isset($path[0])) { + $errorCode = (int)$path; + // More info about error codes: https://github.com/tomaj/omnipay-tatra/issues/12 + if ($errorCode !== 50000) { + return $this->response = new CardTransactionResponse($this, [ + 'transactionId' => false, + 'transactionStatus' => false, + 'transactionApproval' => false, + ]); + } + } } throw $sf; } - $response = $client->doCardTransaction($request); - return $this->response = new CardTransactionResponse($this, [ 'transactionId' => $response->res->transactionId, 'transactionStatus' => $response->res->transactionStatus,