diff --git a/UPGRADE-2.3.md b/UPGRADE-2.3.md index 065ab29bd2..474fe538f5 100644 --- a/UPGRADE-2.3.md +++ b/UPGRADE-2.3.md @@ -44,6 +44,33 @@ (`identity_generation_preferences` for `PostgreSQLPlatform`) to keep the database schema backward compatible with existing installations. +3. The `_sylius: redirect:` block has been removed from the `sylius_shop_order_pay` route definition. + + Previously, `PayumPayResponseProvider` read the after-pay redirect route at runtime from the routing metadata: + + ```yaml + # ShopBundle/Resources/config/routing/order.yml (removed) + sylius_shop_order_pay: + defaults: + _sylius: + redirect: + route: sylius_shop_order_after_pay + ``` + + The redirect route is now resolved from the `sylius_shop` bundle configuration at compile time. + If you customized the after-pay redirect route for Payum, use the dedicated Payum configuration keys instead: + + ```yaml + sylius_shop: + order_pay: + payum_after_pay_route: sylius_shop_order_after_pay + payum_after_pay_route_parameters: [] + ``` + + > **Note:** The `after_pay_route` and `after_pay_route_parameters` keys are reserved for the Payment Request flow + > and their default parameters include Payment Request-specific values (e.g. `hash: paymentRequest.getHash()`). + > Do not use them to configure the Payum after-pay redirect. + ## Dependencies 1. The `behat/transliterator` package has been **deprecated** and will be removed in Sylius 3.0. diff --git a/src/Sylius/Bundle/ApiBundle/Serializer/Normalizer/ProductVariantNormalizer.php b/src/Sylius/Bundle/ApiBundle/Serializer/Normalizer/ProductVariantNormalizer.php index 5780697765..8c2515215d 100644 --- a/src/Sylius/Bundle/ApiBundle/Serializer/Normalizer/ProductVariantNormalizer.php +++ b/src/Sylius/Bundle/ApiBundle/Serializer/Normalizer/ProductVariantNormalizer.php @@ -39,7 +39,7 @@ final class ProductVariantNormalizer implements NormalizerInterface, NormalizerA private const ALREADY_CALLED = 'sylius_product_variant_normalizer_already_called'; public function __construct( - private readonly ProductVariantPricesCalculatorInterface|CatalogPricesCalculatorInterface $priceCalculator, + private readonly CatalogPricesCalculatorInterface|ProductVariantPricesCalculatorInterface $priceCalculator, private readonly AvailabilityCheckerInterface $availabilityChecker, private readonly SectionProviderInterface $uriBasedSectionContext, private readonly IriConverterInterface $iriConverter, diff --git a/src/Sylius/Bundle/ApiBundle/tests/Serializer/Normalizer/ProductVariantNormalizerTest.php b/src/Sylius/Bundle/ApiBundle/tests/Serializer/Normalizer/ProductVariantNormalizerTest.php index 5e3c122061..141fa858f2 100644 --- a/src/Sylius/Bundle/ApiBundle/tests/Serializer/Normalizer/ProductVariantNormalizerTest.php +++ b/src/Sylius/Bundle/ApiBundle/tests/Serializer/Normalizer/ProductVariantNormalizerTest.php @@ -34,7 +34,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; final class ProductVariantNormalizerTest extends TestCase { - private MockObject&CatalogPricesCalculatorInterface $pricesCalculator; + private CatalogPricesCalculatorInterface&MockObject $pricesCalculator; private AvailabilityCheckerInterface&MockObject $availabilityChecker; diff --git a/src/Sylius/Bundle/CoreBundle/Twig/PriceExtension.php b/src/Sylius/Bundle/CoreBundle/Twig/PriceExtension.php index 4eeafe3530..c1d090c1c8 100644 --- a/src/Sylius/Bundle/CoreBundle/Twig/PriceExtension.php +++ b/src/Sylius/Bundle/CoreBundle/Twig/PriceExtension.php @@ -23,7 +23,7 @@ use Webmozart\Assert\Assert; final class PriceExtension extends AbstractExtension { public function __construct( - private readonly ProductVariantPricesCalculatorInterface|CatalogPricesCalculatorInterface $productVariantPricesCalculator, + private readonly CatalogPricesCalculatorInterface|ProductVariantPricesCalculatorInterface $productVariantPricesCalculator, ) { if (!$this->productVariantPricesCalculator instanceof CatalogPricesCalculatorInterface) { trigger_deprecation( diff --git a/src/Sylius/Bundle/PayumBundle/OrderPay/Provider/PayumPayResponseProvider.php b/src/Sylius/Bundle/PayumBundle/OrderPay/Provider/PayumPayResponseProvider.php index 9b0e9d68b3..0dfcba92f5 100644 --- a/src/Sylius/Bundle/PayumBundle/OrderPay/Provider/PayumPayResponseProvider.php +++ b/src/Sylius/Bundle/PayumBundle/OrderPay/Provider/PayumPayResponseProvider.php @@ -29,9 +29,14 @@ use Webmozart\Assert\Assert; /** @experimental */ final class PayumPayResponseProvider implements PayResponseProviderInterface { + /** + * @param array $afterPayUrlParameters + */ public function __construct( private Payum $payum, private PaymentToPayResolverInterface $paymentToPayResolver, + private readonly ?string $afterPayUrlRoute = null, + private readonly array $afterPayUrlParameters = [], ) { } @@ -42,13 +47,7 @@ final class PayumPayResponseProvider implements PayResponseProviderInterface $payment = $this->paymentToPayResolver->getPayment($order); Assert::notNull($payment, sprintf('Order (id %s) must have last payment in state "new".', $order->getId())); - $redirectOptions = $requestConfiguration->getParameters()->get('redirect'); - if (is_string($redirectOptions)) { - $redirectOptions = [ - 'route' => $redirectOptions, - ]; - } - $token = $this->provideTokenBasedOnPayment($payment, $redirectOptions); + $token = $this->provideTokenBasedOnPayment($payment); return new RedirectResponse($token->getTargetUrl()); } @@ -74,10 +73,7 @@ final class PayumPayResponseProvider implements PayResponseProviderInterface return $gatewayConfig->getUsePayum(); } - /** - * @param array{route: ?string, parameters: ?string[]} $redirectOptions - */ - private function provideTokenBasedOnPayment(PaymentInterface $payment, array $redirectOptions): TokenInterface + private function provideTokenBasedOnPayment(PaymentInterface $payment): TokenInterface { $gatewayConfig = $this->getGatewayConfigFromPayment($payment); Assert::notNull($gatewayConfig, 'An existing gateway config must exist.'); @@ -89,16 +85,16 @@ final class PayumPayResponseProvider implements PayResponseProviderInterface return $tokenFactory->createAuthorizeToken( $gatewayConfig->getGatewayName(), $payment, - $redirectOptions['route'] ?? null, - $redirectOptions['parameters'] ?? [], + $this->afterPayUrlRoute, + $this->afterPayUrlParameters, ); } return $tokenFactory->createCaptureToken( $gatewayConfig->getGatewayName(), $payment, - $redirectOptions['route'] ?? null, - $redirectOptions['parameters'] ?? [], + $this->afterPayUrlRoute, + $this->afterPayUrlParameters, ); } diff --git a/src/Sylius/Bundle/PayumBundle/Resources/config/services/integrations/sylius_shop/order_pay/providers.php b/src/Sylius/Bundle/PayumBundle/Resources/config/services/integrations/sylius_shop/order_pay/providers.php index 1644935001..9b073aab10 100644 --- a/src/Sylius/Bundle/PayumBundle/Resources/config/services/integrations/sylius_shop/order_pay/providers.php +++ b/src/Sylius/Bundle/PayumBundle/Resources/config/services/integrations/sylius_shop/order_pay/providers.php @@ -19,7 +19,11 @@ return static function (ContainerConfigurator $container) { $services ->set('sylius_shop.provider.order_pay.pay_response.payum') ->parent('sylius_payum.provider.order_pay.pay_response') - ->args([service('sylius_shop.resolver.order_pay.payment_to_pay')]) + ->args([ + service('sylius_shop.resolver.order_pay.payment_to_pay'), + '%sylius_shop.order_pay.payum_after_pay_route%', + '%sylius_shop.order_pay.payum_after_pay_route_parameters%', + ]) ->tag('sylius_shop.provider.order_pay.pay_response', ['priority' => -200]) ; diff --git a/src/Sylius/Bundle/PayumBundle/tests/OrderPay/Provider/PayumPayResponseProviderTest.php b/src/Sylius/Bundle/PayumBundle/tests/OrderPay/Provider/PayumPayResponseProviderTest.php new file mode 100644 index 0000000000..02aea06342 --- /dev/null +++ b/src/Sylius/Bundle/PayumBundle/tests/OrderPay/Provider/PayumPayResponseProviderTest.php @@ -0,0 +1,186 @@ +payum = $this->createMock(Payum::class); + $this->paymentToPayResolver = $this->createMock(PaymentToPayResolverInterface::class); + $this->tokenFactory = $this->createMock(GenericTokenFactoryInterface::class); + + $this->provider = new PayumPayResponseProvider( + $this->payum, + $this->paymentToPayResolver, + 'app_shop_order_after_pay', + ['tokenValue' => 'fixed-token-value'], + ); + } + + public function testItCreatesCaptureTokenWithConfiguredAfterPayRouteAndParameters(): void + { + $requestConfiguration = $this->createStub(RequestConfiguration::class); + $order = $this->createOrder(); + $payment = $this->createPaymentWithGatewayConfig(['use_authorize' => false]); + $token = $this->createMock(TokenInterface::class); + + $this->paymentToPayResolver + ->expects(self::once()) + ->method('getPayment') + ->with($order) + ->willReturn($payment) + ; + $this->payum->expects(self::once())->method('getTokenFactory')->willReturn($this->tokenFactory); + $this->tokenFactory + ->expects(self::once()) + ->method('createCaptureToken') + ->with( + 'offline', + $payment, + 'app_shop_order_after_pay', + ['tokenValue' => 'fixed-token-value'], + ) + ->willReturn($token) + ; + $this->tokenFactory->expects(self::never())->method('createAuthorizeToken'); + $token->expects(self::once())->method('getTargetUrl')->willReturn('/payum/capture'); + + $response = $this->provider->getResponse($requestConfiguration, $order); + + self::assertInstanceOf(RedirectResponse::class, $response); + self::assertSame('/payum/capture', $response->getTargetUrl()); + } + + public function testItCreatesAuthorizeTokenWithConfiguredAfterPayRouteAndParameters(): void + { + $requestConfiguration = $this->createStub(RequestConfiguration::class); + $order = $this->createOrder(); + $payment = $this->createPaymentWithGatewayConfig(['use_authorize' => true]); + $token = $this->createMock(TokenInterface::class); + + $this->paymentToPayResolver + ->expects(self::once()) + ->method('getPayment') + ->with($order) + ->willReturn($payment) + ; + $this->payum->expects(self::once())->method('getTokenFactory')->willReturn($this->tokenFactory); + $this->tokenFactory + ->expects(self::once()) + ->method('createAuthorizeToken') + ->with( + 'offline', + $payment, + 'app_shop_order_after_pay', + ['tokenValue' => 'fixed-token-value'], + ) + ->willReturn($token) + ; + $this->tokenFactory->expects(self::never())->method('createCaptureToken'); + $token->expects(self::once())->method('getTargetUrl')->willReturn('/payum/authorize'); + + $response = $this->provider->getResponse($requestConfiguration, $order); + + self::assertInstanceOf(RedirectResponse::class, $response); + self::assertSame('/payum/authorize', $response->getTargetUrl()); + } + + public function testItSupportsOrdersWithPayumEnabledPayment(): void + { + $requestConfiguration = $this->createStub(RequestConfiguration::class); + $order = $this->createOrder(); + $payment = $this->createPaymentWithGatewayConfig([]); + + $this->paymentToPayResolver + ->expects(self::once()) + ->method('getPayment') + ->with($order) + ->willReturn($payment) + ; + + self::assertTrue($this->provider->supports($requestConfiguration, $order)); + } + + public function testItDoesNotSupportOrdersWithPayumDisabledPayment(): void + { + $requestConfiguration = $this->createStub(RequestConfiguration::class); + $order = $this->createOrder(); + $gatewayConfig = new GatewayConfig(); + $gatewayConfig->setUsePayum(false); + $payment = $this->createPayment($gatewayConfig); + + $this->paymentToPayResolver + ->expects(self::once()) + ->method('getPayment') + ->with($order) + ->willReturn($payment) + ; + + self::assertFalse($this->provider->supports($requestConfiguration, $order)); + } + + private function createOrder(): MockObject&OrderInterface + { + $order = $this->createMock(OrderInterface::class); + $order->method('getId')->willReturn(1); + + return $order; + } + + /** + * @param array $config + */ + private function createPaymentWithGatewayConfig(array $config): MockObject&PaymentInterface + { + $gatewayConfig = new GatewayConfig(); + $gatewayConfig->setGatewayName('offline'); + $gatewayConfig->setConfig($config); + + return $this->createPayment($gatewayConfig); + } + + private function createPayment(GatewayConfig $gatewayConfig): MockObject&PaymentInterface + { + $paymentMethod = $this->createMock(PaymentMethodInterface::class); + $paymentMethod->method('getGatewayConfig')->willReturn($gatewayConfig); + + $payment = $this->createMock(PaymentInterface::class); + $payment->method('getMethod')->willReturn($paymentMethod); + + return $payment; + } +} diff --git a/src/Sylius/Bundle/ShopBundle/DependencyInjection/Configuration.php b/src/Sylius/Bundle/ShopBundle/DependencyInjection/Configuration.php index 7afbf67300..ba2d66cc81 100644 --- a/src/Sylius/Bundle/ShopBundle/DependencyInjection/Configuration.php +++ b/src/Sylius/Bundle/ShopBundle/DependencyInjection/Configuration.php @@ -91,6 +91,14 @@ final class Configuration implements ConfigurationInterface ->end() ->end() ->end() + ->scalarNode('payum_after_pay_route') + ->defaultValue('sylius_shop_order_after_pay') + ->end() + ->arrayNode('payum_after_pay_route_parameters') + ->defaultValue([]) + ->useAttributeAsKey('name') + ->scalarPrototype()->end() + ->end() ->scalarNode('final_route') ->defaultValue('sylius_shop_order_thank_you') ->end() diff --git a/src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php b/src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php index 4d2e62c649..13cae41b9b 100644 --- a/src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php +++ b/src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php @@ -134,6 +134,8 @@ final class SyliusShopExtension extends Extension implements PrependExtensionInt $container->setParameter('sylius_shop.order_pay.payment_request_pay_route_parameters', $config['payment_request_pay_route_parameters']); $container->setParameter('sylius_shop.order_pay.after_pay_route', $config['after_pay_route']); $container->setParameter('sylius_shop.order_pay.after_pay_route_parameters', $config['after_pay_route_parameters']); + $container->setParameter('sylius_shop.order_pay.payum_after_pay_route', $config['payum_after_pay_route']); + $container->setParameter('sylius_shop.order_pay.payum_after_pay_route_parameters', $config['payum_after_pay_route_parameters']); $container->setParameter('sylius_shop.order_pay.final_route', $config['final_route']); $container->setParameter('sylius_shop.order_pay.final_route_parameters', $config['final_route_parameters']); $container->setParameter('sylius_shop.order_pay.retry_route', $config['retry_route']); diff --git a/src/Sylius/Bundle/ShopBundle/Resources/config/routing/order.yml b/src/Sylius/Bundle/ShopBundle/Resources/config/routing/order.yml index 293c071d3a..1e7fb21b73 100644 --- a/src/Sylius/Bundle/ShopBundle/Resources/config/routing/order.yml +++ b/src/Sylius/Bundle/ShopBundle/Resources/config/routing/order.yml @@ -14,9 +14,6 @@ sylius_shop_order_pay: methods: [GET] defaults: _controller: sylius_shop.controller.order_pay::payAction - _sylius: - redirect: - route: sylius_shop_order_after_pay sylius_shop_order_after_pay: path: /after-pay/{hash?} diff --git a/src/Sylius/Bundle/ShopBundle/Twig/Component/Product/CardComponent.php b/src/Sylius/Bundle/ShopBundle/Twig/Component/Product/CardComponent.php index de3728d799..d83e0ccb40 100644 --- a/src/Sylius/Bundle/ShopBundle/Twig/Component/Product/CardComponent.php +++ b/src/Sylius/Bundle/ShopBundle/Twig/Component/Product/CardComponent.php @@ -49,7 +49,7 @@ class CardComponent protected readonly ProductVariantResolverInterface $productVariantResolver, protected readonly ChannelContextInterface $channelContext, protected readonly LocaleContextInterface $localeContext, - protected readonly ProductVariantPricesCalculatorInterface|CatalogPricesCalculatorInterface $productVariantPricesCalculator, + protected readonly CatalogPricesCalculatorInterface|ProductVariantPricesCalculatorInterface $productVariantPricesCalculator, ) { if (!$this->productVariantPricesCalculator instanceof CatalogPricesCalculatorInterface) { trigger_deprecation( diff --git a/src/Sylius/Bundle/ShopBundle/Twig/Component/Product/PriceComponent.php b/src/Sylius/Bundle/ShopBundle/Twig/Component/Product/PriceComponent.php index f4227f0523..ec9e6cc27a 100644 --- a/src/Sylius/Bundle/ShopBundle/Twig/Component/Product/PriceComponent.php +++ b/src/Sylius/Bundle/ShopBundle/Twig/Component/Product/PriceComponent.php @@ -44,7 +44,7 @@ class PriceComponent public bool $hasDiscount = false; public function __construct( - protected readonly ProductVariantPricesCalculatorInterface|CatalogPricesCalculatorInterface $productVariantPricesCalculator, + protected readonly CatalogPricesCalculatorInterface|ProductVariantPricesCalculatorInterface $productVariantPricesCalculator, protected readonly MoneyFormatterInterface $moneyFormatter, protected readonly ChannelContextInterface $channelContext, protected readonly LocaleContextInterface $localeContext, diff --git a/src/Sylius/Bundle/ShopBundle/tests/DependencyInjection/ConfigurationTest.php b/src/Sylius/Bundle/ShopBundle/tests/DependencyInjection/ConfigurationTest.php index 2fe672cfb3..66002be8b7 100644 --- a/src/Sylius/Bundle/ShopBundle/tests/DependencyInjection/ConfigurationTest.php +++ b/src/Sylius/Bundle/ShopBundle/tests/DependencyInjection/ConfigurationTest.php @@ -149,6 +149,55 @@ final class ConfigurationTest extends TestCase ]]); } + #[Test] + public function it_has_default_configuration_for_order_pay_node(): void + { + $this->assertProcessedConfigurationEquals( + [[]], + ['order_pay' => [ + 'payment_request_pay_route' => 'sylius_shop_payment_request_pay', + 'payment_request_pay_route_parameters' => ['hash' => 'paymentRequest.getHash()'], + 'after_pay_route' => 'sylius_shop_order_after_pay', + 'after_pay_route_parameters' => ['hash' => 'paymentRequest.getHash()'], + 'payum_after_pay_route' => 'sylius_shop_order_after_pay', + 'payum_after_pay_route_parameters' => [], + 'final_route' => 'sylius_shop_order_thank_you', + 'final_route_parameters' => [], + 'retry_route' => 'sylius_shop_order_show', + 'retry_route_parameters' => ['tokenValue' => 'order.getTokenValue()'], + ]], + 'order_pay', + ); + } + + #[Test] + public function its_payum_after_pay_redirect_is_configurable(): void + { + $this->assertProcessedConfigurationEquals( + [[ + 'order_pay' => [ + 'payum_after_pay_route' => 'app_shop_order_after_pay', + 'payum_after_pay_route_parameters' => ['tokenValue' => 'fixed-token-value'], + ], + ]], + [ + 'order_pay' => [ + 'payum_after_pay_route' => 'app_shop_order_after_pay', + 'payum_after_pay_route_parameters' => ['tokenValue' => 'fixed-token-value'], + 'payment_request_pay_route' => 'sylius_shop_payment_request_pay', + 'payment_request_pay_route_parameters' => ['hash' => 'paymentRequest.getHash()'], + 'after_pay_route' => 'sylius_shop_order_after_pay', + 'after_pay_route_parameters' => ['hash' => 'paymentRequest.getHash()'], + 'final_route' => 'sylius_shop_order_thank_you', + 'final_route_parameters' => [], + 'retry_route' => 'sylius_shop_order_show', + 'retry_route_parameters' => ['tokenValue' => 'order.getTokenValue()'], + ], + ], + 'order_pay', + ); + } + protected function getConfiguration(): Configuration { return new Configuration(); diff --git a/src/Sylius/Bundle/ShopBundle/tests/DependencyInjection/SyliusShopExtensionTest.php b/src/Sylius/Bundle/ShopBundle/tests/DependencyInjection/SyliusShopExtensionTest.php index 3888dc440a..13bc7e0adb 100644 --- a/src/Sylius/Bundle/ShopBundle/tests/DependencyInjection/SyliusShopExtensionTest.php +++ b/src/Sylius/Bundle/ShopBundle/tests/DependencyInjection/SyliusShopExtensionTest.php @@ -116,6 +116,32 @@ final class SyliusShopExtensionTest extends AbstractExtensionTestCase $this->assertContainerBuilderHasParameter('sylius_shop.firewall_context_name', 'myshopfirewall'); } + #[Test] + public function it_configures_default_order_pay_parameters(): void + { + $this->load([]); + + $this->assertContainerBuilderHasParameter('sylius_shop.order_pay.payum_after_pay_route', 'sylius_shop_order_after_pay'); + $this->assertContainerBuilderHasParameter('sylius_shop.order_pay.payum_after_pay_route_parameters', []); + } + + #[Test] + public function it_configures_order_pay_parameters(): void + { + $this->load([ + 'order_pay' => [ + 'payum_after_pay_route' => 'app_shop_order_after_pay', + 'payum_after_pay_route_parameters' => ['tokenValue' => 'fixed-token-value'], + ], + ]); + + $this->assertContainerBuilderHasParameter('sylius_shop.order_pay.payum_after_pay_route', 'app_shop_order_after_pay'); + $this->assertContainerBuilderHasParameter( + 'sylius_shop.order_pay.payum_after_pay_route_parameters', + ['tokenValue' => 'fixed-token-value'], + ); + } + #[Test] public function it_prepends_sylius_theme_configuration_with_channel_based_context(): void { diff --git a/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantLowestPriceMapProvider.php b/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantLowestPriceMapProvider.php index 44c11e226d..5a49d3c376 100644 --- a/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantLowestPriceMapProvider.php +++ b/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantLowestPriceMapProvider.php @@ -21,7 +21,7 @@ use Sylius\Component\Core\Model\ProductVariantInterface; final readonly class ProductVariantLowestPriceMapProvider implements ProductVariantMapProviderInterface { public function __construct( - private ProductVariantPricesCalculatorInterface|CatalogPricesCalculatorInterface $calculator, + private CatalogPricesCalculatorInterface|ProductVariantPricesCalculatorInterface $calculator, ) { if (!$this->calculator instanceof CatalogPricesCalculatorInterface) { trigger_deprecation( diff --git a/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantOriginalPriceMapProvider.php b/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantOriginalPriceMapProvider.php index 2e658af3a3..9dc63daafa 100644 --- a/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantOriginalPriceMapProvider.php +++ b/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantOriginalPriceMapProvider.php @@ -21,7 +21,7 @@ use Sylius\Component\Core\Model\ProductVariantInterface; final class ProductVariantOriginalPriceMapProvider implements ProductVariantMapProviderInterface { public function __construct( - private ProductVariantPricesCalculatorInterface|CatalogPricesCalculatorInterface $calculator, + private CatalogPricesCalculatorInterface|ProductVariantPricesCalculatorInterface $calculator, ) { if (!$this->calculator instanceof CatalogPricesCalculatorInterface) { trigger_deprecation( diff --git a/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantPriceMapProvider.php b/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantPriceMapProvider.php index 95e30588f1..67a39f99e3 100644 --- a/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantPriceMapProvider.php +++ b/src/Sylius/Component/Core/Provider/ProductVariantMap/ProductVariantPriceMapProvider.php @@ -21,7 +21,7 @@ use Sylius\Component\Core\Model\ProductVariantInterface; final class ProductVariantPriceMapProvider implements ProductVariantMapProviderInterface { public function __construct( - private ProductVariantPricesCalculatorInterface|CatalogPricesCalculatorInterface $calculator, + private CatalogPricesCalculatorInterface|ProductVariantPricesCalculatorInterface $calculator, ) { if (!$this->calculator instanceof CatalogPricesCalculatorInterface) { trigger_deprecation( diff --git a/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantLowestPriceMapProviderTest.php b/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantLowestPriceMapProviderTest.php index 34cc6cf140..5624c3e5ea 100644 --- a/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantLowestPriceMapProviderTest.php +++ b/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantLowestPriceMapProviderTest.php @@ -30,7 +30,7 @@ final class ProductVariantLowestPriceMapProviderTest extends TestCase private ChannelPricingInterface&MockObject $channelPricing; - private MockObject&CatalogPricesCalculatorInterface $calculator; + private CatalogPricesCalculatorInterface&MockObject $calculator; private ProductVariantLowestPriceMapProvider $provider; diff --git a/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantOriginalPriceMapProviderTest.php b/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantOriginalPriceMapProviderTest.php index 8a035d3e07..6b8b988eb6 100644 --- a/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantOriginalPriceMapProviderTest.php +++ b/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantOriginalPriceMapProviderTest.php @@ -30,7 +30,7 @@ final class ProductVariantOriginalPriceMapProviderTest extends TestCase private ChannelPricingInterface&MockObject $channelPricing; - private MockObject&CatalogPricesCalculatorInterface $calculator; + private CatalogPricesCalculatorInterface&MockObject $calculator; private ProductVariantOriginalPriceMapProvider $provider; diff --git a/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantPriceMapProviderTest.php b/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantPriceMapProviderTest.php index 32a0c6e0b1..8c01c6ff35 100644 --- a/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantPriceMapProviderTest.php +++ b/src/Sylius/Component/Core/tests/Provider/ProductVariantMap/ProductVariantPriceMapProviderTest.php @@ -30,7 +30,7 @@ final class ProductVariantPriceMapProviderTest extends TestCase private ChannelPricingInterface&MockObject $channelPricing; - private MockObject&CatalogPricesCalculatorInterface $calculator; + private CatalogPricesCalculatorInterface&MockObject $calculator; private ProductVariantPriceMapProvider $provider;