From 93b34333394534d80df36222e86b0c7da138c375 Mon Sep 17 00:00:00 2001 From: mustapayev Date: Sun, 17 Nov 2024 10:53:35 +0100 Subject: [PATCH] run rector --- rector.php | 4 +--- .../EstPosRequestDataMapper.php | 4 +--- .../InterPosRequestDataMapper.php | 4 +--- .../PayFlexCPV4PosRequestDataMapper.php | 4 +--- .../PayFlexV4PosRequestDataMapper.php | 4 +--- .../PayForPosRequestDataMapper.php | 6 ++---- .../PosNetRequestDataMapper.php | 4 +--- .../AkbankPosResponseDataMapper.php | 2 +- src/Gateways/AbstractGateway.php | 5 +++-- .../PayForPosRequestDataMapperTest.php | 12 ------------ .../AkbankPosResponseDataMapperTest.php | 1 + .../EstPosResponseDataMapperTest.php | 1 + .../GarantiPosResponseDataMapperTest.php | 1 + .../InterPosResponseDataMapperTest.php | 1 + .../KuveytPosResponseDataMapperTest.php | 1 + .../PayFlexV4PosResponseDataMapperTest.php | 1 + .../PayForPosResponseDataMapperTest.php | 1 + .../PosNetResponseDataMapperTest.php | 1 + .../PosNetV1PosResponseDataMapperTest.php | 1 + .../VakifKatilimPosResponseDataMapperTest.php | 1 + tests/Unit/Gateways/AkbankPosTest.php | 4 ++-- tests/Unit/Gateways/EstPosTest.php | 4 ++-- tests/Unit/Gateways/GarantiPosTest.php | 4 ++-- tests/Unit/Gateways/InterPosTest.php | 4 ++-- tests/Unit/Gateways/KuveytPosTest.php | 8 ++++---- tests/Unit/Gateways/PayFlexCPV4PosTest.php | 4 ++-- tests/Unit/Gateways/PayFlexV4PosTest.php | 4 ++-- tests/Unit/Gateways/PayForTest.php | 4 ++-- tests/Unit/Gateways/PosNetTest.php | 16 ++++++++-------- tests/Unit/Gateways/PosNetV1PosTest.php | 4 ++-- tests/Unit/Gateways/ToslaPosTest.php | 4 ++-- tests/Unit/Gateways/VakifKatilimTest.php | 4 ++-- 32 files changed, 54 insertions(+), 69 deletions(-) diff --git a/rector.php b/rector.php index 2d0901f8..69367546 100644 --- a/rector.php +++ b/rector.php @@ -20,19 +20,17 @@ LevelSetList::UP_TO_PHP_74, ]) ->withSkip([ - \Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector::class, \Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector::class, \Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector::class, \Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector::class, - \Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector::class, \Rector\Naming\Rector\Class_\RenamePropertyToMatchTypeRector::class, + \Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector::class, \Rector\Naming\Rector\ClassMethod\RenameVariableToMatchNewTypeRector::class, \Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector::class, \Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchExprVariableRector::class, \Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector::class, - \Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector::class, \Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector::class, ]) ->withPreparedSets( diff --git a/src/DataMapper/RequestDataMapper/EstPosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/EstPosRequestDataMapper.php index 6266d1a1..f979a30a 100644 --- a/src/DataMapper/RequestDataMapper/EstPosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/EstPosRequestDataMapper.php @@ -272,9 +272,7 @@ public function create3DFormData(AbstractPosAccount $posAccount, array $order, s */ public function createCustomQueryRequestData(AbstractPosAccount $posAccount, array $requestData): array { - $requestData += $this->getRequestAccountData($posAccount); - - return $requestData; + return $requestData + $this->getRequestAccountData($posAccount); } /** diff --git a/src/DataMapper/RequestDataMapper/InterPosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/InterPosRequestDataMapper.php index cc48b640..0831e4d6 100644 --- a/src/DataMapper/RequestDataMapper/InterPosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/InterPosRequestDataMapper.php @@ -254,9 +254,7 @@ public function create3DFormData(AbstractPosAccount $posAccount, array $order, s */ public function createCustomQueryRequestData(AbstractPosAccount $posAccount, array $requestData): array { - $requestData += $this->getRequestAccountData($posAccount); - - return $requestData; + return $requestData + $this->getRequestAccountData($posAccount); } /** diff --git a/src/DataMapper/RequestDataMapper/PayFlexCPV4PosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/PayFlexCPV4PosRequestDataMapper.php index 81d9db6c..a3ea3214 100644 --- a/src/DataMapper/RequestDataMapper/PayFlexCPV4PosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/PayFlexCPV4PosRequestDataMapper.php @@ -250,9 +250,7 @@ public function createRefundRequestData(AbstractPosAccount $posAccount, array $o */ public function createCustomQueryRequestData(AbstractPosAccount $posAccount, array $requestData): array { - $requestData += $this->getRequestAccountData($posAccount); - - return $requestData; + return $requestData + $this->getRequestAccountData($posAccount); } /** diff --git a/src/DataMapper/RequestDataMapper/PayFlexV4PosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/PayFlexV4PosRequestDataMapper.php index b99139f8..b0892925 100644 --- a/src/DataMapper/RequestDataMapper/PayFlexV4PosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/PayFlexV4PosRequestDataMapper.php @@ -255,9 +255,7 @@ public function createRefundRequestData(AbstractPosAccount $posAccount, array $o */ public function createCustomQueryRequestData(AbstractPosAccount $posAccount, array $requestData): array { - $requestData += $this->getRequestAccountData($posAccount); - - return $requestData; + return $requestData + $this->getRequestAccountData($posAccount); } /** diff --git a/src/DataMapper/RequestDataMapper/PayForPosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/PayForPosRequestDataMapper.php index 159368a1..8c3dc506 100644 --- a/src/DataMapper/RequestDataMapper/PayForPosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/PayForPosRequestDataMapper.php @@ -214,11 +214,9 @@ public function createHistoryRequestData(AbstractPosAccount $posAccount, array $ */ public function createCustomQueryRequestData(AbstractPosAccount $posAccount, array $requestData): array { - $requestData += $this->getRequestAccountData($posAccount) + [ + return $requestData + ($this->getRequestAccountData($posAccount) + [ 'MbrId' => self::MBR_ID, - ]; - - return $requestData; + ]); } /** diff --git a/src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php b/src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php index 8235a72d..68d61099 100644 --- a/src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php @@ -354,12 +354,10 @@ public function create3DResolveMerchantRequestData(AbstractPosAccount $posAccoun */ public function createCustomQueryRequestData(AbstractPosAccount $posAccount, array $requestData): array { - $requestData += [ + return $requestData + [ 'mid' => $posAccount->getClientId(), 'tid' => $posAccount->getTerminalId(), ]; - - return $requestData; } /** diff --git a/src/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapper.php b/src/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapper.php index da1f8633..6d854f7b 100644 --- a/src/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapper.php +++ b/src/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapper.php @@ -295,7 +295,7 @@ public function mapOrderHistoryResponse(array $rawResponseData): array } if (!$isRecurringOrder) { - \usort($transactions, static function (array $tx1, array $tx2) { + \usort($transactions, static function (array $tx1, array $tx2): int { if (null !== $tx1['transaction_time'] && null === $tx2['transaction_time']) { return 1; } diff --git a/src/Gateways/AbstractGateway.php b/src/Gateways/AbstractGateway.php index 235df971..7a12f4e1 100644 --- a/src/Gateways/AbstractGateway.php +++ b/src/Gateways/AbstractGateway.php @@ -557,7 +557,7 @@ public function customQuery(array $requestData, string $apiUrl = null): PosInter } $data = $this->serializer->encode($updatedRequestData, $txType); - $apiUrl = $apiUrl ?? $this->getQueryAPIUrl($txType); + $apiUrl ??= $this->getQueryAPIUrl($txType); $this->response = $this->send( $data, $txType, @@ -664,7 +664,8 @@ protected function check3DFormInputs(string $paymentModel, string $txType, Credi throw new \LogicException('Bu banka altyapısı sağlanan ödeme modelini ya da işlem tipini desteklenmiyor.'); } - if ((PosInterface::MODEL_3D_SECURE === $paymentModel || PosInterface::MODEL_3D_PAY === $paymentModel) && null === $card) { + if ((PosInterface::MODEL_3D_SECURE === $paymentModel || PosInterface::MODEL_3D_PAY === $paymentModel) + && !$card instanceof \Mews\Pos\Entity\Card\CreditCardInterface) { throw new \InvalidArgumentException('Bu ödeme modeli için kart bilgileri zorunlu!'); } } diff --git a/tests/Unit/DataMapper/RequestDataMapper/PayForPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/PayForPosRequestDataMapperTest.php index 79b4dc8c..04608632 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/PayForPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/PayForPosRequestDataMapperTest.php @@ -34,8 +34,6 @@ class PayForPosRequestDataMapperTest extends TestCase /** @var CryptInterface & MockObject */ private CryptInterface $crypt; - private array $order; - /** @var EventDispatcherInterface & MockObject */ private EventDispatcherInterface $dispatcher; @@ -52,16 +50,6 @@ protected function setUp(): void '12345678' ); - $this->order = [ - 'id' => '2020110828BC', - 'amount' => 100.01, - 'installment' => '0', - 'currency' => PosInterface::CURRENCY_TRY, - 'success_url' => 'http://localhost/finansbank-payfor/3d/response.php', - 'fail_url' => 'http://localhost/finansbank-payfor/3d/response.php', - 'lang' => PosInterface::LANG_TR, - ]; - $this->crypt = $this->createMock(CryptInterface::class); $this->dispatcher = $this->createMock(EventDispatcherInterface::class); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapperTest.php index 6be65b97..0006ce91 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/AkbankPosResponseDataMapperTest.php @@ -114,6 +114,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + $this->assertArrayHasKey('3d_all', $actualData); $this->assertIsArray($actualData['3d_all']); $this->assertNotEmpty($actualData['3d_all']); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/EstPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/EstPosResponseDataMapperTest.php index 31be4aa0..c2816c37 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/EstPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/EstPosResponseDataMapperTest.php @@ -112,6 +112,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + $this->assertArrayHasKey('3d_all', $actualData); $this->assertIsArray($actualData['3d_all']); $this->assertNotEmpty($actualData['3d_all']); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/GarantiPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/GarantiPosResponseDataMapperTest.php index 62ac34c8..70adb841 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/GarantiPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/GarantiPosResponseDataMapperTest.php @@ -112,6 +112,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + $this->assertArrayHasKey('3d_all', $actualData); $this->assertIsArray($actualData['3d_all']); $this->assertNotEmpty($actualData['3d_all']); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php index 89086df2..5b138c37 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/InterPosResponseDataMapperTest.php @@ -88,6 +88,7 @@ public function testMapPaymentResponse(array $order, string $txType, array $resp $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + unset($actualData['all']); \ksort($expectedData); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/KuveytPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/KuveytPosResponseDataMapperTest.php index a2da84c5..0aeadac6 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/KuveytPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/KuveytPosResponseDataMapperTest.php @@ -189,6 +189,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + $this->assertArrayHasKey('3d_all', $actualData); $this->assertIsArray($actualData['3d_all']); $this->assertNotEmpty($actualData['3d_all']); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapperTest.php index 942c2827..9346f5f0 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/PayFlexV4PosResponseDataMapperTest.php @@ -89,6 +89,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + $this->assertArrayHasKey('3d_all', $actualData); $this->assertIsArray($actualData['3d_all']); $this->assertNotEmpty($actualData['3d_all']); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/PayForPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/PayForPosResponseDataMapperTest.php index 4a1bbd0e..5111bf8e 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/PayForPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/PayForPosResponseDataMapperTest.php @@ -115,6 +115,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + $this->assertArrayHasKey('3d_all', $actualData); $this->assertIsArray($actualData['3d_all']); $this->assertNotEmpty($actualData['3d_all']); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php index fa88632f..a7ee4da6 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/PosNetResponseDataMapperTest.php @@ -117,6 +117,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + $this->assertArrayHasKey('3d_all', $actualData); $this->assertIsArray($actualData['3d_all']); $this->assertNotEmpty($actualData['3d_all']); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/PosNetV1PosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/PosNetV1PosResponseDataMapperTest.php index 2757dd86..e21b525b 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/PosNetV1PosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/PosNetV1PosResponseDataMapperTest.php @@ -121,6 +121,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + $this->assertArrayHasKey('3d_all', $actualData); $this->assertIsArray($actualData['3d_all']); $this->assertNotEmpty($actualData['3d_all']); diff --git a/tests/Unit/DataMapper/ResponseDataMapper/VakifKatilimPosResponseDataMapperTest.php b/tests/Unit/DataMapper/ResponseDataMapper/VakifKatilimPosResponseDataMapperTest.php index c14cf171..51642e37 100644 --- a/tests/Unit/DataMapper/ResponseDataMapper/VakifKatilimPosResponseDataMapperTest.php +++ b/tests/Unit/DataMapper/ResponseDataMapper/VakifKatilimPosResponseDataMapperTest.php @@ -128,6 +128,7 @@ public function testMap3DPaymentData(array $order, string $txType, array $threeD $this->assertIsArray($actualData['all']); $this->assertNotEmpty($actualData['all']); } + $this->assertArrayHasKey('3d_all', $actualData); $this->assertIsArray($actualData['3d_all']); $this->assertNotEmpty($actualData['3d_all']); diff --git a/tests/Unit/Gateways/AkbankPosTest.php b/tests/Unit/Gateways/AkbankPosTest.php index c7ec7853..2e46baa0 100644 --- a/tests/Unit/Gateways/AkbankPosTest.php +++ b/tests/Unit/Gateways/AkbankPosTest.php @@ -1032,7 +1032,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -1042,7 +1042,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/EstPosTest.php b/tests/Unit/Gateways/EstPosTest.php index e98c119a..c8a68826 100644 --- a/tests/Unit/Gateways/EstPosTest.php +++ b/tests/Unit/Gateways/EstPosTest.php @@ -879,7 +879,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -889,7 +889,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/GarantiPosTest.php b/tests/Unit/Gateways/GarantiPosTest.php index 8e926071..9a7fbb67 100644 --- a/tests/Unit/Gateways/GarantiPosTest.php +++ b/tests/Unit/Gateways/GarantiPosTest.php @@ -801,7 +801,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -811,7 +811,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/InterPosTest.php b/tests/Unit/Gateways/InterPosTest.php index 022ac664..161aa826 100644 --- a/tests/Unit/Gateways/InterPosTest.php +++ b/tests/Unit/Gateways/InterPosTest.php @@ -742,7 +742,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -752,7 +752,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/KuveytPosTest.php b/tests/Unit/Gateways/KuveytPosTest.php index 4f44dd84..81650cfb 100644 --- a/tests/Unit/Gateways/KuveytPosTest.php +++ b/tests/Unit/Gateways/KuveytPosTest.php @@ -307,7 +307,7 @@ public function testMake3DPayment( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($create3DPaymentRequestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($create3DPaymentRequestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -317,7 +317,7 @@ public function testMake3DPayment( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function() use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function() use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); @@ -664,7 +664,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -674,7 +674,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/PayFlexCPV4PosTest.php b/tests/Unit/Gateways/PayFlexCPV4PosTest.php index 06d17d19..f0ff9504 100644 --- a/tests/Unit/Gateways/PayFlexCPV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexCPV4PosTest.php @@ -699,7 +699,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -709,7 +709,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/PayFlexV4PosTest.php b/tests/Unit/Gateways/PayFlexV4PosTest.php index 31c0a01c..a6e7e9a2 100644 --- a/tests/Unit/Gateways/PayFlexV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexV4PosTest.php @@ -762,7 +762,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -772,7 +772,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function() use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function() use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/PayForTest.php b/tests/Unit/Gateways/PayForTest.php index 16ec3967..8d87ac8d 100644 --- a/tests/Unit/Gateways/PayForTest.php +++ b/tests/Unit/Gateways/PayForTest.php @@ -850,7 +850,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -859,7 +859,7 @@ private function configureClientResponse( && $order === $dispatchedEvent->getOrder() && $paymentModel === $dispatchedEvent->getPaymentModel(); }))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/PosNetTest.php b/tests/Unit/Gateways/PosNetTest.php index 5e6592de..7b651558 100644 --- a/tests/Unit/Gateways/PosNetTest.php +++ b/tests/Unit/Gateways/PosNetTest.php @@ -258,7 +258,7 @@ public function testMake3DPayment( $this->serializerMock->expects($matcher) ->method('encode') - ->with($this->callback(function ($requestData) use ($matcher, &$updatedRequestDataPreparedEvent1, &$updatedRequestDataPreparedEvent2) { + ->with($this->callback(function ($requestData) use ($matcher, &$updatedRequestDataPreparedEvent1, &$updatedRequestDataPreparedEvent2): bool { if ($matcher->getInvocationCount() === 1) { return $updatedRequestDataPreparedEvent1->getRequestData() === $requestData; } @@ -268,13 +268,12 @@ public function testMake3DPayment( } return true; - }), $this->callback(function ($txT) use ($txType) { - return $txT === $txType; - })) - ->willReturnCallback(function () use ($matcher) { + }), $this->callback(fn($txT): bool => $txT === $txType)) + ->willReturnCallback(function () use ($matcher): ?string { if ($matcher->getInvocationCount() === 1) { return 'resolveMerchantRequestData-body'; } + if ($matcher->getInvocationCount() === 2) { return 'payment-request-body'; } @@ -339,7 +338,7 @@ public function testMake3DPayment( $matcher2, &$updatedRequestDataPreparedEvent1, &$updatedRequestDataPreparedEvent2 - ) { + ): bool { if ($matcher2->getInvocationCount() === 1) { $updatedRequestDataPreparedEvent1 = $dispatchedEvent; @@ -370,6 +369,7 @@ public function testMake3DPayment( return $updatedRequestDataPreparedEvent1; } + if ($matcher2->getInvocationCount() === 2) { $updatedRequestData = $updatedRequestDataPreparedEvent2->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; @@ -872,7 +872,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -882,7 +882,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/PosNetV1PosTest.php b/tests/Unit/Gateways/PosNetV1PosTest.php index 82d21d44..4c0ad76e 100644 --- a/tests/Unit/Gateways/PosNetV1PosTest.php +++ b/tests/Unit/Gateways/PosNetV1PosTest.php @@ -770,7 +770,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -780,7 +780,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function() use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function() use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/ToslaPosTest.php b/tests/Unit/Gateways/ToslaPosTest.php index d0050483..fc64d546 100644 --- a/tests/Unit/Gateways/ToslaPosTest.php +++ b/tests/Unit/Gateways/ToslaPosTest.php @@ -1135,7 +1135,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -1145,7 +1145,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData); diff --git a/tests/Unit/Gateways/VakifKatilimTest.php b/tests/Unit/Gateways/VakifKatilimTest.php index 2d3c8812..ff0ea997 100644 --- a/tests/Unit/Gateways/VakifKatilimTest.php +++ b/tests/Unit/Gateways/VakifKatilimTest.php @@ -978,7 +978,7 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent) { + $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { $updatedRequestDataPreparedEvent = $dispatchedEvent; return get_class($this->pos) === $dispatchedEvent->getGatewayClass() @@ -988,7 +988,7 @@ private function configureClientResponse( && $paymentModel === $dispatchedEvent->getPaymentModel(); } ))) - ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent) { + ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; $updatedRequestDataPreparedEvent->setRequestData($updatedRequestData);