[Api][Admin] Enable Order resource

This commit is contained in:
Wojdylak 2024-08-01 13:30:28 +02:00
parent c5dbbf85d4
commit 9add00905a
No known key found for this signature in database
GPG key ID: 7509E560A6821ABE
30 changed files with 1060 additions and 1298 deletions

View file

@ -1,383 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\Tests\Api\Admin;
use Sylius\Component\Core\Model\AddressInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Tests\Api\JsonApiTestCase;
use Sylius\Tests\Api\Utils\FilterTypes;
use Sylius\Tests\Api\Utils\OrderPlacerTrait;
use Symfony\Component\HttpFoundation\Response;
final class OrdersTest extends JsonApiTestCase
{
use OrderPlacerTrait;
protected function setUp(): void
{
$this->setUpOrderPlacer();
$this->setUpAdminContext();
$this->setUpDefaultGetHeaders();
parent::setUp();
}
/** @test */
public function it_gets_all_orders(): void
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
]);
$this->requestGet(uri: '/api/v2/admin/orders');
$this->assertResponseSuccessful('admin/order/get_all_orders_response');
}
/** @test */
public function it_gets_orders_filtered_by_channel(): void
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
]);
/** @var ChannelInterface $channel */
$channel = $fixtures['channel_mobile'];
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['channel.code' => $channel->getCode()],
);
$this->assertResponseSuccessful('admin/order/get_orders_filtered_by_channel_response');
}
/** @test */
public function it_gets_orders_filtered_by_different_currencies(): void
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
'order/new_in_different_currencies.yaml',
]);
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['currencyCode' => ['PLN']],
);
$this->assertResponseSuccessful('admin/order/get_orders_filtered_by_pln_currency_code_response');
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['currencyCode' => ['USD']],
);
$this->assertResponseSuccessful('admin/order/get_orders_filtered_by_usd_currency_code_response');
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['currencyCode' => ['PLN', 'USD']],
);
$this->assertResponseSuccessful('admin/order/get_orders_filtered_by_pln_and_usd_currency_codes_response');
}
/** @test */
public function it_gets_orders_for_customer(): void
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/fulfilled.yaml',
]);
/** @var CustomerInterface $customer */
$customer = $fixtures['customer_tony'];
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['customer.id' => $customer->getId()],
);
$this->assertResponseSuccessful('admin/order/gets_orders_for_customer_response');
}
/**
* @test
*
* @dataProvider provideOrderFilterDates
*/
public function it_gets_orders_by_period(
string $tokenValue,
array $checkoutsCompletedAt,
array $requestedLimit,
string $filename,
): void {
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'cart.yaml',
'channel.yaml',
'order/customer.yaml',
'payment_method.yaml',
'shipping_method.yaml',
]);
foreach ($checkoutsCompletedAt as $checkoutCompletedAt) {
$this->placeOrder(
tokenValue: $tokenValue,
checkoutCompletedAt: new \DateTimeImmutable($checkoutCompletedAt),
);
}
$checkoutCompletedAt = sprintf('checkoutCompletedAt[%s]', $requestedLimit['filterType']->value);
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: [$checkoutCompletedAt => $requestedLimit['date']],
);
$this->assertResponseSuccessful($filename);
}
private function provideOrderFilterDates(): iterable
{
yield 'checkoutCompletedBefore' => [
'tokenValue' => 'firstOrderToken',
'checkoutsCompletedAt' => [
'2024-01-01T00:00:00+00:00',
],
'requestedLimit' => [
'filterType' => FilterTypes::Before,
'date' => '2024-01-01T00:00:00+00:00',
],
'filename' => 'admin/order/get_orders_before_date_response',
];
yield 'checkoutCompletedStrictlyBefore' => [
'tokenValue' => 'firstOrderToken',
'checkoutsCompletedAt' => [
'2024-01-01T00:00:00+00:00',
],
'requestedLimit' => [
'filterType' => FilterTypes::StrictlyBefore,
'date' => '2024-01-01T00:00:00+00:00',
],
'filename' => 'admin/order/get_orders_empty_collection_response',
];
}
/** @test */
public function it_gets_an_order(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->requestGet(uri: '/api/v2/admin/orders/' . $tokenValue);
$this->assertResponseSuccessful('admin/order/get_order_response');
}
/** @test */
public function it_gets_a_billing_address_of_placed_order(): void
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/new.yaml',
'order/customer.yaml',
]);
/** @var AddressInterface $billingAddress */
$billingAddress = $fixtures['first_order_billing_address'];
$this->requestGet(uri: '/api/v2/admin/addresses/' . $billingAddress->getId());
$this->assertResponseSuccessful('admin/order/get_billing_address_of_placed_order_response');
}
/** @test */
public function it_updates_a_billing_address_of_placed_order(): void
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
]);
/** @var AddressInterface $billingAddress */
$billingAddress = $fixtures['first_order_billing_address'];
$this->client->request(
method: 'PUT',
uri: '/api/v2/admin/addresses/' . $billingAddress->getId(),
server: $this->buildHeaders('api@example.com'),
content: json_encode([
'firstName' => 'Updated: Adam',
'lastName' => 'Updated: Handley',
'company' => 'Updated: FMŻ',
'street' => 'Updated: Kościuszki 21',
'countryCode' => 'PL',
'city' => 'Updated: Bordeaux',
'postcode' => 'Updated: 99-999',
'phoneNumber' => 'Updated: 911213969',
'provinceName' => 'Updated: wielkopolskie',
]),
);
$this->assertResponseSuccessful('admin/order/put_billing_address_of_placed_order_response');
}
/** @test */
public function it_gets_a_shipping_address_of_placed_order(): void
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
]);
/** @var AddressInterface $shippingAddress */
$shippingAddress = $fixtures['first_order_shipping_address'];
$this->requestGet(uri: '/api/v2/admin/addresses/' . $shippingAddress->getId());
$this->assertResponseSuccessful('admin/order/get_shipping_address_of_placed_order_response');
}
/** @test */
public function it_updated_a_shipping_address_of_placed_order(): void
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
]);
/** @var AddressInterface $shippingAddress */
$shippingAddress = $fixtures['first_order_shipping_address'];
$this->client->request(
method: 'PUT',
uri: '/api/v2/admin/addresses/' . $shippingAddress->getId(),
server: $this->buildHeaders('api@example.com'),
content: json_encode([
'firstName' => 'Updated: Julia',
'lastName' => 'Updated: Kowalska',
'company' => 'Updated: Błysk',
'street' => 'Updated: Marszałkowska 10',
'countryCode' => 'GB',
'city' => 'Updated: Warszawa',
'postcode' => 'Updated: 00-001',
'phoneNumber' => 'Updated: 48222333444',
'provinceName' => 'Updated: mazowieckie',
]),
);
$this->assertResponseSuccessful('admin/order/put_shipping_address_of_placed_order_response');
}
/** @test */
public function it_resends_order_confirmation_email(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->client->request(
method: 'POST',
uri: sprintf('/api/v2/admin/orders/%s/resend-confirmation-email', $tokenValue),
server: $this->buildHeaders('api@example.com'),
content: json_encode([]),
);
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_ACCEPTED);
$this->assertEmailCount(2);
}
/** @test */
public function it_does_not_resends_order_confirmation_email_for_order_with_invalid_state(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->cancelOrder($tokenValue);
$this->client->request(
method: 'POST',
uri: sprintf('/api/v2/admin/orders/%s/resend-confirmation-email', $tokenValue),
server: $this->buildHeaders('api@example.com'),
content: json_encode([]),
);
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY);
$this->assertEmailCount(1);
}
/** @test */
public function it_gets_payments_of_order(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->requestGet(uri: sprintf('/api/v2/admin/orders/%s/payments', $tokenValue));
$this->assertResponseSuccessful('admin/order/get_payments_of_order_response');
}
/** @test */
public function it_gets_shipments_of_order(): void
{
$this->loadFixturesFromFiles(['authentication/api_administrator.yaml', 'channel.yaml', 'cart.yaml', 'country.yaml', 'shipping_method.yaml', 'payment_method.yaml']);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->requestGet(uri: sprintf('/api/v2/admin/orders/%s/shipments', $tokenValue));
$this->assertResponseSuccessful('admin/order/get_shipments_of_order_response');
}
/** @return array<string, string> */
private function buildHeaders(string $adminEmail): array
{
return $this
->headerBuilder()
->withJsonLdContentType()
->withJsonLdAccept()
->withAdminUserAuthorization($adminEmail)
->build();
}
}

View file

@ -0,0 +1,22 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\Bundle\ApiBundle\Attribute;
#[\Attribute(\Attribute::TARGET_CLASS)]
final class OrderTokenValueAware
{
public function __construct(public string $constructorArgumentName = 'orderTokenValue')
{
}
}

View file

@ -1,43 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\Bundle\ApiBundle\Controller;
use Doctrine\Common\Collections\Collection;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Sylius\Component\Order\Model\AdjustmentInterface;
use Symfony\Component\HttpFoundation\Request;
final class GetOrderAdjustmentsAction
{
/**
* @param OrderRepositoryInterface<OrderInterface> $orderRepository
*/
public function __construct(
private OrderRepositoryInterface $orderRepository,
) {
}
/**
* @return Collection<array-key, AdjustmentInterface>
*/
public function __invoke(Request $request, string $tokenValue): Collection
{
/** @var OrderInterface $order */
$order = $this->orderRepository->findOneBy(['tokenValue' => $tokenValue]);
$type = $request->query->get('type');
return $order->getAdjustmentsRecursively($type);
}
}

View file

@ -1,35 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\Bundle\ApiBundle\DataTransformer;
use Sylius\Bundle\ApiBundle\Command\OrderTokenValueAwareInterface;
use Sylius\Component\Core\Model\OrderInterface;
final class OrderTokenValueAwareInputCommandDataTransformer implements CommandDataTransformerInterface
{
public function transform($object, string $to, array $context = [])
{
/** @var OrderInterface $cart */
$cart = $context['object_to_populate'];
$object->setOrderTokenValue($cart->getTokenValue());
return $object;
}
public function supportsTransformation($object): bool
{
return $object instanceof OrderTokenValueAwareInterface;
}
}

View file

@ -17,17 +17,32 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0 https://api-platform.com/schema/metadata/resources-3.0.xsd"
>
<resource class="Sylius\Component\Core\Model\Order">
<validationContext>
<values>
<value name="groups">
<values>
<value>sylius</value>
</values>
</value>
</values>
</validationContext>
<operations>
<!-- Admin Section -->
<operation class="ApiPlatform\Metadata\GetCollection" uriTemplate="/admin/orders">
<normalizationContext>
<values>
<value name="groups">
<values>
<value>sylius:admin:order:index</value>
</values>
</value>
</values>
</normalizationContext>
<order>
<values>
<value name="number">DESC</value>
</values>
</order>
<filters>
<filter>sylius_api.admin.search_filter.order</filter>
<filter>sylius_api.admin.date_filter.order</filter>
<filter>sylius_api.admin.range_filter.order</filter>
<filter>sylius_api.admin.order_filter.order</filter>
</filters>
</operation>
<operation class="ApiPlatform\Metadata\Get" uriTemplate="/admin/orders/{tokenValue}">
<normalizationContext>
<values>
@ -40,6 +55,63 @@
</normalizationContext>
</operation>
<operation
class="ApiPlatform\Metadata\Patch"
uriTemplate="/admin/orders/{tokenValue}/resend-confirmation-email"
messenger="input"
input="Sylius\Bundle\ApiBundle\Command\ResendOrderConfirmationEmail"
output="false"
status="202"
>
<validationContext>
<values>
<value name="groups">
<values>
<value>sylius</value>
</values>
</value>
</values>
</validationContext>
<openapiContext>
<values>
<value name="summary">Resends order confirmation email.</value>
</values>
</openapiContext>
</operation>
<operation
class="ApiPlatform\Metadata\Patch"
uriTemplate="/admin/orders/{tokenValue}/cancel"
input="false"
controller="Sylius\Bundle\ApiBundle\Applicator\OrderStateMachineTransitionApplicatorInterface::cancel"
>
<validationContext>
<values>
<value name="groups">
<values>
<value>sylius</value>
</values>
</value>
</values>
</validationContext>
<normalizationContext>
<values>
<value name="groups">
<values>
<value>sylius:admin:order:show</value>
</values>
</value>
</values>
</normalizationContext>
<openapiContext>
<values>
<value name="summary">Cancels Order.</value>
</values>
</openapiContext>
</operation>
<!-- Shop Section -->
<operation class="ApiPlatform\Metadata\Get" uriTemplate="/shop/orders/{tokenValue}">
<normalizationContext>
<values>

View file

@ -134,7 +134,7 @@
<values>
<value name="groups">
<values>
<value>sylius:admin:order:show</value>
<value>sylius:admin:shipment:show</value>
</values>
</value>
</values>

View file

@ -19,31 +19,6 @@
<attribute name="validation_groups">sylius</attribute>
<collectionOperations>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/orders</attribute>
<attribute name="filters">
<attribute>sylius.api.order_channel_filter</attribute>
<attribute>sylius.api.order_currency_filter</attribute>
<attribute>sylius.api.order_customer_filter</attribute>
<attribute>sylius.api.order_date_filter</attribute>
<attribute>sylius.api.order_number_filter</attribute>
<attribute>sylius.api.order_product_filter</attribute>
<attribute>sylius.api.order_shipping_method_filter</attribute>
<attribute>sylius.api.order_total_filter</attribute>
<attribute>sylius.api.order_variants_filter</attribute>
</attribute>
<attribute name="order">
<attribute name="number">DESC</attribute>
</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>admin:order:index</attribute>
<attribute>sylius:admin:order:index</attribute>
</attribute>
</attribute>
</collectionOperation>
<collectionOperation name="shop_post">
<attribute name="method">POST</attribute>
<attribute name="path">/shop/orders</attribute>
@ -81,30 +56,6 @@
</collectionOperations>
<itemOperations>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/orders/{tokenValue}</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>admin:order:show</attribute>
<attribute>sylius:admin:order:show</attribute>
</attribute>
</attribute>
</itemOperation>
<itemOperation name="admin_adjustments">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/orders/{tokenValue}/adjustments</attribute>
<attribute name="controller">Sylius\Bundle\ApiBundle\Controller\GetOrderAdjustmentsAction</attribute>
<attribute name="write">false</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>admin:adjustment:show</attribute>
<attribute>sylius:admin:adjustment:show</attribute>
</attribute>
</attribute>
</itemOperation>
<itemOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/orders/{tokenValue}</attribute>
@ -130,28 +81,6 @@
</attribute>
</itemOperation>
<itemOperation name="admin_cancel">
<attribute name="method">PATCH</attribute>
<attribute name="path">/admin/orders/{tokenValue}/cancel</attribute>
<attribute name="input">false</attribute>
<attribute name="controller">Sylius\Bundle\ApiBundle\Applicator\OrderStateMachineTransitionApplicatorInterface::cancel</attribute>
<attribute name="denormalization_context">
<attribute name="groups">
<attribute>admin:order:update</attribute>
<attribute>sylius:admin:order:update</attribute>
</attribute>
</attribute>
<attribute name="normalization_context">
<attribute name="groups">
<attribute>admin:order:show</attribute>
<attribute>sylius:admin:order:show</attribute>
</attribute>
</attribute>
<attribute name="openapi_context">
<attribute name="summary">Cancels Order.</attribute>
</attribute>
</itemOperation>
<itemOperation name="shop_add_item">
<attribute name="method">POST</attribute>
<attribute name="path">/shop/orders/{tokenValue}/items</attribute>
@ -452,18 +381,6 @@
<attribute name="summary">Addresses cart to given location, logged in Customer does not have to provide an email. Applies coupon to cart.</attribute>
</attribute>
</itemOperation>
<itemOperation name="admin_resend_confirmation">
<attribute name="method">POST</attribute>
<attribute name="path">/admin/orders/{tokenValue}/resend-confirmation-email</attribute>
<attribute name="messenger">input</attribute>
<attribute name="input">Sylius\Bundle\ApiBundle\Command\ResendOrderConfirmationEmail</attribute>
<attribute name="output">false</attribute>
<attribute name="status">202</attribute>
<attribute name="openapi_context">
<attribute name="summary">Resends order confirmation email.</attribute>
</attribute>
</itemOperation>
</itemOperations>
<subresourceOperations>
@ -471,16 +388,6 @@
<attribute name="method">GET</attribute>
<attribute name="path">/shop/orders/{tokenValue}/items</attribute>
</subresourceOperation>
<subresourceOperation name="shipments_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/orders/{tokenValue}/shipments</attribute>
</subresourceOperation>
<subresourceOperation name="payments_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/orders/{tokenValue}/payments</attribute>
</subresourceOperation>
</subresourceOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -17,318 +17,202 @@
>
<class name="Sylius\Component\Core\Model\Order">
<attribute name="id">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
<group>shop:order:index</group>
<group>sylius:shop:order:index</group>
<group>shop:order:show</group>
<group>sylius:shop:order:show</group>
</attribute>
<attribute name="number">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
<group>shop:order:index</group>
<group>sylius:shop:order:index</group>
<group>shop:order:show</group>
<group>sylius:shop:order:show</group>
</attribute>
<attribute name="currencyCode">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
</attribute>
<attribute name="channel">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:order:index</group>
<group>sylius:shop:order:index</group>
<group>shop:order:show</group>
<group>sylius:shop:order:show</group>
</attribute>
<attribute name="customer">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
</attribute>
<attribute name="payments">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="shipments">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
</attribute>
<attribute name="checkoutState">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
</attribute>
<attribute name="state">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:order:index</group>
<group>sylius:shop:order:index</group>
<group>shop:order:show</group>
<group>sylius:shop:order:show</group>
</attribute>
<attribute name="paymentState">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
</attribute>
<attribute name="shippingState">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
</attribute>
<attribute name="total">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="orderPromotionTotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="shippingPromotionTotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="tokenValue">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
<group>shop:order:index</group>
<group>sylius:shop:order:index</group>
<group>shop:order:show</group>
<group>sylius:shop:order:show</group>
</attribute>
<attribute name="items">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="notes">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
</attribute>
<attribute name="itemsTotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:index</group>
<group>sylius:shop:order:index</group>
<group>shop:order:show</group>
<group>sylius:shop:order:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="itemsSubtotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:index</group>
<group>sylius:shop:order:index</group>
<group>shop:order:show</group>
<group>sylius:shop:order:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="taxTotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="shippingTaxTotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="taxExcludedTotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="taxIncludedTotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="itemsSubtotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="localeCode">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>admin:cart:update</group>
<group>sylius:admin:cart:update</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="shippingTotal">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="shippingAddress">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
<attribute name="billingAddress">
<group>admin:order:index</group>
<group>sylius:admin:order:index</group>
<group>admin:order:show</group>
<group>sylius:admin:order:show</group>
<group>shop:cart:show</group>
<group>sylius:shop:cart:show</group>
<group>shop:order:account:show</group>
<group>sylius:shop:order:account:show</group>
</attribute>
</class>

View file

@ -52,10 +52,6 @@
<tag name="property_info.list_extractor" priority="-2000" />
</service>
<!-- <service id="Sylius\Bundle\ApiBundle\DataTransformer\OrderTokenValueAwareInputCommandDataTransformer">-->
<!-- <tag name="sylius.api.command_data_transformer" priority="1000" />-->
<!-- </service>-->
<!-- <service id="Sylius\Bundle\ApiBundle\DataTransformer\LoggedInShopUserIdAwareCommandDataTransformer">-->
<!-- <argument type="service" id="Sylius\Bundle\ApiBundle\Context\UserContextInterface" />-->
<!-- <tag name="sylius.api.command_data_transformer" />-->
@ -76,11 +72,6 @@
<argument type="service" id="sylius.repository.payment_method" />
</service>
<!-- <service id="Sylius\Bundle\ApiBundle\Controller\GetOrderAdjustmentsAction">-->
<!-- <argument type="service" id="sylius.repository.order" />-->
<!-- <tag name="controller.service_arguments" />-->
<!-- </service>-->
<!-- <service id="Sylius\Bundle\ApiBundle\DataProvider\ChannelAwareItemDataProvider" decorates="api_platform.item_data_provider">-->
<!-- <argument type="service" id="Sylius\Bundle\ApiBundle\DataProvider\ChannelAwareItemDataProvider.inner" />-->
<!-- <argument type="service" id="sylius.context.channel" />-->

View file

@ -87,5 +87,13 @@
>
<argument type="service" id=".inner" />
</service>
<service
id="Sylius\Bundle\ApiBundle\SerializerContextBuilder\OrderTokenValueAwareContextBuilder"
decorates="api_platform.serializer.context_builder"
decoration-priority="64"
>
<argument type="service" id=".inner" />
</service>
</services>
</container>

View file

@ -123,12 +123,12 @@
<tag name="api_platform.doctrine.orm.query_extension.item" />
</service>
<!-- <service id="sylius_api.doctrine.orm.query_extension.admin.order.state_based" class="Sylius\Bundle\ApiBundle\Doctrine\ORM\QueryExtension\Admin\Order\StateBasedExtension">-->
<!-- <argument type="service" id="Sylius\Bundle\CoreBundle\SectionResolver\SectionProviderInterface" />-->
<!-- <argument>%sylius_api.order_states_to_filter_out%</argument>-->
<!-- <tag name="api_platform.doctrine.orm.query_extension.collection" />-->
<!-- <tag name="api_platform.doctrine.orm.query_extension.item" />-->
<!-- </service>-->
<service id="sylius_api.doctrine.orm.query_extension.admin.order.state_based" class="Sylius\Bundle\ApiBundle\Doctrine\ORM\QueryExtension\Admin\Order\StateBasedExtension">
<argument type="service" id="Sylius\Bundle\CoreBundle\SectionResolver\SectionProviderInterface" />
<argument>%sylius_api.order_states_to_filter_out%</argument>
<tag name="api_platform.doctrine.orm.query_extension.collection" />
<tag name="api_platform.doctrine.orm.query_extension.item" />
</service>
<service id="sylius_api.doctrine.orm.query_extension.shop.taxon.enabled" class="Sylius\Bundle\ApiBundle\Doctrine\ORM\QueryExtension\Shop\Taxon\EnabledExtension">
<argument type="service" id="Sylius\Bundle\ApiBundle\Context\UserContextInterface" />

View file

@ -132,54 +132,38 @@
<tag name="api_platform.filter" />
</service>
<!-- <service id="sylius.api.order_date_filter" parent="api_platform.doctrine.orm.date_filter" public="true">-->
<!-- <argument type="collection">-->
<!-- <argument key="checkoutCompletedAt">exclude_null</argument>-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<service id="sylius_api.admin.search_filter.order" parent="api_platform.doctrine.orm.search_filter" public="true">
<argument type="collection">
<argument key="channel.code" />
<argument key="currencyCode">exact</argument>
<argument key="customer.id">exact</argument>
<argument key="items.productName">exact</argument>
<argument key="shipments.method.code">exact</argument>
<argument key="items.variant.translations.name">exact</argument>
</argument>
<tag name="api_platform.filter" />
</service>
<!-- <service id="sylius.api.order_product_filter" parent="api_platform.doctrine.orm.search_filter" public="true">-->
<!-- <argument type="collection">-->
<!-- <argument key="items.productName">exact</argument>-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<service id="sylius_api.admin.date_filter.order" parent="api_platform.doctrine.orm.date_filter" public="true">
<argument type="collection">
<argument key="checkoutCompletedAt">exclude_null</argument>
</argument>
<tag name="api_platform.filter" />
</service>
<!-- <service id="sylius.api.order_shipping_method_filter" parent="api_platform.doctrine.orm.search_filter" public="true">-->
<!-- <argument type="collection">-->
<!-- <argument key="shipments.method.code">exact</argument>-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<service id="sylius_api.admin.range_filter.order" parent="api_platform.doctrine.orm.range_filter" public="true">
<argument type="collection">
<argument key="total">exact</argument>
</argument>
<tag name="api_platform.filter" />
</service>
<!-- <service id="sylius.api.order_variants_filter" parent="api_platform.doctrine.orm.search_filter" public="true">-->
<!-- <argument type="collection">-->
<!-- <argument key="items.variant.translations.name">exact</argument>-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<!-- <service id="sylius.api.order_currency_filter" parent="api_platform.doctrine.orm.search_filter" public="true">-->
<!-- <argument type="collection">-->
<!-- <argument key="currencyCode">exact</argument>-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<!-- <service id="sylius.api.order_total_filter" parent="api_platform.doctrine.orm.range_filter" public="true">-->
<!-- <argument type="collection">-->
<!-- <argument key="total">exact</argument>-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<!-- <service id="sylius.api.order_channel_filter" parent="api_platform.doctrine.orm.search_filter" public="true">-->
<!-- <argument type="collection">-->
<!-- <argument key="channel.code" />-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<service id="sylius_api.admin.order_filter.order" parent="api_platform.doctrine.orm.order_filter" public="true">
<argument type="collection">
<argument key="number" />
</argument>
<tag name="api_platform.filter" />
</service>
<service id="sylius.api.product_order_filter" parent="api_platform.doctrine.orm.order_filter" public="true">
<argument type="collection">
@ -291,13 +275,6 @@
<!-- <argument key="channelPricing.productVariant.code">exact</argument>-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<!-- <service id="sylius.api.order_number_filter" parent="api_platform.doctrine.orm.order_filter" public="true">-->
<!-- <argument type="collection">-->
<!-- <argument key="number" />-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<service id="sylius_api.search_filter.customer_group" parent="api_platform.doctrine.orm.search_filter" public="true">
@ -307,13 +284,6 @@
<tag name="api_platform.filter" />
</service>
<!-- <service id="sylius.api.order_customer_filter" parent="api_platform.doctrine.orm.search_filter" public="true">-->
<!-- <argument type="collection">-->
<!-- <argument key="customer.id">exact</argument>-->
<!-- </argument>-->
<!-- <tag name="api_platform.filter" />-->
<!-- </service>-->
<service id="sylius_api.search_filter.promotion_coupon" parent="api_platform.doctrine.orm.search_filter" public="true">
<argument type="collection">
<argument key="code">exact</argument>

View file

@ -0,0 +1,98 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* 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\Bundle\ApiBundle\SerializerContextBuilder;
use ApiPlatform\Metadata\HttpOperation;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use Sylius\Bundle\ApiBundle\Attribute\OrderTokenValueAware;
use Sylius\Bundle\ApiBundle\Command\OrderTokenValueAwareInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
final readonly class OrderTokenValueAwareContextBuilder implements SerializerContextBuilderInterface
{
public function __construct(
private SerializerContextBuilderInterface $decoratedContextBuilder,
) {
}
public function createFromRequest(Request $request, bool $normalization, ?array $extractedAttributes = null): array
{
$context = $this->decoratedContextBuilder->createFromRequest($request, $normalization, $extractedAttributes);
$inputClass = $this->getInputClassFromContext($context);
if ($inputClass === null || !is_a($inputClass, OrderTokenValueAwareInterface::class, true)) {
return $context;
}
$constructorArgumentName = $this->getConstructorArgumentName($inputClass) ?? 'orderTokenValue';
$orderTokenValue = $this->resolveOrderTokenValueFromUriVariables($context, $extractedAttributes);
if (null !== $orderTokenValue) {
if (isset($context[AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS][$inputClass]) && is_array($context[AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS][$inputClass])) {
$context[AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS][$inputClass] = array_merge($context[AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS][$inputClass], [$constructorArgumentName => $orderTokenValue]);
} else {
$context[AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS][$inputClass] = [$constructorArgumentName => $orderTokenValue];
}
}
return $context;
}
private function getConstructorArgumentName(string $class): ?string
{
$classReflection = new \ReflectionClass($class);
$attributes = $classReflection->getAttributes(OrderTokenValueAware::class);
if (count($attributes) === 0) {
return null;
}
/** @var OrderTokenValueAware $orderTokenValueAware */
$orderTokenValueAware = $attributes[0]->newInstance();
return $orderTokenValueAware->constructorArgumentName;
}
private function resolveOrderTokenValueFromUriVariables(array $context, ?array $attributes): ?string
{
if (
null !== $attributes &&
isset($attributes['operation']) &&
$attributes['operation'] instanceof HttpOperation
) {
$operation = $attributes['operation'];
foreach ($operation->getUriVariables() as $uriVariable) {
if (false === is_a($uriVariable->getFromClass(), OrderInterface::class, true)) {
continue;
}
$identifier = $uriVariable->getFromProperty() ?? $uriVariable->getParameterName() ?? 'id';
return $context['uri_variables'][$identifier] ?? null;
}
}
return null;
}
/**
* @param array<string, mixed> $context
*/
private function getInputClassFromContext(array $context): ?string
{
return $context['input']['class'] ?? null;
}
}

View file

@ -13,8 +13,12 @@ declare(strict_types=1);
namespace Sylius\Tests\Api\Admin;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Tests\Api\JsonApiTestCase;
use Sylius\Tests\Api\Utils\FilterTypes;
use Sylius\Tests\Api\Utils\OrderPlacerTrait;
use Symfony\Component\HttpFoundation\Response;
final class OrdersTest extends JsonApiTestCase
{
@ -31,6 +35,275 @@ final class OrdersTest extends JsonApiTestCase
parent::setUp();
}
/** @test */
public function it_gets_all_orders(): void
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
]);
$this->requestGet(uri: '/api/v2/admin/orders');
$this->assertResponseSuccessful('admin/order/get_all_orders');
}
/** @test */
public function it_gets_orders_filtered_by_channel(): void
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
]);
/** @var ChannelInterface $channel */
$channel = $fixtures['channel_mobile'];
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['channel.code' => $channel->getCode()],
);
$this->assertResponseSuccessful('admin/order/get_orders_filtered_by_channel');
}
/** @test */
public function it_gets_orders_filtered_by_different_currencies(): void
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
'order/new_in_different_currencies.yaml',
]);
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['currencyCode' => ['PLN']],
);
$this->assertResponseSuccessful('admin/order/get_orders_filtered_by_pln_currency_code');
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['currencyCode' => ['USD']],
);
$this->assertResponseSuccessful('admin/order/get_orders_filtered_by_usd_currency_code');
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['currencyCode' => ['PLN', 'USD']],
);
$this->assertResponseSuccessful('admin/order/get_orders_filtered_by_pln_and_usd_currency_codes');
}
/** @test */
public function it_gets_orders_for_customer(): void
{
$fixtures = $this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'order/customer.yaml',
'order/fulfilled.yaml',
]);
/** @var CustomerInterface $customer */
$customer = $fixtures['customer_tony'];
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: ['customer.id' => $customer->getId()],
);
$this->assertResponseSuccessful('admin/order/get_orders_for_customer');
}
/**
* @test
*
* @dataProvider provideOrderFilterDates
*/
public function it_gets_orders_by_period(
string $tokenValue,
array $checkoutsCompletedAt,
array $requestedLimit,
string $filename,
): void {
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'cart.yaml',
'channel.yaml',
'order/customer.yaml',
'payment_method.yaml',
'shipping_method.yaml',
]);
foreach ($checkoutsCompletedAt as $checkoutCompletedAt) {
$this->placeOrder(
tokenValue: $tokenValue,
checkoutCompletedAt: new \DateTimeImmutable($checkoutCompletedAt),
);
}
$checkoutCompletedAt = sprintf('checkoutCompletedAt[%s]', $requestedLimit['filterType']->value);
$this->requestGet(
uri: '/api/v2/admin/orders',
queryParameters: [$checkoutCompletedAt => $requestedLimit['date']],
);
$this->assertResponseSuccessful($filename);
}
private function provideOrderFilterDates(): iterable
{
yield 'checkoutCompletedBefore' => [
'tokenValue' => 'firstOrderToken',
'checkoutsCompletedAt' => [
'2024-01-01T00:00:00+00:00',
],
'requestedLimit' => [
'filterType' => FilterTypes::Before,
'date' => '2024-01-01T00:00:00+00:00',
],
'filename' => 'admin/order/get_orders_before_date',
];
yield 'checkoutCompletedStrictlyBefore' => [
'tokenValue' => 'firstOrderToken',
'checkoutsCompletedAt' => [
'2024-01-01T00:00:00+00:00',
],
'requestedLimit' => [
'filterType' => FilterTypes::StrictlyBefore,
'date' => '2024-01-01T00:00:00+00:00',
],
'filename' => 'admin/order/get_orders_empty_collection',
];
}
/** @test */
public function it_gets_an_order(): void
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
'payment_method.yaml',
]);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->requestGet(uri: '/api/v2/admin/orders/' . $tokenValue);
$this->assertResponseSuccessful('admin/order/get_order');
}
/** @test */
public function it_resends_order_confirmation_email(): void
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
'payment_method.yaml'
]);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->client->request(
method: 'Patch',
uri: sprintf('/api/v2/admin/orders/%s/resend-confirmation-email', $tokenValue),
server: $this->buildHeadersWithMergePatchJson('api@example.com'),
content: json_encode([]),
);
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_ACCEPTED);
$this->assertEmailCount(2);
}
/** @test */
public function it_does_not_resends_order_confirmation_email_for_order_with_invalid_state(): void
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
'payment_method.yaml',
]);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->cancelOrder($tokenValue);
$this->client->request(
method: 'PATCH',
uri: sprintf('/api/v2/admin/orders/%s/resend-confirmation-email', $tokenValue),
server: $this->buildHeadersWithMergePatchJson('api@example.com'),
content: json_encode([]),
);
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY);
$this->assertEmailCount(1);
}
/** @test */
public function it_gets_payments_of_order(): void
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
'payment_method.yaml',
]);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->requestGet(uri: sprintf('/api/v2/admin/orders/%s/payments', $tokenValue));
$this->assertResponseSuccessful('admin/order/get_payments_of_order');
}
/** @test */
public function it_gets_shipments_of_order(): void
{
$this->loadFixturesFromFiles([
'authentication/api_administrator.yaml',
'channel.yaml',
'cart.yaml',
'country.yaml',
'shipping_method.yaml',
'payment_method.yaml',
]);
$tokenValue = 'nAWw2jewpA';
$this->placeOrder($tokenValue);
$this->requestGet(uri: sprintf('/api/v2/admin/orders/%s/shipments', $tokenValue));
$this->assertResponseSuccessful('admin/order/get_shipments_of_order');
}
/** @test */
public function it_gets_adjustments_for_order(): void
{
@ -73,4 +346,16 @@ final class OrdersTest extends JsonApiTestCase
$this->assertResponseSuccessful('admin/order/get_adjustments_for_a_given_order_with_type_filter');
}
/** @return array<string, string> */
private function buildHeadersWithMergePatchJson(string $adminEmail): array
{
return $this
->headerBuilder()
->withMergePatchJsonContentType()
->withJsonLdAccept()
->withAdminUserAuthorization($adminEmail)
->build()
;
}
}

View file

@ -23,6 +23,16 @@ Sylius\Component\Core\Model\Order:
customer: "@customer_dave"
billingAddress: "@second_order_billing_address"
shippingAddress: "@second_order_shipping_address"
cart_order:
channel: "@channel_web"
currencyCode: "USD"
localeCode: "en_US"
state: "cart"
paymentState: "paid"
shippingState: "ready"
checkoutState: "completed"
tokenValue: "cartToken"
customer: "@customer_dave"
Sylius\Component\Core\Model\Address:
first_order_billing_address:

View file

@ -2,25 +2,13 @@
"@context": "\/api\/v2\/contexts\/Order",
"@id": "\/api\/v2\/admin\/orders",
"@type": "hydra:Collection",
"hydra:totalItems": 2,
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/orders\/firstToken",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/WEB",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -34,6 +22,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
@ -43,6 +44,8 @@
"shippingState": "ready",
"tokenValue": "firstToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -61,19 +64,6 @@
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/MOBILE",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -87,6 +77,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
@ -96,6 +99,8 @@
"shippingState": "ready",
"tokenValue": "secondToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -110,10 +115,9 @@
"shippingPromotionTotal": 0
}
],
"hydra:totalItems": 2,
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/api\/v2\/admin\/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],order[number],items.productName,items.productName[],shipments.method.code,shipments.method.code[],total[between],total[gt],total[gte],total[lt],total[lte],items.variant.translations.name,items.variant.translations.name[]}",
"hydra:template": "/api/v2/admin/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],items.productName,items.productName[],shipments.method.code,shipments.method.code[],items.variant.translations.name,items.variant.translations.name[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],total[between],total[gt],total[gte],total[lt],total[lte],order[number]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
@ -146,36 +150,6 @@
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[number]",
"property": "number",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName",
@ -200,6 +174,42 @@
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[between]",
@ -232,14 +242,8 @@
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"variable": "order[number]",
"property": "number",
"required": false
}
]

View file

@ -1,16 +0,0 @@
{
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@context": "\/api\/v2\/contexts\/Address",
"@type": "Address",
"id": "@integer@",
"firstName": "Andrzej",
"lastName": "Legs",
"company": "Polmotors office",
"street": "Moniuszki 16/20",
"countryCode": "PL",
"city": "Pabianice",
"postcode": "31-999",
"phoneNumber": "111999222",
"provinceCode": null,
"provinceName": "kujawsko-pomorskie"
}

View file

@ -9,7 +9,10 @@
"@type": "Address",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": null,
"company": null,
"countryCode": "US",
"provinceName": null,
"street": "Avenue",
"city": "New York",
"postcode": "90000"
@ -19,7 +22,10 @@
"@type": "Address",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": null,
"company": null,
"countryCode": "US",
"provinceName": null,
"street": "Avenue",
"city": "New York",
"postcode": "90000"
@ -48,6 +54,7 @@
"tokenValue": "nAWw2jewpA",
"id": "@integer@",
"number": "@string@",
"notes": null,
"items": [
{
"@id": "\/api\/v2\/admin\/order-items\/@integer@",

View file

@ -2,6 +2,7 @@
"@context": "\/api\/v2\/contexts\/Order",
"@id": "\/api\/v2\/admin\/orders",
"@type": "hydra:Collection",
"hydra:totalItems": 1,
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/orders\/firstOrderToken",
@ -13,7 +14,10 @@
"@type": "Address",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": null,
"company": null,
"countryCode": "US",
"provinceName": null,
"street": "Avenue",
"city": "New York",
"postcode": "90000"
@ -23,7 +27,10 @@
"@type": "Address",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": null,
"company": null,
"countryCode": "US",
"provinceName": null,
"street": "Avenue",
"city": "New York",
"postcode": "90000"
@ -52,6 +59,7 @@
"tokenValue": "firstOrderToken",
"id": "@integer@",
"number": "@string@",
"notes": null,
"items": [
{
"@id": "\/api\/v2\/admin\/order-items\/@integer@",
@ -85,14 +93,13 @@
"shippingPromotionTotal": 0
}
],
"hydra:totalItems": 1,
"hydra:view": {
"@id": "\/api\/v2\/admin\/orders?checkoutCompletedAt%5Bbefore%5D=@string@",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/api\/v2\/admin\/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],order[number],items.productName,items.productName[],shipments.method.code,shipments.method.code[],total[between],total[gt],total[gte],total[lt],total[lte],items.variant.translations.name,items.variant.translations.name[]}",
"hydra:template": "/api/v2/admin/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],items.productName,items.productName[],shipments.method.code,shipments.method.code[],items.variant.translations.name,items.variant.translations.name[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],total[between],total[gt],total[gte],total[lt],total[lte],order[number]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
@ -125,36 +132,6 @@
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[number]",
"property": "number",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName",
@ -179,6 +156,42 @@
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[between]",
@ -211,14 +224,8 @@
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"variable": "order[number]",
"property": "number",
"required": false
}
]

View file

@ -10,7 +10,7 @@
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/api\/v2\/admin\/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],order[number],items.productName,items.productName[],shipments.method.code,shipments.method.code[],total[between],total[gt],total[gte],total[lt],total[lte],items.variant.translations.name,items.variant.translations.name[]}",
"hydra:template": "/api/v2/admin/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],items.productName,items.productName[],shipments.method.code,shipments.method.code[],items.variant.translations.name,items.variant.translations.name[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],total[between],total[gt],total[gte],total[lt],total[lte],order[number]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
@ -43,36 +43,6 @@
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[number]",
"property": "number",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName",
@ -97,6 +67,42 @@
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[between]",
@ -129,14 +135,8 @@
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"variable": "order[number]",
"property": "number",
"required": false
}
]

View file

@ -2,25 +2,13 @@
"@context": "\/api\/v2\/contexts\/Order",
"@id": "\/api\/v2\/admin\/orders",
"@type": "hydra:Collection",
"hydra:totalItems": 1,
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/orders\/secondToken",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/MOBILE",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -34,6 +22,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
@ -43,6 +44,8 @@
"shippingState": "ready",
"tokenValue": "secondToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -57,14 +60,13 @@
"shippingPromotionTotal": 0
}
],
"hydra:totalItems": 1,
"hydra:view": {
"@id": "\/api\/v2\/admin\/orders?channel.code=MOBILE",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/api\/v2\/admin\/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],order[number],items.productName,items.productName[],shipments.method.code,shipments.method.code[],total[between],total[gt],total[gte],total[lt],total[lte],items.variant.translations.name,items.variant.translations.name[]}",
"hydra:template": "/api/v2/admin/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],items.productName,items.productName[],shipments.method.code,shipments.method.code[],items.variant.translations.name,items.variant.translations.name[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],total[between],total[gt],total[gte],total[lt],total[lte],order[number]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
@ -97,36 +99,6 @@
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[number]",
"property": "number",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName",
@ -151,6 +123,42 @@
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[between]",
@ -183,14 +191,8 @@
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"variable": "order[number]",
"property": "number",
"required": false
}
]

View file

@ -2,25 +2,13 @@
"@context": "\/api\/v2\/contexts\/Order",
"@id": "\/api\/v2\/admin\/orders",
"@type": "hydra:Collection",
"hydra:totalItems": 4,
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/orders\/polishCurrencyFirstToken",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/WEB",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -34,6 +22,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "PLN",
@ -43,6 +44,8 @@
"shippingState": "ready",
"tokenValue": "polishCurrencyFirstToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -61,19 +64,6 @@
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/MOBILE",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -87,6 +77,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "PLN",
@ -96,6 +99,8 @@
"shippingState": "ready",
"tokenValue": "polishCurrencySecondToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -114,19 +119,6 @@
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/WEB",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -140,6 +132,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
@ -149,6 +154,8 @@
"shippingState": "ready",
"tokenValue": "firstToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -167,19 +174,6 @@
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/MOBILE",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -193,6 +187,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
@ -202,6 +209,8 @@
"shippingState": "ready",
"tokenValue": "secondToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -216,14 +225,13 @@
"shippingPromotionTotal": 0
}
],
"hydra:totalItems": 4,
"hydra:view": {
"@id": "\/api\/v2\/admin\/orders?currencyCode%5B%5D=PLN&currencyCode%5B%5D=USD",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/api\/v2\/admin\/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],order[number],items.productName,items.productName[],shipments.method.code,shipments.method.code[],total[between],total[gt],total[gte],total[lt],total[lte],items.variant.translations.name,items.variant.translations.name[]}",
"hydra:template": "/api/v2/admin/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],items.productName,items.productName[],shipments.method.code,shipments.method.code[],items.variant.translations.name,items.variant.translations.name[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],total[between],total[gt],total[gte],total[lt],total[lte],order[number]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
@ -256,36 +264,6 @@
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[number]",
"property": "number",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName",
@ -310,6 +288,42 @@
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[between]",
@ -342,14 +356,8 @@
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"variable": "order[number]",
"property": "number",
"required": false
}
]

View file

@ -2,25 +2,13 @@
"@context": "\/api\/v2\/contexts\/Order",
"@id": "\/api\/v2\/admin\/orders",
"@type": "hydra:Collection",
"hydra:totalItems": 2,
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/orders\/polishCurrencyFirstToken",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/WEB",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -34,6 +22,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "PLN",
@ -43,6 +44,8 @@
"shippingState": "ready",
"tokenValue": "polishCurrencyFirstToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -61,19 +64,6 @@
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/MOBILE",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -87,6 +77,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "PLN",
@ -96,6 +99,8 @@
"shippingState": "ready",
"tokenValue": "polishCurrencySecondToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -110,14 +115,13 @@
"shippingPromotionTotal": 0
}
],
"hydra:totalItems": 2,
"hydra:view": {
"@id": "\/api\/v2\/admin\/orders?currencyCode%5B%5D=PLN",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/api\/v2\/admin\/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],order[number],items.productName,items.productName[],shipments.method.code,shipments.method.code[],total[between],total[gt],total[gte],total[lt],total[lte],items.variant.translations.name,items.variant.translations.name[]}",
"hydra:template": "/api/v2/admin/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],items.productName,items.productName[],shipments.method.code,shipments.method.code[],items.variant.translations.name,items.variant.translations.name[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],total[between],total[gt],total[gte],total[lt],total[lte],order[number]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
@ -150,36 +154,6 @@
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[number]",
"property": "number",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName",
@ -204,6 +178,42 @@
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[between]",
@ -236,14 +246,8 @@
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"variable": "order[number]",
"property": "number",
"required": false
}
]

View file

@ -2,25 +2,13 @@
"@context": "\/api\/v2\/contexts\/Order",
"@id": "\/api\/v2\/admin\/orders",
"@type": "hydra:Collection",
"hydra:totalItems": 2,
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/orders\/firstToken",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/WEB",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -34,6 +22,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
@ -43,6 +44,8 @@
"shippingState": "ready",
"tokenValue": "firstToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -61,19 +64,6 @@
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/MOBILE",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -87,6 +77,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
@ -96,6 +99,8 @@
"shippingState": "ready",
"tokenValue": "secondToken",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -110,14 +115,13 @@
"shippingPromotionTotal": 0
}
],
"hydra:totalItems": 2,
"hydra:view": {
"@id": "\/api\/v2\/admin\/orders?currencyCode%5B%5D=USD",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/api\/v2\/admin\/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],order[number],items.productName,items.productName[],shipments.method.code,shipments.method.code[],total[between],total[gt],total[gte],total[lt],total[lte],items.variant.translations.name,items.variant.translations.name[]}",
"hydra:template": "/api/v2/admin/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],items.productName,items.productName[],shipments.method.code,shipments.method.code[],items.variant.translations.name,items.variant.translations.name[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],total[between],total[gt],total[gte],total[lt],total[lte],order[number]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
@ -150,36 +154,6 @@
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[number]",
"property": "number",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName",
@ -204,6 +178,42 @@
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[between]",
@ -236,14 +246,8 @@
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"variable": "order[number]",
"property": "number",
"required": false
}
]

View file

@ -2,25 +2,13 @@
"@context": "\/api\/v2\/contexts\/Order",
"@id": "\/api\/v2\/admin\/orders",
"@type": "hydra:Collection",
"hydra:totalItems": 1,
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/orders\/token",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/WEB",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
@ -34,6 +22,19 @@
"city": "Pabianice",
"postcode": "31-999"
},
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
@ -43,6 +44,8 @@
"shippingState": "ready",
"tokenValue": "token",
"id": "@integer@",
"number": null,
"notes": null,
"items": [],
"itemsTotal": 0,
"total": 0,
@ -57,14 +60,13 @@
"shippingPromotionTotal": 0
}
],
"hydra:totalItems": 1,
"hydra:view": {
"@id": "\/api\/v2\/admin\/orders?customer.id=@integer@",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/api\/v2\/admin\/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],order[number],items.productName,items.productName[],shipments.method.code,shipments.method.code[],total[between],total[gt],total[gte],total[lt],total[lte],items.variant.translations.name,items.variant.translations.name[]}",
"hydra:template": "/api/v2/admin/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],items.productName,items.productName[],shipments.method.code,shipments.method.code[],items.variant.translations.name,items.variant.translations.name[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],total[between],total[gt],total[gte],total[lt],total[lte],order[number]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
@ -97,36 +99,6 @@
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[number]",
"property": "number",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName",
@ -151,6 +123,42 @@
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[between]",
@ -183,14 +191,8 @@
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"variable": "order[number]",
"property": "number",
"required": false
}
]

View file

@ -2,6 +2,7 @@
"@context": "\/api\/v2\/contexts\/Payment",
"@id": "\/api\/v2\/admin\/orders\/nAWw2jewpA\/payments",
"@type": "hydra:Collection",
"hydra:totalItems": 1,
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/payments\/@integer@",
@ -26,6 +27,5 @@
"createdAt": "@datetime@",
"updatedAt": "@datetime@"
}
],
"hydra:totalItems": 1
]
}

View file

@ -2,6 +2,7 @@
"@context": "\/api\/v2\/contexts\/Shipment",
"@id": "\/api\/v2\/admin\/orders\/nAWw2jewpA\/shipments",
"@type": "hydra:Collection",
"hydra:totalItems": 1,
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/shipments\/@integer@",
@ -15,9 +16,10 @@
"16": "\/api\/v2\/admin\/order-item-units\/@integer@",
"17": "\/api\/v2\/admin\/order-item-units\/@integer@"
},
"tracking": null,
"shippedAt": null,
"createdAt": "@datetime@",
"updatedAt": "@datetime@"
}
],
"hydra:totalItems": 1
]
}

View file

@ -1,16 +0,0 @@
{
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@context": "\/api\/v2\/contexts\/Address",
"@type": "Address",
"id": "@integer@",
"firstName": "Andrzej",
"lastName": "Legs",
"company": "Polmotors manufactory",
"street": "Moniuszki 16/20",
"countryCode": "PL",
"city": "Pabianice",
"postcode": "31-999",
"phoneNumber": "111999222",
"provinceCode": null,
"provinceName": "kujawsko-pomorskie"
}

View file

@ -1,16 +0,0 @@
{
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@context": "\/api\/v2\/contexts\/Address",
"@type": "Address",
"id": "@integer@",
"firstName": "Updated: Adam",
"lastName": "Updated: Handley",
"company": "Updated: FMŻ",
"street": "Updated: Kościuszki 21",
"countryCode": "PL",
"city": "Updated: Bordeaux",
"postcode": "Updated: 99-999",
"phoneNumber": "Updated: 911213969",
"provinceCode": null,
"provinceName": "Updated: wielkopolskie"
}

View file

@ -1,16 +0,0 @@
{
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@context": "\/api\/v2\/contexts\/Address",
"@type": "Address",
"id": "@integer@",
"firstName": "Updated: Julia",
"lastName": "Updated: Kowalska",
"company": "Updated: Błysk",
"street": "Updated: Marszałkowska 10",
"countryCode": "GB",
"city": "Updated: Warszawa",
"postcode": "Updated: 00-001",
"phoneNumber": "Updated: 48222333444",
"provinceCode": null,
"provinceName": "Updated: mazowieckie"
}