From 5886d23f94216ea55862dac8238e8ba9746530da Mon Sep 17 00:00:00 2001 From: Grzegorz Sadowski Date: Thu, 12 Mar 2020 14:09:31 +0100 Subject: [PATCH] [API] Implement filtering payments by channel feature --- .../filtering_payments_by_channel.feature | 4 ++-- .../Behat/Context/Api/Admin/ManagingPaymentsContext.php | 8 ++++++++ .../ApiBundle/Resources/config/api_resources/Order.xml | 1 + .../ApiBundle/Resources/config/serializer/Order.xml | 3 +++ .../ApiBundle/Resources/config/services/filters.xml | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/features/payment/managing_payments/filtering_payments_by_channel.feature b/features/payment/managing_payments/filtering_payments_by_channel.feature index ddb36b7e64..424ea4a8d5 100644 --- a/features/payment/managing_payments/filtering_payments_by_channel.feature +++ b/features/payment/managing_payments/filtering_payments_by_channel.feature @@ -15,11 +15,11 @@ Feature: Filtering payments by channel And there is an "#00000002" order with "Orange" product in "Canada" channel And I am logged in as an administrator - @ui + @ui @api Scenario: Filtering payments by channel on index When I browse payments And I choose "Canada" as a channel filter And I filter Then I should see a single payment in the list And I should see the payment of the "#00000002" order - But I should not see a payment of order "#00000001" + But I should not see the payment of the "#00000001" order diff --git a/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentsContext.php b/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentsContext.php index 08ba205c5a..92f9e19c25 100644 --- a/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentsContext.php +++ b/src/Sylius/Behat/Context/Api/Admin/ManagingPaymentsContext.php @@ -69,6 +69,14 @@ final class ManagingPaymentsContext implements Context $this->client->buildFilter(['state' => $state]); } + /** + * @When I choose :channel as a channel filter + */ + public function iChooseChannelAsAChannelFilter(ChannelInterface $channel): void + { + $this->client->buildFilter(['order.channel.code' => $channel->getCode()]); + } + /** * @When I filter */ diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Order.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Order.xml index 4fe38dcc4d..316baa94aa 100644 --- a/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Order.xml +++ b/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Order.xml @@ -22,6 +22,7 @@ + diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/serializer/Order.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/serializer/Order.xml index b24d069ae2..4bc3e5ca7b 100644 --- a/src/Sylius/Bundle/ApiBundle/Resources/config/serializer/Order.xml +++ b/src/Sylius/Bundle/ApiBundle/Resources/config/serializer/Order.xml @@ -11,6 +11,9 @@ order:read + + order:read + order:read diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/services/filters.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/services/filters.xml index c6f8b391e9..d837e31bfc 100644 --- a/src/Sylius/Bundle/ApiBundle/Resources/config/services/filters.xml +++ b/src/Sylius/Bundle/ApiBundle/Resources/config/services/filters.xml @@ -12,6 +12,7 @@ exact + exact