diff --git a/Checkout/Cart/Order/RecalculationService.php b/Checkout/Cart/Order/RecalculationService.php index 4ce10c79f3..8ac382f023 100644 --- a/Checkout/Cart/Order/RecalculationService.php +++ b/Checkout/Cart/Order/RecalculationService.php @@ -15,7 +15,7 @@ use Shopware\Core\Checkout\Cart\LineItem\LineItem; use Shopware\Core\Checkout\Cart\Order\Transformer\AddressTransformer; use Shopware\Core\Checkout\Cart\Processor; -use Shopware\Core\Checkout\Cart\Storefront\CartService; +use Shopware\Core\Checkout\Cart\SalesChannel\CartService; use Shopware\Core\Checkout\Customer\Exception\AddressNotFoundException; use Shopware\Core\Checkout\Order\Exception\DeliveryWithoutAddressException; use Shopware\Core\Checkout\Order\Exception\EmptyCartException; diff --git a/Checkout/Cart/Storefront/CartService.php b/Checkout/Cart/SalesChannel/CartService.php similarity index 96% rename from Checkout/Cart/Storefront/CartService.php rename to Checkout/Cart/SalesChannel/CartService.php index 30ad41ce60..c265a464aa 100644 --- a/Checkout/Cart/Storefront/CartService.php +++ b/Checkout/Cart/SalesChannel/CartService.php @@ -1,6 +1,6 @@ cart[$token]) && $caching) { return $this->cart[$token]; diff --git a/Checkout/Cart/Storefront/StorefrontCartController.php b/Checkout/Cart/SalesChannel/SalesChannelCartController.php similarity index 89% rename from Checkout/Cart/Storefront/StorefrontCartController.php rename to Checkout/Cart/SalesChannel/SalesChannelCartController.php index 716f22fb59..53ef16cb2a 100644 --- a/Checkout/Cart/Storefront/StorefrontCartController.php +++ b/Checkout/Cart/SalesChannel/SalesChannelCartController.php @@ -1,6 +1,6 @@ query->getAlnum('token', $context->getToken()); - $name = $request->query->getAlnum('name', CartService::STOREFRONT); + $name = $request->query->getAlnum('name', CartService::SALES_CHANNEL); $cart = $this->cartService->getCart($token, $context, $name); @@ -69,14 +69,14 @@ public function getCart(Request $request, SalesChannelContext $context): JsonRes } /** - * @Route("/storefront-api/v{version}/checkout/cart", name="storefront-api.checkout.cart.create", methods={"POST"}) + * @Route("/sales-channel-api/v{version}/checkout/cart", name="sales-channel-api.checkout.cart.create", methods={"POST"}) * * @throws CartTokenNotFoundException */ public function createCart(Request $request, SalesChannelContext $context): JsonResponse { $token = $request->request->getAlnum('token', $context->getToken()); - $name = $request->request->getAlnum('name', CartService::STOREFRONT); + $name = $request->request->getAlnum('name', CartService::SALES_CHANNEL); $this->cartService->createNew($token, $name); @@ -88,7 +88,7 @@ public function createCart(Request $request, SalesChannelContext $context): Json } /** - * @Route("/storefront-api/v{version}/checkout/cart/product/{id}", name="storefront-api.checkout.frontend.cart.product.add", methods={"POST"}) + * @Route("/sales-channel-api/v{version}/checkout/cart/product/{id}", name="sales-channel-api.checkout.frontend.cart.product.add", methods={"POST"}) * * @throws MixedLineItemTypeException * @throws InvalidQuantityException @@ -118,7 +118,7 @@ public function addProduct(string $id, Request $request, SalesChannelContext $co * That one will be replaced with a real promotion (if valid) within the * promotion collector service. * - * @Route("/storefront-api/v{version}/checkout/cart/code/{code}", name="storefront-api.checkout.frontend.cart.code.add", methods={"POST"}) + * @Route("/sales-channel-api/v{version}/checkout/cart/code/{code}", name="sales-channel-api.checkout.frontend.cart.code.add", methods={"POST"}) * * @throws CartTokenNotFoundException * @throws InvalidQuantityException @@ -142,7 +142,7 @@ public function addCode(string $code, Request $request, SalesChannelContext $con } /** - * @Route("/storefront-api/v{version}/checkout/cart/line-item/{id}", name="storefront-api.checkout.cart.line-item.add", methods={"POST"}) + * @Route("/sales-channel-api/v{version}/checkout/cart/line-item/{id}", name="sales-channel-api.checkout.cart.line-item.add", methods={"POST"}) * * @throws MissingRequestParameterException * @throws MixedLineItemTypeException @@ -174,7 +174,7 @@ public function addLineItem(string $id, Request $request, SalesChannelContext $c } /** - * @Route("/storefront-api/v{version}/checkout/cart/line-item/{id}", name="storefront-api.checkout.cart.line-item.delete", methods={"DELETE"}) + * @Route("/sales-channel-api/v{version}/checkout/cart/line-item/{id}", name="sales-channel-api.checkout.cart.line-item.delete", methods={"DELETE"}) * * @throws LineItemNotFoundException * @throws LineItemNotRemovableException @@ -196,7 +196,7 @@ public function removeLineItem(string $id, Request $request, SalesChannelContext } /** - * @Route("/storefront-api/v{version}/checkout/cart/line-item/{id}", name="storefront-api.checkout.cart.line-item.update", methods={"PATCH"}) + * @Route("/sales-channel-api/v{version}/checkout/cart/line-item/{id}", name="sales-channel-api.checkout.cart.line-item.update", methods={"PATCH"}) * * @throws InvalidQuantityException * @throws LineItemNotFoundException diff --git a/Checkout/Cart/Storefront/StorefrontCheckoutController.php b/Checkout/Cart/SalesChannel/SalesChannelCheckoutController.php similarity index 90% rename from Checkout/Cart/Storefront/StorefrontCheckoutController.php rename to Checkout/Cart/SalesChannel/SalesChannelCheckoutController.php index e914c9e6c2..84a458a739 100644 --- a/Checkout/Cart/Storefront/StorefrontCheckoutController.php +++ b/Checkout/Cart/SalesChannel/SalesChannelCheckoutController.php @@ -1,10 +1,10 @@ - + @@ -87,8 +87,8 @@ - - + + @@ -96,14 +96,14 @@ - + - + - + @@ -177,7 +177,7 @@ - + diff --git a/Checkout/DependencyInjection/customer.xml b/Checkout/DependencyInjection/customer.xml index e2b02a9f2c..7ca46a32d0 100644 --- a/Checkout/DependencyInjection/customer.xml +++ b/Checkout/DependencyInjection/customer.xml @@ -26,7 +26,7 @@ - + @@ -37,19 +37,19 @@ - + - + - - + + - + @@ -58,7 +58,7 @@ - + diff --git a/Checkout/DependencyInjection/order.xml b/Checkout/DependencyInjection/order.xml index 434ab4c209..731ebd32a3 100644 --- a/Checkout/DependencyInjection/order.xml +++ b/Checkout/DependencyInjection/order.xml @@ -38,11 +38,11 @@ - + - + diff --git a/Checkout/Order/Storefront/OrderService.php b/Checkout/Order/SalesChannel/OrderService.php similarity index 95% rename from Checkout/Order/Storefront/OrderService.php rename to Checkout/Order/SalesChannel/OrderService.php index e78819bd99..15e4a89c6d 100644 --- a/Checkout/Order/Storefront/OrderService.php +++ b/Checkout/Order/SalesChannel/OrderService.php @@ -1,8 +1,8 @@ request( 'GET', sprintf( - '/api/v%s/_proxy/storefront-api/%s/v%s/checkout/cart', + '/api/v%s/_proxy/sales-channel-api/%s/v%s/checkout/cart', PlatformRequest::API_VERSION, Defaults::SALES_CHANNEL, PlatformRequest::API_VERSION @@ -200,7 +200,7 @@ public function testOrderConverterController(): void $client->request( 'PATCH', sprintf( - '/api/v%s/_proxy/storefront-api/%s/v%s/checkout/cart/line-item/%s', + '/api/v%s/_proxy/sales-channel-api/%s/v%s/checkout/cart/line-item/%s', PlatformRequest::API_VERSION, Defaults::SALES_CHANNEL, PlatformRequest::API_VERSION, diff --git a/Checkout/Test/Cart/StorefrontCartControllerTest.php b/Checkout/Test/Cart/SalesChannelCartControllerTest.php similarity index 93% rename from Checkout/Test/Cart/StorefrontCartControllerTest.php rename to Checkout/Test/Cart/SalesChannelCartControllerTest.php index e189ac2102..8606c91b5a 100644 --- a/Checkout/Test/Cart/StorefrontCartControllerTest.php +++ b/Checkout/Test/Cart/SalesChannelCartControllerTest.php @@ -7,16 +7,16 @@ use Shopware\Core\Content\Product\Cart\ProductCollector; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; -use Shopware\Core\Framework\Test\TestCaseBase\StorefrontFunctionalTestBehaviour; +use Shopware\Core\Framework\Test\TestCaseBase\SalesChannelFunctionalTestBehaviour; use Shopware\Core\Framework\Uuid\Uuid; use Shopware\Core\PlatformRequest; use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Router; -class StorefrontCartControllerTest extends TestCase +class SalesChannelCartControllerTest extends TestCase { - use StorefrontFunctionalTestBehaviour; + use SalesChannelFunctionalTestBehaviour; /** * @var EntityRepositoryInterface @@ -398,7 +398,7 @@ public function testAddProductUsingGenericLineItemRoute(): void $client->request( 'POST', - '/storefront-api/v1/checkout/cart/line-item/' . $productId, + '/sales-channel-api/v1/checkout/cart/line-item/' . $productId, [ 'type' => $type, 'quantity' => $quantity, @@ -484,7 +484,7 @@ public function testUpdateLineItem(): void $client->request( 'PATCH', - '/storefront-api/v1/checkout/cart/line-item/' . $productId, + '/sales-channel-api/v1/checkout/cart/line-item/' . $productId, [ 'quantity' => $quantity, 'stackable' => $stackable, @@ -521,10 +521,10 @@ public function testUpdateLineItem(): void public function testGetCartWithoutAccessKey(): void { $accessHeader = 'HTTP_' . str_replace('-', '_', strtoupper(PlatformRequest::HEADER_ACCESS_KEY)); - $this->getStorefrontClient()->setServerParameter($accessHeader, ''); + $this->getSalesChannelClient()->setServerParameter($accessHeader, ''); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/checkout/cart'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/checkout/cart'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(500, $response->getStatusCode(), $response->getContent()); $content = json_decode($response->getContent(), true); static::assertEquals('Access key is invalid and could not be identified.', $content['errors'][0]['detail']); @@ -532,14 +532,14 @@ public function testGetCartWithoutAccessKey(): void private function createCart(): Client { - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/checkout/cart'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/checkout/cart'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode(), $response->getContent()); $content = json_decode($response->getContent(), true); - $client = clone $this->getStorefrontClient(); + $client = clone $this->getSalesChannelClient(); $client->setServerParameter('HTTP_X_SW_CONTEXT_TOKEN', $content[PlatformRequest::HEADER_CONTEXT_TOKEN]); return $client; @@ -547,7 +547,7 @@ private function createCart(): Client private function getCart(Client $client) { - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/checkout/cart'); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/checkout/cart'); $cart = json_decode($client->getResponse()->getContent(), true); @@ -558,7 +558,7 @@ private function addProduct(Client $client, string $id, int $quantity = 1): void { $client->request( 'POST', - '/storefront-api/v1/checkout/cart/product/' . $id, + '/sales-channel-api/v1/checkout/cart/product/' . $id, [ 'quantity' => $quantity, ] @@ -567,16 +567,16 @@ private function addProduct(Client $client, string $id, int $quantity = 1): void private function changeQuantity(Client $client, string $lineItemId, int $quantity): void { - $client->request('PATCH', '/storefront-api/v1/checkout/cart/line-item/' . $lineItemId, ['quantity' => $quantity]); + $client->request('PATCH', '/sales-channel-api/v1/checkout/cart/line-item/' . $lineItemId, ['quantity' => $quantity]); } private function updateLineItemQuantity(Client $client, string $lineItemId, int $quantity): void { - $client->request('PATCH', '/storefront-api/v1/checkout/cart/line-item/' . $lineItemId, ['quantity' => $quantity]); + $client->request('PATCH', '/sales-channel-api/v1/checkout/cart/line-item/' . $lineItemId, ['quantity' => $quantity]); } private function removeLineItem(Client $client, string $lineItemId): void { - $client->request('DELETE', '/storefront-api/v1/checkout/cart/line-item/' . $lineItemId); + $client->request('DELETE', '/sales-channel-api/v1/checkout/cart/line-item/' . $lineItemId); } } diff --git a/Checkout/Test/Cart/StorefrontCheckoutControllerTest.php b/Checkout/Test/Cart/SalesChannelCheckoutControllerTest.php similarity index 92% rename from Checkout/Test/Cart/StorefrontCheckoutControllerTest.php rename to Checkout/Test/Cart/SalesChannelCheckoutControllerTest.php index eef74689b4..db9238eb41 100644 --- a/Checkout/Test/Cart/StorefrontCheckoutControllerTest.php +++ b/Checkout/Test/Cart/SalesChannelCheckoutControllerTest.php @@ -13,7 +13,7 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\Test\TestCaseBase\AssertArraySubsetBehaviour; -use Shopware\Core\Framework\Test\TestCaseBase\StorefrontFunctionalTestBehaviour; +use Shopware\Core\Framework\Test\TestCaseBase\SalesChannelFunctionalTestBehaviour; use Shopware\Core\Framework\Test\TestCaseHelper\ReflectionHelper; use Shopware\Core\Framework\Util\Random; use Shopware\Core\Framework\Uuid\Uuid; @@ -21,9 +21,9 @@ use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Component\HttpFoundation\Response; -class StorefrontCheckoutControllerTest extends TestCase +class SalesChannelCheckoutControllerTest extends TestCase { - use StorefrontFunctionalTestBehaviour, + use SalesChannelFunctionalTestBehaviour, AssertArraySubsetBehaviour; /** @@ -153,7 +153,7 @@ public function testOrderProcessWithDifferentCurrency(): void ]; $context = Context::createDefaultContext(); $this->currencyRepository->create([$yen], $context); - $yenStorefrontClient = $this->createCustomStorefrontClient([ + $salesChannelClient = $this->createCustomSalesChannelClient([ 'currencyId' => $yen['id'], ]); @@ -175,7 +175,7 @@ public function testOrderProcessWithDifferentCurrency(): void $this->createCustomer($addressId, $mail, $password, $context); - $client = $this->createCart($yenStorefrontClient); + $client = $this->createCart($salesChannelClient); $this->addProduct($client, $productId); static::assertSame(200, $client->getResponse()->getStatusCode(), $client->getResponse()->getContent()); @@ -513,12 +513,12 @@ public function testDeepLinkGuestOrderWithoutAccessKey(): void $expectedOrder = $this->createGuestOrder(); $accessHeader = 'HTTP_' . str_replace('-', '_', strtoupper(PlatformRequest::HEADER_ACCESS_KEY)); - $this->getStorefrontClient()->setServerParameter($accessHeader, ''); + $this->getSalesChannelClient()->setServerParameter($accessHeader, ''); $orderId = $expectedOrder['data']['id']; $accessCode = $expectedOrder['data']['deepLinkCode']; - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/checkout/guest-order/' . $orderId, ['accessCode' => $accessCode]); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/checkout/guest-order/' . $orderId, ['accessCode' => $accessCode]); + $response = $this->getSalesChannelClient()->getResponse(); static::assertSame(200, $response->getStatusCode(), print_r($response, true)); $actualOrder = json_decode($response->getContent(), true); @@ -530,9 +530,9 @@ public function testDeepLinkGuestOrderWithAccessKey(): void $expectedOrder = $this->createGuestOrder(); $orderId = $expectedOrder['data']['id']; $accessCode = $expectedOrder['data']['deepLinkCode']; - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/checkout/guest-order/' . $orderId, ['accessCode' => $accessCode]); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/checkout/guest-order/' . $orderId, ['accessCode' => $accessCode]); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); static::assertSame(200, $response->getStatusCode()); $actualOrder = json_decode($response->getContent(), true); @@ -544,13 +544,13 @@ public function testDeepLinkGuestOrderWithWrongCode(): void $order = $this->createGuestOrder(); $accessHeader = 'HTTP_' . str_replace('-', '_', strtoupper(PlatformRequest::HEADER_ACCESS_KEY)); - $this->getStorefrontClient()->setServerParameter($accessHeader, ''); + $this->getSalesChannelClient()->setServerParameter($accessHeader, ''); $orderId = $order['data']['id']; $accessCode = Random::getBase64UrlString(32); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/checkout/guest-order/' . $orderId, ['accessCode' => $accessCode]); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/checkout/guest-order/' . $orderId, ['accessCode' => $accessCode]); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); static::assertSame(400, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -562,12 +562,12 @@ public function testDeepLinkGuestOrderWithoutCode(): void $order = $this->createGuestOrder(); $accessHeader = 'HTTP_' . str_replace('-', '_', strtoupper(PlatformRequest::HEADER_ACCESS_KEY)); - $this->getStorefrontClient()->setServerParameter($accessHeader, ''); + $this->getSalesChannelClient()->setServerParameter($accessHeader, ''); $orderId = $order['data']['id']; - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/checkout/guest-order/' . $orderId); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/checkout/guest-order/' . $orderId); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); static::assertSame(400, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -579,13 +579,13 @@ public function testDeepLinkGuestOrderWithWrongOrderId(): void $order = $this->createGuestOrder(); $accessHeader = 'HTTP_' . str_replace('-', '_', strtoupper(PlatformRequest::HEADER_ACCESS_KEY)); - $this->getStorefrontClient()->setServerParameter($accessHeader, ''); + $this->getSalesChannelClient()->setServerParameter($accessHeader, ''); $orderId = Uuid::randomHex(); $accessCode = $order['data']['deepLinkCode']; - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/checkout/guest-order/' . $orderId, ['accessCode' => $accessCode]); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/checkout/guest-order/' . $orderId, ['accessCode' => $accessCode]); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); static::assertSame(400, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -834,19 +834,19 @@ private function createCustomer(string $addressId, string $mail, string $passwor private function createCart(?Client $client = null): Client { - $storefrontClient = $client; + $salesChannelClient = $client; if ($client === null) { - $storefrontClient = $this->getStorefrontClient(); + $salesChannelClient = $this->getSalesChannelClient(); } - $storefrontClient->request('POST', '/storefront-api/v1/checkout/cart'); - $response = $storefrontClient->getResponse(); + $salesChannelClient->request('POST', '/sales-channel-api/v1/checkout/cart'); + $response = $salesChannelClient->getResponse(); static::assertEquals(200, $response->getStatusCode(), $response->getContent()); $content = json_decode($response->getContent(), true); if ($client === null) { - $client = clone $storefrontClient; + $client = clone $salesChannelClient; } $client->setServerParameter('HTTP_X_SW_CONTEXT_TOKEN', $content[PlatformRequest::HEADER_CONTEXT_TOKEN]); @@ -857,7 +857,7 @@ private function addProduct(Client $client, string $id, int $quantity = 1): void { $client->request( 'POST', - '/storefront-api/v1/checkout/cart/product/' . $id, + '/sales-channel-api/v1/checkout/cart/product/' . $id, [ 'quantity' => $quantity, ] @@ -866,17 +866,17 @@ private function addProduct(Client $client, string $id, int $quantity = 1): void private function order(Client $client): void { - $client->request('POST', '/storefront-api/v1/checkout/order'); + $client->request('POST', '/sales-channel-api/v1/checkout/order'); } private function guestOrder(Client $client, array $payload): void { - $client->request('POST', '/storefront-api/v1/checkout/guest-order', $payload); + $client->request('POST', '/sales-channel-api/v1/checkout/guest-order', $payload); } private function login(Client $client, string $email, string $password): void { - $client->request('POST', '/storefront-api/v1/customer/login', [ + $client->request('POST', '/sales-channel-api/v1/customer/login', [ 'username' => $email, 'password' => $password, ]); @@ -884,14 +884,14 @@ private function login(Client $client, string $email, string $password): void private function setShippingMethod(string $shippingId, Client $client): void { - $client->request('PATCH', '/storefront-api/v1/context', [ + $client->request('PATCH', '/sales-channel-api/v1/context', [ 'shippingMethodId' => $shippingId, ]); } private function setPaymentMethod(string $paymentMethodId, Client $client): void { - $client->request('PATCH', '/storefront-api/v1/context', [ + $client->request('PATCH', '/sales-channel-api/v1/context', [ 'paymentMethodId' => $paymentMethodId, ]); } diff --git a/Checkout/Test/Customer/StorefrontCustomerControllerTest.php b/Checkout/Test/Customer/SalesChannelCustomerControllerTest.php similarity index 83% rename from Checkout/Test/Customer/StorefrontCustomerControllerTest.php rename to Checkout/Test/Customer/SalesChannelCustomerControllerTest.php index a318e23878..72a3c06e07 100644 --- a/Checkout/Test/Customer/StorefrontCustomerControllerTest.php +++ b/Checkout/Test/Customer/SalesChannelCustomerControllerTest.php @@ -11,15 +11,15 @@ use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; -use Shopware\Core\Framework\Test\TestCaseBase\StorefrontFunctionalTestBehaviour; +use Shopware\Core\Framework\Test\TestCaseBase\SalesChannelFunctionalTestBehaviour; use Shopware\Core\Framework\Test\TestCaseHelper\ReflectionHelper; use Shopware\Core\Framework\Uuid\Uuid; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Serializer\Serializer; -class StorefrontCustomerControllerTest extends TestCase +class SalesChannelCustomerControllerTest extends TestCase { - use StorefrontFunctionalTestBehaviour; + use SalesChannelFunctionalTestBehaviour; /** * @var EntityRepositoryInterface @@ -78,11 +78,11 @@ public function testLogin(): void $password = 'shopware'; $customerId = $this->createCustomer($password, $email); - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/customer/login', [ + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/customer/login', [ 'username' => $email, 'password' => $password, ]); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(200, $response->getStatusCode()); @@ -90,8 +90,8 @@ public function testLogin(): void static::assertArrayHasKey('x-sw-context-token', $content); static::assertNotEmpty($content['x-sw-context-token']); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); $customer = $this->serialize($this->readCustomer($customerId)); @@ -106,11 +106,11 @@ public function testLoginWithBadCredentials(): void $email = Uuid::randomHex() . '@example.com'; $password = 'shopware'; - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/customer/login', [ + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/customer/login', [ 'username' => $email, 'password' => $password, ]); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(401, $response->getStatusCode()); @@ -118,8 +118,8 @@ public function testLoginWithBadCredentials(): void static::assertArrayHasKey('errors', $content); static::assertNotEmpty($content['errors']); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(403, $response->getStatusCode()); @@ -141,11 +141,11 @@ public function testLoginWithLegacyPassword(): void ], ], $this->context); - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/customer/login', [ + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/customer/login', [ 'username' => $email, 'password' => $password, ]); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(200, $response->getStatusCode()); @@ -153,8 +153,8 @@ public function testLoginWithLegacyPassword(): void static::assertArrayHasKey('x-sw-context-token', $content); static::assertNotEmpty($content['x-sw-context-token']); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); $customer = $this->readCustomer($customerId); @@ -171,15 +171,15 @@ public function testLoginWithLegacyPassword(): void public function testLogout(): void { $this->createCustomerAndLogin(); - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/customer/logout'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/customer/logout'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(Response::HTTP_NO_CONTENT, $response->getStatusCode()); static::assertNull($content); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(403, $response->getStatusCode()); @@ -191,8 +191,8 @@ public function testGetCustomerDetail(): void { $customerId = $this->createCustomerAndLogin(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); $customer = $this->serialize($this->readCustomer($customerId)); @@ -207,8 +207,8 @@ public function testGetAddress(): void $customerId = $this->createCustomerAndLogin(); $addressId = $this->createCustomerAddress($customerId); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer/address/' . $addressId); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer/address/' . $addressId); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(200, $response->getStatusCode()); @@ -227,8 +227,8 @@ public function testGetAddresses(): void $customerId = $this->createCustomerAndLogin(); $this->createCustomerAddress($customerId); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer/address'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer/address'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(200, $response->getStatusCode()); @@ -252,8 +252,8 @@ public function testCreateAddress(): void 'company' => 'Shopware AG', ]; - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/customer/address', $address); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/customer/address', $address); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(Response::HTTP_OK, $response->getStatusCode(), $response->getContent()); @@ -283,7 +283,7 @@ public function testDeleteAddress(): void static::assertInstanceOf(CustomerAddressEntity::class, $customerAddress); static::assertEquals($addressId, $customerAddress->getId()); - $this->getStorefrontClient()->request('DELETE', '/storefront-api/v1/customer/address/' . $addressId); + $this->getSalesChannelClient()->request('DELETE', '/sales-channel-api/v1/customer/address/' . $addressId); $customerAddress = $this->readCustomerAddress($customerId); static::assertNull($customerAddress); @@ -293,8 +293,8 @@ public function testSetDefaultShippingAddress(): void { $customerId = $this->createCustomerAndLogin(); $addressId = $this->createCustomerAddress($customerId); - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/customer/address/' . $addressId . '/default-shipping'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/customer/address/' . $addressId . '/default-shipping'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); $customer = $this->readCustomer($customerId); @@ -310,8 +310,8 @@ public function testSetDefaultBillingAddress(): void { $customerId = $this->createCustomerAndLogin(); $addressId = $this->createCustomerAddress($customerId); - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/customer/address/' . $addressId . '/default-billing'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/customer/address/' . $addressId . '/default-billing'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); $customer = $this->readCustomer($customerId); @@ -360,9 +360,9 @@ public function testRegister(): void ], ]; - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/customer', $personal); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/customer', $personal); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(Response::HTTP_OK, $response->getStatusCode(), print_r($response->getContent(), true)); @@ -425,8 +425,8 @@ public function testChangeEmail(): void $customerId = $this->createCustomerAndLogin(); $mail = 'test@exapmle.com'; - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/customer/email', ['email' => $mail]); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/customer/email', ['email' => $mail]); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(Response::HTTP_NO_CONTENT, $response->getStatusCode(), print_r($content, true)); @@ -441,8 +441,8 @@ public function testChangePassword(): void $customerId = $this->createCustomerAndLogin(); $password = '1234'; - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/customer/password', ['password' => $password]); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/customer/password', ['password' => $password]); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); $hash = $this->readCustomer($customerId)->getPassword(); @@ -465,8 +465,8 @@ public function testChangeProfile(): void 'birthdayMonth' => 5, 'birthdayDay' => 3, ]; - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/customer', $data); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/customer', $data); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); $customer = $this->readCustomer($customerId); @@ -488,8 +488,8 @@ public function testChangeProfile(): void public function testGetOrdersWithoutLogin(): void { - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer/order'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer/order'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(Response::HTTP_FORBIDDEN, $response->getStatusCode()); @@ -502,8 +502,8 @@ public function testGetOrders(): void $this->createCustomerAndLogin(); $this->createOrder(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer/order'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer/order'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(Response::HTTP_OK, $response->getStatusCode(), print_r($content, true)); @@ -518,8 +518,8 @@ public function testGetOrdersWithLimit(): void $this->createOrder(); $this->createOrder(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer/order?limit=2'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer/order?limit=2'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(Response::HTTP_OK, $response->getStatusCode()); @@ -534,8 +534,8 @@ public function testGetOrdersWithLimitAndPage(): void $this->createOrder(); $this->createOrder(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/customer/order?limit=2&page=2'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/customer/order?limit=2&page=2'); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertEquals(Response::HTTP_OK, $response->getStatusCode()); @@ -548,7 +548,7 @@ private function createCustomerAndLogin(?string $email = null, string $password $email = $email ?? Uuid::randomHex() . '@example.com'; $customerId = $this->createCustomer($password, $email); - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/customer/login', [ + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/customer/login', [ 'username' => $email, 'password' => $password, ]); @@ -682,20 +682,20 @@ private function createOrder(): void ], $context); // create new cart - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/checkout/cart'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/checkout/cart'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode(), $response->getContent()); // add product - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/checkout/cart/product/' . $productId); - static::assertSame(200, $this->getStorefrontClient()->getResponse()->getStatusCode(), $this->getStorefrontClient()->getResponse()->getContent()); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/checkout/cart/product/' . $productId); + static::assertSame(200, $this->getSalesChannelClient()->getResponse()->getStatusCode(), $this->getSalesChannelClient()->getResponse()->getContent()); // finish checkout - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/checkout/order'); - static::assertSame(200, $this->getStorefrontClient()->getResponse()->getStatusCode(), $this->getStorefrontClient()->getResponse()->getContent()); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/checkout/order'); + static::assertSame(200, $this->getSalesChannelClient()->getResponse()->getStatusCode(), $this->getSalesChannelClient()->getResponse()->getContent()); - $order = json_decode($this->getStorefrontClient()->getResponse()->getContent(), true); + $order = json_decode($this->getSalesChannelClient()->getResponse()->getContent(), true); static::assertArrayHasKey('data', $order); $order = $order['data']; diff --git a/Content/Category/Storefront/StorefrontCategoryController.php b/Content/Category/SalesChannel/SalesChannelCategoryController.php similarity index 87% rename from Content/Category/Storefront/StorefrontCategoryController.php rename to Content/Category/SalesChannel/SalesChannelCategoryController.php index 4628cd8d9e..4c3a9c1844 100644 --- a/Content/Category/Storefront/StorefrontCategoryController.php +++ b/Content/Category/SalesChannel/SalesChannelCategoryController.php @@ -1,6 +1,6 @@ cmsPageRepository = $cmsPageRepository; $this->slotDataResolver = $slotDataResolver; } /** - * @Route("/storefront-api/v1/cms-page/{pageId}", methods={"GET"}) + * @Route("/sales-channel-api/v1/cms-page/{pageId}", methods={"GET"}) */ public function getPage(string $pageId, Request $request, SalesChannelContext $context, ResponseFactoryInterface $responseFactory): Response { diff --git a/Content/Cms/Storefront/StorefrontCmsPageRepository.php b/Content/Cms/SalesChannel/SalesChannelCmsPageRepository.php similarity index 95% rename from Content/Cms/Storefront/StorefrontCmsPageRepository.php rename to Content/Cms/SalesChannel/SalesChannelCmsPageRepository.php index d4ef50d136..6843185a67 100644 --- a/Content/Cms/Storefront/StorefrontCmsPageRepository.php +++ b/Content/Cms/SalesChannel/SalesChannelCmsPageRepository.php @@ -1,6 +1,6 @@ product; } - public function setProduct(StorefrontProductEntity $product): void + public function setProduct(SalesChannelProductEntity $product): void { $this->product = $product; } diff --git a/Content/Cms/Storefront/Struct/ProductListingStruct.php b/Content/Cms/SalesChannel/Struct/ProductListingStruct.php similarity index 90% rename from Content/Cms/Storefront/Struct/ProductListingStruct.php rename to Content/Cms/SalesChannel/Struct/ProductListingStruct.php index 49ecb157e3..70b3b3b21b 100644 --- a/Content/Cms/Storefront/Struct/ProductListingStruct.php +++ b/Content/Cms/SalesChannel/Struct/ProductListingStruct.php @@ -1,6 +1,6 @@ $ids) { - $repository = $this->getStorefrontRepository($definition); + $repository = $this->getSalesChannelApiRepository($definition); if ($repository) { $entities[$definition] = $repository->search(new Criteria($ids), $context); } else { @@ -130,7 +130,7 @@ private function fetchByCriteria(array $searches, SalesChannelContext $context): /** @var Criteria[] $criteriaObjects */ foreach ($searches as $definition => $criteriaObjects) { foreach ($criteriaObjects as $criteriaHash => $criteria) { - $repository = $this->getStorefrontRepository($definition); + $repository = $this->getSalesChannelApiRepository($definition); if ($repository) { $result = $repository->search($criteria, $context); } else { @@ -236,7 +236,7 @@ private function getApiRepository(string $definition): EntityRepositoryInterface * * @return mixed|null */ - private function getStorefrontRepository(string $definition) + private function getSalesChannelApiRepository(string $definition) { return $this->repositories[$definition::getEntityName()] ?? null; } diff --git a/Content/Cms/SlotDataResolver/Type/ImageTypeDataResolver.php b/Content/Cms/SlotDataResolver/Type/ImageTypeDataResolver.php index 75892a8a96..bbb617c209 100644 --- a/Content/Cms/SlotDataResolver/Type/ImageTypeDataResolver.php +++ b/Content/Cms/SlotDataResolver/Type/ImageTypeDataResolver.php @@ -3,12 +3,12 @@ namespace Shopware\Core\Content\Cms\SlotDataResolver\Type; use Shopware\Core\Content\Cms\Aggregate\CmsSlot\CmsSlotEntity; +use Shopware\Core\Content\Cms\SalesChannel\Struct\ImageStruct; use Shopware\Core\Content\Cms\SlotDataResolver\CriteriaCollection; use Shopware\Core\Content\Cms\SlotDataResolver\FieldConfig; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\EntityResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\SlotDataResolveResult; -use Shopware\Core\Content\Cms\Storefront\Struct\ImageStruct; use Shopware\Core\Content\Media\MediaDefinition; use Shopware\Core\Content\Media\MediaEntity; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; diff --git a/Content/Cms/SlotDataResolver/Type/ProductBoxTypeDataResolver.php b/Content/Cms/SlotDataResolver/Type/ProductBoxTypeDataResolver.php index 6bedc0a8a5..e50af54e4c 100644 --- a/Content/Cms/SlotDataResolver/Type/ProductBoxTypeDataResolver.php +++ b/Content/Cms/SlotDataResolver/Type/ProductBoxTypeDataResolver.php @@ -3,13 +3,13 @@ namespace Shopware\Core\Content\Cms\SlotDataResolver\Type; use Shopware\Core\Content\Cms\Aggregate\CmsSlot\CmsSlotEntity; +use Shopware\Core\Content\Cms\SalesChannel\Struct\ProductBoxStruct; use Shopware\Core\Content\Cms\SlotDataResolver\CriteriaCollection; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\EntityResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\SlotDataResolveResult; -use Shopware\Core\Content\Cms\Storefront\Struct\ProductBoxStruct; use Shopware\Core\Content\Product\ProductDefinition; -use Shopware\Core\Content\Product\Storefront\StorefrontProductEntity; +use Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; class ProductBoxTypeDataResolver extends TypeDataResolver @@ -68,7 +68,7 @@ private function resolveProductFromRemote(CmsSlotEntity $slot, ProductBoxStruct return; } - /** @var StorefrontProductEntity|null $product */ + /** @var SalesChannelProductEntity|null $product */ $product = $searchResult->get($productId); if (!$product) { return; diff --git a/Content/Cms/SlotDataResolver/Type/ProductListingTypeDataResolver.php b/Content/Cms/SlotDataResolver/Type/ProductListingTypeDataResolver.php index c75889af67..9ac35bab63 100644 --- a/Content/Cms/SlotDataResolver/Type/ProductListingTypeDataResolver.php +++ b/Content/Cms/SlotDataResolver/Type/ProductListingTypeDataResolver.php @@ -3,11 +3,11 @@ namespace Shopware\Core\Content\Cms\SlotDataResolver\Type; use Shopware\Core\Content\Cms\Aggregate\CmsSlot\CmsSlotEntity; +use Shopware\Core\Content\Cms\SalesChannel\Struct\ProductListingStruct; use Shopware\Core\Content\Cms\SlotDataResolver\CriteriaCollection; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ListingResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\SlotDataResolveResult; -use Shopware\Core\Content\Cms\Storefront\Struct\ProductListingStruct; class ProductListingTypeDataResolver extends TypeDataResolver { diff --git a/Content/Cms/SlotDataResolver/Type/ProductSliderTypeDataResolver.php b/Content/Cms/SlotDataResolver/Type/ProductSliderTypeDataResolver.php index 9180b6c307..699710eb82 100644 --- a/Content/Cms/SlotDataResolver/Type/ProductSliderTypeDataResolver.php +++ b/Content/Cms/SlotDataResolver/Type/ProductSliderTypeDataResolver.php @@ -3,12 +3,12 @@ namespace Shopware\Core\Content\Cms\SlotDataResolver\Type; use Shopware\Core\Content\Cms\Aggregate\CmsSlot\CmsSlotEntity; +use Shopware\Core\Content\Cms\SalesChannel\Struct\ProductSliderStruct; use Shopware\Core\Content\Cms\SlotDataResolver\CriteriaCollection; use Shopware\Core\Content\Cms\SlotDataResolver\FieldConfig; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\EntityResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\SlotDataResolveResult; -use Shopware\Core\Content\Cms\Storefront\Struct\ProductSliderStruct; use Shopware\Core\Content\Product\ProductCollection; use Shopware\Core\Content\Product\ProductDefinition; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; diff --git a/Content/Cms/SlotDataResolver/Type/TextTypeDataResolver.php b/Content/Cms/SlotDataResolver/Type/TextTypeDataResolver.php index 71ed97e01e..044e77b32e 100644 --- a/Content/Cms/SlotDataResolver/Type/TextTypeDataResolver.php +++ b/Content/Cms/SlotDataResolver/Type/TextTypeDataResolver.php @@ -3,11 +3,11 @@ namespace Shopware\Core\Content\Cms\SlotDataResolver\Type; use Shopware\Core\Content\Cms\Aggregate\CmsSlot\CmsSlotEntity; +use Shopware\Core\Content\Cms\SalesChannel\Struct\TextStruct; use Shopware\Core\Content\Cms\SlotDataResolver\CriteriaCollection; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\EntityResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\SlotDataResolveResult; -use Shopware\Core\Content\Cms\Storefront\Struct\TextStruct; class TextTypeDataResolver extends TypeDataResolver { diff --git a/Content/DependencyInjection/cms.xml b/Content/DependencyInjection/cms.xml index b8a3e257a2..1072b9ca9b 100644 --- a/Content/DependencyInjection/cms.xml +++ b/Content/DependencyInjection/cms.xml @@ -25,14 +25,14 @@ - + - + @@ -57,8 +57,8 @@ - - + + diff --git a/Content/DependencyInjection/product.xml b/Content/DependencyInjection/product.xml index 3d68082725..38f04b8b64 100644 --- a/Content/DependencyInjection/product.xml +++ b/Content/DependencyInjection/product.xml @@ -5,21 +5,21 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + - + - - + + - + diff --git a/Content/Product/Storefront/StorefrontProductController.php b/Content/Product/SalesChannel/SalesChannelProductController.php similarity index 85% rename from Content/Product/Storefront/StorefrontProductController.php rename to Content/Product/SalesChannel/SalesChannelProductController.php index a985a8be0b..fea2bef818 100644 --- a/Content/Product/Storefront/StorefrontProductController.php +++ b/Content/Product/SalesChannel/SalesChannelProductController.php @@ -1,6 +1,6 @@ repository = $repository; @@ -36,7 +36,7 @@ public function __construct( } /** - * @Route("/storefront-api/v{version}/product", name="storefront-api.product.list") + * @Route("/sales-channel-api/v{version}/product", name="sales-channel-api.product.list") */ public function list(Request $request, SalesChannelContext $salesChannelContext, ResponseFactoryInterface $responseFactory): Response { @@ -60,7 +60,7 @@ public function list(Request $request, SalesChannelContext $salesChannelContext, } /** - * @Route("/storefront-api/v{version}/product/{productId}", name="storefront-api.product.detail", methods={"GET"}) + * @Route("/sales-channel-api/v{version}/product/{productId}", name="sales-channel-api.product.detail", methods={"GET"}) * * @throws ProductNotFoundException * @throws InvalidUuidException diff --git a/Content/Product/Storefront/StorefrontProductEntity.php b/Content/Product/SalesChannel/SalesChannelProductEntity.php similarity index 93% rename from Content/Product/Storefront/StorefrontProductEntity.php rename to Content/Product/SalesChannel/SalesChannelProductEntity.php index 6801eacb07..de1f2587c1 100644 --- a/Content/Product/Storefront/StorefrontProductEntity.php +++ b/Content/Product/SalesChannel/SalesChannelProductEntity.php @@ -1,12 +1,12 @@ add($product); $this->calculatePrices($context, $product); @@ -90,7 +90,7 @@ private function loadListProducts(ProductCollection $products, SalesChannelConte return $listingProducts; } - private function calculatePrices(SalesChannelContext $context, StorefrontProductEntity $product): void + private function calculatePrices(SalesChannelContext $context, SalesChannelProductEntity $product): void { //calculate listing price $listingPriceDefinition = $product->getListingPriceDefinition($context->getContext()); diff --git a/Content/Test/Category/Storefront/StorefrontCategoryControllerTest.php b/Content/Test/Category/SalesChannel/SalesChannelCategoryControllerTest.php similarity index 81% rename from Content/Test/Category/Storefront/StorefrontCategoryControllerTest.php rename to Content/Test/Category/SalesChannel/SalesChannelCategoryControllerTest.php index 38439e032f..6e98f17391 100644 --- a/Content/Test/Category/Storefront/StorefrontCategoryControllerTest.php +++ b/Content/Test/Category/SalesChannel/SalesChannelCategoryControllerTest.php @@ -1,17 +1,17 @@ $id, 'name' => 'Test category'], ], $this->context); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/category'); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/category'); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); static::assertSame(200, $response->getStatusCode()); @@ -65,9 +65,9 @@ public function testCategoryDetailRoute(): void ['id' => $id, 'name' => 'Test category'], ], $this->context); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/category/' . $id); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/category/' . $id); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); static::assertSame(200, $response->getStatusCode()); @@ -91,17 +91,17 @@ public function testSortingOnListRoute(): void ], $this->context); $params = ['sort' => 'name']; - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/category', $params); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/category', $params); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertNotEmpty($content); $ids = array_column($content['data'], 'id'); static::assertSame([$categoryA, $categoryB, $categoryC], $ids); $params['sort'] = '-name'; - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/category', $params); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/category', $params); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertNotEmpty($content); $ids = array_column($content['data'], 'id'); @@ -121,9 +121,9 @@ public function testTermOnListRoute(): void ['id' => $categoryB, 'name' => 'Matching name'], ], $this->context); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/category', ['term' => 'Matching']); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/category', ['term' => 'Matching']); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertNotEmpty($content); @@ -153,9 +153,9 @@ public function testFilterOnListRoute(): void ], ]; - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/category', $params); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/category', $params); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertNotEmpty($content); static::assertSame(1, $content['total']); @@ -188,9 +188,9 @@ public function testSwagQLForListRoute(): void ], ]; - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/category', $body); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/category', $body); - $response = $this->getStorefrontClient()->getResponse(); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertSame(200, $response->getStatusCode()); static::assertSame(2, $content['total']); @@ -211,8 +211,8 @@ public function testSwagQLForListRoute(): void ], ]; - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/category', $body); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/category', $body); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertSame(200, $response->getStatusCode()); @@ -233,8 +233,8 @@ public function testSwagQLForListRoute(): void ], ]; - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/category', $body); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/category', $body); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertSame(200, $response->getStatusCode()); @@ -258,8 +258,8 @@ public function testSwagQLForListRoute(): void ], ]; - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/category', $body); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/category', $body); + $response = $this->getSalesChannelClient()->getResponse(); $content = json_decode($response->getContent(), true); static::assertSame(200, $response->getStatusCode()); @@ -287,8 +287,8 @@ public function testDetailWithNoneExistingCategory(): void { $id = Uuid::randomHex(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/category/' . $id); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/category/' . $id); + $response = $this->getSalesChannelClient()->getResponse(); static::assertSame(404, $response->getStatusCode()); $content = json_decode($response->getContent(), true); diff --git a/Content/Test/Cms/Storefront/StorefrontCmsPageRepositoryTest.php b/Content/Test/Cms/SalesChannel/SalesChannelCmsPageRepositoryTest.php similarity index 89% rename from Content/Test/Cms/Storefront/StorefrontCmsPageRepositoryTest.php rename to Content/Test/Cms/SalesChannel/SalesChannelCmsPageRepositoryTest.php index 114eef9cd5..671e5a3a71 100644 --- a/Content/Test/Cms/Storefront/StorefrontCmsPageRepositoryTest.php +++ b/Content/Test/Cms/SalesChannel/SalesChannelCmsPageRepositoryTest.php @@ -1,12 +1,12 @@ getContainer()->get(SalesChannelContextFactory::class); - $this->pageRepository = $this->getContainer()->get(StorefrontCmsPageRepository::class); + $this->pageRepository = $this->getContainer()->get(SalesChannelCmsPageRepository::class); $this->cmsPageRepository = $this->getContainer()->get('cms_page.repository'); $this->salesChannelContext = $contextFactory->create(Uuid::randomHex(), Defaults::SALES_CHANNEL); } diff --git a/Content/Test/Cms/SlotDataResolver/Type/ImageTypeDataResolverTest.php b/Content/Test/Cms/SlotDataResolver/Type/ImageTypeDataResolverTest.php index 381db42af0..caeda3ecd9 100644 --- a/Content/Test/Cms/SlotDataResolver/Type/ImageTypeDataResolverTest.php +++ b/Content/Test/Cms/SlotDataResolver/Type/ImageTypeDataResolverTest.php @@ -4,13 +4,13 @@ use PHPUnit\Framework\TestCase; use Shopware\Core\Content\Cms\Aggregate\CmsSlot\CmsSlotEntity; +use Shopware\Core\Content\Cms\SalesChannel\Struct\ImageStruct; use Shopware\Core\Content\Cms\SlotDataResolver\FieldConfig; use Shopware\Core\Content\Cms\SlotDataResolver\FieldConfigCollection; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\EntityResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\SlotDataResolveResult; use Shopware\Core\Content\Cms\SlotDataResolver\Type\ImageTypeDataResolver; -use Shopware\Core\Content\Cms\Storefront\Struct\ImageStruct; use Shopware\Core\Content\Media\MediaCollection; use Shopware\Core\Content\Media\MediaDefinition; use Shopware\Core\Content\Media\MediaEntity; diff --git a/Content/Test/Cms/SlotDataResolver/Type/ProductBoxTypeDataResolverTest.php b/Content/Test/Cms/SlotDataResolver/Type/ProductBoxTypeDataResolverTest.php index 3eefd40ce4..d0ab54cb11 100644 --- a/Content/Test/Cms/SlotDataResolver/Type/ProductBoxTypeDataResolverTest.php +++ b/Content/Test/Cms/SlotDataResolver/Type/ProductBoxTypeDataResolverTest.php @@ -4,16 +4,16 @@ use PHPUnit\Framework\TestCase; use Shopware\Core\Content\Cms\Aggregate\CmsSlot\CmsSlotEntity; +use Shopware\Core\Content\Cms\SalesChannel\Struct\ProductBoxStruct; use Shopware\Core\Content\Cms\SlotDataResolver\FieldConfig; use Shopware\Core\Content\Cms\SlotDataResolver\FieldConfigCollection; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\EntityResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\SlotDataResolveResult; use Shopware\Core\Content\Cms\SlotDataResolver\Type\ProductBoxTypeDataResolver; -use Shopware\Core\Content\Cms\Storefront\Struct\ProductBoxStruct; use Shopware\Core\Content\Product\ProductCollection; use Shopware\Core\Content\Product\ProductDefinition; -use Shopware\Core\Content\Product\Storefront\StorefrontProductEntity; +use Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult; use Shopware\Core\System\SalesChannel\SalesChannelContext; @@ -105,7 +105,7 @@ public function testEnrichWithEmptyConfig(): void public function testEnrichWithStaticConfig(): void { - $product = new StorefrontProductEntity(); + $product = new SalesChannelProductEntity(); $product->setId('product123'); $resolverContext = new ResolverContext($this->createMock(SalesChannelContext::class)); @@ -162,10 +162,10 @@ public function testEnrichWithStaticConfigButNoResult(): void public function testEnrichWithMappedConfig(): void { - $parent = new StorefrontProductEntity(); + $parent = new SalesChannelProductEntity(); $parent->setId('product_parent'); - $product = new StorefrontProductEntity(); + $product = new SalesChannelProductEntity(); $product->setId('product123'); $product->setParent($parent); @@ -189,7 +189,7 @@ public function testEnrichWithMappedConfig(): void public function testEnrichWithMappedConfigButInvalidProperty(): void { - $product = new StorefrontProductEntity(); + $product = new SalesChannelProductEntity(); $product->setId('product123'); $resolverContext = new EntityResolverContext($this->createMock(SalesChannelContext::class), ProductDefinition::class, $product); @@ -204,7 +204,7 @@ public function testEnrichWithMappedConfigButInvalidProperty(): void $slot->setFieldConfig($fieldConfig); $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('Property foo do not exist in class ' . StorefrontProductEntity::class); + $this->expectExceptionMessage('Property foo do not exist in class ' . SalesChannelProductEntity::class); $this->productBoxResolver->enrich($slot, $resolverContext, $result); } diff --git a/Content/Test/Cms/SlotDataResolver/Type/ProductListingTypeDataResolverTest.php b/Content/Test/Cms/SlotDataResolver/Type/ProductListingTypeDataResolverTest.php index 8db35629e2..8037251189 100644 --- a/Content/Test/Cms/SlotDataResolver/Type/ProductListingTypeDataResolverTest.php +++ b/Content/Test/Cms/SlotDataResolver/Type/ProductListingTypeDataResolverTest.php @@ -4,14 +4,14 @@ use PHPUnit\Framework\TestCase; use Shopware\Core\Content\Cms\Aggregate\CmsSlot\CmsSlotEntity; +use Shopware\Core\Content\Cms\SalesChannel\Struct\ProductListingStruct; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ListingResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\SlotDataResolveResult; use Shopware\Core\Content\Cms\SlotDataResolver\Type\ProductListingTypeDataResolver; -use Shopware\Core\Content\Cms\Storefront\Struct\ProductListingStruct; use Shopware\Core\Content\Product\ProductCollection; use Shopware\Core\Content\Product\ProductDefinition; -use Shopware\Core\Content\Product\Storefront\StorefrontProductEntity; +use Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult; @@ -64,7 +64,7 @@ public function testEnrichWithoutListingContext(): void public function testEnrichWithListingContext(): void { - $product = new StorefrontProductEntity(); + $product = new SalesChannelProductEntity(); $product->setUniqueIdentifier('product1'); $searchResult = new EntitySearchResult( diff --git a/Content/Test/Cms/SlotDataResolver/Type/ProductSliderTypeDataResolverTest.php b/Content/Test/Cms/SlotDataResolver/Type/ProductSliderTypeDataResolverTest.php index 69a092958a..c88a718151 100644 --- a/Content/Test/Cms/SlotDataResolver/Type/ProductSliderTypeDataResolverTest.php +++ b/Content/Test/Cms/SlotDataResolver/Type/ProductSliderTypeDataResolverTest.php @@ -13,7 +13,7 @@ use Shopware\Core\Content\Cms\SlotDataResolver\Type\ProductSliderTypeDataResolver; use Shopware\Core\Content\Product\ProductCollection; use Shopware\Core\Content\Product\ProductDefinition; -use Shopware\Core\Content\Product\Storefront\StorefrontProductEntity; +use Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Shopware\Core\System\SalesChannel\SalesChannelContext; @@ -125,10 +125,10 @@ public function testCollectWithMappedConfigButWithInvalidProperty(): void public function testCollectWithMappedConfig(): void { - $product1 = new StorefrontProductEntity(); + $product1 = new SalesChannelProductEntity(); $product1->setUniqueIdentifier('product1'); - $product2 = new StorefrontProductEntity(); + $product2 = new SalesChannelProductEntity(); $product2->setUniqueIdentifier('product2'); $products = new ProductCollection([$product1, $product2]); @@ -178,7 +178,7 @@ public function testCollectWithMappedConfigButEmptyManyToManyRelation(): void public function testCollectWithMappedConfigButEmptyOneToManyRelation(): void { - $product = new StorefrontProductEntity(); + $product = new SalesChannelProductEntity(); $product->setUniqueIdentifier('product1'); $resolverContext = new EntityResolverContext($this->createMock(SalesChannelContext::class), ProductDefinition::class, $product); diff --git a/Content/Test/Cms/SlotDataResolver/Type/TextTypeDataResolverTest.php b/Content/Test/Cms/SlotDataResolver/Type/TextTypeDataResolverTest.php index 706b730c59..ff8d099709 100644 --- a/Content/Test/Cms/SlotDataResolver/Type/TextTypeDataResolverTest.php +++ b/Content/Test/Cms/SlotDataResolver/Type/TextTypeDataResolverTest.php @@ -4,13 +4,13 @@ use PHPUnit\Framework\TestCase; use Shopware\Core\Content\Cms\Aggregate\CmsSlot\CmsSlotEntity; +use Shopware\Core\Content\Cms\SalesChannel\Struct\TextStruct; use Shopware\Core\Content\Cms\SlotDataResolver\FieldConfig; use Shopware\Core\Content\Cms\SlotDataResolver\FieldConfigCollection; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\EntityResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\ResolverContext\ResolverContext; use Shopware\Core\Content\Cms\SlotDataResolver\SlotDataResolveResult; use Shopware\Core\Content\Cms\SlotDataResolver\Type\TextTypeDataResolver; -use Shopware\Core\Content\Cms\Storefront\Struct\TextStruct; use Shopware\Core\Content\Product\ProductDefinition; use Shopware\Core\Content\Product\ProductEntity; use Shopware\Core\System\SalesChannel\SalesChannelContext; diff --git a/Content/Test/Product/ProductControllerTest.php b/Content/Test/Product/ProductControllerTest.php index 18b9ec508c..b5bab69d9a 100644 --- a/Content/Test/Product/ProductControllerTest.php +++ b/Content/Test/Product/ProductControllerTest.php @@ -7,12 +7,12 @@ use Shopware\Core\Content\Product\Aggregate\ProductVisibility\ProductVisibilityDefinition; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; -use Shopware\Core\Framework\Test\TestCaseBase\StorefrontFunctionalTestBehaviour; +use Shopware\Core\Framework\Test\TestCaseBase\SalesChannelFunctionalTestBehaviour; use Shopware\Core\Framework\Uuid\Uuid; class ProductControllerTest extends TestCase { - use StorefrontFunctionalTestBehaviour; + use SalesChannelFunctionalTestBehaviour; /** * @var EntityRepositoryInterface @@ -35,7 +35,7 @@ public function testProductList(): void $manufacturerId = Uuid::randomHex(); $taxId = Uuid::randomHex(); - $client = $this->getStorefrontClient(); + $client = $this->getSalesChannelClient(); $salesChannelId = $this->salesChannelIds[count($this->salesChannelIds) - 1]; $this->productRepository->create([ @@ -52,7 +52,7 @@ public function testProductList(): void ], ], Context::createDefaultContext()); - $client->request('GET', '/storefront-api/v1/product'); + $client->request('GET', '/sales-channel-api/v1/product'); static::assertSame(200, $client->getResponse()->getStatusCode(), $client->getResponse()->getContent()); @@ -80,7 +80,7 @@ public function testProductDetail(): void $manufacturerId = Uuid::randomHex(); $taxId = Uuid::randomHex(); - $client = $this->getStorefrontClient(); + $client = $this->getSalesChannelClient(); $salesChannelId = $this->salesChannelIds[count($this->salesChannelIds) - 1]; $this->productRepository->create([ @@ -97,7 +97,7 @@ public function testProductDetail(): void ], ], Context::createDefaultContext()); - $client->request('GET', '/storefront-api/v1/product/' . $productId); + $client->request('GET', '/sales-channel-api/v1/product/' . $productId); static::assertSame(200, $client->getResponse()->getStatusCode(), $client->getResponse()->getContent()); diff --git a/Framework/Api/Controller/StorefrontProxyController.php b/Framework/Api/Controller/SalesChannelProxyController.php similarity index 91% rename from Framework/Api/Controller/StorefrontProxyController.php rename to Framework/Api/Controller/SalesChannelProxyController.php index 4e15a784a0..759f4f4af1 100644 --- a/Framework/Api/Controller/StorefrontProxyController.php +++ b/Framework/Api/Controller/SalesChannelProxyController.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Routing\Annotation\Route; -class StorefrontProxyController extends AbstractController +class SalesChannelProxyController extends AbstractController { /** * @var KernelInterface @@ -45,7 +45,7 @@ public function __construct( } /** - * @Route("/api/v{version}/_proxy/storefront-api/{salesChannelId}/{_path}", name="api.proxy.storefront", requirements={"_path" = ".*"}) + * @Route("/api/v{version}/_proxy/sales-channel-api/{salesChannelId}/{_path}", name="api.proxy.sales-channel", requirements={"_path" = ".*"}) * * @throws InvalidSalesChannelIdException */ @@ -63,7 +63,7 @@ public function proxy(string $_path, string $salesChannelId, Request $request, C $contextToken = Random::getAlphanumericString(32); } - $server = array_merge($request->server->all(), ['REQUEST_URI' => '/storefront-api/' . $_path]); + $server = array_merge($request->server->all(), ['REQUEST_URI' => '/sales-channel-api/' . $_path]); $cloned = $request->duplicate(null, null, [], null, null, $server); $cloned->headers->set(PlatformRequest::HEADER_ACCESS_KEY, $salesChannel->getAccessKey()); $cloned->headers->set(PlatformRequest::HEADER_CONTEXT_TOKEN, $contextToken); diff --git a/Framework/Api/EventListener/Authentication/StorefrontAuthenticationListener.php b/Framework/Api/EventListener/Authentication/SalesChannelAuthenticationListener.php similarity index 93% rename from Framework/Api/EventListener/Authentication/StorefrontAuthenticationListener.php rename to Framework/Api/EventListener/Authentication/SalesChannelAuthenticationListener.php index 2244090549..7a84a64cff 100644 --- a/Framework/Api/EventListener/Authentication/StorefrontAuthenticationListener.php +++ b/Framework/Api/EventListener/Authentication/SalesChannelAuthenticationListener.php @@ -12,19 +12,19 @@ use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; use Symfony\Component\HttpKernel\KernelEvents; -class StorefrontAuthenticationListener implements EventSubscriberInterface +class SalesChannelAuthenticationListener implements EventSubscriberInterface { /** * @var string */ - private static $routePrefix = '/storefront-api/'; + private static $routePrefix = '/sales-channel-api/'; /** * @var array[] */ private static $unprotectedRoutes = [ [ - 'path' => '/storefront-api/v1/checkout/guest-order/', + 'path' => '/sales-channel-api/v1/checkout/guest-order/', 'methods' => ['GET'], ], ]; diff --git a/Framework/Api/Response/ResponseFactoryRegistry.php b/Framework/Api/Response/ResponseFactoryRegistry.php index c9baa85e37..234d453b6b 100644 --- a/Framework/Api/Response/ResponseFactoryRegistry.php +++ b/Framework/Api/Response/ResponseFactoryRegistry.php @@ -10,8 +10,8 @@ class ResponseFactoryRegistry { - public const DEFAULT_RESPONSE_TYPE = 'application/vnd.api+json'; - public const STOREFRONT_DEFAULT_RESPONSE_TYPE = 'application/json'; + private const DEFAULT_RESPONSE_TYPE = 'application/vnd.api+json'; + private const SALES_CHANNEL_DEFAULT_RESPONSE_TYPE = 'application/json'; /** * @var ResponseFactoryInterface[] @@ -31,7 +31,7 @@ public function getType(Request $request): ResponseFactoryInterface $contentTypes = $request->getAcceptableContentTypes(); if (\in_array('*/*', $contentTypes, true)) { $contentTypes[] = ($context->getSource() instanceof SalesChannelApiSource) - ? self::STOREFRONT_DEFAULT_RESPONSE_TYPE + ? self::SALES_CHANNEL_DEFAULT_RESPONSE_TYPE : self::DEFAULT_RESPONSE_TYPE; } diff --git a/Framework/Api/Response/Type/Storefront/JsonApiType.php b/Framework/Api/Response/Type/SalesChannel/JsonApiType.php similarity index 70% rename from Framework/Api/Response/Type/Storefront/JsonApiType.php rename to Framework/Api/Response/Type/SalesChannel/JsonApiType.php index 6700ebae9b..5d2af20af5 100644 --- a/Framework/Api/Response/Type/Storefront/JsonApiType.php +++ b/Framework/Api/Response/Type/SalesChannel/JsonApiType.php @@ -1,16 +1,16 @@ getVersion($request) ? ('/v' . $this->getVersion($request)) : ''; - return $this->getBaseUrl($request) . '/storefront-api' . $versionPart; + return $this->getBaseUrl($request) . '/sales-channel-api' . $versionPart; } } diff --git a/Framework/Api/Response/Type/Storefront/JsonType.php b/Framework/Api/Response/Type/SalesChannel/JsonType.php similarity index 81% rename from Framework/Api/Response/Type/Storefront/JsonType.php rename to Framework/Api/Response/Type/SalesChannel/JsonType.php index 013ccf6dc8..8fdf8d67ee 100644 --- a/Framework/Api/Response/Type/Storefront/JsonType.php +++ b/Framework/Api/Response/Type/SalesChannel/JsonType.php @@ -1,6 +1,6 @@ getVersion($request) ? ('/v' . $this->getVersion($request)) : ''; - return $this->getBaseUrl($request) . '/storefront-api' . $versionPart; + return $this->getBaseUrl($request) . '/sales-channel-api' . $versionPart; } } diff --git a/Framework/Api/Serializer/JsonStorefrontApiEncoder.php b/Framework/Api/Serializer/JsonSalesChannelApiEncoder.php similarity index 93% rename from Framework/Api/Serializer/JsonStorefrontApiEncoder.php rename to Framework/Api/Serializer/JsonSalesChannelApiEncoder.php index 31e2e319ae..672cfc4c61 100644 --- a/Framework/Api/Serializer/JsonStorefrontApiEncoder.php +++ b/Framework/Api/Serializer/JsonSalesChannelApiEncoder.php @@ -4,7 +4,7 @@ use Shopware\Core\Framework\DataAbstractionLayer\Entity; -class JsonStorefrontApiEncoder extends JsonApiEncoder +class JsonSalesChannelApiEncoder extends JsonApiEncoder { /** * @var string[][] diff --git a/Framework/DataAbstractionLayer/DefinitionValidator.php b/Framework/DataAbstractionLayer/DefinitionValidator.php index 95f390a3ad..269f39cd65 100644 --- a/Framework/DataAbstractionLayer/DefinitionValidator.php +++ b/Framework/DataAbstractionLayer/DefinitionValidator.php @@ -69,7 +69,7 @@ class DefinitionValidator 'search_dictionary', 'cart', 'migration', - 'storefront_api_context', + 'sales_channel_api_context', ]; /** diff --git a/Framework/Demodata/Generator/OrderGenerator.php b/Framework/Demodata/Generator/OrderGenerator.php index b1b90ea629..a066ebec46 100644 --- a/Framework/Demodata/Generator/OrderGenerator.php +++ b/Framework/Demodata/Generator/OrderGenerator.php @@ -8,7 +8,7 @@ use Shopware\Core\Checkout\Cart\Order\OrderConversionContext; use Shopware\Core\Checkout\Cart\Order\OrderConverter; use Shopware\Core\Checkout\Cart\Price\Struct\CartPrice; -use Shopware\Core\Checkout\Cart\Storefront\CartService; +use Shopware\Core\Checkout\Cart\SalesChannel\CartService; use Shopware\Core\Checkout\Order\OrderDefinition; use Shopware\Core\Content\Product\Cart\ProductCollector; use Shopware\Core\Defaults; diff --git a/Framework/DependencyInjection/api.xml b/Framework/DependencyInjection/api.xml index 03bb4202af..d892757dcf 100644 --- a/Framework/DependencyInjection/api.xml +++ b/Framework/DependencyInjection/api.xml @@ -81,15 +81,15 @@ - - - + + + - + @@ -98,7 +98,7 @@ - + @@ -198,7 +198,7 @@ - + diff --git a/Framework/DependencyInjection/demodata.xml b/Framework/DependencyInjection/demodata.xml index a046c18a78..483d433fd6 100644 --- a/Framework/DependencyInjection/demodata.xml +++ b/Framework/DependencyInjection/demodata.xml @@ -89,7 +89,7 @@ - + diff --git a/Framework/DependencyInjection/services.xml b/Framework/DependencyInjection/services.xml index 8304457ecb..c1992e45a9 100644 --- a/Framework/DependencyInjection/services.xml +++ b/Framework/DependencyInjection/services.xml @@ -238,7 +238,7 @@ - + diff --git a/Framework/Routing/ApiRequestContextResolver.php b/Framework/Routing/ApiRequestContextResolver.php index 401d1d567d..d950e6156d 100644 --- a/Framework/Routing/ApiRequestContextResolver.php +++ b/Framework/Routing/ApiRequestContextResolver.php @@ -14,7 +14,7 @@ use Shopware\Core\Framework\Routing\Exception\LanguageNotFoundException; use Shopware\Core\Framework\Uuid\Uuid; use Shopware\Core\PlatformRequest; -use Shopware\Core\StorefrontRequest; +use Shopware\Core\SalesChannelRequest; use Symfony\Component\HttpFoundation\Request; class ApiRequestContextResolver implements RequestContextResolverInterface @@ -97,7 +97,7 @@ private function getRuntimeParameters(Request $request): array private function resolveContextOrigin(Request $request): ContextSource { - if ($request->attributes->has(StorefrontRequest::ATTRIBUTE_IS_STOREFRONT_REQUEST)) { + if ($request->attributes->has(SalesChannelRequest::ATTRIBUTE_IS_SALES_CHANNEL_REQUEST)) { return new SalesChannelApiSource(Defaults::SALES_CHANNEL); } diff --git a/Framework/Routing/SalesChannelRequestContextResolver.php b/Framework/Routing/SalesChannelRequestContextResolver.php index bf3a20dd21..6e57b1480b 100644 --- a/Framework/Routing/SalesChannelRequestContextResolver.php +++ b/Framework/Routing/SalesChannelRequestContextResolver.php @@ -44,8 +44,8 @@ public function resolve(SymfonyRequest $master, SymfonyRequest $request): void $salesChannelId = $master->attributes->get(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_ID); // sub requests can use the context of the master request - if ($master->attributes->has(PlatformRequest::ATTRIBUTE_STOREFRONT_CONTEXT_OBJECT)) { - $context = $master->attributes->get(PlatformRequest::ATTRIBUTE_STOREFRONT_CONTEXT_OBJECT); + if ($master->attributes->has(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT)) { + $context = $master->attributes->get(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT); } else { $context = $this->contextService->get( $salesChannelId, @@ -55,19 +55,19 @@ public function resolve(SymfonyRequest $master, SymfonyRequest $request): void } $request->attributes->set(PlatformRequest::ATTRIBUTE_CONTEXT_OBJECT, $context->getContext()); - $request->attributes->set(PlatformRequest::ATTRIBUTE_STOREFRONT_CONTEXT_OBJECT, $context); + $request->attributes->set(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT, $context); } public function handleSalesChannelContext(Request $request, Request $master, string $salesChannelId, string $contextToken): void { // sub requests can use the context of the master request - if ($master->attributes->has(PlatformRequest::ATTRIBUTE_STOREFRONT_CONTEXT_OBJECT)) { - $context = $master->attributes->get(PlatformRequest::ATTRIBUTE_STOREFRONT_CONTEXT_OBJECT); + if ($master->attributes->has(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT)) { + $context = $master->attributes->get(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT); } else { $context = $this->contextService->get($salesChannelId, $contextToken, $request->headers->get(PlatformRequest::HEADER_LANGUAGE_ID)); } $request->attributes->set(PlatformRequest::ATTRIBUTE_CONTEXT_OBJECT, $context->getContext()); - $request->attributes->set(PlatformRequest::ATTRIBUTE_STOREFRONT_CONTEXT_OBJECT, $context); + $request->attributes->set(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT, $context); } } diff --git a/Framework/Test/Api/Controller/StorefrontProxyControllerTest.php b/Framework/Test/Api/Controller/SalesChannelProxyControllerTest.php similarity index 98% rename from Framework/Test/Api/Controller/StorefrontProxyControllerTest.php rename to Framework/Test/Api/Controller/SalesChannelProxyControllerTest.php index 62c628c4ba..6a421be674 100644 --- a/Framework/Test/Api/Controller/StorefrontProxyControllerTest.php +++ b/Framework/Test/Api/Controller/SalesChannelProxyControllerTest.php @@ -13,7 +13,7 @@ use Shopware\Core\PlatformRequest; use Symfony\Component\HttpFoundation\Response; -class StorefrontProxyControllerTest extends TestCase +class SalesChannelProxyControllerTest extends TestCase { use AdminFunctionalTestBehaviour, AssertArraySubsetBehaviour; @@ -39,7 +39,7 @@ public function testProxyWithInvalidSalesChannelId(): void static::assertEquals('FRAMEWORK__INVALID_SALES_CHANNEL', $response['errors'][0]['code'] ?? null); } - public function testProxyCallToStorefrontApi(): void + public function testProxyCallToSalesChannelApi(): void { $salesChannel = $this->createSalesChannel(); @@ -221,7 +221,7 @@ private function createLanguage($langId, string $salesChannelId, $fallbackId = n private function getUrl(string $salesChannelId, string $url): string { return sprintf( - '/api/v%d/_proxy/storefront-api/%s/v%1$d/%s', + '/api/v%d/_proxy/sales-channel-api/%s/v%1$d/%s', PlatformRequest::API_VERSION, $salesChannelId, ltrim($url, '/') diff --git a/Framework/Test/Api/ResponseTypeRegistryTest.php b/Framework/Test/Api/ResponseTypeRegistryTest.php index 99fba343d1..8375580087 100644 --- a/Framework/Test/Api/ResponseTypeRegistryTest.php +++ b/Framework/Test/Api/ResponseTypeRegistryTest.php @@ -14,7 +14,7 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult; -use Shopware\Core\Framework\Test\TestCaseBase\StorefrontFunctionalTestBehaviour; +use Shopware\Core\Framework\Test\TestCaseBase\SalesChannelFunctionalTestBehaviour; use Shopware\Core\Framework\Uuid\Uuid; use Shopware\Core\PlatformRequest; use Symfony\Component\HttpFoundation\ParameterBag; @@ -24,7 +24,7 @@ class ResponseTypeRegistryTest extends TestCase { - use StorefrontFunctionalTestBehaviour; + use SalesChannelFunctionalTestBehaviour; /** * @var ResponseFactoryRegistry @@ -97,27 +97,27 @@ public function testAdminApiUnsupportedContentType(): void $this->getDetailResponse($context, $id, $self, 1, $accept, false); } - public function testStorefrontApi(): void + public function testSalesChannelApi(): void { $id = Uuid::randomHex(); $accept = 'application/json'; - $context = $this->getStorefrontContext(); - $response = $this->getDetailResponse($context, $id, '/storefront-api/category/' . $id, '', $accept, false); + $context = $this->getSalesChannelContext(); + $response = $this->getDetailResponse($context, $id, '/sales-channel-api/category/' . $id, '', $accept, false); static::assertEquals($accept, $response->headers->get('content-type')); $content = json_decode($response->getContent(), true); static::assertEquals($id, $content['data']['name']); } - public function testStorefrontJsonApi(): void + public function testSalesChannelJsonApi(): void { - // jsonapi support for storefront is deactivated + // jsonapi support for sales channel is deactivated $this->expectException(UnsupportedMediaTypeHttpException::class); $id = Uuid::randomHex(); $accept = 'application/vnd.api+json'; - $self = 'http://localhost/storefront-api/category/' . $id; - $context = $this->getStorefrontContext(); + $self = 'http://localhost/sales-channel-api/category/' . $id; + $context = $this->getSalesChannelContext(); $response = $this->getDetailResponse($context, $id, $self, '', $accept, false); static::assertEquals($accept, $response->headers->get('content-type')); @@ -131,12 +131,12 @@ public function testStorefrontJsonApi(): void $this->assertEmptyRelationships($content); } - public function testStorefrontDefaultContentType(): void + public function testSSalesChannelDefaultContentType(): void { $id = Uuid::randomHex(); $accept = '*/*'; - $self = 'http://localhost/storefront-api/category/' . $id; - $context = $this->getStorefrontContext(); + $self = 'http://localhost/sales-channel-api/category/' . $id; + $context = $this->getSalesChannelContext(); $response = $this->getDetailResponse($context, $id, $self, '', $accept, false); static::assertEquals('application/json', $response->headers->get('content-type')); @@ -144,25 +144,25 @@ public function testStorefrontDefaultContentType(): void static::assertEquals($id, $content['data']['name']); } - public function testStorefrontApiUnsupportedContentType(): void + public function testSalesChannelApiUnsupportedContentType(): void { $this->expectException(UnsupportedMediaTypeHttpException::class); $id = Uuid::randomHex(); $accept = 'text/plain'; - $self = 'http://localhost/storefront-api/category/' . $id; - $context = $this->getStorefrontContext(); + $self = 'http://localhost/sales-channel-api/category/' . $id; + $context = $this->getSalesChannelContext(); $this->getDetailResponse($context, $id, $self, '', $accept, false); } - public function testStorefrontJsonApiList(): void + public function testSalesChannelJsonApiList(): void { // jsonapi support for storefront is deactivated $this->expectException(UnsupportedMediaTypeHttpException::class); $id = Uuid::randomHex(); $accept = 'application/vnd.api+json'; - $self = 'http://localhost/storefront-api/category'; - $context = $this->getStorefrontContext(); + $self = 'http://localhost/sales-channel-api/category'; + $context = $this->getSalesChannelContext(); $response = $this->getListResponse($context, $id, $self, '', $accept); static::assertEquals($accept, $response->headers->get('content-type')); @@ -211,7 +211,7 @@ protected function assertDetailJsonApiStructure($content): void static::assertArrayHasKey('included', $content); } - private function getStorefrontContext(): Context + private function getSalesChannelContext(): Context { return new Context(new SalesChannelApiSource(Defaults::SALES_CHANNEL)); } diff --git a/Framework/Test/Api/Serializer/JsonStorefrontApiEncoderTest.php b/Framework/Test/Api/Serializer/JsonSalesChannelApiEncoderTest.php similarity index 95% rename from Framework/Test/Api/Serializer/JsonStorefrontApiEncoderTest.php rename to Framework/Test/Api/Serializer/JsonSalesChannelApiEncoderTest.php index 802ac24ffe..34b909e1e4 100644 --- a/Framework/Test/Api/Serializer/JsonStorefrontApiEncoderTest.php +++ b/Framework/Test/Api/Serializer/JsonSalesChannelApiEncoderTest.php @@ -7,19 +7,19 @@ use Shopware\Core\Content\Media\MediaEntity; use Shopware\Core\Content\Product\ProductDefinition; use Shopware\Core\Framework\Api\Exception\UnsupportedEncoderInputException; -use Shopware\Core\Framework\Api\Serializer\JsonStorefrontApiEncoder; +use Shopware\Core\Framework\Api\Serializer\JsonSalesChannelApiEncoder; use Shopware\Core\System\User\UserDefinition; -class JsonStorefrontApiEncoderTest extends TestCase +class JsonSalesChannelApiEncoderTest extends TestCase { /** - * @var JsonStorefrontApiEncoder + * @var JsonSalesChannelApiEncoder */ private $encoder; protected function setUp(): void { - $this->encoder = new JsonStorefrontApiEncoder(); + $this->encoder = new JsonSalesChannelApiEncoder(); } public function emptyInputProvider(): array @@ -43,7 +43,7 @@ public function testEncodeWithEmptyInput($input): void { $this->expectException(UnsupportedEncoderInputException::class); - $this->encoder->encode(ProductDefinition::class, $input, '/storefront-api'); + $this->encoder->encode(ProductDefinition::class, $input, '/sales-channel-api'); } public function testEncodeStruct(): void diff --git a/Framework/Test/ClassNamespaceTest.php b/Framework/Test/ClassNamespaceTest.php index 513f5713b9..712c94b33e 100644 --- a/Framework/Test/ClassNamespaceTest.php +++ b/Framework/Test/ClassNamespaceTest.php @@ -48,6 +48,56 @@ public function testNoGlobalCommandDirectories(): void static::assertCount(0, $result, 'No global Command directories allowed, put your commands in the right domain directory, violations: ' . print_r($result, true)); } + public function testNoStorefrontFiles(): void + { + $iterator = (new Finder()) + ->in(__DIR__ . '/../../') + ->files() + ->sortByName() + ->filter(function (SplFileInfo $file): bool { + if (in_array($file->getRelativePathname(), [ + 'Framework/Bundle.php', + 'Framework/DataAbstractionLayer/SchemaGenerator.php', + 'Defaults.php', + 'Framework/Snippet/SnippetService.php', + 'Framework/Snippet/SnippetServiceInterface.php', + 'Framework/Test/Api/Controller/SalesChannelProxyControllerTest.php', + 'Framework/Test/Api/ResponseTypeRegistryTest.php', + 'Framework/Test/ClassNamespaceTest.php', + 'Framework/Test/Snippet/SnippetServiceTest.php', + 'Framework/Test/Snippet/_fixtures/testGetStoreFrontSnippets/SnippetFile_de.php', + 'Framework/Test/Snippet/_fixtures/testGetStoreFrontSnippets/SnippetFile_en.php', + 'Framework/Test/Snippet/_fixtures/testGetStoreFrontSnippets/de.json', + 'Framework/Test/Snippet/_fixtures/testGetStoreFrontSnippets/en.json', + 'Framework/Test/TestCaseBase/TestValidityListener.php', + 'Framework/Translation/Translator.php', + 'Migration/Migration1536232740StorefrontApiContext.php', + 'Migration/Migration1536233420BasicData.php', + 'Migration/Migration1554724978ChangeTokenToVarchar.php', + 'Migration/Migration1554901441SalesChannelApiContext.php', + ], true)) { + return false; + } + + if (stripos($file->getRealPath(), 'Storefront') !== false) { + return true; + } + + if ($file->isFile() && stripos($file->getContents(), 'Storefront') !== false) { + return true; + } + + return false; + }) + ->getIterator(); + + $result = array_map(function (SplFileInfo $info) { + return $info->getRelativePathname(); + }, iterator_to_array($iterator)); + + static::assertCount(0, $result, 'No global storefront files allowed, name them %SalesChannel% instead, violations: ' . print_r(array_values($result), true)); + } + /** * @param string[] $basePathParts * diff --git a/Framework/Test/TestCaseBase/StorefrontApiTestBehaviour.php b/Framework/Test/TestCaseBase/SalesChannelApiTestBehaviour.php similarity index 67% rename from Framework/Test/TestCaseBase/StorefrontApiTestBehaviour.php rename to Framework/Test/TestCaseBase/SalesChannelApiTestBehaviour.php index 4005289deb..28f3c45272 100644 --- a/Framework/Test/TestCaseBase/StorefrontApiTestBehaviour.php +++ b/Framework/Test/TestCaseBase/SalesChannelApiTestBehaviour.php @@ -12,7 +12,7 @@ use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Component\HttpKernel\KernelInterface; -trait StorefrontApiTestBehaviour +trait SalesChannelApiTestBehaviour { /** * @var array @@ -22,19 +22,19 @@ trait StorefrontApiTestBehaviour /** * @var Client|null */ - private $storeFrontClient; + private $salesChannelApiClient; /** * @after */ - public function resetStorefrontApiTestCaseTrait(): void + public function resetSalesChannelApiTestCaseTrait(): void { - if (!$this->storeFrontClient) { + if (!$this->salesChannelApiClient) { return; } /** @var Connection $connection */ - $connection = $this->storeFrontClient + $connection = $this->salesChannelApiClient ->getContainer() ->get(Connection::class); @@ -49,42 +49,42 @@ public function resetStorefrontApiTestCaseTrait(): void } $this->salesChannelIds = []; - $this->storeFrontClient = null; + $this->salesChannelApiClient = null; } - public function getStorefrontApiSalesChannelId(): string + public function getSalesChannelApiSalesChannelId(): string { if (!$this->salesChannelIds) { - throw new \LogicException('The sales channel id con only be requested after calling `createStorefrontClient`.'); + throw new \LogicException('The sales channel id con only be requested after calling `createSalesChannelApiClient`.'); } return end($this->salesChannelIds); } - public function createCustomStorefrontClient(array $salesChannelOverride = []): Client + public function createCustomSalesChannelClient(array $salesChannelOverride = []): Client { $kernel = KernelLifecycleManager::getKernel(); - $storefrontApiClient = KernelLifecycleManager::createClient($kernel); - $storefrontApiClient->setServerParameters([ + $salesChannelApiClient = KernelLifecycleManager::createClient($kernel); + $salesChannelApiClient->setServerParameters([ 'HTTP_X-Requested-With' => 'XMLHttpRequest', 'HTTP_Accept' => 'application/json', 'HTTP_X_SW_CONTEXT_TOKEN' => Uuid::randomHex(), ]); - $this->authorizeStorefrontClient($storefrontApiClient, $salesChannelOverride); + $this->authorizeSalesChannelClient($salesChannelApiClient, $salesChannelOverride); - return $storefrontApiClient; + return $salesChannelApiClient; } - protected function getStorefrontClient(): Client + protected function getSalesChannelClient(): Client { - if ($this->storeFrontClient) { - return $this->storeFrontClient; + if ($this->salesChannelApiClient) { + return $this->salesChannelApiClient; } - return $this->storeFrontClient = $this->createStorefrontClient(); + return $this->salesChannelApiClient = $this->createSalesChannelClient(); } - protected function createStorefrontClient( + protected function createSalesChannelClient( ?KernelInterface $kernel = null, bool $enableReboot = false ): Client { @@ -92,23 +92,23 @@ protected function createStorefrontClient( $kernel = KernelLifecycleManager::getKernel(); } - $storefrontApiClient = KernelLifecycleManager::createClient($kernel, $enableReboot); - $storefrontApiClient->setServerParameters([ + $salesChannelApiClient = KernelLifecycleManager::createClient($kernel, $enableReboot); + $salesChannelApiClient->setServerParameters([ 'HTTP_X-Requested-With' => 'XMLHttpRequest', 'HTTP_Accept' => 'application/json', 'HTTP_X_SW_CONTEXT_TOKEN' => Uuid::randomHex(), ]); - $this->authorizeStorefrontClient($storefrontApiClient); + $this->authorizeSalesChannelClient($salesChannelApiClient); - return $storefrontApiClient; + return $salesChannelApiClient; } - private function authorizeStorefrontClient(Client $storefrontApiClient, array $salesChannelOverride = []): void + private function authorizeSalesChannelClient(Client $salesChannelApiClient, array $salesChannelOverride = []): void { $accessKey = AccessKeyHelper::generateAccessKey('sales-channel'); /** @var EntityRepositoryInterface $salesChannelRepository */ - $salesChannelRepository = $storefrontApiClient + $salesChannelRepository = $salesChannelApiClient ->getContainer() ->get('sales_channel.repository'); @@ -133,6 +133,6 @@ private function authorizeStorefrontClient(Client $storefrontApiClient, array $s $this->salesChannelIds[] = $salesChannel['id']; $header = 'HTTP_' . str_replace('-', '_', strtoupper(PlatformRequest::HEADER_ACCESS_KEY)); - $storefrontApiClient->setServerParameter($header, $accessKey); + $salesChannelApiClient->setServerParameter($header, $accessKey); } } diff --git a/Framework/Test/TestCaseBase/StorefrontFunctionalTestBehaviour.php b/Framework/Test/TestCaseBase/SalesChannelFunctionalTestBehaviour.php similarity index 60% rename from Framework/Test/TestCaseBase/StorefrontFunctionalTestBehaviour.php rename to Framework/Test/TestCaseBase/SalesChannelFunctionalTestBehaviour.php index ba7ad31c11..8d9b8fd9f9 100644 --- a/Framework/Test/TestCaseBase/StorefrontFunctionalTestBehaviour.php +++ b/Framework/Test/TestCaseBase/SalesChannelFunctionalTestBehaviour.php @@ -2,8 +2,8 @@ namespace Shopware\Core\Framework\Test\TestCaseBase; -trait StorefrontFunctionalTestBehaviour +trait SalesChannelFunctionalTestBehaviour { use IntegrationTestBehaviour, - StorefrontApiTestBehaviour; + SalesChannelApiTestBehaviour; } diff --git a/Framework/Test/Translation/TranslatorTest.php b/Framework/Test/Translation/TranslatorTest.php index 2587550f87..1f359d2743 100644 --- a/Framework/Test/Translation/TranslatorTest.php +++ b/Framework/Test/Translation/TranslatorTest.php @@ -13,7 +13,7 @@ use Shopware\Core\Framework\Test\Translation\_fixtures\SnippetFile_UnitTest; use Shopware\Core\Framework\Translation\Translator; use Shopware\Core\Framework\Uuid\Uuid; -use Shopware\Core\StorefrontRequest; +use Shopware\Core\SalesChannelRequest; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; @@ -56,8 +56,8 @@ public function testPassthru(): void // fake request $request = new Request(); - $request->attributes->set(StorefrontRequest::ATTRIBUTE_DOMAIN_SNIPPET_SET_ID, $this->getSnippetSetIdForLocale('en_GB')); - $request->attributes->set(StorefrontRequest::ATTRIBUTE_DOMAIN_LOCALE, 'en_GB'); + $request->attributes->set(SalesChannelRequest::ATTRIBUTE_DOMAIN_SNIPPET_SET_ID, $this->getSnippetSetIdForLocale('en_GB')); + $request->attributes->set(SalesChannelRequest::ATTRIBUTE_DOMAIN_LOCALE, 'en_GB'); $stack->push($request); $result = $this->translator->getCatalogue('en_GB')->get('frontend.note.item.NoteLinkZoom'); @@ -84,8 +84,8 @@ public function testSimpleOverwrite(): void // fake request $request = new Request(); - $request->attributes->set(StorefrontRequest::ATTRIBUTE_DOMAIN_SNIPPET_SET_ID, $this->getSnippetSetIdForLocale('en_GB')); - $request->attributes->set(StorefrontRequest::ATTRIBUTE_DOMAIN_LOCALE, 'en_GB'); + $request->attributes->set(SalesChannelRequest::ATTRIBUTE_DOMAIN_SNIPPET_SET_ID, $this->getSnippetSetIdForLocale('en_GB')); + $request->attributes->set(SalesChannelRequest::ATTRIBUTE_DOMAIN_LOCALE, 'en_GB'); $this->getContainer()->get(RequestStack::class)->push($request); diff --git a/Framework/Translation/Translator.php b/Framework/Translation/Translator.php index dcb84d03f9..04e26eca1e 100644 --- a/Framework/Translation/Translator.php +++ b/Framework/Translation/Translator.php @@ -4,7 +4,7 @@ use Psr\Cache\CacheItemPoolInterface; use Shopware\Core\Framework\Snippet\SnippetServiceInterface; -use Shopware\Core\StorefrontRequest; +use Shopware\Core\SalesChannelRequest; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Translation\Exception\LogicException; use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface; @@ -143,7 +143,7 @@ private function getCustomizedCatalog(MessageCatalogueInterface $catalog): Messa return $catalog; } - $snippetSetId = $request->attributes->get(StorefrontRequest::ATTRIBUTE_DOMAIN_SNIPPET_SET_ID); + $snippetSetId = $request->attributes->get(SalesChannelRequest::ATTRIBUTE_DOMAIN_SNIPPET_SET_ID); if ($snippetSetId === null) { return $catalog; } diff --git a/Migration/Migration1554901441SalesChannelApiContext.php b/Migration/Migration1554901441SalesChannelApiContext.php new file mode 100644 index 0000000000..5e1bacc852 --- /dev/null +++ b/Migration/Migration1554901441SalesChannelApiContext.php @@ -0,0 +1,32 @@ +executeQuery(' + CREATE TABLE `sales_channel_api_context` ( + `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `payload` json NOT NULL, + PRIMARY KEY (`token`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + '); + } + + public function updateDestructive(Connection $connection): void + { + $connection->executeQuery(' + DROP TABLE `storefront_api_context`; + '); + } +} diff --git a/PlatformRequest.php b/PlatformRequest.php index 2cb247a2d6..d8a6bb8c4b 100644 --- a/PlatformRequest.php +++ b/PlatformRequest.php @@ -20,7 +20,7 @@ final class PlatformRequest * Context attributes */ public const ATTRIBUTE_CONTEXT_OBJECT = 'x-sw-context'; - public const ATTRIBUTE_STOREFRONT_CONTEXT_OBJECT = 'x-sw-storefront-context'; + public const ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT = 'x-sw-sales-channel-context'; public const ATTRIBUTE_SALES_CHANNEL_ID = 'x-sw-sales-channel-id'; /** diff --git a/StorefrontRequest.php b/SalesChannelRequest.php similarity index 71% rename from StorefrontRequest.php rename to SalesChannelRequest.php index 19234bed3c..d06dcfe987 100644 --- a/StorefrontRequest.php +++ b/SalesChannelRequest.php @@ -2,10 +2,10 @@ namespace Shopware\Core; -final class StorefrontRequest +final class SalesChannelRequest { - public const ATTRIBUTE_IS_STOREFRONT_REQUEST = '_is_storefront'; - public const ATTRIBUTE_STOREFRONT_REDIRECT = '_storefront_seo_redirect'; + public const ATTRIBUTE_IS_SALES_CHANNEL_REQUEST = '_is_sales_channel'; + public const ATTRIBUTE_SALES_CHANNEL_REDIRECT = '_sales_channel_seo_redirect'; /** * domain-resolved attributes diff --git a/System/DependencyInjection/sales_channel.xml b/System/DependencyInjection/sales_channel.xml index 908d28847b..c0cf2984dd 100644 --- a/System/DependencyInjection/sales_channel.xml +++ b/System/DependencyInjection/sales_channel.xml @@ -69,11 +69,11 @@ - + - + @@ -94,7 +94,7 @@ - + diff --git a/System/SalesChannel/Command/SalesChannelCreateCommand.php b/System/SalesChannel/Command/SalesChannelCreateCommand.php index 5117556ba2..7012ff1672 100644 --- a/System/SalesChannel/Command/SalesChannelCreateCommand.php +++ b/System/SalesChannel/Command/SalesChannelCreateCommand.php @@ -65,7 +65,7 @@ protected function configure(): void { $this->setName('sales-channel:create') ->addOption('id', null, InputOption::VALUE_REQUIRED, 'Id for the sales channel', Uuid::randomHex()) - ->addOption('name', null, InputOption::VALUE_REQUIRED, 'Name for the application', 'Storefront API endpoint') + ->addOption('name', null, InputOption::VALUE_REQUIRED, 'Name for the application', 'SalesChannel API endpoint') ->addOption('languageId', null, InputOption::VALUE_REQUIRED, 'Default language', Defaults::LANGUAGE_SYSTEM) ->addOption('snippetSetId', null, InputOption::VALUE_REQUIRED, 'Default snippet set') ->addOption('currencyId', null, InputOption::VALUE_REQUIRED, 'Default currency', Defaults::CURRENCY) diff --git a/System/SalesChannel/Context/SalesChannelContextFactory.php b/System/SalesChannel/Context/SalesChannelContextFactory.php index 8aa23cbc27..8e40e07914 100644 --- a/System/SalesChannel/Context/SalesChannelContextFactory.php +++ b/System/SalesChannel/Context/SalesChannelContextFactory.php @@ -262,7 +262,7 @@ private function getContext(string $salesChannelId, array $session): Context $languageIds = $data['sales_channel_language_ids'] ? explode(',', $data['sales_channel_language_ids']) : null; $languageIds = array_keys(array_flip($languageIds)); - //check which language should be used in the current request (request header set, or context already contains a language - stored in `storefront_api_context`) + //check which language should be used in the current request (request header set, or context already contains a language - stored in `sales_channel_api_context`) $defaultLanguageId = Uuid::fromBytesToHex($data['sales_channel_default_language_id']); $languageChain = $this->buildLanguageChain($session, $defaultLanguageId, $languageIds); diff --git a/System/SalesChannel/Context/SalesChannelContextPersister.php b/System/SalesChannel/Context/SalesChannelContextPersister.php index 0727c91bfb..ed038674fd 100644 --- a/System/SalesChannel/Context/SalesChannelContextPersister.php +++ b/System/SalesChannel/Context/SalesChannelContextPersister.php @@ -23,7 +23,7 @@ public function save(string $token, array $parameters): void $parameters = array_replace_recursive($existing, $parameters); $this->connection->executeUpdate( - 'REPLACE INTO storefront_api_context (`token`, `payload`) VALUES (:token, :payload)', + 'REPLACE INTO sales_channel_api_context (`token`, `payload`) VALUES (:token, :payload)', [ 'token' => $token, 'payload' => json_encode($parameters), @@ -34,7 +34,7 @@ public function save(string $token, array $parameters): void public function load(string $token): array { $parameter = $this->connection->fetchColumn( - 'SELECT `payload` FROM storefront_api_context WHERE token = :token', + 'SELECT `payload` FROM sales_channel_api_context WHERE token = :token', ['token' => $token] ); diff --git a/System/SalesChannel/Context/SalesChannelContextService.php b/System/SalesChannel/Context/SalesChannelContextService.php index 239977019b..3d2d7ee137 100644 --- a/System/SalesChannel/Context/SalesChannelContextService.php +++ b/System/SalesChannel/Context/SalesChannelContextService.php @@ -5,7 +5,7 @@ use Psr\Cache\CacheItemInterface; use Psr\Cache\CacheItemPoolInterface; use Shopware\Core\Checkout\Cart\CartRuleLoader; -use Shopware\Core\Checkout\Cart\Storefront\CartService; +use Shopware\Core\Checkout\Cart\SalesChannel\CartService; use Shopware\Core\System\SalesChannel\SalesChannelContext; class SalesChannelContextService implements SalesChannelContextServiceInterface diff --git a/System/SalesChannel/Context/SalesChannelContextValueResolver.php b/System/SalesChannel/Context/SalesChannelContextValueResolver.php index e6864e6e28..2b7018f984 100644 --- a/System/SalesChannel/Context/SalesChannelContextValueResolver.php +++ b/System/SalesChannel/Context/SalesChannelContextValueResolver.php @@ -33,6 +33,6 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable $master = $request; } - yield $master->attributes->get(PlatformRequest::ATTRIBUTE_STOREFRONT_CONTEXT_OBJECT); + yield $master->attributes->get(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT); } } diff --git a/System/SalesChannel/Storefront/StorefrontSalesChannelContextController.php b/System/SalesChannel/SalesChannel/SalesChannelContextController.php similarity index 95% rename from System/SalesChannel/Storefront/StorefrontSalesChannelContextController.php rename to System/SalesChannel/SalesChannel/SalesChannelContextController.php index 51b2a727b8..26747193a3 100644 --- a/System/SalesChannel/Storefront/StorefrontSalesChannelContextController.php +++ b/System/SalesChannel/SalesChannel/SalesChannelContextController.php @@ -1,6 +1,6 @@ getStorefrontClient()->request('PATCH', '/storefront-api/v1/context', ['shippingMethodId' => $testId]); - static::assertSame(Response::HTTP_BAD_REQUEST, $this->getStorefrontClient()->getResponse()->getStatusCode()); - $content = json_decode($this->getStorefrontClient()->getResponse()->getContent(), true); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/context', ['shippingMethodId' => $testId]); + static::assertSame(Response::HTTP_BAD_REQUEST, $this->getSalesChannelClient()->getResponse()->getStatusCode()); + $content = json_decode($this->getSalesChannelClient()->getResponse()->getContent(), true); static::assertEquals( sprintf('Shipping method with id "%s" not found.', $testId), @@ -61,9 +61,9 @@ public function testUpdateContextWithNonExistingParameters(): void /* * Payment method */ - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/context', ['paymentMethodId' => $testId]); - static::assertSame(Response::HTTP_NOT_FOUND, $this->getStorefrontClient()->getResponse()->getStatusCode()); - $content = json_decode($this->getStorefrontClient()->getResponse()->getContent(), true); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/context', ['paymentMethodId' => $testId]); + static::assertSame(Response::HTTP_NOT_FOUND, $this->getSalesChannelClient()->getResponse()->getStatusCode()); + $content = json_decode($this->getSalesChannelClient()->getResponse()->getContent(), true); static::assertEquals( sprintf('The payment method %s could not be found.', $testId), @@ -78,9 +78,9 @@ public function testUpdateContextWithNonLoggedInCustomer(): void /* * Billing address */ - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/context', ['billingAddressId' => $testId]); - static::assertSame(Response::HTTP_FORBIDDEN, $this->getStorefrontClient()->getResponse()->getStatusCode()); - $content = json_decode($this->getStorefrontClient()->getResponse()->getContent(), true); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/context', ['billingAddressId' => $testId]); + static::assertSame(Response::HTTP_FORBIDDEN, $this->getSalesChannelClient()->getResponse()->getStatusCode()); + $content = json_decode($this->getSalesChannelClient()->getResponse()->getContent(), true); static::assertEquals( 'Customer is not logged in.', @@ -90,9 +90,9 @@ public function testUpdateContextWithNonLoggedInCustomer(): void /* * Shipping address */ - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/context', ['shippingAddressId' => $testId]); - static::assertSame(Response::HTTP_FORBIDDEN, $this->getStorefrontClient()->getResponse()->getStatusCode()); - $content = json_decode($this->getStorefrontClient()->getResponse()->getContent(), true); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/context', ['shippingAddressId' => $testId]); + static::assertSame(Response::HTTP_FORBIDDEN, $this->getSalesChannelClient()->getResponse()->getStatusCode()); + $content = json_decode($this->getSalesChannelClient()->getResponse()->getContent(), true); static::assertEquals( 'Customer is not logged in.', @@ -109,10 +109,10 @@ public function testUpdateContextWithLoggedInCustomerAndNonExistingAddresses(): /* * Billing address */ - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/context', ['billingAddressId' => $testId]); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/context', ['billingAddressId' => $testId]); - static::assertSame(Response::HTTP_BAD_REQUEST, $this->getStorefrontClient()->getResponse()->getStatusCode()); - $content = json_decode($this->getStorefrontClient()->getResponse()->getContent(), true); + static::assertSame(Response::HTTP_BAD_REQUEST, $this->getSalesChannelClient()->getResponse()->getStatusCode()); + $content = json_decode($this->getSalesChannelClient()->getResponse()->getContent(), true); static::assertEquals( sprintf('Customer address with id "%s" not found.', $testId), @@ -122,9 +122,9 @@ public function testUpdateContextWithLoggedInCustomerAndNonExistingAddresses(): /* * Shipping address */ - $this->getStorefrontClient()->request('PATCH', '/storefront-api/v1/context', ['shippingAddressId' => $testId]); - static::assertSame(Response::HTTP_BAD_REQUEST, $this->getStorefrontClient()->getResponse()->getStatusCode()); - $content = json_decode($this->getStorefrontClient()->getResponse()->getContent(), true); + $this->getSalesChannelClient()->request('PATCH', '/sales-channel-api/v1/context', ['shippingAddressId' => $testId]); + static::assertSame(Response::HTTP_BAD_REQUEST, $this->getSalesChannelClient()->getResponse()->getStatusCode()); + $content = json_decode($this->getSalesChannelClient()->getResponse()->getContent(), true); static::assertEquals( sprintf('Customer address with id "%s" not found.', $testId), @@ -141,16 +141,16 @@ public function testUpdateContextWithLoggedInCustomer(): void /* * Billing address */ - $this->getStorefrontClient() - ->request('PATCH', '/storefront-api/v1/context', ['billingAddressId' => $billingId]); - static::assertSame(Response::HTTP_OK, $this->getStorefrontClient()->getResponse()->getStatusCode()); + $this->getSalesChannelClient() + ->request('PATCH', '/sales-channel-api/v1/context', ['billingAddressId' => $billingId]); + static::assertSame(Response::HTTP_OK, $this->getSalesChannelClient()->getResponse()->getStatusCode()); /* * Shipping address */ - $this->getStorefrontClient() - ->request('PATCH', '/storefront-api/v1/context', ['shippingAddressId' => $shippingId]); - static::assertSame(Response::HTTP_OK, $this->getStorefrontClient()->getResponse()->getStatusCode()); + $this->getSalesChannelClient() + ->request('PATCH', '/sales-channel-api/v1/context', ['shippingAddressId' => $shippingId]); + static::assertSame(Response::HTTP_OK, $this->getSalesChannelClient()->getResponse()->getStatusCode()); } private function createCustomerAndLogin(?string $email = null, string $password = 'shopware'): string @@ -158,11 +158,11 @@ private function createCustomerAndLogin(?string $email = null, string $password $email = $email ?? Uuid::randomHex() . '@example.com'; $customerId = $this->createCustomer($password, $email); - $this->getStorefrontClient()->request('POST', '/storefront-api/v1/customer/login', [ + $this->getSalesChannelClient()->request('POST', '/sales-channel-api/v1/customer/login', [ 'username' => $email, 'password' => $password, ]); - static::assertSame(Response::HTTP_OK, $this->getStorefrontClient()->getResponse()->getStatusCode()); + static::assertSame(Response::HTTP_OK, $this->getSalesChannelClient()->getResponse()->getStatusCode()); return $customerId; } diff --git a/System/Test/SalesChannel/Storefront/StorefrontSalesChannelControllerTest.php b/System/Test/SalesChannel/SalesChannel/SalesChannelControllerTest.php similarity index 85% rename from System/Test/SalesChannel/Storefront/StorefrontSalesChannelControllerTest.php rename to System/Test/SalesChannel/SalesChannel/SalesChannelControllerTest.php index 89f2fa43cc..c61ebc145d 100644 --- a/System/Test/SalesChannel/Storefront/StorefrontSalesChannelControllerTest.php +++ b/System/Test/SalesChannel/SalesChannel/SalesChannelControllerTest.php @@ -1,6 +1,6 @@ getStorefrontClient(); + $client = $this->getSalesChannelClient(); $client->setServerParameter('CONTENT_TYPE', 'application/json'); $this->connection = $this->getContainer()->get(Connection::class); $this->salesChannelRepository = $this->getContainer()->get('sales_channel.repository'); @@ -54,8 +53,8 @@ public function testGetSalesChannelCurrencies(): void { $originalCurrency = $this->addCurrency(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/currency'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/currency'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode(), $response->getContent()); $content = json_decode($response->getContent(), true); @@ -77,8 +76,8 @@ public function testGetSalesChannelLanguages(): void { $originalLanguage = $this->addLanguage(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/language'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/language'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -100,8 +99,8 @@ public function testGetSalesChannelCountries(): void { $originalCountry = $this->addCountry(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/country'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/country'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -124,8 +123,8 @@ public function testGetSalesChannelCountryStates(): void $originalCountryWithStates = $this->addCountryWithStates(); $countryId = $originalCountryWithStates['id']; - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/country/' . $countryId . '/state'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/country/' . $countryId . '/state'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -143,8 +142,8 @@ public function testGetSalesChannelPaymentMethods(): void { $originalPaymentMethod = $this->addPaymentMethod(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/payment-method'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/payment-method'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -166,8 +165,8 @@ public function testGetSalesChannelShippingMethods(): void { $originalShippingMethod = $this->addShippingMethod(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/shipping-method'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/shipping-method'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -186,8 +185,8 @@ public function testGetSalesChannelShippingMethodsWithoutUnavailable(): void $originalShippingMethod = $this->addShippingMethod(); $this->addUnavailableShippingMethod(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/shipping-method'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/shipping-method'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -206,8 +205,8 @@ public function testGetMultiSalesChannelShippingMethods(): void $originalShippingMethod = $this->addShippingMethod(); $this->addShippingMethod(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/shipping-method'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/shipping-method'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -227,8 +226,8 @@ public function testGetMultiSalesChannelShippingMethods(): void public function testGetDefaultSalesChannelShippingMethod(): void { $this->addUnavailableShippingMethod(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/shipping-method'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/shipping-method'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -241,13 +240,13 @@ public function testGetSalesChannelPaymentMethodsWithoutUnavailable(): void $originalPaymentMethod = $this->addPaymentMethod(); $this->addUnavailablePaymentMethod(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/payment-method'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/payment-method'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); - static::assertCount(StorefrontPageTestConstants::PAYMENT_METHOD_COUNT + 1, $content['data'], print_r($content['data'], true)); + static::assertCount(6, $content['data'], print_r($content['data'], true)); foreach ($content['data'] as $paymentMethod) { if ($paymentMethod['id'] !== $originalPaymentMethod['id']) { @@ -267,8 +266,8 @@ public function testGetMultiSalesChannelPaymentMethods(): void $originalPaymentMethod = $this->addPaymentMethod(); $this->addPaymentMethod(); - $this->getStorefrontClient()->request('GET', '/storefront-api/v1/payment-method'); - $response = $this->getStorefrontClient()->getResponse(); + $this->getSalesChannelClient()->request('GET', '/sales-channel-api/v1/payment-method'); + $response = $this->getSalesChannelClient()->getResponse(); static::assertEquals(200, $response->getStatusCode()); $content = json_decode($response->getContent(), true); @@ -308,7 +307,7 @@ private function addCurrency(): array 'name' => 'US Dollar', ]; $data = [ - 'id' => $this->getStorefrontApiSalesChannelId(), + 'id' => $this->getSalesChannelApiSalesChannelId(), 'currencies' => [ $currency, ], @@ -337,7 +336,7 @@ private function addLanguage(): array ], ]; $data = [ - 'id' => $this->getStorefrontApiSalesChannelId(), + 'id' => $this->getSalesChannelApiSalesChannelId(), 'languages' => [ $language, ], @@ -355,7 +354,7 @@ private function addCountry(): array 'name' => 'Germany', ]; $data = [ - 'id' => $this->getStorefrontApiSalesChannelId(), + 'id' => $this->getSalesChannelApiSalesChannelId(), 'countries' => [ $country, ], @@ -384,7 +383,7 @@ private function addCountryWithStates(): array ], ]; $data = [ - 'id' => $this->getStorefrontApiSalesChannelId(), + 'id' => $this->getSalesChannelApiSalesChannelId(), 'countries' => [ $country, ], @@ -427,7 +426,7 @@ private function addPaymentMethod(): array $paymentMethods[] = $paymentMethod; $data = [ - 'id' => $this->getStorefrontApiSalesChannelId(), + 'id' => $this->getSalesChannelApiSalesChannelId(), 'paymentMethods' => $paymentMethods, ]; $this->salesChannelRepository->update([$data], $this->context); @@ -459,7 +458,7 @@ private function addShippingMethod(): array ], ]; $data = [ - 'id' => $this->getStorefrontApiSalesChannelId(), + 'id' => $this->getSalesChannelApiSalesChannelId(), 'shippingMethods' => [ ['id' => $this->getAvailableShippingMethodId()], $shippingMethod, @@ -480,7 +479,7 @@ private function addUnavailableShippingMethod(): array 'deliveryTime' => $this->createDeliveryTimeData(), ]; $data = [ - 'id' => $this->getStorefrontApiSalesChannelId(), + 'id' => $this->getSalesChannelApiSalesChannelId(), 'shippingMethods' => [ ['id' => $this->getAvailableShippingMethodId()], $shippingMethod, @@ -525,7 +524,7 @@ private function addUnavailablePaymentMethod(): array ]; $paymentMethodId = $this->getValidPaymentMethodId(); $data = [ - 'id' => $this->getStorefrontApiSalesChannelId(), + 'id' => $this->getSalesChannelApiSalesChannelId(), 'paymentMethodId' => $paymentMethodId, 'paymentMethods' => [ ['id' => $paymentMethodId],