From b28558c730d457b33d949c91460f9368df7cd105 Mon Sep 17 00:00:00 2001 From: Nuryagdy Mustapayev Date: Thu, 23 May 2024 17:36:08 +0200 Subject: [PATCH 1/3] issue #204 KuveytTurk partial refund support --- docs/REFUND-EXAMPLE.md | 24 +++++-- examples/_common-codes/regular/refund.php | 27 +++++-- .../KuveytPosRequestDataMapper.php | 8 ++- src/Gateways/KuveytPos.php | 7 +- tests/Functional/KuveytPosTest.php | 72 +++++++++++++++---- tests/Functional/PaymentTestTrait.php | 13 ++-- .../KuveytPosRequestDataMapperTest.php | 58 +++++++++++++-- 7 files changed, 166 insertions(+), 43 deletions(-) diff --git a/docs/REFUND-EXAMPLE.md b/docs/REFUND-EXAMPLE.md index b7b529b5..c88190c8 100644 --- a/docs/REFUND-EXAMPLE.md +++ b/docs/REFUND-EXAMPLE.md @@ -44,14 +44,18 @@ try { require 'config.php'; -function createRefundOrder(string $gatewayClass, array $lastResponse, string $ip): array +function createRefundOrder(string $gatewayClass, array $lastResponse, string $ip, ?float $refundAmount = null): array { $refundOrder = [ - 'id' => $lastResponse['order_id'], // MerchantOrderId - 'amount' => $lastResponse['amount'], - 'currency' => $lastResponse['currency'], - 'ref_ret_num' => $lastResponse['ref_ret_num'], - 'ip' => filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ? $ip : '127.0.0.1', + 'id' => $lastResponse['order_id'], // MerchantOrderId + 'amount' => $refundAmount ?? $lastResponse['amount'], + + // toplam siparis tutari, kismi iade mi ya da tam iade mi oldugunu anlamak icin kullanilir. + 'order_amount' => $lastResponse['amount'], + + 'currency' => $lastResponse['currency'], + 'ref_ret_num' => $lastResponse['ref_ret_num'], + 'ip' => filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ? $ip : '127.0.0.1', ]; if (\Mews\Pos\Gateways\KuveytPos::class === $gatewayClass) { @@ -89,8 +93,14 @@ function createRefundOrder(string $gatewayClass, array $lastResponse, string $ip // odemeden aldiginiz cevap: $pos->getResponse(); $lastResponse = $session->get('last_response'); + +// tam iade: +$refundAmount = $lastResponse['amount']; +// kismi iade: +$refundAmount = $lastResponse['amount'] - 2; + $ip = '127.0.0.1'; -$order = createRefundOrder(get_class($pos), $lastResponse, $ip); +$order = createRefundOrder(get_class($pos), $lastResponse, $ip, $refundAmount); $pos->refund($order); $response = $pos->getResponse(); diff --git a/examples/_common-codes/regular/refund.php b/examples/_common-codes/regular/refund.php index 9d076c56..8d2c49b6 100644 --- a/examples/_common-codes/regular/refund.php +++ b/examples/_common-codes/regular/refund.php @@ -10,14 +10,18 @@ require '../../_templates/_header.php'; -function createRefundOrder(string $gatewayClass, array $lastResponse, string $ip): array +function createRefundOrder(string $gatewayClass, array $lastResponse, string $ip, ?float $refundAmount = null): array { $refundOrder = [ - 'id' => $lastResponse['order_id'], // MerchantOrderId - 'amount' => $lastResponse['amount'], - 'currency' => $lastResponse['currency'], - 'ref_ret_num' => $lastResponse['ref_ret_num'], - 'ip' => filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ? $ip : '127.0.0.1', + 'id' => $lastResponse['order_id'], // MerchantOrderId + 'amount' => $refundAmount ?? $lastResponse['amount'], + + // toplam siparis tutari, kismi iade mi ya da tam iade mi oldugunu anlamak icin kullanilir. + 'order_amount' => $lastResponse['amount'], + + 'currency' => $lastResponse['currency'], + 'ref_ret_num' => $lastResponse['ref_ret_num'], + 'ip' => filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ? $ip : '127.0.0.1', ]; if (\Mews\Pos\Gateways\KuveytPos::class === $gatewayClass) { @@ -53,8 +57,17 @@ function createRefundOrder(string $gatewayClass, array $lastResponse, string $ip return $refundOrder; } +$lastResponse = $session->get('last_response'); +// kismi iade: +$refundAmount = $lastResponse['amount'] - 2; + -$order = createRefundOrder(get_class($pos), $session->get('last_response'), $ip); +$order = createRefundOrder( + get_class($pos), + $lastResponse, + $ip, + $refundAmount +); dump($order); $transaction = PosInterface::TX_TYPE_REFUND; diff --git a/src/DataMapper/RequestDataMapper/KuveytPosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/KuveytPosRequestDataMapper.php index 1f5dcc32..739dd145 100644 --- a/src/DataMapper/RequestDataMapper/KuveytPosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/KuveytPosRequestDataMapper.php @@ -277,7 +277,6 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o 'RRN' => $order['ref_ret_num'], 'Stan' => $order['transaction_id'], 'ProvisionNumber' => $order['auth_code'], - 'TransactionType' => 0, 'VPosMessage' => $this->getRequestAccountData($posAccount) + [ 'APIVersion' => self::API_VERSION, 'InstallmentMaturityCommisionFlag' => 0, @@ -314,6 +313,9 @@ public function createRefundRequestData(AbstractPosAccount $posAccount, array $o { $order = $this->prepareRefundOrder($order); + $isPartialRefund = isset($order['order_amount']) && $order['order_amount'] > $order['amount']; + $txType = $isPartialRefund ? 'PartialDrawback' : $this->mapTxType(PosInterface::TX_TYPE_REFUND); + $result = [ 'IsFromExternalNetwork' => true, 'BusinessKey' => 0, @@ -328,7 +330,6 @@ public function createRefundRequestData(AbstractPosAccount $posAccount, array $o 'RRN' => $order['ref_ret_num'], 'Stan' => $order['transaction_id'], 'ProvisionNumber' => $order['auth_code'], - 'TransactionType' => 0, 'VPosMessage' => $this->getRequestAccountData($posAccount) + [ 'APIVersion' => self::API_VERSION, 'InstallmentMaturityCommisionFlag' => 0, @@ -336,7 +337,7 @@ public function createRefundRequestData(AbstractPosAccount $posAccount, array $o 'SubMerchantId' => 0, 'CardType' => $this->cardTypeMapping[CreditCardInterface::CARD_TYPE_VISA], //Default gönderilebilir. 'BatchID' => 0, - 'TransactionType' => $this->mapTxType(PosInterface::TX_TYPE_REFUND), + 'TransactionType' => $txType, 'InstallmentCount' => 0, 'Amount' => $this->formatAmount($order['amount']), 'DisplayAmount' => 0, @@ -465,6 +466,7 @@ protected function prepareRefundOrder(array $order): array 'auth_code' => $order['auth_code'], 'transaction_id' => $order['transaction_id'], 'amount' => $order['amount'], + 'order_amount' => $order['order_amount'] ?? null, 'currency' => $order['currency'] ?? PosInterface::CURRENCY_TRY, ]); } diff --git a/src/Gateways/KuveytPos.php b/src/Gateways/KuveytPos.php index d27a6429..0360aaf8 100644 --- a/src/Gateways/KuveytPos.php +++ b/src/Gateways/KuveytPos.php @@ -207,7 +207,6 @@ public function make3DPayment(Request $request, array $order, string $txType, Cr * * @return array * - * @throws UnsupportedTransactionTypeException * @throws SoapFault */ protected function send($contents, string $txType, string $paymentModel, string $url): array @@ -244,7 +243,6 @@ protected function send($contents, string $txType, string $paymentModel, string * * @throws SoapFault * @throws RuntimeException - * @throws UnsupportedTransactionTypeException */ private function sendSoapRequest(array $contents, string $txType, string $url): array { @@ -276,7 +274,10 @@ private function sendSoapRequest(array $contents, string $txType, string $url): $client = new SoapClient($url, $options); try { - $result = $client->__soapCall($this->requestDataMapper->mapTxType($txType), ['parameters' => ['request' => $contents]]); + $result = $client->__soapCall( + $contents['VPosMessage']['TransactionType'], + ['parameters' => ['request' => $contents]] + ); } catch (SoapFault $throwable) { $this->logger->error('soap error response', [ 'message' => $throwable->getMessage(), diff --git a/tests/Functional/KuveytPosTest.php b/tests/Functional/KuveytPosTest.php index 73f53561..95274b51 100644 --- a/tests/Functional/KuveytPosTest.php +++ b/tests/Functional/KuveytPosTest.php @@ -171,7 +171,7 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro } /** - * @depends testRefundFail + * @depends testFullRefundFail */ public function testCancelSuccess(array $lastResponse): array { @@ -183,7 +183,7 @@ public function testCancelSuccess(array $lastResponse): array function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThrown): void { $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_CANCEL, $requestDataPreparedEvent->getTxType()); - $this->assertCount(15, $requestDataPreparedEvent->getRequestData()); + $this->assertCount(14, $requestDataPreparedEvent->getRequestData()); }); $this->pos->cancel($statusOrder); @@ -224,13 +224,63 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThro return $lastResponse; } + public function testNonSecurePaymentSuccessForRefundTest(): array + { + $order = $this->createPaymentOrder(PosInterface::MODEL_NON_SECURE); + + $this->pos->payment( + PosInterface::MODEL_NON_SECURE, + $order, + PosInterface::TX_TYPE_PAY_AUTH, + $this->card + ); + + $this->assertTrue($this->pos->isSuccess()); + + return $this->pos->getResponse(); + } + +// /** +// * @depends testNonSecurePaymentSuccessForRefundTest +// */ +// public function testFullRefundFail(array $lastResponse): array +// { +// $refundOrder = $this->createRefundOrder(\get_class($this->pos), $lastResponse); +// +// $eventIsThrown = false; +// $this->eventDispatcher->addListener( +// RequestDataPreparedEvent::class, +// function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThrown): void { +// $eventIsThrown = true; +// $this->assertSame(PosInterface::TX_TYPE_REFUND, $requestDataPreparedEvent->getTxType()); +// $this->assertCount(14, $requestDataPreparedEvent->getRequestData()); +// }); +// +// $this->pos->refund($refundOrder); +// +// $this->assertFalse($this->pos->isSuccess()); +// $response = $this->pos->getResponse(); +// $this->assertIsArray($response); +// $this->assertNotEmpty($response); +// $this->assertTrue($eventIsThrown); +// $this->assertSame( +// 'İade işlemi, satışla aynı gün içerisinde yapılamaz. İptal işlemi yapabilirsiniz.', +// $response['error_message'] +// ); +// +// return $lastResponse; +// } + /** - * @depends testNonSecurePaymentSuccess + * @depends testNonSecurePaymentSuccessForRefundTest */ - public function testRefundFail(array $lastResponse): array + public function testPartialRefundSuccess(array $lastResponse): array { - $refundOrder = $this->createRefundOrder(\get_class($this->pos), $lastResponse); - $refundOrder['amount'] = 1.0; + $refundOrder = $this->createRefundOrder( + \get_class($this->pos), + $lastResponse, + $lastResponse['amount'] - 3, + ); $eventIsThrown = false; $this->eventDispatcher->addListener( @@ -238,20 +288,16 @@ public function testRefundFail(array $lastResponse): array function (RequestDataPreparedEvent $requestDataPreparedEvent) use (&$eventIsThrown): void { $eventIsThrown = true; $this->assertSame(PosInterface::TX_TYPE_REFUND, $requestDataPreparedEvent->getTxType()); - $this->assertCount(15, $requestDataPreparedEvent->getRequestData()); + $this->assertCount(14, $requestDataPreparedEvent->getRequestData()); }); $this->pos->refund($refundOrder); - - $this->assertFalse($this->pos->isSuccess()); $response = $this->pos->getResponse(); + + $this->assertTrue($this->pos->isSuccess(), $response['error_message'] ?? 'error'); $this->assertIsArray($response); $this->assertNotEmpty($response); $this->assertTrue($eventIsThrown); - $this->assertSame( - 'İade işlemi, satışla aynı gün içerisinde yapılamaz. İptal işlemi yapabilirsiniz.', - $response['error_message'] - ); return $lastResponse; } diff --git a/tests/Functional/PaymentTestTrait.php b/tests/Functional/PaymentTestTrait.php index a58e3714..60144077 100644 --- a/tests/Functional/PaymentTestTrait.php +++ b/tests/Functional/PaymentTestTrait.php @@ -288,14 +288,15 @@ private function createHistoryOrder(string $gatewayClass, array $extraData): arr return []; } - private function createRefundOrder(string $gatewayClass, array $lastResponse): array + private function createRefundOrder(string $gatewayClass, array $lastResponse, ?float $refundAmount = null): array { $refundOrder = [ - 'id' => $lastResponse['order_id'], // MerchantOrderId - 'amount' => $lastResponse['amount'], - 'currency' => $lastResponse['currency'], - 'ref_ret_num' => $lastResponse['ref_ret_num'], - 'ip' => '127.0.0.1', + 'id' => $lastResponse['order_id'], // MerchantOrderId + 'amount' => $refundAmount ?? $lastResponse['amount'], + 'order_amount' => $lastResponse['amount'], + 'currency' => $lastResponse['currency'], + 'ref_ret_num' => $lastResponse['ref_ret_num'], + 'ip' => '127.0.0.1', ]; if (\Mews\Pos\Gateways\KuveytPos::class === $gatewayClass) { diff --git a/tests/Unit/DataMapper/RequestDataMapper/KuveytPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/KuveytPosRequestDataMapperTest.php index 718ee119..bfe66992 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/KuveytPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/KuveytPosRequestDataMapperTest.php @@ -353,7 +353,6 @@ public static function createCancelRequestDataProvider(): iterable 'RRN' => '318923298433', 'Stan' => '298433', 'ProvisionNumber' => '241839', - 'TransactionType' => 0, 'VPosMessage' => [ 'APIVersion' => KuveytPosRequestDataMapper::API_VERSION, 'InstallmentMaturityCommisionFlag' => 0, @@ -385,7 +384,7 @@ public static function createCancelRequestDataProvider(): iterable public static function createRefundRequestDataProvider(): Generator { yield [ - 'order' => [ + 'full_order' => [ 'id' => '2023070849CD', 'remote_order_id' => '114293600', 'ref_ret_num' => '318923298433', @@ -394,7 +393,7 @@ public static function createRefundRequestDataProvider(): Generator 'amount' => 1.01, 'currency' => PosInterface::CURRENCY_TRY, ], - 'expected' => [ + 'expected' => [ 'IsFromExternalNetwork' => true, 'BusinessKey' => 0, 'ResourceId' => 0, @@ -408,7 +407,6 @@ public static function createRefundRequestDataProvider(): Generator 'RRN' => '318923298433', 'Stan' => '298433', 'ProvisionNumber' => '241839', - 'TransactionType' => 0, 'VPosMessage' => [ 'APIVersion' => KuveytPosRequestDataMapper::API_VERSION, 'InstallmentMaturityCommisionFlag' => 0, @@ -435,6 +433,58 @@ public static function createRefundRequestDataProvider(): Generator ], ], ]; + + yield [ + 'partial_refund' => [ + 'id' => '2023070849CD', + 'remote_order_id' => '114293600', + 'ref_ret_num' => '318923298433', + 'auth_code' => '241839', + 'transaction_id' => '298433', + 'amount' => 9.01, + 'order_amount' => 10.01, + 'currency' => PosInterface::CURRENCY_TRY, + ], + 'expected' => [ + 'IsFromExternalNetwork' => true, + 'BusinessKey' => 0, + 'ResourceId' => 0, + 'ActionId' => 0, + 'LanguageId' => 0, + 'CustomerId' => '400235', + 'MailOrTelephoneOrder' => true, + 'Amount' => 901, + 'MerchantId' => '80', + 'OrderId' => '114293600', + 'RRN' => '318923298433', + 'Stan' => '298433', + 'ProvisionNumber' => '241839', + 'VPosMessage' => [ + 'APIVersion' => KuveytPosRequestDataMapper::API_VERSION, + 'InstallmentMaturityCommisionFlag' => 0, + 'HashData' => 'request-hash', + 'MerchantId' => '80', + 'SubMerchantId' => 0, + 'CustomerId' => '400235', + 'UserName' => 'apiuser', + 'CardType' => 'Visa', + 'BatchID' => 0, + 'TransactionType' => 'PartialDrawback', + 'InstallmentCount' => 0, + 'Amount' => 901, + 'DisplayAmount' => 0, + 'CancelAmount' => 901, + 'MerchantOrderId' => '2023070849CD', + 'FECAmount' => 0, + 'CurrencyCode' => '0949', + 'QeryId' => 0, + 'DebtId' => 0, + 'SurchargeAmount' => 0, + 'SGKDebtAmount' => 0, + 'TransactionSecurity' => 1, + ], + ], + ]; } public static function createStatusRequestDataProvider(): iterable From 15cd83c85343fb55bbfb49004d28b20079fa67a7 Mon Sep 17 00:00:00 2001 From: Nuryagdy Mustapayev Date: Fri, 24 May 2024 11:46:17 +0200 Subject: [PATCH 2/3] run rector --- src/Gateways/KuveytPos.php | 6 +-- .../AkbankPosRequestDataMapperTest.php | 26 +++++------ .../EstPosRequestDataMapperTest.php | 13 +++--- .../EstV3PosRequestDataMapperTest.php | 13 +++--- .../GarantiPosRequestDataMapperTest.php | 12 +++-- .../InterPosRequestDataMapperTest.php | 12 +++-- .../PayForPosRequestDataMapperTest.php | 12 +++-- .../PosNetV1PosRequestDataMapperTest.php | 12 +++-- tests/Unit/Gateways/AkbankPosTest.php | 15 +++---- tests/Unit/Gateways/EstPosTest.php | 15 +++---- tests/Unit/Gateways/GarantiPosTest.php | 15 +++---- tests/Unit/Gateways/InterPosTest.php | 15 +++---- tests/Unit/Gateways/KuveytPosTest.php | 30 +++++-------- tests/Unit/Gateways/PayFlexCPV4PosTest.php | 15 +++---- tests/Unit/Gateways/PayFlexV4PosTest.php | 15 +++---- tests/Unit/Gateways/PayForTest.php | 15 +++---- tests/Unit/Gateways/PosNetTest.php | 45 ++++++++----------- tests/Unit/Gateways/PosNetV1PosTest.php | 15 +++---- tests/Unit/Gateways/ToslaPosTest.php | 15 +++---- tests/Unit/Gateways/VakifKatilimTest.php | 15 +++---- 20 files changed, 133 insertions(+), 198 deletions(-) diff --git a/src/Gateways/KuveytPos.php b/src/Gateways/KuveytPos.php index 0360aaf8..344f8d6f 100644 --- a/src/Gateways/KuveytPos.php +++ b/src/Gateways/KuveytPos.php @@ -278,12 +278,12 @@ private function sendSoapRequest(array $contents, string $txType, string $url): $contents['VPosMessage']['TransactionType'], ['parameters' => ['request' => $contents]] ); - } catch (SoapFault $throwable) { + } catch (SoapFault $soapFault) { $this->logger->error('soap error response', [ - 'message' => $throwable->getMessage(), + 'message' => $soapFault->getMessage(), ]); - throw $throwable; + throw $soapFault; } if (null === $result) { diff --git a/tests/Unit/DataMapper/RequestDataMapper/AkbankPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/AkbankPosRequestDataMapperTest.php index c5d2a8fb..5df8d1d2 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/AkbankPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/AkbankPosRequestDataMapperTest.php @@ -148,14 +148,11 @@ public function testGet3DFormData(array $order, string $txType, string $paymentM $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $paymentModel) { - return $dispatchedEvent instanceof Before3DFormHashCalculatedEvent - && AkbankPos::class === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $paymentModel === $dispatchedEvent->getPaymentModel() - && count($dispatchedEvent->getFormInputs()) > 3 - ; - })); + ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + && AkbankPos::class === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $paymentModel === $dispatchedEvent->getPaymentModel() + && count($dispatchedEvent->getFormInputs()) > 3)); $actual = $this->requestDataMapper->create3DFormData( $this->account, @@ -213,14 +210,11 @@ public function testGet3DFormDataSubMerchant(): void $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $paymentModel) { - return $dispatchedEvent instanceof Before3DFormHashCalculatedEvent - && AkbankPos::class === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $paymentModel === $dispatchedEvent->getPaymentModel() - && count($dispatchedEvent->getFormInputs()) > 3 - ; - })); + ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + && AkbankPos::class === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $paymentModel === $dispatchedEvent->getPaymentModel() + && count($dispatchedEvent->getFormInputs()) > 3)); $actual = $this->requestDataMapper->create3DFormData( $this->subMerchantAccount, diff --git a/tests/Unit/DataMapper/RequestDataMapper/EstPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/EstPosRequestDataMapperTest.php index da26e053..5a3cf5b2 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/EstPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/EstPosRequestDataMapperTest.php @@ -223,14 +223,11 @@ public function testGet3DFormData( $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $paymentModel) { - return $dispatchedEvent instanceof Before3DFormHashCalculatedEvent - && EstPos::class === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $paymentModel === $dispatchedEvent->getPaymentModel() - && count($dispatchedEvent->getFormInputs()) > 3 - ; - })); + ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + && EstPos::class === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $paymentModel === $dispatchedEvent->getPaymentModel() + && count($dispatchedEvent->getFormInputs()) > 3)); $actual = $this->requestDataMapper->create3DFormData( $this->account, diff --git a/tests/Unit/DataMapper/RequestDataMapper/EstV3PosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/EstV3PosRequestDataMapperTest.php index 837fb7c3..5e6367f7 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/EstV3PosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/EstV3PosRequestDataMapperTest.php @@ -77,14 +77,11 @@ public function testGet3DFormData( $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $paymentModel) { - return $dispatchedEvent instanceof Before3DFormHashCalculatedEvent - && EstV3Pos::class === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $paymentModel === $dispatchedEvent->getPaymentModel() - && count($dispatchedEvent->getFormInputs()) > 3 - ; - })); + ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + && EstV3Pos::class === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $paymentModel === $dispatchedEvent->getPaymentModel() + && count($dispatchedEvent->getFormInputs()) > 3)); $actual = $this->requestDataMapper->create3DFormData( $this->account, diff --git a/tests/Unit/DataMapper/RequestDataMapper/GarantiPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/GarantiPosRequestDataMapperTest.php index 15c309f7..21cae2a2 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/GarantiPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/GarantiPosRequestDataMapperTest.php @@ -240,13 +240,11 @@ public function testGet3DFormData(): void $paymentModel = PosInterface::MODEL_3D_SECURE; $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $paymentModel) { - return $dispatchedEvent instanceof Before3DFormHashCalculatedEvent - && GarantiPos::class === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $paymentModel === $dispatchedEvent->getPaymentModel() - && count($dispatchedEvent->getFormInputs()) > 3; - })); + ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + && GarantiPos::class === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $paymentModel === $dispatchedEvent->getPaymentModel() + && count($dispatchedEvent->getFormInputs()) > 3)); $actual = $this->requestDataMapper->create3DFormData( $this->account, diff --git a/tests/Unit/DataMapper/RequestDataMapper/InterPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/InterPosRequestDataMapperTest.php index b60255fd..03b77856 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/InterPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/InterPosRequestDataMapperTest.php @@ -219,13 +219,11 @@ public function testGet3DFormData( $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $paymentModel) { - return $dispatchedEvent instanceof Before3DFormHashCalculatedEvent - && InterPos::class === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $paymentModel === $dispatchedEvent->getPaymentModel() - && count($dispatchedEvent->getFormInputs()) > 3; - })); + ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + && InterPos::class === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $paymentModel === $dispatchedEvent->getPaymentModel() + && count($dispatchedEvent->getFormInputs()) > 3)); $actual = $this->requestDataMapper->create3DFormData( $this->account, diff --git a/tests/Unit/DataMapper/RequestDataMapper/PayForPosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/PayForPosRequestDataMapperTest.php index 5a5bb0cd..e33f8398 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/PayForPosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/PayForPosRequestDataMapperTest.php @@ -230,13 +230,11 @@ public function testGet3DFormData( $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $paymentModel) { - return $dispatchedEvent instanceof Before3DFormHashCalculatedEvent - && PayForPos::class === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $paymentModel === $dispatchedEvent->getPaymentModel() - && count($dispatchedEvent->getFormInputs()) > 3; - })); + ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + && PayForPos::class === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $paymentModel === $dispatchedEvent->getPaymentModel() + && count($dispatchedEvent->getFormInputs()) > 3)); $actual = $this->requestDataMapper->create3DFormData( $this->account, diff --git a/tests/Unit/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapperTest.php b/tests/Unit/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapperTest.php index 43bcda0b..e1031aaa 100644 --- a/tests/Unit/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapperTest.php +++ b/tests/Unit/DataMapper/RequestDataMapper/PosNetV1PosRequestDataMapperTest.php @@ -186,13 +186,11 @@ public function testCreate3DFormData(array $order, string $txType, string $gatew $paymentModel = PosInterface::MODEL_3D_SECURE; $this->dispatcher->expects(self::once()) ->method('dispatch') - ->with($this->callback(function ($dispatchedEvent) use ($txType, $paymentModel) { - return $dispatchedEvent instanceof Before3DFormHashCalculatedEvent - && PosNetV1Pos::class === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $paymentModel === $dispatchedEvent->getPaymentModel() - && count($dispatchedEvent->getFormInputs()) > 3; - })); + ->with($this->callback(static fn($dispatchedEvent): bool => $dispatchedEvent instanceof Before3DFormHashCalculatedEvent + && PosNetV1Pos::class === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $paymentModel === $dispatchedEvent->getPaymentModel() + && count($dispatchedEvent->getFormInputs()) > 3)); $actual = $this->requestDataMapper->create3DFormData( $this->account, diff --git a/tests/Unit/Gateways/AkbankPosTest.php b/tests/Unit/Gateways/AkbankPosTest.php index a1b0b5ac..c454e32c 100644 --- a/tests/Unit/Gateways/AkbankPosTest.php +++ b/tests/Unit/Gateways/AkbankPosTest.php @@ -903,14 +903,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 eb2713b4..3a70de9a 100644 --- a/tests/Unit/Gateways/EstPosTest.php +++ b/tests/Unit/Gateways/EstPosTest.php @@ -722,14 +722,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 e3f95bd5..c29803fa 100644 --- a/tests/Unit/Gateways/GarantiPosTest.php +++ b/tests/Unit/Gateways/GarantiPosTest.php @@ -625,14 +625,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 42d66bce..e8d17011 100644 --- a/tests/Unit/Gateways/InterPosTest.php +++ b/tests/Unit/Gateways/InterPosTest.php @@ -594,14 +594,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 c900c100..103aff46 100644 --- a/tests/Unit/Gateways/KuveytPosTest.php +++ b/tests/Unit/Gateways/KuveytPosTest.php @@ -286,15 +286,12 @@ public function testMake3DPayment( $paymentModel = PosInterface::MODEL_3D_SECURE; $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $dispatchedEvent instanceof RequestDataPreparedEvent + && get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $create3DPaymentRequestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel())); $this->serializerMock->expects(self::once()) ->method('encode') @@ -556,14 +553,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 d6adf81e..b98b7e3b 100644 --- a/tests/Unit/Gateways/PayFlexCPV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexCPV4PosTest.php @@ -606,14 +606,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 3cb5b433..cb0cef3f 100644 --- a/tests/Unit/Gateways/PayFlexV4PosTest.php +++ b/tests/Unit/Gateways/PayFlexV4PosTest.php @@ -658,14 +658,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 ebee9a6c..50ec1c45 100644 --- a/tests/Unit/Gateways/PayForTest.php +++ b/tests/Unit/Gateways/PayForTest.php @@ -710,14 +710,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 5a69e42d..ea16862e 100644 --- a/tests/Unit/Gateways/PosNetTest.php +++ b/tests/Unit/Gateways/PosNetTest.php @@ -293,24 +293,18 @@ public function testMake3DPayment( ->method('dispatch') // could not find another way expect using deprecated withConsecutive() function ->withConsecutive( - [$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, $paymentModel) { - return $dispatchedEvent instanceof RequestDataPreparedEvent - && get_class($this->pos) === $dispatchedEvent->getGatewayClass() - && $txType === $dispatchedEvent->getTxType() - && $create3DPaymentRequestData === $dispatchedEvent->getRequestData() - && $order === $dispatchedEvent->getOrder() - && $paymentModel === $dispatchedEvent->getPaymentModel() - ; - })] + [$this->callback(fn($dispatchedEvent): bool => $dispatchedEvent instanceof RequestDataPreparedEvent + && get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $resolveMerchantRequestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel())], + [$this->callback(fn($dispatchedEvent): bool => $dispatchedEvent instanceof RequestDataPreparedEvent + && get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $create3DPaymentRequestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel())] ); $this->responseMapperMock->expects(self::once()) @@ -688,14 +682,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 6ccc040b..53bab61a 100644 --- a/tests/Unit/Gateways/PosNetV1PosTest.php +++ b/tests/Unit/Gateways/PosNetV1PosTest.php @@ -638,14 +638,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 ea80211b..9bd8a0ec 100644 --- a/tests/Unit/Gateways/ToslaPosTest.php +++ b/tests/Unit/Gateways/ToslaPosTest.php @@ -897,14 +897,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $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 bad22549..46c0120b 100644 --- a/tests/Unit/Gateways/VakifKatilimTest.php +++ b/tests/Unit/Gateways/VakifKatilimTest.php @@ -827,14 +827,11 @@ private function configureClientResponse( $this->eventDispatcherMock->expects(self::once()) ->method('dispatch') - ->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() - ; - })); + ->with($this->callback(fn($dispatchedEvent): bool => $dispatchedEvent instanceof RequestDataPreparedEvent + && get_class($this->pos) === $dispatchedEvent->getGatewayClass() + && $txType === $dispatchedEvent->getTxType() + && $requestData === $dispatchedEvent->getRequestData() + && $order === $dispatchedEvent->getOrder() + && $paymentModel === $dispatchedEvent->getPaymentModel())); } } From c6eb2535c33c3907e72bdf306f9af2469081a4ce Mon Sep 17 00:00:00 2001 From: Nuryagdy Mustapayev Date: Fri, 24 May 2024 11:42:05 +0200 Subject: [PATCH 3/3] updated CHANGELOG.md --- composer.json | 4 ++-- docs/CHANGELOG.md | 13 +++++++++++++ .../AkbankPosRequestDataMapper.php | 3 +++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 116c0a9b..8e665d4e 100644 --- a/composer.json +++ b/composer.json @@ -39,10 +39,10 @@ "escapestudios/symfony2-coding-standard": "^3.11", "monolog/monolog": "^2.8", "php-http/curl-client": "^2.2", - "phpstan/phpstan": "^1.9", + "phpstan/phpstan": "^1.11", "phpstan/phpstan-strict-rules": "^1.4", "phpunit/phpunit": "^9", - "rector/rector": "^1.0", + "rector/rector": "^1.1", "slim/psr7": "^1.4", "squizlabs/php_codesniffer": "^3.5", "symfony/event-dispatcher": "^5.4", diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 272c032f..e06e9287 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,16 @@ +# Changelog +## [1.3.0] - 2024-05-24 + +### New Features +- **KuveytPos** kısmi iade desteği eklendi. (issue #205) +- **EstPos/Payten** ön otorizasyonu kapatırken daha fazla miktar desteği eklendi. (issue #171) + +### Changed +- Dispatched event'lere **gatewayClass**, **order**, **paymenModel** verileri eklendi. + +### Fixed +- **PosNet** - 3D Secure ödeme başarısız olduğunda `3d_all` boş olması giderildi. + # Changelog ## [1.2.0] - 2024-05-19 diff --git a/src/DataMapper/RequestDataMapper/AkbankPosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/AkbankPosRequestDataMapper.php index 2d2fe6ed..b070454d 100644 --- a/src/DataMapper/RequestDataMapper/AkbankPosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/AkbankPosRequestDataMapper.php @@ -254,6 +254,9 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o } /** + * Eğer kısmi tutarlı iade işlemi yapılmak isteniyorsa, iade işlemi requestinde transaction alanı gönderilmelidir. + * Eğer transaction alanı gönderilmezse, iade işlemi tam tutarlı olarak gerçekleşecektir. + * * @param AkbankPosAccount $posAccount * * {@inheritDoc}