From 1fe6820bb072bf342350cf0eac113c92d28f28c9 Mon Sep 17 00:00:00 2001 From: Nuryagdy Mustapayev Date: Wed, 22 May 2024 15:42:57 +0200 Subject: [PATCH] add order info into dispatched events --- src/Event/RequestDataPreparedEvent.php | 16 +++++++++++- src/Gateways/AbstractGateway.php | 21 ++++++++++----- src/Gateways/AkbankPos.php | 3 ++- src/Gateways/EstPos.php | 3 ++- src/Gateways/GarantiPos.php | 3 ++- src/Gateways/InterPos.php | 3 ++- src/Gateways/KuveytPos.php | 6 +++-- src/Gateways/PayFlexCPV4Pos.php | 6 +++-- src/Gateways/PayFlexV4Pos.php | 6 +++-- src/Gateways/PayForPos.php | 3 ++- src/Gateways/PosNet.php | 9 ++++--- src/Gateways/PosNetV1Pos.php | 3 ++- src/Gateways/ToslaPos.php | 3 ++- src/Gateways/VakifKatilimPos.php | 6 +++-- tests/Unit/Gateways/AkbankPosTest.php | 29 ++++++++++++++------- tests/Unit/Gateways/EstPosTest.php | 13 ++++++++-- tests/Unit/Gateways/GarantiPosTest.php | 13 ++++++++-- tests/Unit/Gateways/InterPosTest.php | 12 +++++++-- tests/Unit/Gateways/KuveytPosTest.php | 18 ++++++++----- tests/Unit/Gateways/PayFlexCPV4PosTest.php | 13 ++++++++-- tests/Unit/Gateways/PayFlexV4PosTest.php | 19 +++++++++++--- tests/Unit/Gateways/PayForTest.php | 14 ++++++++-- tests/Unit/Gateways/PosNetTest.php | 30 ++++++++++++++++------ tests/Unit/Gateways/PosNetV1PosTest.php | 15 ++++++++--- tests/Unit/Gateways/ToslaPosTest.php | 24 ++++++++++++----- tests/Unit/Gateways/VakifKatilimTest.php | 18 ++++++++++--- 26 files changed, 234 insertions(+), 75 deletions(-) diff --git a/src/Event/RequestDataPreparedEvent.php b/src/Event/RequestDataPreparedEvent.php index 9c162ffe..89bb693f 100644 --- a/src/Event/RequestDataPreparedEvent.php +++ b/src/Event/RequestDataPreparedEvent.php @@ -16,6 +16,9 @@ class RequestDataPreparedEvent /** @var array */ private array $requestData; + /** @var array */ + private array $order; + private string $bank; /** @var PosInterface::TX_TYPE_* */ @@ -32,17 +35,20 @@ class RequestDataPreparedEvent * @param string $bank * @param string $txType * @param string $gatewayClass + * @param array $order */ public function __construct( array $requestData, string $bank, string $txType, - string $gatewayClass + string $gatewayClass, + array $order ) { $this->requestData = $requestData; $this->bank = $bank; $this->txType = $txType; $this->gatewayClass = $gatewayClass; + $this->order = $order; } /** @@ -65,6 +71,14 @@ public function setRequestData(array $requestData): self return $this; } + /** + * @return array + */ + public function getOrder(): array + { + return $this->order; + } + /** * @return PosInterface::TX_TYPE_* */ diff --git a/src/Gateways/AbstractGateway.php b/src/Gateways/AbstractGateway.php index 402787a9..514e4795 100644 --- a/src/Gateways/AbstractGateway.php +++ b/src/Gateways/AbstractGateway.php @@ -234,7 +234,8 @@ public function makeRegularPayment(array $order, CreditCardInterface $creditCard $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -276,7 +277,8 @@ public function makeRegularPostPayment(array $order): PosInterface $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -313,7 +315,8 @@ public function refund(array $order): PosInterface $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -354,7 +357,8 @@ public function cancel(array $order): PosInterface $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -395,7 +399,8 @@ public function status(array $order): PosInterface $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -432,7 +437,8 @@ public function history(array $data): PosInterface $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $data ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -469,7 +475,8 @@ public function orderHistory(array $order): PosInterface $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/AkbankPos.php b/src/Gateways/AkbankPos.php index ccb7cbdc..73261080 100644 --- a/src/Gateways/AkbankPos.php +++ b/src/Gateways/AkbankPos.php @@ -88,7 +88,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/EstPos.php b/src/Gateways/EstPos.php index e5975e84..93ec78bc 100644 --- a/src/Gateways/EstPos.php +++ b/src/Gateways/EstPos.php @@ -87,7 +87,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/GarantiPos.php b/src/Gateways/GarantiPos.php index 6a41d546..21b286b3 100644 --- a/src/Gateways/GarantiPos.php +++ b/src/Gateways/GarantiPos.php @@ -81,7 +81,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/InterPos.php b/src/Gateways/InterPos.php index 818fbb5b..15bd4a2c 100644 --- a/src/Gateways/InterPos.php +++ b/src/Gateways/InterPos.php @@ -87,7 +87,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/KuveytPos.php b/src/Gateways/KuveytPos.php index b0041f84..7c395dfa 100644 --- a/src/Gateways/KuveytPos.php +++ b/src/Gateways/KuveytPos.php @@ -172,7 +172,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -331,7 +332,8 @@ private function getCommon3DFormData(KuveytPosAccount $kuveytPosAccount, array $ $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PayFlexCPV4Pos.php b/src/Gateways/PayFlexCPV4Pos.php index 338eba67..641e2c09 100644 --- a/src/Gateways/PayFlexCPV4Pos.php +++ b/src/Gateways/PayFlexCPV4Pos.php @@ -92,7 +92,8 @@ public function make3DPayPayment(Request $request, array $order, string $txType) $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -247,7 +248,8 @@ private function registerPayment(array $order, string $txType, string $paymentMo $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PayFlexV4Pos.php b/src/Gateways/PayFlexV4Pos.php index 5834cda0..b60b070e 100644 --- a/src/Gateways/PayFlexV4Pos.php +++ b/src/Gateways/PayFlexV4Pos.php @@ -82,7 +82,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -222,7 +223,8 @@ private function sendEnrollmentRequest(array $order, CreditCardInterface $credit $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PayForPos.php b/src/Gateways/PayForPos.php index 94b262b5..418b71c1 100644 --- a/src/Gateways/PayForPos.php +++ b/src/Gateways/PayForPos.php @@ -81,7 +81,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PosNet.php b/src/Gateways/PosNet.php index 9ec23c81..e8fa0d60 100644 --- a/src/Gateways/PosNet.php +++ b/src/Gateways/PosNet.php @@ -73,7 +73,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -111,7 +112,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -250,7 +252,8 @@ private function getOosTransactionData(array $order, string $txType, CreditCardI $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PosNetV1Pos.php b/src/Gateways/PosNetV1Pos.php index 560a9d82..4a04ed65 100644 --- a/src/Gateways/PosNetV1Pos.php +++ b/src/Gateways/PosNetV1Pos.php @@ -93,7 +93,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/ToslaPos.php b/src/Gateways/ToslaPos.php index 65f06acb..ed1dea11 100644 --- a/src/Gateways/ToslaPos.php +++ b/src/Gateways/ToslaPos.php @@ -224,7 +224,8 @@ private function registerPayment(array $order, string $paymentModel, string $txT $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/VakifKatilimPos.php b/src/Gateways/VakifKatilimPos.php index 131b7c35..3867ae18 100644 --- a/src/Gateways/VakifKatilimPos.php +++ b/src/Gateways/VakifKatilimPos.php @@ -131,7 +131,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -202,7 +203,8 @@ private function sendEnrollmentRequest(KuveytPosAccount $kuveytPosAccount, array $requestData, $this->account->getBank(), $txType, - \get_class($this) + \get_class($this), + $order ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/tests/Unit/Gateways/AkbankPosTest.php b/tests/Unit/Gateways/AkbankPosTest.php index 3bb3bb6f..de5ae1bc 100644 --- a/tests/Unit/Gateways/AkbankPosTest.php +++ b/tests/Unit/Gateways/AkbankPosTest.php @@ -297,7 +297,8 @@ public function testMake3DPayment( $create3DPaymentRequestData, 'request-body', 'response-body', - $paymentResponse + $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -398,18 +399,20 @@ public function testHistoryRequest(array $order, string $apiUrl): void ->with($account, $order) ->willReturn($requestData); + $decodedResponse = ['decodedData']; $this->configureClientResponse( $txType, $apiUrl, $requestData, 'request-body', 'response-body', - ['decodedResponse'] + $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) ->method('mapHistoryResponse') - ->with(['decodedResponse']) + ->with($decodedResponse) ->willReturn(['result']); $this->pos->history($order); @@ -447,7 +450,8 @@ public function testOrderHistory( $requestData, $encodedRequest, $responseContent, - $decodedResponse + $decodedResponse, + $order ); $this->pos->orderHistory($order); @@ -476,7 +480,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api $requestData, 'request-body', $apiUrl, - ['paymentResponse'] + ['paymentResponse'], + $order ); $this->responseMapperMock->expects(self::once()) @@ -507,6 +512,7 @@ public function testMakeRegularPaymentBadRequest(array $order, string $txType, s 'request-body', $apiUrl, ['code' => 123, 'message' => 'error'], + $order, 400 ); @@ -534,7 +540,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo $requestData, 'request-body', $apiUrl, - ['paymentResponse'] + ['paymentResponse'], + $order ); $this->responseMapperMock->expects(self::once()) @@ -571,7 +578,8 @@ public function testCancelRequest(array $order, string $apiUrl): void $requestData, 'request-body', $apiUrl, - ['decodedResponse'] + ['decodedResponse'], + $order ); $this->responseMapperMock->expects(self::once()) @@ -602,7 +610,8 @@ public function testRefundRequest(array $order, string $apiUrl): void ['createRefundRequestData'], 'request-body', $apiUrl, - ['decodedResponse'] + ['decodedResponse'], + $order ); $this->responseMapperMock->expects(self::once()) @@ -850,6 +859,7 @@ private function configureClientResponse( string $encodedRequestData, string $responseContent, array $decodedResponse, + array $order, ?int $statusCode = null ): void { @@ -884,11 +894,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/EstPosTest.php b/tests/Unit/Gateways/EstPosTest.php index 3c2b2713..1d0754b6 100644 --- a/tests/Unit/Gateways/EstPosTest.php +++ b/tests/Unit/Gateways/EstPosTest.php @@ -255,6 +255,7 @@ public function testStatus(array $bankResponse, array $expectedData, bool $isSuc 'request-body', 'response-body', $bankResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -297,6 +298,7 @@ public function testOrderHistory(array $bankResponse, array $expectedData, bool 'request-body', 'response-body', $bankResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -333,6 +335,7 @@ public function testCancel(array $bankResponse, array $expectedData, bool $isSuc 'request-body', 'response-body', $bankResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -369,6 +372,7 @@ public function testRefund(array $bankResponse, array $expectedData, bool $isSuc 'request-body', 'response-body', $bankResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -429,6 +433,7 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -478,6 +483,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -510,6 +516,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -682,7 +689,8 @@ private function configureClientResponse( array $requestData, string $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { $this->serializerMock->expects(self::once()) @@ -706,11 +714,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/GarantiPosTest.php b/tests/Unit/Gateways/GarantiPosTest.php index 6edb015f..6caefda2 100644 --- a/tests/Unit/Gateways/GarantiPosTest.php +++ b/tests/Unit/Gateways/GarantiPosTest.php @@ -215,6 +215,7 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -300,6 +301,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -331,6 +333,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -363,6 +366,7 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -395,6 +399,7 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -427,6 +432,7 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -465,6 +471,7 @@ public function testOrderHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -585,7 +592,8 @@ private function configureClientResponse( array $requestData, string $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { $this->serializerMock->expects(self::once()) @@ -609,11 +617,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/InterPosTest.php b/tests/Unit/Gateways/InterPosTest.php index 314c9f20..ab664df1 100644 --- a/tests/Unit/Gateways/InterPosTest.php +++ b/tests/Unit/Gateways/InterPosTest.php @@ -210,6 +210,7 @@ public function testMake3DPayment( ['request-body'], 'response-body', $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -326,6 +327,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $api ['request-body'], 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -358,6 +360,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo ['request-body'], 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -391,6 +394,7 @@ public function testStatusRequest(array $order, string $apiUrl): void ['request-body'], 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -423,6 +427,7 @@ public function testCancelRequest(array $order, string $apiUrl): void ['request-body'], 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -455,6 +460,7 @@ public function testRefundRequest(array $order, string $apiUrl): void ['request-body'], 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -556,7 +562,8 @@ private function configureClientResponse( array $requestData, array $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { $this->serializerMock->expects(self::once()) @@ -580,11 +587,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/KuveytPosTest.php b/tests/Unit/Gateways/KuveytPosTest.php index 6d232473..fd390c05 100644 --- a/tests/Unit/Gateways/KuveytPosTest.php +++ b/tests/Unit/Gateways/KuveytPosTest.php @@ -195,7 +195,8 @@ public function testGetCommon3DFormDataSuccessResponse(): void $txType = PosInterface::TX_TYPE_PAY_AUTH; $paymentModel = PosInterface::MODEL_3D_SECURE; $card = $this->card; - $requestData = ['form-data']; + $requestData = ['form-data']; + $order = $this->order; $this->configureClientResponse( $txType, 'https://boatest.kuveytturk.com.tr/boa.virtualpos.services/Home/ThreeDModelPayGate', @@ -203,6 +204,7 @@ public function testGetCommon3DFormDataSuccessResponse(): void 'encoded-request-data', $response, ['form_inputs' => ['form-inputs'], 'gateway' => 'form-action-url'], + $order ); $this->requestMapperMock->expects(self::once()) @@ -227,7 +229,7 @@ public function testGetCommon3DFormDataSuccessResponse(): void $card ) ->willReturn(['3d-form-data']); - $result = $this->pos->get3DFormData($this->order, $paymentModel, $txType, $card); + $result = $this->pos->get3DFormData($order, $paymentModel, $txType, $card); $this->assertSame(['3d-form-data'], $result); } @@ -283,11 +285,12 @@ public function testMake3DPayment( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $create3DPaymentRequestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $create3DPaymentRequestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $create3DPaymentRequestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); @@ -358,7 +361,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api $requestData, 'request-body', 'response-body', - $paymentResponse + $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -519,7 +523,8 @@ private function configureClientResponse( string $encodedRequestData, string $responseContent, array $decodedResponse, - ?int $statusCode = null + array $order, + ?int $statusCode = null ): void { $this->serializerMock->expects(self::once()) @@ -547,11 +552,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/PayFlexCPV4PosTest.php b/tests/Unit/Gateways/PayFlexCPV4PosTest.php index 28dc1e2c..29391382 100644 --- a/tests/Unit/Gateways/PayFlexCPV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexCPV4PosTest.php @@ -177,6 +177,7 @@ public function testGet3DFormDataSuccess(): void $requestData, 'response-body', $enrollmentResponse, + $order ); $this->requestMapperMock->expects(self::once()) @@ -234,6 +235,7 @@ public function testGet3DFormDataEnrollmentFail(): void $requestData, 'response-body', $enrollmentResponse, + $order ); $this->requestMapperMock->expects(self::never()) @@ -292,6 +294,7 @@ public function testMake3DPayPayment( $create3DPaymentStatusRequestData, 'response-body', $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -341,6 +344,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -373,6 +377,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -411,6 +416,7 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -443,6 +449,7 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -563,7 +570,8 @@ private function configureClientResponse( array $requestData, $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { if ($requestData === $encodedRequestData) { @@ -590,11 +598,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/PayFlexV4PosTest.php b/tests/Unit/Gateways/PayFlexV4PosTest.php index 2554d63e..33e6aa26 100644 --- a/tests/Unit/Gateways/PayFlexV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexV4PosTest.php @@ -154,9 +154,10 @@ public function testGet3DFormDataEnrollmentFail(): void $this->expectException(Exception::class); $txType = PosInterface::TX_TYPE_PAY_AUTH; $requestData = ['request-data']; + $order = $this->order; $this->requestMapperMock->expects(self::once()) ->method('create3DEnrollmentCheckRequestData') - ->with($this->pos->getAccount(), $this->order, $this->card) + ->with($this->pos->getAccount(), $order, $this->card) ->willReturn($requestData); $this->configureClientResponse( @@ -166,12 +167,13 @@ public function testGet3DFormDataEnrollmentFail(): void $requestData, 'response-body', self::getSampleEnrollmentFailResponseDataProvider(), + $order ); $this->requestMapperMock->expects(self::never()) ->method('create3DFormData'); - $this->pos->get3DFormData($this->order, PosInterface::MODEL_3D_SECURE, $txType, $this->card); + $this->pos->get3DFormData($order, PosInterface::MODEL_3D_SECURE, $txType, $this->card); } /** @@ -200,6 +202,7 @@ public function testGet3DFormDataSuccess(): void $requestData, 'response-body', $enrollmentResponse, + $order ); $this->requestMapperMock->expects(self::once()) @@ -264,6 +267,7 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -329,6 +333,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -360,6 +365,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -393,6 +399,7 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -425,6 +432,7 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -457,6 +465,7 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -610,7 +619,8 @@ private function configureClientResponse( array $requestData, $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { if ($requestData === $encodedRequestData) { @@ -639,11 +649,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/PayForTest.php b/tests/Unit/Gateways/PayForTest.php index ad890c99..f0aca518 100644 --- a/tests/Unit/Gateways/PayForTest.php +++ b/tests/Unit/Gateways/PayForTest.php @@ -228,6 +228,7 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -331,6 +332,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -363,6 +365,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -396,6 +399,7 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -428,6 +432,7 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -460,6 +465,7 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -492,6 +498,7 @@ public function testHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -524,6 +531,7 @@ public function testOrderHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -665,7 +673,8 @@ private function configureClientResponse( array $requestData, string $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { $this->serializerMock->expects(self::once()) @@ -692,11 +701,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/PosNetTest.php b/tests/Unit/Gateways/PosNetTest.php index fe88ea15..729fbb48 100644 --- a/tests/Unit/Gateways/PosNetTest.php +++ b/tests/Unit/Gateways/PosNetTest.php @@ -152,10 +152,11 @@ public function testGet3DFormDataOosTransactionFail(): void { $txType = PosInterface::TX_TYPE_PAY_AUTH; $requestData = ['request-data']; + $order = $this->order; $this->expectException(Exception::class); $this->requestMapperMock->expects(self::once()) ->method('create3DEnrollmentCheckRequestData') - ->with($this->pos->getAccount(), $this->order, $txType, $this->card) + ->with($this->pos->getAccount(), $order, $txType, $this->card) ->willReturn($requestData); $responseData = [ @@ -171,12 +172,13 @@ public function testGet3DFormDataOosTransactionFail(): void 'request-body', 'response-body', $responseData, + $order ); $this->requestMapperMock->expects(self::never()) ->method('create3DFormData'); - $this->pos->get3DFormData($this->order, PosInterface::MODEL_3D_SECURE, $txType, $this->card); + $this->pos->get3DFormData($order, PosInterface::MODEL_3D_SECURE, $txType, $this->card); } /** @@ -289,17 +291,21 @@ public function testMake3DPayment( ->method('dispatch') // could not find another way expect using deprecated withConsecutive() function ->withConsecutive( - [$this->callback(function ($dispatchedEvent) use ($txType, $resolveMerchantRequestData) { + [$this->callback(function ($dispatchedEvent) use ($txType, $resolveMerchantRequestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() - && $resolveMerchantRequestData === $dispatchedEvent->getRequestData(); + && $resolveMerchantRequestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + ; })], - [$this->callback(function ($dispatchedEvent) use ($txType, $create3DPaymentRequestData) { + [$this->callback(function ($dispatchedEvent) use ($txType, $create3DPaymentRequestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() - && $create3DPaymentRequestData === $dispatchedEvent->getRequestData(); + && $create3DPaymentRequestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + ; })] ); @@ -315,6 +321,7 @@ public function testMake3DPayment( 'resolveMerchantRequestData-body', 'resolveMerchantRequestData-body', $resolveResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -370,6 +377,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -402,6 +410,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -435,6 +444,7 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -467,6 +477,7 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -499,6 +510,7 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -637,7 +649,8 @@ private function configureClientResponse( array $requestData, string $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { $this->serializerMock->expects(self::once()) @@ -664,11 +677,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/PosNetV1PosTest.php b/tests/Unit/Gateways/PosNetV1PosTest.php index 1294aff4..983c4342 100644 --- a/tests/Unit/Gateways/PosNetV1PosTest.php +++ b/tests/Unit/Gateways/PosNetV1PosTest.php @@ -221,6 +221,7 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -292,6 +293,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $map 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -329,6 +331,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -367,6 +370,7 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -404,6 +408,7 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -441,6 +446,7 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -597,7 +603,8 @@ private function configureClientResponse( array $requestData, string $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { $this->serializerMock->expects(self::once()) @@ -624,11 +631,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() - && $requestData === $dispatchedEvent->getRequestData(); + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + ; })); } } diff --git a/tests/Unit/Gateways/ToslaPosTest.php b/tests/Unit/Gateways/ToslaPosTest.php index 8b36458b..ac0a6355 100644 --- a/tests/Unit/Gateways/ToslaPosTest.php +++ b/tests/Unit/Gateways/ToslaPosTest.php @@ -271,6 +271,7 @@ public function testGet3DFormData( $encodedRequestData, $responseData, $decodedResponseData, + $order ); $this->requestMapperMock->expects(self::once()) @@ -322,7 +323,8 @@ public function testStatus( $requestData, $encodedRequest, $responseContent, - $decodedResponse + $decodedResponse, + $order ); $this->pos->status($order); @@ -362,7 +364,8 @@ public function testCancel( $requestData, $encodedRequest, $responseContent, - $decodedResponse + $decodedResponse, + $order ); $this->pos->cancel($order); @@ -401,7 +404,8 @@ public function testRefund( $requestData, $encodedRequest, $responseContent, - $decodedResponse + $decodedResponse, + $order ); $this->pos->refund($order); @@ -449,7 +453,8 @@ public function testOrderHistory( $requestData, $encodedRequest, $responseContent, - $decodedResponse + $decodedResponse, + $order ); $this->pos->orderHistory($order); @@ -585,6 +590,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -617,6 +623,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -650,6 +657,7 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -682,6 +690,7 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -714,6 +723,7 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -849,7 +859,8 @@ private function configureClientResponse( array $requestData, string $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { $this->serializerMock->expects(self::once()) @@ -875,11 +886,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); } diff --git a/tests/Unit/Gateways/VakifKatilimTest.php b/tests/Unit/Gateways/VakifKatilimTest.php index de558d7f..9ce454c6 100644 --- a/tests/Unit/Gateways/VakifKatilimTest.php +++ b/tests/Unit/Gateways/VakifKatilimTest.php @@ -180,6 +180,7 @@ public function testGetCommon3DFormDataSuccessResponse(): void $paymentModel = PosInterface::MODEL_3D_SECURE; $card = $this->card; $requestData = ['form-data']; + $order = $this->order; $decodedResponse = ['form_inputs' => ['form-inputs'], 'gateway' => 'form-action-url']; $this->configureClientResponse( @@ -189,6 +190,7 @@ public function testGetCommon3DFormDataSuccessResponse(): void 'request-body', 'bank-api-html-response', $decodedResponse, + $order ); $this->requestMapperMock->expects(self::once()) @@ -213,7 +215,7 @@ public function testGetCommon3DFormDataSuccessResponse(): void $card ) ->willReturn(['3d-form-data']); - $result = $this->pos->get3DFormData($this->order, $paymentModel, $txType, $card); + $result = $this->pos->get3DFormData($order, $paymentModel, $txType, $card); $this->assertSame(['3d-form-data'], $result); } @@ -283,6 +285,7 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -366,6 +369,7 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -398,6 +402,7 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -431,6 +436,7 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -463,6 +469,7 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -495,6 +502,7 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -528,6 +536,7 @@ public function testHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -560,6 +569,7 @@ public function testOrderHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, + $order ); $this->responseMapperMock->expects(self::once()) @@ -780,7 +790,8 @@ private function configureClientResponse( array $requestData, string $encodedRequestData, string $responseContent, - array $decodedResponse + array $decodedResponse, + array $order ): void { $this->serializerMock->expects(self::once()) @@ -806,11 +817,12 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() ; })); }