diff --git a/config/pos_production.php b/config/pos_production.php index 5a428e4a..92668d04 100644 --- a/config/pos_production.php +++ b/config/pos_production.php @@ -1,4 +1,5 @@ $extraData['CommonPaymentUrl'], 'method' => 'GET', diff --git a/src/DataMapper/RequestDataMapper/PayFlexV4PosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/PayFlexV4PosRequestDataMapper.php index b0892925..a5db9664 100644 --- a/src/DataMapper/RequestDataMapper/PayFlexV4PosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/PayFlexV4PosRequestDataMapper.php @@ -1,4 +1,5 @@ $padLength) { throw new InvalidArgumentException(\sprintf( - // Banka tarafindan belirlenen kisitlama + // Banka tarafindan belirlenen kisitlama "Saglanan siparis ID'nin (%s) uzunlugu %d karakter. Siparis ID %d karakterden uzun olamaz!", $orderId, \strlen($orderId), diff --git a/src/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapper.php index 38e05907..30f3d712 100644 --- a/src/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapper.php @@ -1,4 +1,5 @@ $padLength) { throw new InvalidArgumentException(\sprintf( - // Banka tarafindan belirlenen kisitlama + // Banka tarafindan belirlenen kisitlama "Saglanan siparis ID'nin (%s) uzunlugu %d karakter. Siparis ID %d karakterden uzun olamaz!", $orderId, \strlen($orderId), diff --git a/src/DataMapper/RequestDataMapper/RequestDataMapperInterface.php b/src/DataMapper/RequestDataMapper/RequestDataMapperInterface.php index b0573d39..a6228ac3 100644 --- a/src/DataMapper/RequestDataMapper/RequestDataMapperInterface.php +++ b/src/DataMapper/RequestDataMapper/RequestDataMapperInterface.php @@ -1,4 +1,5 @@ formatAmount($rawTx['amount']); $transaction['capture'] = $transaction['first_amount'] === $transaction['capture_amount']; diff --git a/src/DataMapper/ResponseDataMapper/EstPosResponseDataMapper.php b/src/DataMapper/ResponseDataMapper/EstPosResponseDataMapper.php index abe05bee..9f9f154a 100644 --- a/src/DataMapper/ResponseDataMapper/EstPosResponseDataMapper.php +++ b/src/DataMapper/ResponseDataMapper/EstPosResponseDataMapper.php @@ -1,4 +1,5 @@ terminalId = $terminalId; $this->merchantType = $merchantType; diff --git a/src/Entity/Account/PayForAccount.php b/src/Entity/Account/PayForAccount.php index 8792b344..f97ddcdd 100644 --- a/src/Entity/Account/PayForAccount.php +++ b/src/Entity/Account/PayForAccount.php @@ -1,4 +1,5 @@ requestDataMapper = $requestDataMapper; $this->responseDataMapper = $responseDataMapper; $this->serializer = $serializer; diff --git a/src/Gateways/AkbankPos.php b/src/Gateways/AkbankPos.php index aeb2d0f8..e3e1ff4f 100644 --- a/src/Gateways/AkbankPos.php +++ b/src/Gateways/AkbankPos.php @@ -1,4 +1,5 @@ assertSame(PosInterface::TX_TYPE_PAY_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(9, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -106,7 +108,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->cancel($statusOrder); @@ -133,7 +136,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_ORDER_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->orderHistory($historyOrder); @@ -155,7 +159,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(3, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->history($historyOrder); @@ -181,7 +186,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_PRE_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(9, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -214,7 +220,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_POST_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(8, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -245,7 +252,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_REFUND, $requestDataPreparedEvent->getTxType()); $this->assertCount(7, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->refund($refundOrder); @@ -274,7 +282,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(10, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->recurringPos->payment( PosInterface::MODEL_NON_SECURE, @@ -311,7 +320,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); $this->assertCount(7, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->recurringPos->cancel($statusOrder); @@ -342,7 +352,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); $this->assertCount(7, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->recurringPos->cancel($statusOrder); @@ -373,7 +384,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->recurringPos->cancel($statusOrder); @@ -400,7 +412,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_ORDER_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->recurringPos->orderHistory($historyOrder); @@ -425,7 +438,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(3, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->recurringPos->history($historyOrder); @@ -463,7 +477,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CUSTOM_QUERY, $requestDataPreparedEvent->getTxType()); $this->assertCount(8, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->customQuery($customQuery); diff --git a/tests/Functional/EstV3PosTest.php b/tests/Functional/EstV3PosTest.php index 623d87b2..31cb518a 100644 --- a/tests/Functional/EstV3PosTest.php +++ b/tests/Functional/EstV3PosTest.php @@ -1,4 +1,5 @@ assertSame(PosInterface::TX_TYPE_PAY_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(13, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -104,7 +106,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_STATUS, $requestDataPreparedEvent->getTxType()); $this->assertCount(5, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->status($statusOrder); @@ -132,7 +135,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); $this->assertCount(5, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->cancel($cancelOrder); @@ -161,7 +165,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_PRE_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(13, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -199,7 +204,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_POST_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(7, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -232,7 +238,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_REFUND_PARTIAL, $requestDataPreparedEvent->getTxType()); $this->assertCount(7, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->refund($refundOrder); @@ -260,7 +267,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_ORDER_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(5, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->orderHistory($historyOrder); @@ -285,7 +293,8 @@ function (Before3DFormHashCalculatedEvent $before3DFormHashCalculatedEvent) use $formInputs = $before3DFormHashCalculatedEvent->getFormInputs(); $formInputs['test_input'] = 'test_value'; $before3DFormHashCalculatedEvent->setFormInputs($formInputs); - }); + } + ); $formData = $this->pos->get3DFormData( $order, @@ -316,7 +325,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CUSTOM_QUERY, $requestDataPreparedEvent->getTxType()); $this->assertCount(7, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->customQuery($customQuery); diff --git a/tests/Functional/GarantiPosTest.php b/tests/Functional/GarantiPosTest.php index 2659b5df..35e64b99 100644 --- a/tests/Functional/GarantiPosTest.php +++ b/tests/Functional/GarantiPosTest.php @@ -1,4 +1,5 @@ assertSame(PosInterface::TX_TYPE_PAY_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(7, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -107,7 +109,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_STATUS, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->status($statusOrder); @@ -135,7 +138,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->cancel($statusOrder); @@ -162,7 +166,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_PRE_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(7, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -195,7 +200,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_POST_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -224,7 +230,8 @@ function (Before3DFormHashCalculatedEvent $before3DFormHashCalculatedEvent) use $formInputs = $before3DFormHashCalculatedEvent->getFormInputs(); $formInputs['test_input'] = 'test_value'; $before3DFormHashCalculatedEvent->setFormInputs($formInputs); - }); + } + ); $formData = $this->pos->get3DFormData( $order, @@ -251,7 +258,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_ORDER_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->orderHistory($historyOrder); @@ -275,7 +283,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->history($historyOrder); @@ -315,7 +324,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CUSTOM_QUERY, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->customQuery($customQuery); diff --git a/tests/Functional/KuveytPosTest.php b/tests/Functional/KuveytPosTest.php index d7e3e89a..b0717e7f 100644 --- a/tests/Functional/KuveytPosTest.php +++ b/tests/Functional/KuveytPosTest.php @@ -1,4 +1,5 @@ setRequestData($requestData); $this->assertSame(PosInterface::TX_TYPE_PAY_AUTH, $requestDataPreparedEvent->getTxType()); - }); + } + ); $formData = $this->pos->get3DFormData( $order, @@ -150,7 +152,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(17, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -184,7 +187,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); $this->assertCount(14, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->cancel($statusOrder); @@ -211,7 +215,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_STATUS, $requestDataPreparedEvent->getTxType()); $this->assertCount(15, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->status($statusOrder); @@ -240,36 +245,36 @@ public function testNonSecurePaymentSuccessForRefundTest(): array return $this->pos->getResponse(); } -// /** -// * @depends testNonSecurePaymentSuccessForRefundTest -// */ -// public function testFullRefundFail(array $lastResponse): array -// { -// $refundOrder = $this->createRefundOrder(\get_class($this->pos), $lastResponse); -// -// $eventIsThrown = false; -// $this->eventDispatcher->addListener( -// RequestDataPreparedEvent::class, -// function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThrown): void { -// $eventIsThrown = true; -// $this->assertSame(PosInterface::TX_TYPE_REFUND, $requestDataPreparedEvent->getTxType()); -// $this->assertCount(14, $requestDataPreparedEvent->getRequestData()); -// }); -// -// $this->pos->refund($refundOrder); -// -// $this->assertFalse($this->pos->isSuccess()); -// $response = $this->pos->getResponse(); -// $this->assertIsArray($response); -// $this->assertNotEmpty($response); -// $this->assertTrue($eventIsThrown); -// $this->assertSame( -// 'İade işlemi, satışla aynı gün içerisinde yapılamaz. İptal işlemi yapabilirsiniz.', -// $response['error_message'] -// ); -// -// return $lastResponse; -// } + // /** + // * @depends testNonSecurePaymentSuccessForRefundTest + // */ + // public function testFullRefundFail(array $lastResponse): array + // { + // $refundOrder = $this->createRefundOrder(\get_class($this->pos), $lastResponse); + // + // $eventIsThrown = false; + // $this->eventDispatcher->addListener( + // RequestDataPreparedEvent::class, + // function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThrown): void { + // $eventIsThrown = true; + // $this->assertSame(PosInterface::TX_TYPE_REFUND, $requestDataPreparedEvent->getTxType()); + // $this->assertCount(14, $requestDataPreparedEvent->getRequestData()); + // }); + // + // $this->pos->refund($refundOrder); + // + // $this->assertFalse($this->pos->isSuccess()); + // $response = $this->pos->getResponse(); + // $this->assertIsArray($response); + // $this->assertNotEmpty($response); + // $this->assertTrue($eventIsThrown); + // $this->assertSame( + // 'İade işlemi, satışla aynı gün içerisinde yapılamaz. İptal işlemi yapabilirsiniz.', + // $response['error_message'] + // ); + // + // return $lastResponse; + // } /** * @depends testNonSecurePaymentSuccessForRefundTest @@ -289,7 +294,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_REFUND_PARTIAL, $requestDataPreparedEvent->getTxType()); $this->assertCount(14, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->refund($refundOrder); $response = $this->pos->getResponse(); @@ -320,7 +326,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CUSTOM_QUERY, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->customQuery($customQuery); diff --git a/tests/Functional/PayForPosTest.php b/tests/Functional/PayForPosTest.php index c8d37de9..0745fa92 100644 --- a/tests/Functional/PayForPosTest.php +++ b/tests/Functional/PayForPosTest.php @@ -1,4 +1,5 @@ assertSame(PosInterface::TX_TYPE_PAY_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(16, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -103,7 +105,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_STATUS, $requestDataPreparedEvent->getTxType()); $this->assertCount(8, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->status($statusOrder); @@ -131,7 +134,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); $this->assertCount(9, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->cancel($statusOrder); @@ -159,7 +163,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_ORDER_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(8, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->orderHistory($historyOrder); @@ -180,7 +185,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(8, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->history($historyOrder); @@ -206,7 +212,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_PRE_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(16, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -239,7 +246,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_PAY_POST_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(10, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -270,7 +278,8 @@ function (Before3DFormHashCalculatedEvent $before3DFormHashCalculatedEvent) use $formInputs = $before3DFormHashCalculatedEvent->getFormInputs(); $formInputs['test_input'] = 'test_value'; $before3DFormHashCalculatedEvent->setFormInputs($formInputs); - }); + } + ); $formData = $this->pos->get3DFormData( $order, @@ -297,7 +306,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_REFUND, $requestDataPreparedEvent->getTxType()); $this->assertCount(10, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->refund($refundOrder); @@ -328,7 +338,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CUSTOM_QUERY, $requestDataPreparedEvent->getTxType()); $this->assertCount(9, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->customQuery($customQuery); diff --git a/tests/Functional/PaymentTestTrait.php b/tests/Functional/PaymentTestTrait.php index 9119da54..f40bfdd1 100644 --- a/tests/Functional/PaymentTestTrait.php +++ b/tests/Functional/PaymentTestTrait.php @@ -1,4 +1,5 @@ pos instanceof \Mews\Pos\Gateways\AkbankPos) { // AkbankPos'ta recurring odemede orderTrackId/orderId en az 36 karakter olmasi gerekiyor $orderId = date('Ymd').strtoupper(substr(uniqid(sha1(time())), 0, 28)); @@ -286,10 +286,10 @@ private function createHistoryOrder(string $gatewayClass, array $extraData, stri 'start_date' => $txTime->modify('-23 hour'), 'end_date' => $txTime, ]; -// ya da batch number ile (batch number odeme isleminden alinan response'da bulunur): -// $order = [ -// 'batch_num' => 24, -// ]; + // ya da batch number ile (batch number odeme isleminden alinan response'da bulunur): + // $order = [ + // 'batch_num' => 24, + // ]; } return []; diff --git a/tests/Functional/ToslaPosTest.php b/tests/Functional/ToslaPosTest.php index 97de83d1..7916b186 100644 --- a/tests/Functional/ToslaPosTest.php +++ b/tests/Functional/ToslaPosTest.php @@ -1,4 +1,5 @@ assertSame(PosInterface::TX_TYPE_PAY_AUTH, $requestDataPreparedEvent->getTxType()); $this->assertCount(13, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->payment( PosInterface::MODEL_NON_SECURE, @@ -100,7 +102,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_STATUS, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->status($statusOrder); @@ -128,7 +131,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->cancel($statusOrder); @@ -155,7 +159,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_ORDER_HISTORY, $requestDataPreparedEvent->getTxType()); $this->assertCount(9, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->orderHistory($historyOrder); @@ -177,7 +182,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertCount(10, $requestDataPreparedEvent->getRequestData()); $this->assertSame(PosInterface::TX_TYPE_PAY_AUTH, $requestDataPreparedEvent->getTxType()); - }); + } + ); $formData = $this->pos->get3DFormData( $order, PosInterface::MODEL_3D_PAY, @@ -213,7 +219,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_REFUND_PARTIAL, $requestDataPreparedEvent->getTxType()); $this->assertCount(7, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->refund($refundOrder); @@ -239,7 +246,8 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CUSTOM_QUERY, $requestDataPreparedEvent->getTxType()); $this->assertCount(6, $requestDataPreparedEvent->getRequestData()); - }); + } + ); $this->pos->customQuery($customQuery, 'https://prepentegrasyon.tosla.com/api/Payment/GetCommissionAndInstallmentInfo'); diff --git a/tests/Unit/Crypt/AkbankPosCryptTest.php b/tests/Unit/Crypt/AkbankPosCryptTest.php index 4aad5b7c..d8ed98f8 100644 --- a/tests/Unit/Crypt/AkbankPosCryptTest.php +++ b/tests/Unit/Crypt/AkbankPosCryptTest.php @@ -1,4 +1,5 @@ dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + ->with($this->callback(static fn ($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent && AkbankPos::class === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $paymentModel === $dispatchedEvent->getPaymentModel() @@ -209,7 +210,7 @@ public function testGet3DFormDataSubMerchant(): void $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + ->with($this->callback(static fn ($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent && AkbankPos::class === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $paymentModel === $dispatchedEvent->getPaymentModel() diff --git a/tests/Unit/DataMapper/RequestDataMapper/EstPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/EstPosRequestDataMapperTest.php index c7c4563a..33c66d3f 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/EstPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/EstPosRequestDataMapperTest.php @@ -1,4 +1,5 @@ crypt->expects(self::once()) ->method('create3DHash') ->willReturn($expected['inputs']['hash']); @@ -207,7 +207,7 @@ public function testGet3DFormData( $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + ->with($this->callback(static fn ($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent && EstPos::class === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $paymentModel === $dispatchedEvent->getPaymentModel() diff --git a/tests/Unit/DataMapper/RequestDataMapper/EstV3PosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/EstV3PosRequestDataMapperTest.php index 7aa128e2..af2903bc 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/EstV3PosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/EstV3PosRequestDataMapperTest.php @@ -1,4 +1,5 @@ crypt->expects(self::once()) ->method('create3DHash') ->willReturn($expected['inputs']['hash']); @@ -77,7 +77,7 @@ public function testGet3DFormData( $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + ->with($this->callback(static fn ($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent && EstV3Pos::class === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $paymentModel === $dispatchedEvent->getPaymentModel() diff --git a/tests/Unit/DataMapper/RequestDataMapper/GarantiPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/GarantiPosRequestDataMapperTest.php index 3f1161de..8282dc6d 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/GarantiPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/GarantiPosRequestDataMapperTest.php @@ -1,4 +1,5 @@ dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + ->with($this->callback(static fn ($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent && GarantiPos::class === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $paymentModel === $dispatchedEvent->getPaymentModel() diff --git a/tests/Unit/DataMapper/RequestDataMapper/InterPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/InterPosRequestDataMapperTest.php index 368728e0..ec1dc359 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/InterPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/InterPosRequestDataMapperTest.php @@ -1,4 +1,5 @@ card : null; $this->crypt->expects(self::once()) @@ -186,7 +186,7 @@ public function testGet3DFormData( $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + ->with($this->callback(static fn ($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent && InterPos::class === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $paymentModel === $dispatchedEvent->getPaymentModel() diff --git a/tests/Unit/DataMapper/RequestDataMapper/KuveytPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/KuveytPosRequestDataMapperTest.php index 44b996b3..e4fd2d2d 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/KuveytPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/KuveytPosRequestDataMapperTest.php @@ -1,4 +1,5 @@ card : null; $this->crypt->expects(self::once()) @@ -201,7 +200,7 @@ public function testGet3DFormData( $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + ->with($this->callback(static fn ($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent && PayForPos::class === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $paymentModel === $dispatchedEvent->getPaymentModel() diff --git a/tests/Unit/DataMapper/RequestDataMapper/PosNetRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/PosNetRequestDataMapperTest.php index 018096d9..50f9871d 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/PosNetRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/PosNetRequestDataMapperTest.php @@ -1,4 +1,5 @@ crypt->expects(self::once()) ->method('createHash') - ->with($this->account, $requestDataWithoutMac, $mappedOrder) + ->with($this->account, $requestDataWithoutMac, $mappedOrder) ->willReturn($expectedData['oosResolveMerchantData']['mac']); $actualData = $this->requestDataMapper->create3DResolveMerchantRequestData($this->account, $order, $responseData); diff --git a/tests/Unit/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapperTest.php index 0b270e52..95fcf4f1 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapperTest.php @@ -1,4 +1,5 @@ dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + ->with($this->callback(static fn ($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent && PosNetV1Pos::class === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $paymentModel === $dispatchedEvent->getPaymentModel() @@ -335,7 +336,7 @@ public static function createCustomQueryRequestDataDataProvider(): \Generator 'CipheredData' => null, 'DealerData' => null, 'IsEncrypted' => 'N', - 'PaymentFacilitatorData'=> null, + 'PaymentFacilitatorData' => null, 'AdditionalInfoData' => null, 'CardInformationData' => [ 'CardHolderName' => 'deneme deneme', diff --git a/tests/Unit/DataMapper/RequestDataMapper/ToslaPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/ToslaPosRequestDataMapperTest.php index 09598373..f7838c24 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/ToslaPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/ToslaPosRequestDataMapperTest.php @@ -1,4 +1,5 @@ cryptMock->expects(self::once()) ->method('check3DHash') ->with($this->pos->getAccount(), $request->request->all()) @@ -221,8 +221,7 @@ public function testMake3DHostPayment( Request $request, array $expectedResponse, bool $isSuccess - ): void - { + ): void { $this->cryptMock->expects(self::once()) ->method('check3DHash') ->with($this->account, $request->request->all()) @@ -273,8 +272,7 @@ public function testMake3DPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($is3DSuccess) { $this->cryptMock->expects(self::once()) ->method('check3DHash') @@ -375,8 +373,7 @@ public function testGet3DFormData( bool $isWithCard, array $formData, string $gatewayUrl - ): void - { + ): void { $card = $isWithCard ? $this->card : null; $this->requestMapperMock->expects(self::once()) @@ -406,8 +403,7 @@ public function testGet3DFormDataWithBadInputs( bool $isWithCard, bool $createWithoutCard, string $expectedExceptionClass - ): void - { + ): void { $card = $isWithCard ? $this->card : null; $this->expectException($expectedExceptionClass); @@ -460,8 +456,7 @@ public function testOrderHistory( array $decodedResponse, array $mappedResponse, bool $isSuccess - ): void - { + ): void { $account = $this->pos->getAccount(); $txType = PosInterface::TX_TYPE_ORDER_HISTORY; @@ -999,8 +994,7 @@ private function configureClientResponse( array $order, string $paymentModel, ?int $statusCode = null - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->cryptMock->expects(self::once()) @@ -1036,16 +1030,18 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/Gateways/EstPosTest.php b/tests/Unit/Gateways/EstPosTest.php index 7f90e978..566ad463 100644 --- a/tests/Unit/Gateways/EstPosTest.php +++ b/tests/Unit/Gateways/EstPosTest.php @@ -1,4 +1,5 @@ card : null; $this->expectException($expectedExceptionClass); @@ -456,8 +456,7 @@ public function testMake3DPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($is3DSuccess) { $this->cryptMock->expects(self::once()) ->method('check3DHash') @@ -855,8 +854,7 @@ private function configureClientResponse( array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->serializerMock->expects(self::once()) @@ -882,16 +880,18 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/Gateways/GarantiPosTest.php b/tests/Unit/Gateways/GarantiPosTest.php index e3883b63..7c29f307 100644 --- a/tests/Unit/Gateways/GarantiPosTest.php +++ b/tests/Unit/Gateways/GarantiPosTest.php @@ -1,4 +1,5 @@ card : null; $paymentModel = $isWithCard ? PosInterface::MODEL_3D_SECURE : PosInterface::MODEL_3D_HOST; $order = ['id' => '124']; @@ -178,8 +178,7 @@ public function testGet3DFormDataWithBadInputs( bool $isWithCard, bool $createWithoutCard, string $expectedExceptionClass - ): void - { + ): void { $card = $isWithCard ? $this->card : null; $this->expectException($expectedExceptionClass); @@ -198,8 +197,7 @@ public function testMake3DPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($is3DSuccess) { $this->cryptMock->expects(self::once()) ->method('check3DHash') @@ -779,8 +777,7 @@ private function configureClientResponse( array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->serializerMock->expects(self::once()) @@ -806,16 +803,18 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/Gateways/InterPosTest.php b/tests/Unit/Gateways/InterPosTest.php index c4440494..0929c463 100644 --- a/tests/Unit/Gateways/InterPosTest.php +++ b/tests/Unit/Gateways/InterPosTest.php @@ -1,4 +1,5 @@ card : null; $paymentModel = $isWithCard ? PosInterface::MODEL_3D_SECURE : PosInterface::MODEL_3D_HOST; $gatewayUrl = $isWithCard ? 'https://test.inter-vpos.com.tr/mpi/Default.aspx' : 'https://test.inter-vpos.com.tr/mpi/3DHost.aspx'; @@ -188,8 +188,7 @@ public function testGet3DFormDataWithBadInputs( bool $isWithCard, bool $createWithoutCard, string $expectedExceptionClass - ): void - { + ): void { $card = $isWithCard ? $this->card : null; $this->expectException($expectedExceptionClass); @@ -209,8 +208,7 @@ public function testMake3DPayment( bool $checkHash, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($checkHash) { $this->cryptMock->expects(self::once()) ->method('check3DHash') @@ -722,8 +720,7 @@ private function configureClientResponse( array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->serializerMock->expects(self::once()) @@ -749,16 +746,18 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/Gateways/KuveytPosTest.php b/tests/Unit/Gateways/KuveytPosTest.php index ce0358ab..4e7187d0 100644 --- a/tests/Unit/Gateways/KuveytPosTest.php +++ b/tests/Unit/Gateways/KuveytPosTest.php @@ -1,4 +1,5 @@ card : null; $this->expectException($expectedExceptionClass); @@ -266,8 +266,7 @@ public function testMake3DPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { $this->cryptMock->expects(self::never()) ->method('check3DHash'); @@ -308,16 +307,18 @@ public function testMake3DPayment( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($create3DPaymentRequestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $create3DPaymentRequestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($create3DPaymentRequestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $create3DPaymentRequestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; @@ -637,8 +638,7 @@ private function configureClientResponse( array $order, string $paymentModel, ?int $statusCode = null - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->serializerMock->expects(self::once()) @@ -668,16 +668,18 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/Gateways/PayFlexCPV4PosTest.php b/tests/Unit/Gateways/PayFlexCPV4PosTest.php index eafe3e7b..36f66f85 100644 --- a/tests/Unit/Gateways/PayFlexCPV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexCPV4PosTest.php @@ -1,4 +1,5 @@ card : null; $this->expectException($expectedExceptionClass); @@ -286,8 +286,7 @@ public function testMake3DPayPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($is3DSuccess) { $this->cryptMock->expects(self::never()) ->method('check3DHash'); @@ -551,8 +550,8 @@ public static function customQueryRequestDataProvider(): array public static function make3DPayPaymentDataProvider(): array { $testData = iterator_to_array( - PayFlexCPV4PosResponseDataMapperTest::threesDPayResponseDataProvider() - ); + PayFlexCPV4PosResponseDataMapperTest::threesDPayResponseDataProvider() + ); return [ 'auth_fail' => [ @@ -671,8 +670,7 @@ private function configureClientResponse( array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; if ($requestData === $encodedRequestData) { @@ -702,16 +700,18 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/Gateways/PayFlexV4PosTest.php b/tests/Unit/Gateways/PayFlexV4PosTest.php index a6e7e9a2..f954bb36 100644 --- a/tests/Unit/Gateways/PayFlexV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexV4PosTest.php @@ -1,4 +1,5 @@ card : null; $this->expectException($expectedExceptionClass); @@ -261,8 +261,7 @@ public function testMake3DPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($is3DSuccess) { $this->cryptMock->expects(self::never()) ->method('check3DHash'); @@ -724,13 +723,12 @@ private function configureClientResponse( string $txType, string $apiUrl, array $requestData, - $encodedRequestData, + $encodedRequestData, string $responseContent, array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; if ($requestData === $encodedRequestData) { @@ -762,17 +760,19 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) - ->willReturnCallback(function() use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) + ->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 8fc2dcd8..ec0d3cfc 100644 --- a/tests/Unit/Gateways/PayForTest.php +++ b/tests/Unit/Gateways/PayForTest.php @@ -1,4 +1,5 @@ card : null; $this->expectException($expectedExceptionClass); @@ -210,8 +210,7 @@ public function testMake3DPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($is3DSuccess) { $this->cryptMock->expects(self::once()) ->method('check3DHash') @@ -824,8 +823,7 @@ private function configureClientResponse( array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->serializerMock->expects(self::once()) @@ -862,7 +860,8 @@ private function configureClientResponse( && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() && $paymentModel === $dispatchedEvent->getPaymentModel(); - }))) + }) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/Gateways/PosNetTest.php b/tests/Unit/Gateways/PosNetTest.php index 7b651558..903a4f6f 100644 --- a/tests/Unit/Gateways/PosNetTest.php +++ b/tests/Unit/Gateways/PosNetTest.php @@ -1,4 +1,5 @@ card : null; $this->expectException($expectedExceptionClass); @@ -213,8 +213,7 @@ public function testMake3DPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($is3DSuccess) { $this->cryptMock->expects(self::once()) ->method('check3DHash') @@ -268,7 +267,7 @@ public function testMake3DPayment( } return true; - }), $this->callback(fn($txT): bool => $txT === $txType)) + }), $this->callback(fn ($txT): bool => $txT === $txType)) ->willReturnCallback(function () use ($matcher): ?string { if ($matcher->getInvocationCount() === 1) { return 'resolveMerchantRequestData-body'; @@ -360,7 +359,8 @@ public function testMake3DPayment( } return false; - }))) + }) + )) ->willReturnCallback(function () use ($matcher2, &$updatedRequestDataPreparedEvent1, &$updatedRequestDataPreparedEvent2) { if ($matcher2->getInvocationCount() === 1) { $updatedRequestData = $updatedRequestDataPreparedEvent1->getRequestData(); @@ -842,8 +842,7 @@ private function configureClientResponse( array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->serializerMock->expects(self::once()) @@ -872,16 +871,18 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/Gateways/PosNetV1PosTest.php b/tests/Unit/Gateways/PosNetV1PosTest.php index 781f8a19..b38cf1ee 100644 --- a/tests/Unit/Gateways/PosNetV1PosTest.php +++ b/tests/Unit/Gateways/PosNetV1PosTest.php @@ -1,4 +1,5 @@ card : null; $paymentModel = $isWithCard ? PosInterface::MODEL_3D_SECURE : PosInterface::MODEL_3D_HOST; $order = ['id' => '124']; @@ -190,8 +190,7 @@ public function testGet3DFormDataWithBadInputs( bool $isWithCard, bool $createWithoutCard, string $expectedExceptionClass - ): void - { + ): void { $card = $isWithCard ? $this->card : null; $this->expectException($expectedExceptionClass); @@ -210,8 +209,7 @@ public function testMake3DPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($is3DSuccess) { $this->cryptMock->expects(self::once()) ->method('check3DHash') @@ -743,8 +741,7 @@ private function configureClientResponse( array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->serializerMock->expects(self::once()) @@ -773,17 +770,19 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) - ->willReturnCallback(function() use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) + ->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 4c84e5c7..2aa43e03 100644 --- a/tests/Unit/Gateways/ToslaPosTest.php +++ b/tests/Unit/Gateways/ToslaPosTest.php @@ -1,4 +1,5 @@ cryptMock->expects(self::once()) ->method('check3DHash') @@ -233,8 +233,7 @@ public function testMake3DHostPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { if ($is3DSuccess) { $this->cryptMock->expects(self::once()) ->method('check3DHash') @@ -307,8 +306,7 @@ public function testGet3DFormData( array $decodedResponseData, array $formData, string $gatewayUrl - ): void - { + ): void { $card = $isWithCard ? $this->card : null; $this->requestMapperMock->expects(self::once()) @@ -354,8 +352,7 @@ public function testGet3DFormDataWithBadInputs( bool $isWithCard, bool $createWithoutCard, string $expectedExceptionClass - ): void - { + ): void { $card = $isWithCard ? $this->card : null; $this->expectException($expectedExceptionClass); @@ -405,8 +402,7 @@ public function testStatus( array $decodedResponse, array $mappedResponse, bool $isSuccess - ): void - { + ): void { $account = $this->pos->getAccount(); $txType = PosInterface::TX_TYPE_STATUS; @@ -450,8 +446,7 @@ public function testCancel( array $decodedResponse, array $mappedResponse, bool $isSuccess - ): void - { + ): void { $this->requestMapperMock->expects(self::once()) ->method('createCancelRequestData') ->with($this->pos->getAccount(), $order) @@ -492,8 +487,7 @@ public function testRefund( array $decodedResponse, array $mappedResponse, bool $isSuccess - ): void - { + ): void { $this->requestMapperMock->expects(self::once()) ->method('createRefundRequestData') ->with($this->pos->getAccount(), $order, $txType) @@ -539,8 +533,7 @@ public function testOrderHistory( array $decodedResponse, array $mappedResponse, bool $isSuccess - ): void - { + ): void { $account = $this->pos->getAccount(); $txType = PosInterface::TX_TYPE_ORDER_HISTORY; @@ -1108,8 +1101,7 @@ private function configureClientResponse( array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->serializerMock->expects(self::once()) @@ -1138,16 +1130,18 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/Gateways/VakifKatilimTest.php b/tests/Unit/Gateways/VakifKatilimTest.php index 190dcf38..02ebd9a7 100644 --- a/tests/Unit/Gateways/VakifKatilimTest.php +++ b/tests/Unit/Gateways/VakifKatilimTest.php @@ -1,4 +1,5 @@ card : null; $this->expectException($expectedExceptionClass); @@ -276,8 +276,7 @@ public function testMake3DPayment( array $expectedResponse, bool $is3DSuccess, bool $isSuccess - ): void - { + ): void { $this->responseMapperMock->expects(self::once()) ->method('extractMdStatus') ->with($request->request->all()) @@ -953,8 +952,7 @@ private function configureClientResponse( array $decodedResponse, array $order, string $paymentModel - ): void - { + ): void { $updatedRequestDataPreparedEvent = null; $this->serializerMock->expects(self::once()) @@ -983,16 +981,18 @@ private function configureClientResponse( ->method('dispatch') ->with($this->logicalAnd( $this->isInstanceOf(RequestDataPreparedEvent::class), - $this->callback(function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { - $updatedRequestDataPreparedEvent = $dispatchedEvent; - - return get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel(); - } - ))) + $this->callback( + function (RequestDataPreparedEvent $dispatchedEvent) use ($requestData, $txType, $order, $paymentModel, &$updatedRequestDataPreparedEvent): bool { + $updatedRequestDataPreparedEvent = $dispatchedEvent; + + return get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel(); + } + ) + )) ->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent { $updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData(); $updatedRequestData['test-update-request-data-with-event'] = true; diff --git a/tests/Unit/HttpClientTestTrait.php b/tests/Unit/HttpClientTestTrait.php index 46c0845b..da0eef42 100644 --- a/tests/Unit/HttpClientTestTrait.php +++ b/tests/Unit/HttpClientTestTrait.php @@ -1,4 +1,5 @@ A_WRAP -; + ; yield 'test_utf_16' => [ 'input' => $testUtf16, 'txType' => PosInterface::TX_TYPE_PAY_AUTH,