refactor #11795 Api refactor product and order related endpoints (AdamKasp)

This PR was merged into the 1.8 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         |1.8
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Related tickets | part of #11250 based on #11791 
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.7 branch (the lowest possible)
 - Features and deprecations must be submitted against the master branch
 - Make sure that the correct base branch is set

 To be sure you are not breaking any Backward Compatibilities, check the documentation:
 https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->


Commits
-------

588e075110 [API] refactor product related endpoints
010460e1a4 [API] refactor order related endpoints
7ce7be3997 Fix subresources and fix behats
c64233b14e minors fixes and improvments
This commit is contained in:
Łukasz Chruściel 2020-09-09 13:49:18 +02:00 committed by GitHub
commit 54864fb3b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 738 additions and 349 deletions

View file

@ -6,6 +6,8 @@ parameters:
sylius.security.new_api_regex: "^%sylius.security.new_api_route%"
sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin"
sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%"
sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop"
sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%"
security:
always_authenticate_before_granting: true
@ -154,3 +156,4 @@ security:
- { path: "%sylius.security.shop_regex%/account", role: ROLE_USER }
- { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS }
- { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY }

View file

@ -140,7 +140,7 @@ final class ManagingPaymentsContext implements Context
public function iShouldSeePaymentForTheOrderInTheList(OrderInterface $order, int $position): void
{
Assert::true($this->responseChecker->hasItemOnPositionWithValue(
$this->client->getLastResponse(), $position - 1, 'order', sprintf('/new-api/orders/%s', $order->getTokenValue())
$this->client->getLastResponse(), $position - 1, 'order', sprintf('/new-api/admin/orders/%s', $order->getTokenValue())
));
}

View file

@ -17,6 +17,7 @@ use Behat\Behat\Context\Context;
use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\Request;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Sylius\Behat\Service\Converter\AdminToShopIriConverterInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Behat\Service\SprintfResponseEscaper;
use Sylius\Component\Core\Formatter\StringInflector;
@ -38,6 +39,9 @@ final class CartContext implements Context
/** @var ResponseCheckerInterface */
private $responseChecker;
/** @var AdminToShopIriConverterInterface */
private $adminToShopIriConverter;
/** @var SharedStorageInterface */
private $sharedStorage;
@ -48,12 +52,14 @@ final class CartContext implements Context
ApiClientInterface $cartsClient,
ApiClientInterface $productsClient,
ResponseCheckerInterface $responseChecker,
AdminToShopIriConverterInterface $adminToShopIriConverter,
SharedStorageInterface $sharedStorage,
ProductVariantResolverInterface $productVariantResolver
) {
$this->cartsClient = $cartsClient;
$this->productsClient = $productsClient;
$this->responseChecker = $responseChecker;
$this->adminToShopIriConverter = $adminToShopIriConverter;
$this->sharedStorage = $sharedStorage;
$this->productVariantResolver = $productVariantResolver;
}
@ -328,7 +334,7 @@ final class CartContext implements Context
*/
public function iCheckItemsOfMyCart(string $tokenValue): void
{
$request = Request::customItemAction(null,'orders', $tokenValue, HttpRequest::METHOD_GET, 'items');
$request = Request::customItemAction('shop','orders', $tokenValue, HttpRequest::METHOD_GET, 'items');
$this->cartsClient->executeCustomRequest($request);
}
@ -345,7 +351,7 @@ final class CartContext implements Context
private function putProductToCart(ProductInterface $product, string $tokenValue, int $quantity = 1): void
{
$request = Request::customItemAction(null, 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'items');
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'items');
$request->updateContent([
'productCode' => $product->getCode(),
@ -358,7 +364,7 @@ final class CartContext implements Context
private function putProductVariantToCart(ProductVariantInterface $productVariant, string $tokenValue, int $quantity = 1): void
{
$request = Request::customItemAction(null, 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'items');
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'items');
$request->updateContent([
'productCode' => $productVariant->getProduct()->getCode(),
@ -371,7 +377,7 @@ final class CartContext implements Context
private function removeOrderItemFromCart(string $orderItemId, string $tokenValue): void
{
$request = Request::customItemAction(null, 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'remove');
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'remove');
$request->updateContent(['orderItemId' => $orderItemId]);
@ -387,9 +393,9 @@ final class CartContext implements Context
);
}
$this->cartsClient->executeCustomRequest(Request::custom($item['variant'], HttpRequest::METHOD_GET));
$response = $this->cartsClient->getLastResponse();
$response = $this->cartsClient->executeCustomRequest(
Request::custom($this->adminToShopIriConverter->convert($item['variant']), HttpRequest::METHOD_GET)
);
$product = $this->responseChecker->getValue($response, 'product');
@ -409,7 +415,9 @@ final class CartContext implements Context
);
}
$this->cartsClient->executeCustomRequest(Request::custom($item['variant'], HttpRequest::METHOD_GET));
$this->cartsClient->executeCustomRequest(
Request::custom($this->adminToShopIriConverter->convert($item['variant']), HttpRequest::METHOD_GET)
);
return $this->cartsClient->getLastResponse();
}
@ -437,7 +445,7 @@ final class CartContext implements Context
private function changeQuantityOfOrderItem(string $orderItemId, int $quantity, string $tokenValue): void
{
$request = Request::customItemAction(null, 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'change-quantity');
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'change-quantity');
$request->updateContent(['orderItemId' => $orderItemId, 'newQuantity' => $quantity]);

View file

@ -237,7 +237,7 @@ final class CheckoutContext implements Context
$this->client->request(
Request::METHOD_PATCH,
\sprintf('/new-api/orders/%s/complete', $this->sharedStorage->get('cart_token')),
\sprintf('/new-api/shop/orders/%s/complete', $this->sharedStorage->get('cart_token')),
[],
[],
$this->getHeaders(),
@ -268,7 +268,7 @@ final class CheckoutContext implements Context
$this->client->request(
Request::METHOD_PATCH,
\sprintf(
'/new-api/orders/%s/shipments/%s',
'/new-api/shop/orders/%s/shipments/%s',
$this->sharedStorage->get('cart_token'),
(string) $this->iriConverter->getItemFromIri($this->getCart()['shipments'][0])->getId()
),
@ -322,7 +322,7 @@ final class CheckoutContext implements Context
$this->client->request(
Request::METHOD_PATCH,
\sprintf(
'/new-api/orders/%s/payments/%s',
'/new-api/shop/orders/%s/payments/%s',
$this->sharedStorage->get('cart_token'),
(string) $this->iriConverter->getItemFromIri($this->getCart()['payments'][0])->getId()
),
@ -677,7 +677,7 @@ final class CheckoutContext implements Context
$this->client->request(
Request::METHOD_PATCH,
\sprintf('/new-api/orders/%s/address', $this->sharedStorage->get('cart_token')),
\sprintf('/new-api/shop/orders/%s/address', $this->sharedStorage->get('cart_token')),
[],
[],
$this->getHeaders(),
@ -709,7 +709,7 @@ final class CheckoutContext implements Context
$this->client->request(
Request::METHOD_GET,
\sprintf('/new-api/orders/%s/shipments/%s/methods', $cart['tokenValue'], $shipment->getId()),
\sprintf('/new-api/shop/orders/%s/shipments/%s/methods', $cart['tokenValue'], $shipment->getId()),
[],
[],
$this->getHeaders(),
@ -755,7 +755,7 @@ final class CheckoutContext implements Context
$this->client->request(
Request::METHOD_GET,
\sprintf('/new-api/orders/%s/payments/%s/methods',
\sprintf('/new-api/shop/orders/%s/payments/%s/methods',
$this->sharedStorage->get('cart_token'),
$order->getLastPayment()->getId()),
[],

View file

@ -46,7 +46,7 @@ final class HomepageContext implements Context
public function iCheckLatestProducts(): void
{
$this->productsClient->customAction(
'new-api/products?itemsPerPage=3&order[createdAt]=desc',
'new-api/shop/products?itemsPerPage=3&order[createdAt]=desc',
HttpRequest::METHOD_GET
);
}
@ -56,7 +56,7 @@ final class HomepageContext implements Context
*/
public function iCheckAvailableTaxons(): void
{
$this->taxonsClient->customAction('new-api/taxons', HttpRequest::METHOD_GET);
$this->taxonsClient->customAction('new-api/shop/taxons', HttpRequest::METHOD_GET);
}
/**

View file

@ -17,6 +17,7 @@ use Behat\Behat\Context\Context;
use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\Request;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Sylius\Behat\Service\Converter\AdminToShopIriConverterInterface;
use Sylius\Behat\Service\SharedStorageInterface;
use Sylius\Component\Core\Formatter\StringInflector;
use Sylius\Component\Core\Model\ProductInterface;
@ -32,23 +33,33 @@ final class OrderContext implements Context
private $client;
/** @var ApiClientInterface */
private $productsClient;
private $productsAdminClient;
/** @var ApiClientInterface */
private $productsShopClient;
/** @var ResponseCheckerInterface */
private $responseChecker;
/** @var AdminToShopIriConverterInterface */
private $adminToShopIriConverter;
/** @var SharedStorageInterface */
private $sharedStorage;
public function __construct(
ApiClientInterface $client,
ApiClientInterface $productsClient,
ApiClientInterface $productsAdminClient,
ApiClientInterface $productsShopClient,
ResponseCheckerInterface $responseChecker,
AdminToShopIriConverterInterface $adminToShopIriConverter,
SharedStorageInterface $sharedStorage
) {
$this->client = $client;
$this->productsClient = $productsClient;
$this->productsAdminClient = $productsAdminClient;
$this->productsShopClient = $productsShopClient;
$this->responseChecker = $responseChecker;
$this->adminToShopIriConverter = $adminToShopIriConverter;
$this->sharedStorage = $sharedStorage;
}
@ -114,7 +125,7 @@ final class OrderContext implements Context
private function getAdjustmentsForOrderItem(string $itemId): array
{
$response = $this->client->customAction(
sprintf('/new-api/orders/%s/items/%s/adjustments', $this->sharedStorage->get('cart_token'), $itemId),
sprintf('/new-api/shop/orders/%s/items/%s/adjustments', $this->sharedStorage->get('cart_token'), $itemId),
HttpRequest::METHOD_GET
);
@ -144,14 +155,16 @@ final class OrderContext implements Context
);
}
$this->client->executeCustomRequest(Request::custom($item['variant'], HttpRequest::METHOD_GET));
$this->client->executeCustomRequest(
Request::custom($this->adminToShopIriConverter->convert($item['variant']), HttpRequest::METHOD_GET)
);
$product = $this->responseChecker->getValue($this->client->getLastResponse(), 'product');
$pathElements = explode('/', $product);
$productCode = $pathElements[array_key_last($pathElements)];
return $this->productsClient->show(StringInflector::nameToSlug($productCode));
return $this->productsShopClient->show(StringInflector::nameToSlug($productCode));
}
private function getAdjustmentWithLabel(string $label): ?array

View file

@ -17,6 +17,7 @@ use Behat\Behat\Context\Context;
use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\Request;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Sylius\Behat\Service\Converter\AdminToShopIriConverterInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Symfony\Component\HttpFoundation\Request as HttpRequest;
use Webmozart\Assert\Assert;
@ -29,10 +30,17 @@ final class ProductContext implements Context
/** @var ResponseCheckerInterface */
private $responseChecker;
public function __construct(ApiClientInterface $client, ResponseCheckerInterface $responseChecker)
{
/** @var AdminToShopIriConverterInterface */
private $adminToShopIriConverter;
public function __construct(
ApiClientInterface $client,
ResponseCheckerInterface $responseChecker,
AdminToShopIriConverterInterface $adminToShopIriConverter
) {
$this->client = $client;
$this->responseChecker = $responseChecker;
$this->adminToShopIriConverter = $adminToShopIriConverter;
}
/**
@ -69,7 +77,9 @@ final class ProductContext implements Context
$response = $this->client->getLastResponse();
$productVariant = $this->responseChecker->getValue($response, 'variants');
$this->client->executeCustomRequest(Request::custom($productVariant[0], HttpRequest::METHOD_GET));
$this->client->executeCustomRequest(
Request::custom($this->adminToShopIriConverter->convert($productVariant[0]), HttpRequest::METHOD_GET)
);
Assert::true(
$this->responseChecker->hasTranslation(

View file

@ -103,7 +103,7 @@ final class RegistrationContext implements Context
{
$this->client->request(
'POST',
'/new-api/register',
'/new-api/shop/register',
[],
[],
['HTTP_ACCEPT' => 'application/ld+json', 'CONTENT_TYPE' => 'application/ld+json'],

View file

@ -91,5 +91,7 @@
<service id="sylius.calendar" class="Sylius\Behat\Service\Provider\Calendar">
<argument>%kernel.project_dir%</argument>
</service>
<service id="sylius.admin_to_shop_iri_converter" class="Sylius\Behat\Service\Converter\AdminToShopIriConverter" public="false" />
</services>
</container>

View file

@ -23,101 +23,117 @@
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.avatar_image" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.avatar_image" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>avatar-images</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.channel" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.channel" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>channels</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.country" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.country" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>countries</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.currency" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.currency" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>currencies</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.customer_group" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.customer_group" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>customer-groups</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.exchange_rate" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.exchange_rate" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>exchange-rates</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.locale" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.locale" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>locales</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.payment" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.payment" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>payments</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.product_association_type" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.product_association_type" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>product-association-types</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.product_option" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.product_option" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>product-options</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.product_review" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.product_review" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>product-reviews</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.product" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.product" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>products</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.province" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.shop.product" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>products</argument>
<argument>shop</argument>
</service>
<service id="sylius.behat.api_platform_client.admin.province" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>provinces</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.cart" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.shop.cart" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>orders</argument>
<argument>shop</argument>
</service>
<service id="sylius.behat.api_platform_client.shipping_category" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.shipping_category" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>shipping-categories</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.shipping_method" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.shipping_method" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>shipping-methods</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.tax_category" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.tax_category" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>tax-categories</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.shipment" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.shipment" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>shipments</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.order" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.order" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>orders</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.taxon" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.shop.order" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>orders</argument>
<argument>shop</argument>
</service>
<service id="sylius.behat.api_platform_client.admin.taxon" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>taxons</argument>
<argument>admin</argument>
</service>
<service id="sylius.behat.api_platform_client.zone" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<service id="sylius.behat.api_platform_client.admin.zone" class="Sylius\Behat\Client\ApiPlatformClient" parent="sylius.behat.api_platform_client">
<argument>zones</argument>
<argument>admin</argument>
</service>

View file

@ -24,7 +24,7 @@
<service id="sylius.behat.context.api.admin.managing_administrators" class="Sylius\Behat\Context\Api\Admin\ManagingAdministratorsContext">
<argument type="service" id="sylius.behat.api_platform_client.administrator" />
<argument type="service" id="sylius.behat.api_platform_client.avatar_image" />
<argument type="service" id="sylius.behat.api_platform_client.admin.avatar_image" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.iri_converter" />
<argument type="service" id="sylius.behat.shared_storage" />
@ -32,43 +32,43 @@
</service>
<service id="sylius.behat.context.api.admin.managing_channels" class="Sylius\Behat\Context\Api\Admin\ManagingChannelsContext">
<argument type="service" id="sylius.behat.api_platform_client.channel" />
<argument type="service" id="sylius.behat.api_platform_client.admin.channel" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.iri_converter" />
</service>
<service id="sylius.behat.context.api.admin.managing_countries" class="Sylius\Behat\Context\Api\Admin\ManagingCountriesContext">
<argument type="service" id="sylius.behat.api_platform_client.country" />
<argument type="service" id="sylius.behat.api_platform_client.province" />
<argument type="service" id="sylius.behat.api_platform_client.admin.country" />
<argument type="service" id="sylius.behat.api_platform_client.admin.province" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="api_platform.iri_converter" />
</service>
<service id="sylius.behat.context.api.admin.managing_currencies" class="Sylius\Behat\Context\Api\Admin\ManagingCurrenciesContext">
<argument type="service" id="sylius.behat.api_platform_client.currency" />
<argument type="service" id="sylius.behat.api_platform_client.admin.currency" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
<service id="sylius.behat.context.api.admin.managing_exchange_rates" class="Sylius\Behat\Context\Api\Admin\ManagingExchangeRatesContext">
<argument type="service" id="sylius.behat.api_platform_client.exchange_rate" />
<argument type="service" id="sylius.behat.api_platform_client.admin.exchange_rate" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.behat.shared_storage" />
</service>
<service id="sylius.behat.context.api.admin.managing_locales" class="Sylius\Behat\Context\Api\Admin\ManagingLocalesContext">
<argument type="service" id="sylius.behat.api_platform_client.locale" />
<argument type="service" id="sylius.behat.api_platform_client.admin.locale" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
<service id="sylius.behat.context.api.admin.managing_product_association_types" class="Sylius\Behat\Context\Api\Admin\ManagingProductAssociationTypesContext">
<argument type="service" id="sylius.behat.api_platform_client.product_association_type" />
<argument type="service" id="sylius.behat.api_platform_client.admin.product_association_type" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.behat.shared_storage" />
</service>
<service id="sylius.behat.context.api.admin.managing_product_options" class="Sylius\Behat\Context\Api\Admin\ManagingProductOptionsContext">
<argument type="service" id="sylius.behat.api_platform_client.product_option" />
<argument type="service" id="sylius.behat.api_platform_client.admin.product_option" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.behat.shared_storage" />
</service>
@ -79,16 +79,16 @@
</service>
<service id="sylius.behat.context.api.admin.managing_products" class="Sylius\Behat\Context\Api\Admin\ManagingProductsContext">
<argument type="service" id="sylius.behat.api_platform_client.product" />
<argument type="service" id="sylius.behat.api_platform_client.admin.product" />
<argument type="service" id="sylius.behat.api_platform_client.administrator" />
<argument type="service" id="sylius.behat.api_platform_client.product_review" />
<argument type="service" id="sylius.behat.api_platform_client.admin.product_review" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.iri_converter" />
<argument type="service" id="sylius.behat.shared_storage" />
</service>
<service id="sylius.behat.context.api.admin.managing_tax_categories" class="Sylius\Behat\Context\Api\Admin\ManagingTaxCategoriesContext">
<argument type="service" id="sylius.behat.api_platform_client.tax_category" />
<argument type="service" id="sylius.behat.api_platform_client.admin.tax_category" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
@ -98,12 +98,12 @@
</service>
<service id="sylius.behat.context.api.admin.managing_shipping_categories" class="Sylius\Behat\Context\Api\Admin\ManagingShippingCategoriesContext">
<argument type="service" id="sylius.behat.api_platform_client.shipping_category" />
<argument type="service" id="sylius.behat.api_platform_client.admin.shipping_category" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
<service id="sylius.behat.context.api.admin.managing_shipping_methods" class="Sylius\Behat\Context\Api\Admin\ManagingShippingMethodsContext">
<argument type="service" id="sylius.behat.api_platform_client.shipping_method" />
<argument type="service" id="sylius.behat.api_platform_client.admin.shipping_method" />
<argument type="service" id="sylius.behat.api_platform_client.administrator" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.iri_converter" />
@ -111,33 +111,33 @@
</service>
<service id="sylius.behat.context.api.admin.managing_product_reviews" class="Sylius\Behat\Context\Api\Admin\ManagingProductReviewsContext">
<argument type="service" id="sylius.behat.api_platform_client.product_review" />
<argument type="service" id="sylius.behat.api_platform_client.admin.product_review" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.behat.shared_storage" />
</service>
<service id="sylius.behat.context.api.admin.managing_customer_groups" class="Sylius\Behat\Context\Api\Admin\ManagingCustomerGroupsContext">
<argument type="service" id="sylius.behat.api_platform_client.customer_group" />
<argument type="service" id="sylius.behat.api_platform_client.admin.customer_group" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
<service id="sylius.behat.context.api.admin.managing_payments" class="Sylius\Behat\Context\Api\Admin\ManagingPaymentsContext">
<argument type="service" id="sylius.behat.api_platform_client.payment" />
<argument type="service" id="sylius.behat.api_platform_client.admin.payment" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.iri_converter" />
</service>
<service id="sylius.behat.context.api.admin.managing_shipments" class="Sylius\Behat\Context\Api\Admin\ManagingShipmentsContext">
<argument type="service" id="sylius.behat.api_platform_client.shipment" />
<argument type="service" id="sylius.behat.api_platform_client.admin.shipment" />
<argument type="service" id="sylius.behat.api_platform_client.iri" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.iri_converter" />
</service>
<service id="sylius.behat.context.api.admin.managing_orders" class="Sylius\Behat\Context\Api\Admin\ManagingOrdersContext">
<argument type="service" id="sylius.behat.api_platform_client.order" />
<argument type="service" id="sylius.behat.api_platform_client.shipment" />
<argument type="service" id="sylius.behat.api_platform_client.payment" />
<argument type="service" id="sylius.behat.api_platform_client.admin.order" />
<argument type="service" id="sylius.behat.api_platform_client.admin.shipment" />
<argument type="service" id="sylius.behat.api_platform_client.admin.payment" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.iri_converter" />
<argument type="service" id="sylius.behat.admin_api_security" />
@ -145,7 +145,7 @@
</service>
<service id="sylius.behat.context.api.admin.managing_zones" class="Sylius\Behat\Context\Api\Admin\ManagingZonesContext">
<argument type="service" id="sylius.behat.api_platform_client.zone" />
<argument type="service" id="sylius.behat.api_platform_client.admin.zone" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="api_platform.iri_converter" />

View file

@ -19,9 +19,10 @@
<defaults public="true" />
<service id="sylius.behat.context.api.shop.cart" class="Sylius\Behat\Context\Api\Shop\CartContext">
<argument type="service" id="sylius.behat.api_platform_client.cart" />
<argument type="service" id="sylius.behat.api_platform_client.product" />
<argument type="service" id="sylius.behat.api_platform_client.shop.cart" />
<argument type="service" id="sylius.behat.api_platform_client.shop.product" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.admin_to_shop_iri_converter" />
<argument type="service" id="sylius.behat.shared_storage" />
<argument type="service" id="sylius.product_variant_resolver.default" />
</service>
@ -32,7 +33,7 @@
<service id="sylius.behat.context.api.shop.checkout" class="Sylius\Behat\Context\Api\Shop\CheckoutContext">
<argument type="service" id="test.client" />
<argument type="service" id="sylius.behat.api_platform_client.order" />
<argument type="service" id="sylius.behat.api_platform_client.shop.order" />
<argument type="service" id="api_platform.iri_converter" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.repository.shipping_method" />
@ -42,8 +43,8 @@
</service>
<service id="sylius.behat.context.api.shop.homepage" class="Sylius\Behat\Context\Api\Shop\HomepageContext">
<argument type="service" id="sylius.behat.api_platform_client.product" />
<argument type="service" id="sylius.behat.api_platform_client.taxon" />
<argument type="service" id="sylius.behat.api_platform_client.admin.product" />
<argument type="service" id="sylius.behat.api_platform_client.admin.taxon" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
@ -52,8 +53,9 @@
</service>
<service id="sylius.behat.context.api.shop.product" class="Sylius\Behat\Context\Api\Shop\ProductContext">
<argument type="service" id="sylius.behat.api_platform_client.product" />
<argument type="service" id="sylius.behat.api_platform_client.shop.product" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.admin_to_shop_iri_converter" />
</service>
<service id="sylius.behat.context.api.shop.registration" class="Sylius\Behat\Context\Api\Shop\RegistrationContext">
@ -61,9 +63,11 @@
</service>
<service id="sylius.behat.context.api.shop.order" class="Sylius\Behat\Context\Api\Shop\OrderContext">
<argument type="service" id="sylius.behat.api_platform_client.order" />
<argument type="service" id="sylius.behat.api_platform_client.product" />
<argument type="service" id="sylius.behat.api_platform_client.shop.order" />
<argument type="service" id="sylius.behat.api_platform_client.admin.product" />
<argument type="service" id="sylius.behat.api_platform_client.shop.product" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="sylius.admin_to_shop_iri_converter" />
<argument type="service" id="sylius.behat.shared_storage" />
</service>
</services>

View file

@ -0,0 +1,22 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Behat\Service\Converter;
final class AdminToShopIriConverter implements AdminToShopIriConverterInterface
{
public function convert(string $iri): string
{
return str_replace('/admin/', '/shop/', $iri);
}
}

View file

@ -0,0 +1,19 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Behat\Service\Converter;
interface AdminToShopIriConverterInterface
{
public function convert(string $iri): string;
}

View file

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace spec\Sylius\Behat\Service\Converter;
use PhpSpec\ObjectBehavior;
use Sylius\Behat\Service\Converter\AdminToShopIriConverterInterface;
final class AdminToShopIriConverterSpec extends ObjectBehavior
{
function it_is_an_admin_to_shop_iri_converter(): void
{
$this->shouldImplement(AdminToShopIriConverterInterface::class);
}
function it_converts_admin_iri_to_shop_iri(): void
{
$this->convert('new-api/admin/order/products/TEST')->shouldReturn('new-api/shop/order/products/TEST');
}
}

View file

@ -25,20 +25,17 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/adjustments</attribute>
</itemOperation>
<itemOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/adjustments</attribute>
</itemOperation>
</itemOperations>
<subresourceOperations>
<subresourceOperation name="api_order_items_adjustments_get_subresource">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
</subresourceOperation>
<subresourceOperation name="api_orders_items_adjustments_get_subresource">
<attribute name="path">/new-api/orders/{token}/items/{itemId}/adjustments</attribute>
</subresourceOperation>
</subresourceOperations>
<property name="id" identifier="true" writable="false" />
<property name="type" writable="false" />
<property name="label" writable="false" />

View file

@ -17,6 +17,7 @@
>
<resource class="%sylius.model.admin_user.class%" shortName="Administrator">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>admin_user:read</attribute>
@ -32,8 +33,12 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="validation_groups">
<attribute>sylius</attribute>
<attribute>sylius_user_create</attribute>
@ -42,13 +47,20 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="put">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">admin_user:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="delete" />
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="true" writable="false" />

View file

@ -17,6 +17,7 @@
>
<resource class="%sylius.model.avatar_image.class%" shortName="AvatarImage">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>avatar_image:read</attribute>
@ -24,7 +25,8 @@
</attribute>
<collectionOperations>
<collectionOperation name="post">
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="controller">sylius.api.upload_avatar_image_action</attribute>
<attribute name="deserialize">false</attribute>
<attribute name="openapi_context">
@ -52,8 +54,13 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="delete" />
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="true" writable="false" />

View file

@ -17,6 +17,7 @@
>
<resource class="%sylius.model.channel.class%" shortName="Channel">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>channel:read</attribute>
@ -24,8 +25,12 @@
</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="denormalization_context">
<attribute name="groups">channel:create</attribute>
</attribute>
@ -33,7 +38,8 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="groups">
<attribute>channel:read</attribute>
</attribute>

View file

@ -16,17 +16,19 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.5.xsd"
>
<resource class="Sylius\Bundle\ApiBundle\Command\RegisterShopUser" shortName="RegisterShopUser">
<attribute name="route_prefix">shop</attribute>
<attribute name="messenger">true</attribute>
<attribute name="output">false</attribute>
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="post">
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
<attribute name="path">/register</attribute>
<attribute name="openapi_context">
<attribute name="summary">Register a shop user</attribute>
<attribute name="summary">Registers a shop user</attribute>
</attribute>
<attribute name="validation_groups">
<attribute>sylius</attribute>

View file

@ -27,8 +27,12 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="denormalization_context">
<attribute name="groups">country:create</attribute>
</attribute>
@ -36,8 +40,12 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">country:update</attribute>
</attribute>

View file

@ -21,12 +21,19 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post" />
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -16,7 +16,7 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.customer.class%" shortName="Customer">
<attribute name="route_name">admin</attribute>
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
@ -27,7 +27,8 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="groups">
<attribute>customer:read</attribute>
</attribute>

View file

@ -33,18 +33,30 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post" />
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="put">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">customer_group:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="delete" />
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -27,12 +27,15 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get" >
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="filters">
<attribute>sylius.api.exchange_rate_filter</attribute>
</attribute>
</collectionOperation>
<collectionOperation name="post">
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="denormalization_context">
<attribute name="groups">exchange_rate:create</attribute>
</attribute>
@ -40,13 +43,20 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="put">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">exchange_rate:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="delete" />
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="true" writable="false" />

View file

@ -21,12 +21,19 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post" />
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -25,65 +25,73 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">admin/orders</attribute>
</collectionOperation>
<collectionOperation name="post">
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
<attribute name="openapi_context">
<attribute name="summary">Pickup a new cart</attribute>
</attribute>
<collectionOperation name="shop_post">
<attribute name="method">POST</attribute>
<attribute name="path">/admin/orders</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Cart\PickupCart</attribute>
<attribute name="denormalization_context">
<attribute name="groups">order:create</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Pickups a new cart</attribute>
</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="delete">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/orders/{id}</attribute>
</itemOperation>
<itemOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/orders/{id}</attribute>
</itemOperation>
<itemOperation name="shop_delete">
<attribute name="method">DELETE</attribute>
<attribute name="path">/shop/orders/{id}</attribute>
<attribute name="openapi_context">
<attribute name="summary">Delete cart</attribute>
<attribute name="summary">Deletes cart</attribute>
</attribute>
</itemOperation>
<itemOperation name="cancel">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<attribute name="openapi_context">
<attribute name="summary">Cancels Order</attribute>
</attribute>
<itemOperation name="admin_cancel">
<attribute name="method">PATCH</attribute>
<attribute name="path">/admin/orders/{id}/cancel</attribute>
<attribute name="input">false</attribute>
<attribute name="path">/orders/{id}/cancel</attribute>
<attribute name="controller">sylius.api.order_state_machine_transition_applicator:cancel</attribute>
<attribute name="denormalization_context">
<attribute name="groups">order:update</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Cancels Order</attribute>
</attribute>
</itemOperation>
<itemOperation name="add_item">
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
<attribute name="openapi_context">
<attribute name="summary">Add Item to cart</attribute>
</attribute>
<itemOperation name="shop_add_item">
<attribute name="method">PATCH</attribute>
<attribute name="path">/orders/{id}/items</attribute>
<attribute name="path">/shop/orders/{id}/items</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Cart\AddItemToCart</attribute>
<attribute name="denormalization_context">
<attribute name="groups">cart:add_item</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Adds Item to cart</attribute>
</attribute>
</itemOperation>
<itemOperation name="address">
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
<attribute name="openapi_context">
<attribute name="summary">Address cart to given location, logged in Customer does not have to provide an email</attribute>
</attribute>
<itemOperation name="shop_address">
<attribute name="method">PATCH</attribute>
<attribute name="path">/orders/{id}/address</attribute>
<attribute name="path">/shop/orders/{id}/address</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\AddressOrder</attribute>
<attribute name="denormalization_context">
@ -92,12 +100,24 @@
<attribute name="normalization_context">
<attribute name="groups">checkout:read</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Addresses cart to given location, logged in Customer does not have to provide an email</attribute>
</attribute>
</itemOperation>
<itemOperation name="select_shipping_method">
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
<itemOperation name="shop_select_shipping_method">
<attribute name="method">PATCH</attribute>
<attribute name="path">/shop/orders/{id}/shipments/{shipmentId}</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\ChooseShippingMethod</attribute>
<attribute name="denormalization_context">
<attribute name="groups">cart:select_shipping_method</attribute>
</attribute>
<attribute name="normalization_context">
<attribute name="groups">checkout:read</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Select shipping methods for particular shipment</attribute>
<attribute name="summary">Selects shipping methods for particular shipment</attribute>
<attribute name="parameters">
<attribute>
<attribute name="name">id</attribute>
@ -117,22 +137,21 @@
</attribute>
</attribute>
</attribute>
</itemOperation>
<itemOperation name="shop_select_payment_method">
<attribute name="method">PATCH</attribute>
<attribute name="path">/orders/{id}/shipments/{shipmentId}</attribute>
<attribute name="path">/shop/orders/{id}/payments/{paymentId}</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\ChooseShippingMethod</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\ChoosePaymentMethod</attribute>
<attribute name="denormalization_context">
<attribute name="groups">cart:select_shipping_method</attribute>
<attribute name="groups">cart:select_payment_method</attribute>
</attribute>
<attribute name="normalization_context">
<attribute name="groups">checkout:read</attribute>
</attribute>
</itemOperation>
<itemOperation name="select_payment_method">
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
<attribute name="openapi_context">
<attribute name="summary">Select payment methods for particular payment</attribute>
<attribute name="summary">Selects payment methods for particular payment</attribute>
<attribute name="parameters">
<attribute>
<attribute name="name">id</attribute>
@ -152,29 +171,15 @@
</attribute>
</attribute>
</attribute>
<attribute name="method">PATCH</attribute>
<attribute name="path">/orders/{id}/payments/{paymentId}</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\ChoosePaymentMethod</attribute>
<attribute name="denormalization_context">
<attribute name="groups">cart:select_payment_method</attribute>
</attribute>
<attribute name="normalization_context">
<attribute name="groups">checkout:read</attribute>
</attribute>
</itemOperation>
<itemOperation name="complete">
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
<attribute name="openapi_context">
<attribute name="summary">Complete checkout</attribute>
</attribute>
<itemOperation name="shop_complete">
<attribute name="method">PATCH</attribute>
<attribute name="path">/shop/orders/{id}/complete</attribute>
<attribute name="validation_groups">
<attribute>sylius</attribute>
<attribute>sylius_checkout_complete</attribute>
</attribute>
<attribute name="path">/orders/{id}/complete</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\CompleteOrder</attribute>
<attribute name="denormalization_context">
@ -183,37 +188,75 @@
<attribute name="normalization_context">
<attribute name="groups">checkout:read</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Completes checkout</attribute>
</attribute>
</itemOperation>
<itemOperation name="remove_item">
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
<attribute name="openapi_context">
<attribute name="summary">Remove Item</attribute>
</attribute>
<itemOperation name="shop_remove_item">
<attribute name="method">PATCH</attribute>
<attribute name="path">/orders/{id}/remove</attribute>
<attribute name="path">/shop/orders/{id}/remove</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Cart\RemoveItemFromCart</attribute>
<attribute name="denormalization_context">
<attribute name="groups">cart:remove_item</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Removes Item</attribute>
</attribute>
</itemOperation>
<itemOperation name="change_quantity">
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
<attribute name="openapi_context">
<attribute name="summary">Change quantity of order item</attribute>
</attribute>
<itemOperation name="shop_change_quantity">
<attribute name="method">PATCH</attribute>
<attribute name="path">/orders/{id}/change-quantity</attribute>
<attribute name="path">/shop/orders/{id}/change-quantity</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Cart\ChangeItemQuantityInCart</attribute>
<attribute name="denormalization_context">
<attribute name="groups">cart:change_quantity</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Changes quantity of order item</attribute>
</attribute>
</itemOperation>
</itemOperations>
<subresourceOperations>
<subresourceOperation name="items_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/orders/{id}/items</attribute>
</subresourceOperation>
<subresourceOperation name="shipments_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/orders/{id}/shipments</attribute>
</subresourceOperation>
<subresourceOperation name="payments_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/orders/{id}/payments</attribute>
</subresourceOperation>
<subresourceOperation name="adjustments_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/orders/{id}/adjustments</attribute>
</subresourceOperation>
<subresourceOperation name="payments_methods_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/orders/{id}/payments/{payments}/methods</attribute>
</subresourceOperation>
<subresourceOperation name="shipments_methods_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/orders/{id}/shipments/{shipments}/methods</attribute>
</subresourceOperation>
<subresourceOperation name="items_adjustments_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/orders/{id}/items/{items}/adjustments</attribute>
</subresourceOperation>
</subresourceOperations>
<property name="id" identifier="false" writable="false" />
<property name="number" identifier="false" writable="false" />
<property name="tokenValue" identifier="true" writable="false" />

View file

@ -16,6 +16,8 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.order_item.class%" shortName="OrderItem">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>order_item:read</attribute>
@ -25,8 +27,8 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>

View file

@ -16,20 +16,22 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.order_item_unit.class%" shortName="OrderItemUnit">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>order_item_unit:read</attribute>
</attribute>
</attribute>
<collectionOperations />
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>
<collectionOperations />
<property name="id" identifier="true" writable="false" />
<property name="shippable" />
</resource>

View file

@ -16,8 +16,6 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.payment.class%" shortName="Payment">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>payment:read</attribute>
@ -31,7 +29,9 @@
</attribute>
<collectionOperations>
<collectionOperation name="get">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/payments</attribute>
<attribute name="filters">
<attribute>sylius.api.search_payment_filter</attribute>
</attribute>
@ -39,15 +39,19 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="complete">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/payments/{id}</attribute>
</itemOperation>
<itemOperation name="admin_complete">
<attribute name="method">PATCH</attribute>
<attribute name="input">false</attribute>
<attribute name="path">/admin/payments/{id}/complete</attribute>
<attribute name="controller">sylius.api.payment_state_machine_transition_applicator:complete</attribute>
<attribute name="openapi_context">
<attribute name="summary">Completes Payment</attribute>
</attribute>
<attribute name="method">PATCH</attribute>
<attribute name="input">false</attribute>
<attribute name="path">/payments/{id}/complete</attribute>
<attribute name="controller">sylius.api.payment_state_machine_transition_applicator:complete</attribute>
</itemOperation>
</itemOperations>

View file

@ -27,7 +27,9 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get" />
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="true" writable="false" />

View file

@ -21,6 +21,7 @@
<attribute>product:read</attribute>
</attribute>
</attribute>
<attribute name="validation_groups">sylius</attribute>
<attribute name="order">
@ -28,7 +29,9 @@
</attribute>
<collectionOperations>
<collectionOperation name="get">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/products</attribute>
<attribute name="filters">
<attribute>sylius.api.product_order_filter</attribute>
<attribute>sylius.api.product_taxon_code_filter</attribute>
@ -36,8 +39,19 @@
</attribute>
</collectionOperation>
<collectionOperation name="post">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<collectionOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/products</attribute>
<attribute name="filters">
<attribute>sylius.api.product_order_filter</attribute>
<attribute>sylius.api.product_taxon_code_filter</attribute>
<attribute>sylius.api.translation_order_name_and_locale_filter</attribute>
</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="path">/admin/products</attribute>
<attribute name="denormalization_context">
<attribute name="groups">product:create</attribute>
</attribute>
@ -45,22 +59,33 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get">
<attribute name="path">products/{id}</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/products/{id}</attribute>
<attribute name="openapi_context">
<attribute name="summary">As a logged administrator use $code to retrieve a product resource. As a Visitor or logged in Customer use $slug to retrieve a product resource.</attribute>
<attribute name="summary">Use $code to retrieve a product resource.</attribute>
</attribute>
</itemOperation>
<itemOperation name="put">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<attribute name="path">products/{id}</attribute>
<itemOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/products/{id}</attribute>
<attribute name="openapi_context">
<attribute name="summary">Use $slug to retrieve a product resource.</attribute>
</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="path">/admin/products/{id}</attribute>
<attribute name="denormalization_context">
<attribute name="groups">product:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="delete">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<attribute name="path">products/{id}</attribute>
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
<attribute name="path">/admin/products/{id}</attribute>
</itemOperation>
</itemOperations>

View file

@ -27,12 +27,15 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="filters">
<attribute>sylius.api.product_association_type_filter</attribute>
</attribute>
</collectionOperation>
<collectionOperation name="post">
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="denormalization_context">
<attribute name="groups">product_association_type:create</attribute>
</attribute>
@ -40,13 +43,20 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="put">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">product_association_type:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="delete" />
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -23,7 +23,9 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get" />
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="true" writable="false" />

View file

@ -5,7 +5,10 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.product_image.class%" shortName="ProductImage">
<attribute name="route_prefix">admin</attribute>
<attribute name="validation_groups">sylius</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>product_image:read</attribute>
@ -13,14 +16,14 @@
</attribute>
<collectionOperations>
<collectionOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>

View file

@ -16,6 +16,8 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.product_option.class%" shortName="ProductOption">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>product_option:read</attribute>
@ -29,11 +31,12 @@
</attribute>
<collectionOperations>
<collectionOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="post">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="denormalization_context">
<attribute name="groups">product_option:create</attribute>
</attribute>
@ -41,11 +44,12 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="put">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">product_option:update</attribute>
</attribute>

View file

@ -16,13 +16,15 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.product_option_translation.class%" shortName="ProductOptionTranslation">
<attribute name="route_prefix">admin</attribute>
<attribute name="validation_groups">sylius</attribute>
<collectionOperations />
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>

View file

@ -16,6 +16,8 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.product_option_value.class%" shortName="ProductOptionValue">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>product_option_value:read</attribute>
@ -33,17 +35,11 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>
<subresourceOperations>
<subresourceOperation name="api_product_options_values_get_subresource">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
</subresourceOperation>
</subresourceOperations>
<property name="id" identifier="false" writable="false" />
<property name="code" identifier="true" required="true" />
<property name="translations" readable="true" writable="true" />

View file

@ -16,6 +16,8 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.product_review.class%" shortName="ProductReview">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>product_review:read</attribute>
@ -31,45 +33,45 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="delete">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
<itemOperation name="put">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">product_review:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="accept">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_accept">
<attribute name="method">PATCH</attribute>
<attribute name="path">/product-reviews/{id}/accept</attribute>
<attribute name="input">false</attribute>
<attribute name="controller">sylius.api.product_review_state_machine_transition_applicator:accept</attribute>
<attribute name="openapi_context">
<attribute name="summary">Accepts Product Review</attribute>
</attribute>
<attribute name="method">PATCH</attribute>
<attribute name="input">false</attribute>
<attribute name="path">/product-reviews/{id}/accept</attribute>
<attribute name="controller">sylius.api.product_review_state_machine_transition_applicator:accept</attribute>
</itemOperation>
<itemOperation name="reject">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_reject">
<attribute name="method">PATCH</attribute>
<attribute name="path">/product-reviews/{id}/reject</attribute>
<attribute name="input">false</attribute>
<attribute name="controller">sylius.api.product_review_state_machine_transition_applicator:reject</attribute>
<attribute name="openapi_context">
<attribute name="summary">Rejects Product Review</attribute>
</attribute>
<attribute name="method">PATCH</attribute>
<attribute name="input">false</attribute>
<attribute name="path">/product-reviews/{id}/reject</attribute>
<attribute name="controller">sylius.api.product_review_state_machine_transition_applicator:reject</attribute>
</itemOperation>
</itemOperations>

View file

@ -5,7 +5,10 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.product_taxon.class%" shortName="ProductTaxon">
<attribute name="route_prefix">admin</attribute>
<attribute name="validation_groups">sylius</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>product_taxon:read</attribute>
@ -13,14 +16,14 @@
</attribute>
<collectionOperations>
<collectionOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>

View file

@ -5,13 +5,15 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.product_translation.class%" shortName="ProductTranslation">
<attribute name="route_prefix">admin</attribute>
<attribute name="validation_groups">sylius</attribute>
<collectionOperations />
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>

View file

@ -6,6 +6,7 @@
>
<resource class="%sylius.model.product_variant.class%" shortName="ProductVariant">
<attribute name="validation_groups">sylius</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>product_variant:read</attribute>
@ -13,9 +14,30 @@
</attribute>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/product-variants/{id}</attribute>
</itemOperation>
<itemOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="path">/admin/product-variants</attribute>
<attribute name="controller">api_platform.doctrine.orm.data_persister</attribute>
</itemOperation>
<itemOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/product-variants/{id}</attribute>
</itemOperation>
</itemOperations>
<collectionOperations>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/product-variants</attribute>
</collectionOperation>
</collectionOperations>
<property name="id" identifier="false" writable="false" />
<property name="code" identifier="true" required="true" />
<property name="product" />

View file

@ -10,7 +10,15 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get" />
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/product-variant-translation/{id}</attribute>
</itemOperation>
<itemOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/product-variant-translation/{id}</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="true" writable="false" />

View file

@ -35,15 +35,14 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get" />
<itemOperation name="put" />
</itemOperations>
<subresourceOperations>
<subresourceOperation name="api_countries_provinces_get_subresource">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</subresourceOperation>
</subresourceOperations>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />
<property name="code" identifier="true" required="true" />

View file

@ -37,7 +37,8 @@
</attribute>
<collectionOperations>
<collectionOperation name="get">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="filters">
<attribute>sylius.api.search_shipment_filter</attribute>
</attribute>
@ -45,14 +46,17 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="ship">
<attribute name="openapi_context">
<attribute name="summary">Ships Shipment</attribute>
</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_ship">
<attribute name="method">PATCH</attribute>
<attribute name="path">/shipments/{id}/ship</attribute>
<attribute name="controller">sylius.api.shipment_state_machine_transition_applicator::ship</attribute>
<attribute name="openapi_context">
<attribute name="summary">Ships Shipment</attribute>
</attribute>
</itemOperation>
</itemOperations>

View file

@ -27,8 +27,12 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="denormalization_context">
<attribute name="groups">shipping_category:create</attribute>
</attribute>
@ -36,13 +40,20 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="put">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">shipping_category:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="delete" />
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -31,44 +31,54 @@
</attribute>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="put">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">shipping_method:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="delete" />
<itemOperation name="archive">
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
<itemOperation name="admin_archive">
<attribute name="method">PATCH</attribute>
<attribute name="path">/shipping-methods/{id}/archive</attribute>
<attribute name="input">false</attribute>
<attribute name="controller">sylius.api.archiving_shipping_method_applicator:archive</attribute>
<attribute name="openapi_context">
<attribute name="summary">Archives Shipping Method</attribute>
</attribute>
<attribute name="method">PATCH</attribute>
<attribute name="input">false</attribute>
<attribute name="path">/shipping-methods/{id}/archive</attribute>
<attribute name="controller">sylius.api.archiving_shipping_method_applicator:archive</attribute>
</itemOperation>
<itemOperation name="restore">
<itemOperation name="admin_restore">
<attribute name="method">PATCH</attribute>
<attribute name="path">/shipping-methods/{id}/restore</attribute>
<attribute name="input">false</attribute>
<attribute name="controller">sylius.api.archiving_shipping_method_applicator:restore</attribute>
<attribute name="openapi_context">
<attribute name="summary">Restores archived Shipping Method</attribute>
</attribute>
<attribute name="method">PATCH</attribute>
<attribute name="input">false</attribute>
<attribute name="path">/shipping-methods/{id}/restore</attribute>
<attribute name="controller">sylius.api.archiving_shipping_method_applicator:restore</attribute>
</itemOperation>
</itemOperations>
<collectionOperations>
<collectionOperation name="get">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="filters">
<attribute>sylius.api.filter_archived_shipping_methods</attribute>
<attribute>sylius.api.shipping_method_order_filter</attribute>
<attribute>sylius.api.translation_order_name_and_locale_filter</attribute>
</attribute>
</collectionOperation>
<collectionOperation name="post">
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="denormalization_context">
<attribute name="groups">shipping_method:create</attribute>
</attribute>

View file

@ -17,12 +17,15 @@
>
<resource class="%sylius.model.shipping_method_translation.class%" shortName="ShippingMethodTranslation">
<attribute name="route_prefix">admin</attribute>
<attribute name="validation_groups">sylius</attribute>
<collectionOperations />
<itemOperations>
<itemOperation name="get" />
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="true" writable="false" />

View file

@ -17,7 +17,7 @@
>
<resource class="%sylius.model.shop_billing_data.class%" shortName="ShopBillingData">
<attribute name="route_prefix">admin</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>shop_billing_data:read</attribute>
@ -29,14 +29,10 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get" />
</itemOperations>
<subresourceOperations>
<subresourceOperation name="api_channels_shop_billing_data_get_subresource">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</subresourceOperation>
</subresourceOperations>
</itemOperation>
</itemOperations>
<property name="id" identifier="true" writable="false" />
<property name="company" writable="true" readable="true" />

View file

@ -33,18 +33,30 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post" />
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="put">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">tax_category:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="delete" />
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -5,8 +5,8 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.taxon.class%" shortName="Taxon">
<attribute name="validation_groups">sylius</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>taxon:read</attribute>
@ -14,27 +14,43 @@
</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/taxons</attribute>
</collectionOperation>
<collectionOperation name="admin_get">
<attribute name="method">POST</attribute>
<attribute name="path">/admin/taxons</attribute>
<attribute name="denormalization_context">
<attribute name="groups">taxon:create</attribute>
</attribute>
</collectionOperation>
<collectionOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/taxons</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<attribute name="path">/taxons/{id}</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/taxons/{id}</attribute>
</itemOperation>
<itemOperation name="put">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<attribute name="path">/taxons/{id}</attribute>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="path">/admin/taxons/{id}</attribute>
<attribute name="denormalization_context">
<attribute name="groups">taxon:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/taxons/{id}</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -5,7 +5,10 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.taxon_translation.class%" shortName="TaxonTranslation">
<attribute name="route_prefix">admin</attribute>
<attribute name="validation_groups">sylius</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>taxon:read</attribute>
@ -14,14 +17,14 @@
</attribute>
<collectionOperations>
<collectionOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="get">
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
</itemOperations>

View file

@ -27,8 +27,12 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="get" />
<collectionOperation name="post">
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
</collectionOperation>
<collectionOperation name="admin_post">
<attribute name="method">POST</attribute>
<attribute name="denormalization_context">
<attribute name="groups">zone:create</attribute>
</attribute>
@ -36,13 +40,20 @@
</collectionOperations>
<itemOperations>
<itemOperation name="get" />
<itemOperation name="put">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</itemOperation>
<itemOperation name="admin_put">
<attribute name="method">PUT</attribute>
<attribute name="denormalization_context">
<attribute name="groups">zone:update</attribute>
</attribute>
</itemOperation>
<itemOperation name="delete" />
<itemOperation name="admin_delete">
<attribute name="method">DELETE</attribute>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -35,14 +35,10 @@
<collectionOperations />
<itemOperations>
<itemOperation name="get" />
</itemOperations>
<subresourceOperations>
<subresourceOperation name="api_zones_members_get_subresource">
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
</subresourceOperation>
</subresourceOperations>
</itemOperation>
</itemOperations>
<property name="id" identifier="false" writable="false" />
<property name="code" identifier="true" required="true" />