diff --git a/src/Event/RequestDataPreparedEvent.php b/src/Event/RequestDataPreparedEvent.php index 89bb693f..717d197d 100644 --- a/src/Event/RequestDataPreparedEvent.php +++ b/src/Event/RequestDataPreparedEvent.php @@ -24,11 +24,15 @@ class RequestDataPreparedEvent /** @var PosInterface::TX_TYPE_* */ private string $txType; + /** @var PosInterface::MODEL_* */ + private string $paymentModel; + /** @var class-string */ private string $gatewayClass; /** * @phpstan-param PosInterface::TX_TYPE_* $txType + * @phpstan-param PosInterface::MODEL_* $paymentModel * @phpstan-param class-string $gatewayClass * * @param array $requestData @@ -36,19 +40,22 @@ class RequestDataPreparedEvent * @param string $txType * @param string $gatewayClass * @param array $order + * @param string $paymentModel */ public function __construct( array $requestData, string $bank, string $txType, string $gatewayClass, - array $order + array $order, + string $paymentModel ) { $this->requestData = $requestData; $this->bank = $bank; $this->txType = $txType; $this->gatewayClass = $gatewayClass; $this->order = $order; + $this->paymentModel = $paymentModel; } /** @@ -87,6 +94,14 @@ public function getTxType(): string return $this->txType; } + /** + * @return PosInterface::MODEL_* + */ + public function getPaymentModel(): string + { + return $this->paymentModel; + } + /** * @return string */ diff --git a/src/Gateways/AbstractGateway.php b/src/Gateways/AbstractGateway.php index 514e4795..03ccd7f8 100644 --- a/src/Gateways/AbstractGateway.php +++ b/src/Gateways/AbstractGateway.php @@ -235,7 +235,8 @@ public function makeRegularPayment(array $order, CreditCardInterface $creditCard $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -278,7 +279,8 @@ public function makeRegularPostPayment(array $order): PosInterface $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -316,7 +318,8 @@ public function refund(array $order): PosInterface $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -358,7 +361,8 @@ public function cancel(array $order): PosInterface $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -400,7 +404,8 @@ public function status(array $order): PosInterface $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -438,7 +443,8 @@ public function history(array $data): PosInterface $this->account->getBank(), $txType, \get_class($this), - $data + $data, + PosInterface::MODEL_NON_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -476,7 +482,8 @@ public function orderHistory(array $order): PosInterface $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/AkbankPos.php b/src/Gateways/AkbankPos.php index 73261080..d374bc7f 100644 --- a/src/Gateways/AkbankPos.php +++ b/src/Gateways/AkbankPos.php @@ -89,7 +89,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/EstPos.php b/src/Gateways/EstPos.php index 93ec78bc..8f0b84c6 100644 --- a/src/Gateways/EstPos.php +++ b/src/Gateways/EstPos.php @@ -88,7 +88,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/GarantiPos.php b/src/Gateways/GarantiPos.php index 21b286b3..550ba002 100644 --- a/src/Gateways/GarantiPos.php +++ b/src/Gateways/GarantiPos.php @@ -82,7 +82,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/InterPos.php b/src/Gateways/InterPos.php index 15bd4a2c..b121a76f 100644 --- a/src/Gateways/InterPos.php +++ b/src/Gateways/InterPos.php @@ -88,7 +88,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/KuveytPos.php b/src/Gateways/KuveytPos.php index 7c395dfa..d27a6429 100644 --- a/src/Gateways/KuveytPos.php +++ b/src/Gateways/KuveytPos.php @@ -173,7 +173,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -333,7 +334,8 @@ private function getCommon3DFormData(KuveytPosAccount $kuveytPosAccount, array $ $this->account->getBank(), $txType, \get_class($this), - $order + $order, + $paymentModel ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PayFlexCPV4Pos.php b/src/Gateways/PayFlexCPV4Pos.php index 641e2c09..9915391a 100644 --- a/src/Gateways/PayFlexCPV4Pos.php +++ b/src/Gateways/PayFlexCPV4Pos.php @@ -93,7 +93,8 @@ public function make3DPayPayment(Request $request, array $order, string $txType) $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_PAY ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -249,7 +250,8 @@ private function registerPayment(array $order, string $txType, string $paymentMo $this->account->getBank(), $txType, \get_class($this), - $order + $order, + $paymentModel ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PayFlexV4Pos.php b/src/Gateways/PayFlexV4Pos.php index b60b070e..93d38102 100644 --- a/src/Gateways/PayFlexV4Pos.php +++ b/src/Gateways/PayFlexV4Pos.php @@ -83,7 +83,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -151,7 +152,7 @@ public function get3DFormData(array $order, string $paymentModel, string $txType throw new LogicException('Kredi kartı bilgileri eksik!'); } - $data = $this->sendEnrollmentRequest($order, $creditCard, $txType); + $data = $this->sendEnrollmentRequest($order, $creditCard, $txType, $paymentModel); $status = $data['Message']['VERes']['Status']; /** @@ -206,16 +207,18 @@ protected function send($contents, string $txType, string $paymentModel, string * (Enrollment Status) sorulması, yani kart 3-D Secure programına dâhil mi yoksa değil mi sorgusu * * @phpstan-param PosInterface::TX_TYPE_PAY_AUTH|PosInterface::TX_TYPE_PAY_PRE_AUTH $txType + * @phpstan-param PosInterface::MODEL_3D_* $paymentModel * * @param array $order * @param CreditCardInterface $creditCard * @param string $txType + * @param string $paymentModel * * @return array * * @throws Exception */ - private function sendEnrollmentRequest(array $order, CreditCardInterface $creditCard, string $txType): array + private function sendEnrollmentRequest(array $order, CreditCardInterface $creditCard, string $txType, string $paymentModel): array { $requestData = $this->requestDataMapper->create3DEnrollmentCheckRequestData($this->account, $order, $creditCard); @@ -224,7 +227,8 @@ private function sendEnrollmentRequest(array $order, CreditCardInterface $credit $this->account->getBank(), $txType, \get_class($this), - $order + $order, + $paymentModel ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PayForPos.php b/src/Gateways/PayForPos.php index 418b71c1..bc9d2958 100644 --- a/src/Gateways/PayForPos.php +++ b/src/Gateways/PayForPos.php @@ -82,7 +82,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PosNet.php b/src/Gateways/PosNet.php index e8fa0d60..7a7f2806 100644 --- a/src/Gateways/PosNet.php +++ b/src/Gateways/PosNet.php @@ -74,7 +74,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -113,7 +114,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -165,7 +167,7 @@ public function get3DFormData(array $order, string $paymentModel, string $txType throw new LogicException('Kredi kartı veya sipariş bilgileri eksik!'); } - $data = $this->getOosTransactionData($order, $txType, $creditCard); + $data = $this->getOosTransactionData($order, $txType, $paymentModel, $creditCard); if ($this->responseDataMapper::PROCEDURE_SUCCESS_CODE !== $data['approved']) { $this->logger->error('enrollment fail response', $data); @@ -234,9 +236,11 @@ protected function send($contents, string $txType, string $paymentModel, string * siparis bilgileri ve kart bilgilerinin şifrelendiği adımdır. * * @phpstan-param PosInterface::TX_TYPE_PAY_AUTH|PosInterface::TX_TYPE_PAY_PRE_AUTH $txType + * @phpstan-param PosInterface::MODEL_3D_* $paymentModel * * @param array $order * @param string $txType + * @param string $paymentModel * @param CreditCardInterface $creditCard * * @return array{approved: string, respCode: string, respText: string, oosRequestDataResponse?: array{data1: string, data2: string, sign: string}} @@ -244,16 +248,22 @@ protected function send($contents, string $txType, string $paymentModel, string * @throws UnsupportedTransactionTypeException * @throws ClientExceptionInterface */ - private function getOosTransactionData(array $order, string $txType, CreditCardInterface $creditCard): array + private function getOosTransactionData(array $order, string $txType, string $paymentModel, CreditCardInterface $creditCard): array { - $requestData = $this->requestDataMapper->create3DEnrollmentCheckRequestData($this->account, $order, $txType, $creditCard); + $requestData = $this->requestDataMapper->create3DEnrollmentCheckRequestData( + $this->account, + $order, + $txType, + $creditCard + ); $event = new RequestDataPreparedEvent( $requestData, $this->account->getBank(), $txType, \get_class($this), - $order + $order, + $paymentModel ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/PosNetV1Pos.php b/src/Gateways/PosNetV1Pos.php index 4a04ed65..759f24e1 100644 --- a/src/Gateways/PosNetV1Pos.php +++ b/src/Gateways/PosNetV1Pos.php @@ -94,7 +94,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/ToslaPos.php b/src/Gateways/ToslaPos.php index ed1dea11..20770418 100644 --- a/src/Gateways/ToslaPos.php +++ b/src/Gateways/ToslaPos.php @@ -225,7 +225,8 @@ private function registerPayment(array $order, string $paymentModel, string $txT $this->account->getBank(), $txType, \get_class($this), - $order + $order, + $paymentModel ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/src/Gateways/VakifKatilimPos.php b/src/Gateways/VakifKatilimPos.php index 3867ae18..16c67595 100644 --- a/src/Gateways/VakifKatilimPos.php +++ b/src/Gateways/VakifKatilimPos.php @@ -132,7 +132,8 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr $this->account->getBank(), $txType, \get_class($this), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { @@ -204,7 +205,8 @@ private function sendEnrollmentRequest(KuveytPosAccount $kuveytPosAccount, array $this->account->getBank(), $txType, \get_class($this), - $order + $order, + $paymentModel ); $this->eventDispatcher->dispatch($event); if ($requestData !== $event->getRequestData()) { diff --git a/tests/Unit/Gateways/AkbankPosTest.php b/tests/Unit/Gateways/AkbankPosTest.php index de5ae1bc..a1b0b5ac 100644 --- a/tests/Unit/Gateways/AkbankPosTest.php +++ b/tests/Unit/Gateways/AkbankPosTest.php @@ -298,7 +298,8 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -407,7 +408,8 @@ public function testHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -451,7 +453,8 @@ public function testOrderHistory( $encodedRequest, $responseContent, $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->pos->orderHistory($order); @@ -481,7 +484,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', $apiUrl, ['paymentResponse'], - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -513,6 +517,7 @@ public function testMakeRegularPaymentBadRequest(array $order, string $txType, s $apiUrl, ['code' => 123, 'message' => 'error'], $order, + PosInterface::MODEL_NON_SECURE, 400 ); @@ -541,7 +546,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', $apiUrl, ['paymentResponse'], - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -579,7 +585,8 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', $apiUrl, ['decodedResponse'], - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -611,7 +618,8 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', $apiUrl, ['decodedResponse'], - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -860,6 +868,7 @@ private function configureClientResponse( string $responseContent, array $decodedResponse, array $order, + string $paymentModel, ?int $statusCode = null ): void { @@ -894,12 +903,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/EstPosTest.php b/tests/Unit/Gateways/EstPosTest.php index 1d0754b6..eb2713b4 100644 --- a/tests/Unit/Gateways/EstPosTest.php +++ b/tests/Unit/Gateways/EstPosTest.php @@ -255,7 +255,8 @@ public function testStatus(array $bankResponse, array $expectedData, bool $isSuc 'request-body', 'response-body', $bankResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -298,7 +299,8 @@ public function testOrderHistory(array $bankResponse, array $expectedData, bool 'request-body', 'response-body', $bankResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -335,7 +337,8 @@ public function testCancel(array $bankResponse, array $expectedData, bool $isSuc 'request-body', 'response-body', $bankResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -372,7 +375,8 @@ public function testRefund(array $bankResponse, array $expectedData, bool $isSuc 'request-body', 'response-body', $bankResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -433,7 +437,8 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -483,7 +488,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -516,7 +522,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -690,7 +697,8 @@ private function configureClientResponse( string $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { $this->serializerMock->expects(self::once()) @@ -714,12 +722,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/GarantiPosTest.php b/tests/Unit/Gateways/GarantiPosTest.php index 6caefda2..e3f95bd5 100644 --- a/tests/Unit/Gateways/GarantiPosTest.php +++ b/tests/Unit/Gateways/GarantiPosTest.php @@ -215,7 +215,8 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -301,7 +302,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -333,7 +335,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -366,7 +369,8 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -399,7 +403,8 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -432,7 +437,8 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -471,7 +477,8 @@ public function testOrderHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -593,7 +600,8 @@ private function configureClientResponse( string $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { $this->serializerMock->expects(self::once()) @@ -617,12 +625,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/InterPosTest.php b/tests/Unit/Gateways/InterPosTest.php index ab664df1..42d66bce 100644 --- a/tests/Unit/Gateways/InterPosTest.php +++ b/tests/Unit/Gateways/InterPosTest.php @@ -210,7 +210,8 @@ public function testMake3DPayment( ['request-body'], 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -327,7 +328,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api ['request-body'], 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -360,7 +362,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo ['request-body'], 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -394,7 +397,8 @@ public function testStatusRequest(array $order, string $apiUrl): void ['request-body'], 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -427,7 +431,8 @@ public function testCancelRequest(array $order, string $apiUrl): void ['request-body'], 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -460,7 +465,8 @@ public function testRefundRequest(array $order, string $apiUrl): void ['request-body'], 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -563,7 +569,8 @@ private function configureClientResponse( array $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { $this->serializerMock->expects(self::once()) @@ -587,12 +594,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/KuveytPosTest.php b/tests/Unit/Gateways/KuveytPosTest.php index fd390c05..c900c100 100644 --- a/tests/Unit/Gateways/KuveytPosTest.php +++ b/tests/Unit/Gateways/KuveytPosTest.php @@ -204,7 +204,8 @@ public function testGetCommon3DFormDataSuccessResponse(): void 'encoded-request-data', $response, ['form_inputs' => ['form-inputs'], 'gateway' => 'form-action-url'], - $order + $order, + $paymentModel ); $this->requestMapperMock->expects(self::once()) @@ -282,15 +283,16 @@ public function testMake3DPayment( ], ] ); - + $paymentModel = PosInterface::MODEL_3D_SECURE; $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $create3DPaymentRequestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $create3DPaymentRequestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $create3DPaymentRequestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); @@ -362,7 +364,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -524,6 +527,7 @@ private function configureClientResponse( string $responseContent, array $decodedResponse, array $order, + string $paymentModel, ?int $statusCode = null ): void { @@ -552,12 +556,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/PayFlexCPV4PosTest.php b/tests/Unit/Gateways/PayFlexCPV4PosTest.php index 29391382..d6adf81e 100644 --- a/tests/Unit/Gateways/PayFlexCPV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexCPV4PosTest.php @@ -177,7 +177,8 @@ public function testGet3DFormDataSuccess(): void $requestData, 'response-body', $enrollmentResponse, - $order + $order, + $paymentModel ); $this->requestMapperMock->expects(self::once()) @@ -235,7 +236,8 @@ public function testGet3DFormDataEnrollmentFail(): void $requestData, 'response-body', $enrollmentResponse, - $order + $order, + $paymentModel ); $this->requestMapperMock->expects(self::never()) @@ -294,7 +296,8 @@ public function testMake3DPayPayment( $create3DPaymentStatusRequestData, 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_3D_PAY ); $this->responseMapperMock->expects(self::once()) @@ -344,7 +347,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -377,7 +381,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -416,7 +421,8 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -449,7 +455,8 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -571,7 +578,8 @@ private function configureClientResponse( $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { if ($requestData === $encodedRequestData) { @@ -598,12 +606,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/PayFlexV4PosTest.php b/tests/Unit/Gateways/PayFlexV4PosTest.php index 33e6aa26..3cb5b433 100644 --- a/tests/Unit/Gateways/PayFlexV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexV4PosTest.php @@ -167,7 +167,8 @@ public function testGet3DFormDataEnrollmentFail(): void $requestData, 'response-body', self::getSampleEnrollmentFailResponseDataProvider(), - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->requestMapperMock->expects(self::never()) @@ -202,7 +203,8 @@ public function testGet3DFormDataSuccess(): void $requestData, 'response-body', $enrollmentResponse, - $order + $order, + $paymentModel ); $this->requestMapperMock->expects(self::once()) @@ -267,7 +269,8 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -333,7 +336,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -365,7 +369,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -399,7 +404,8 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -432,7 +438,8 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -465,7 +472,8 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -620,7 +628,8 @@ private function configureClientResponse( $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { if ($requestData === $encodedRequestData) { @@ -649,12 +658,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/PayForTest.php b/tests/Unit/Gateways/PayForTest.php index f0aca518..ebee9a6c 100644 --- a/tests/Unit/Gateways/PayForTest.php +++ b/tests/Unit/Gateways/PayForTest.php @@ -228,7 +228,8 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -332,7 +333,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -365,7 +367,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -399,7 +402,8 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -432,7 +436,8 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -465,7 +470,8 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -498,7 +504,8 @@ public function testHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -531,7 +538,8 @@ public function testOrderHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -674,7 +682,8 @@ private function configureClientResponse( string $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { $this->serializerMock->expects(self::once()) @@ -701,12 +710,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/PosNetTest.php b/tests/Unit/Gateways/PosNetTest.php index 729fbb48..5a69e42d 100644 --- a/tests/Unit/Gateways/PosNetTest.php +++ b/tests/Unit/Gateways/PosNetTest.php @@ -172,7 +172,8 @@ public function testGet3DFormDataOosTransactionFail(): void 'request-body', 'response-body', $responseData, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->requestMapperMock->expects(self::never()) @@ -287,24 +288,27 @@ public function testMake3DPayment( ] ); + $paymentModel = PosInterface::MODEL_3D_SECURE; $this->eventDispatcherMock->expects(self::exactly(2)) ->method('dispatch') // could not find another way expect using deprecated withConsecutive() function ->withConsecutive( - [$this->callback(function ($dispatchedEvent) use ($txType, $resolveMerchantRequestData, $order) { + [$this->callback(function ($dispatchedEvent) use ($txType, $resolveMerchantRequestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $resolveMerchantRequestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })], - [$this->callback(function ($dispatchedEvent) use ($txType, $create3DPaymentRequestData, $order) { + [$this->callback(function ($dispatchedEvent) use ($txType, $create3DPaymentRequestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $create3DPaymentRequestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })] ); @@ -321,7 +325,8 @@ public function testMake3DPayment( 'resolveMerchantRequestData-body', 'resolveMerchantRequestData-body', $resolveResponse, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -377,7 +382,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -410,7 +416,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -444,7 +451,8 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -477,7 +485,8 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -510,7 +519,8 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -650,7 +660,8 @@ private function configureClientResponse( string $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { $this->serializerMock->expects(self::once()) @@ -677,12 +688,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/PosNetV1PosTest.php b/tests/Unit/Gateways/PosNetV1PosTest.php index 983c4342..6ccc040b 100644 --- a/tests/Unit/Gateways/PosNetV1PosTest.php +++ b/tests/Unit/Gateways/PosNetV1PosTest.php @@ -221,7 +221,8 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -293,7 +294,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $map 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -331,7 +333,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -370,7 +373,8 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -408,7 +412,8 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -446,7 +451,8 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -604,7 +610,8 @@ private function configureClientResponse( string $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { $this->serializerMock->expects(self::once()) @@ -631,12 +638,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/ToslaPosTest.php b/tests/Unit/Gateways/ToslaPosTest.php index ac0a6355..ea80211b 100644 --- a/tests/Unit/Gateways/ToslaPosTest.php +++ b/tests/Unit/Gateways/ToslaPosTest.php @@ -271,7 +271,8 @@ public function testGet3DFormData( $encodedRequestData, $responseData, $decodedResponseData, - $order + $order, + $paymentModel ); $this->requestMapperMock->expects(self::once()) @@ -324,7 +325,8 @@ public function testStatus( $encodedRequest, $responseContent, $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->pos->status($order); @@ -365,7 +367,8 @@ public function testCancel( $encodedRequest, $responseContent, $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->pos->cancel($order); @@ -405,7 +408,8 @@ public function testRefund( $encodedRequest, $responseContent, $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->pos->refund($order); @@ -454,7 +458,8 @@ public function testOrderHistory( $encodedRequest, $responseContent, $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->pos->orderHistory($order); @@ -590,7 +595,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -623,7 +629,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -657,7 +664,8 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -690,7 +698,8 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -723,7 +732,8 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -860,7 +870,8 @@ private function configureClientResponse( string $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { $this->serializerMock->expects(self::once()) @@ -886,12 +897,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); } diff --git a/tests/Unit/Gateways/VakifKatilimTest.php b/tests/Unit/Gateways/VakifKatilimTest.php index 9ce454c6..bad22549 100644 --- a/tests/Unit/Gateways/VakifKatilimTest.php +++ b/tests/Unit/Gateways/VakifKatilimTest.php @@ -190,7 +190,8 @@ public function testGetCommon3DFormDataSuccessResponse(): void 'request-body', 'bank-api-html-response', $decodedResponse, - $order + $order, + $paymentModel ); $this->requestMapperMock->expects(self::once()) @@ -285,7 +286,8 @@ public function testMake3DPayment( 'request-body', 'response-body', $paymentResponse, - $order + $order, + PosInterface::MODEL_3D_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -369,7 +371,8 @@ public function testMakeRegularPayment(array $order, string $txType, string $api 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -402,7 +405,8 @@ public function testMakeRegularPostAuthPayment(array $order, string $apiUrl): vo 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -436,7 +440,8 @@ public function testStatusRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -469,7 +474,8 @@ public function testCancelRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -502,7 +508,8 @@ public function testRefundRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -536,7 +543,8 @@ public function testHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -569,7 +577,8 @@ public function testOrderHistoryRequest(array $order, string $apiUrl): void 'request-body', 'response-body', $decodedResponse, - $order + $order, + PosInterface::MODEL_NON_SECURE ); $this->responseMapperMock->expects(self::once()) @@ -791,7 +800,8 @@ private function configureClientResponse( string $encodedRequestData, string $responseContent, array $decodedResponse, - array $order + array $order, + string $paymentModel ): void { $this->serializerMock->expects(self::once()) @@ -817,12 +827,13 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order) { + ->with($this->callback(function ($dispatchedEvent) use ($txType, $requestData, $order, $paymentModel) { return $dispatchedEvent instanceof RequestDataPreparedEvent && get_class($this->pos) === $dispatchedEvent->getGatewayClass() && $txType === $dispatchedEvent->getTxType() && $requestData === $dispatchedEvent->getRequestData() && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel() ; })); }