Skip to content

Commit

Permalink
Updated the PHP version check in SoapFaultTest.php to skip tests for …
Browse files Browse the repository at this point in the history
…versions lower than 8.1
  • Loading branch information
otazniksk committed Dec 9, 2024
1 parent b77704e commit 3168b38
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions src/ComfortPay/Message/ChargeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Omnipay\ComfortPay\Message;

use Omnipay\ComfortPay\Gateway;
use SoapFault;
use stdClass;

class ChargeRequest extends AbstractSoapRequest
{
Expand Down Expand Up @@ -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'];
Expand All @@ -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;
Expand All @@ -186,22 +188,22 @@ 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'];
$ipspData->alpha2CountryCode = $data['alpha2CountryCode'];
$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:
Expand All @@ -213,6 +215,7 @@ public function sendData($data)
'transactionApproval' => false,
]);
}

throw $sf;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/ComfortPay/SoapFaultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 3168b38

Please sign in to comment.