[API] Implement filtering payments by channel feature

This commit is contained in:
Grzegorz Sadowski 2020-03-12 14:09:31 +01:00 committed by Mateusz Zalewski
parent 559744a9b1
commit 5886d23f94
No known key found for this signature in database
GPG key ID: 9BECA0BB71612E52
5 changed files with 15 additions and 2 deletions

View file

@ -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

View file

@ -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
*/

View file

@ -22,6 +22,7 @@
<property name="id" identifier="false" writable="false" />
<property name="number" identifier="true" writable="false" />
<property name="channel" writable="false" />
<property name="customer" writable="false" />
</resource>
</resources>

View file

@ -11,6 +11,9 @@
<attribute name="number">
<group>order:read</group>
</attribute>
<attribute name="channel">
<group>order:read</group>
</attribute>
<attribute name="customer">
<group>order:read</group>
</attribute>

View file

@ -12,6 +12,7 @@
<service id="sylius.api.search_payment_filter" parent="api_platform.doctrine.orm.search_filter">
<argument type="collection">
<argument key="state">exact</argument>
<argument key="order.channel.code">exact</argument>
</argument>
<tag name="api_platform.filter" />
</service>