diff --git a/src/ComfortPay/Message/ChargeRequest.php b/src/ComfortPay/Message/ChargeRequest.php index 030a7d3..dd6a4f0 100644 --- a/src/ComfortPay/Message/ChargeRequest.php +++ b/src/ComfortPay/Message/ChargeRequest.php @@ -3,6 +3,8 @@ namespace Omnipay\ComfortPay\Message; use Omnipay\ComfortPay\Gateway; +use SoapFault; +use stdClass; class ChargeRequest extends AbstractSoapRequest { @@ -163,7 +165,7 @@ public function sendData($data) ); } - $req = new \stdClass(); + $req = new stdClass(); $req->transactionId = $data['transactionId']; $req->referedCardId = $data['referedCardId']; $req->merchantId = $data['merchantId']; @@ -172,10 +174,10 @@ public function sendData($data) $req->parentTransactionId = $data['parentTransactionId']; $req->cc = $data['cc']; - $transactionIdentificator = new \stdClass(); + $transactionIdentificator = new stdClass(); if (!empty($data['vs']) && !empty($data['ss'])) { - $symbols = new \stdClass(); + $symbols = new stdClass(); $symbols->variableSymbol = $data['vs']; $symbols->specificSymbol = $data['ss']; $transactionIdentificator->symbols = $symbols; @@ -186,7 +188,7 @@ public function sendData($data) $req->transactionIdentificator = $transactionIdentificator; if (!empty($data['submerchantId']) && !empty($data['location']) && !empty($data['city']) && !empty($data['alpha2CountryCode'])) { - $ipspData = new \stdClass(); + $ipspData = new stdClass(); $ipspData->submerchantId = $data['submerchantId']; $ipspData->location = $data['location']; $ipspData->city = $data['city']; @@ -194,14 +196,14 @@ public function sendData($data) $req->ipspData = $ipspData; } - $request = new \stdClass(); + $request = new stdClass(); $request->req = $req; $request->transactionType = $data['transactionType']; $client = $this->getSoapClient(); try { $response = $client->doCardTransaction($request); - } catch (\SoapFault $sf) { + } catch (SoapFault $sf) { // special case for TB :-( // they started to return an error when they are not able to charge this card. We don't want to treat it as SoapFault Exception because it is a "regular" answer. SoapFault is for error on network, outage, etc... // here is an error example: @@ -213,6 +215,7 @@ public function sendData($data) 'transactionApproval' => false, ]); } + throw $sf; } diff --git a/tests/ComfortPay/SoapFaultTest.php b/tests/ComfortPay/SoapFaultTest.php index e936150..4212628 100644 --- a/tests/ComfortPay/SoapFaultTest.php +++ b/tests/ComfortPay/SoapFaultTest.php @@ -16,8 +16,8 @@ class SoapFaultTest extends TestCase */ public function testSoapFault($data, $expected): void { - if (version_compare(PHP_VERSION, '8.0.0', '<=')) { - $this->markTestSkipped('Skipped for php 8.0'); + if (version_compare(PHP_VERSION, '8.1.0', '<')) { + $this->markTestSkipped('Skipped for php less 8.1'); } $soapClientMock = $this->getMockFromWsdl(__DIR__ . '/../../src/ComfortPay/Teleplatba_1_0.wsdl');