diff --git a/features/channel/managing_channels/adding_channel.feature b/features/channel/managing_channels/adding_channel.feature
index 4d28784c12..44f18b7433 100644
--- a/features/channel/managing_channels/adding_channel.feature
+++ b/features/channel/managing_channels/adding_channel.feature
@@ -12,19 +12,20 @@ Feature: Adding a new channel
@ui @api
Scenario: Adding a new channel
- Given I want to create a new channel
- When I specify its code as "MOBILE"
+ When I want to create a new channel
+ And I specify its code as "MOBILE"
And I name it "Mobile channel"
And I choose "Euro" as the base currency
And I choose "English (United States)" as a default locale
+ And I select the "Order items based" as tax calculation strategy
And I add it
Then I should be notified that it has been successfully created
And the channel "Mobile channel" should appear in the registry
@ui @api
Scenario: Adding a new channel with additional fields
- Given I want to create a new channel
- When I specify its code as "MOBILE"
+ When I want to create a new channel
+ And I specify its code as "MOBILE"
And I name it "Mobile channel"
And I describe it as "Main distribution channel for mobile apps"
And I set its hostname as "m.avengers-gear.com"
@@ -33,6 +34,7 @@ Feature: Adding a new channel
And I choose "Euro" as the base currency
And I choose "English (United States)" as a default locale
And I choose "United States" and "Poland" as operating countries
+ And I select the "Order items based" as tax calculation strategy
And I allow to skip shipping step if only one shipping method is available
And I allow to skip payment step if only one payment method is available
And I add it
diff --git a/features/channel/managing_channels/adding_channel_with_shop_billing_data.feature b/features/channel/managing_channels/adding_channel_with_shop_billing_data.feature
index d324547bc1..6c6ea0eee4 100644
--- a/features/channel/managing_channels/adding_channel_with_shop_billing_data.feature
+++ b/features/channel/managing_channels/adding_channel_with_shop_billing_data.feature
@@ -12,11 +12,12 @@ Feature: Adding a new channel with shop billing data
@ui @api
Scenario: Adding a new channel with shop billing data
- Given I want to create a new channel
- When I specify its code as "MOBILE"
+ When I want to create a new channel
+ And I specify its code as "MOBILE"
And I name it "Mobile channel"
And I choose "Euro" as the base currency
And I choose "English (United States)" as a default locale
+ And I select the "Order items based" as tax calculation strategy
And I specify company as "Ragnarok"
And I specify tax ID as "1100110011"
And I specify shop billing address as "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
diff --git a/features/channel/managing_channels/adding_new_channel_with_menu_taxon.feature b/features/channel/managing_channels/adding_new_channel_with_menu_taxon.feature
index b7696b10df..943ae8e4aa 100644
--- a/features/channel/managing_channels/adding_new_channel_with_menu_taxon.feature
+++ b/features/channel/managing_channels/adding_new_channel_with_menu_taxon.feature
@@ -18,6 +18,7 @@ Feature: Adding a new channel with menu taxon
And I name it "Mobile channel"
And I choose "Euro" as the base currency
And I choose "English (United States)" as a default locale
+ And I select the "Order items based" as tax calculation strategy
And I specify menu taxon as "Clothes"
And I add it
Then I should be notified that it has been successfully created
diff --git a/src/Sylius/Behat/Context/Api/Admin/ManagingChannelsContext.php b/src/Sylius/Behat/Context/Api/Admin/ManagingChannelsContext.php
index a6fedbbec0..8083148d18 100644
--- a/src/Sylius/Behat/Context/Api/Admin/ManagingChannelsContext.php
+++ b/src/Sylius/Behat/Context/Api/Admin/ManagingChannelsContext.php
@@ -18,6 +18,7 @@ use Behat\Behat\Context\Context;
use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Sylius\Component\Addressing\Model\CountryInterface;
+use Sylius\Component\Core\Formatter\StringInflector;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Currency\Model\CurrencyInterface;
@@ -30,7 +31,7 @@ final class ManagingChannelsContext implements Context
private $client;
/** @var ApiClientInterface */
- private $billingDataClient;
+ private $shopBillingDatasClient;
/** @var ResponseCheckerInterface */
private $responseChecker;
@@ -39,29 +40,26 @@ final class ManagingChannelsContext implements Context
private $iriConverter;
/** @var array */
- private $billingData = [];
+ private $shopBillingData = [];
public function __construct(
ApiClientInterface $client,
- ApiClientInterface $billingDataClient,
+ ApiClientInterface $shopBillingDatasClient,
ResponseCheckerInterface $responseChecker,
IriConverterInterface $iriConverter
) {
$this->client = $client;
- $this->billingDataClient = $billingDataClient;
+ $this->shopBillingDatasClient = $shopBillingDatasClient;
$this->responseChecker = $responseChecker;
$this->iriConverter = $iriConverter;
}
/**
- * @Given I want to create a new channel
+ * @When I want to create a new channel
*/
public function iWantToCreateANewChannel(): void
{
$this->client->buildCreateRequest();
-
- // @see https://github.com/Sylius/Sylius/issues/11414
- $this->client->addRequestData('taxCalculationStrategy', 'order_items_based');
}
/**
@@ -70,7 +68,7 @@ final class ManagingChannelsContext implements Context
* @When I set its :field as :value
* @When I define its :field as :value
*/
- public function iSpecifyItsCodeAs(string $field, string $value): void
+ public function iSpecifyItsAs(string $field, string $value): void
{
$this->client->addRequestData($field, $value);
}
@@ -147,7 +145,7 @@ final class ManagingChannelsContext implements Context
*/
public function iSpecifyCompanyAs(string $company): void
{
- $this->billingData['company'] = $company;
+ $this->shopBillingData['company'] = $company;
}
/**
@@ -155,7 +153,7 @@ final class ManagingChannelsContext implements Context
*/
public function iSpecifyTaxIdAs(string $taxId): void
{
- $this->billingData['taxId'] = $taxId;
+ $this->shopBillingData['taxId'] = $taxId;
}
/**
@@ -167,10 +165,18 @@ final class ManagingChannelsContext implements Context
string $city,
CountryInterface $country
): void {
- $this->billingData['street'] = $street;
- $this->billingData['city'] = $city;
- $this->billingData['postcode'] = $postcode;
- $this->billingData['countryCode'] = $country->getCode();
+ $this->shopBillingData['street'] = $street;
+ $this->shopBillingData['city'] = $city;
+ $this->shopBillingData['postcode'] = $postcode;
+ $this->shopBillingData['countryCode'] = $country->getCode();
+ }
+
+ /**
+ * @When I select the :taxCalculationStrategy as tax calculation strategy
+ */
+ public function iSelectTaxCalculationStrategy(string $taxCalculationStrategy): void
+ {
+ $this->client->addRequestData('taxCalculationStrategy', StringInflector::nameToLowercaseCode($taxCalculationStrategy));
}
/**
@@ -236,13 +242,13 @@ final class ManagingChannelsContext implements Context
private function createBillingData(): void
{
- if (!empty($this->billingData)) {
- $this->billingDataClient->buildCreateRequest();
- foreach ($this->billingData as $field => $value) {
- $this->billingDataClient->addRequestData($field, $value);
+ if (!empty($this->shopBillingData)) {
+ $this->shopBillingDatasClient->buildCreateRequest();
+ foreach ($this->shopBillingData as $field => $value) {
+ $this->shopBillingDatasClient->addRequestData($field, $value);
}
- $this->billingDataClient->create();
- $iri = $this->responseChecker->getValue($this->billingDataClient->getLastResponse(), '@id');
+ $this->shopBillingDatasClient->create();
+ $iri = $this->responseChecker->getValue($this->shopBillingDatasClient->getLastResponse(), '@id');
$this->client->addRequestData('shopBillingData', $iri);
}
}
diff --git a/src/Sylius/Behat/Context/Transform/LocaleContext.php b/src/Sylius/Behat/Context/Transform/LocaleContext.php
index 67dadb612b..364d59e79f 100644
--- a/src/Sylius/Behat/Context/Transform/LocaleContext.php
+++ b/src/Sylius/Behat/Context/Transform/LocaleContext.php
@@ -55,14 +55,14 @@ final class LocaleContext implements Context
/**
* @Transform :locale
*/
- public function getProductByName(string $localeName): LocaleInterface
+ public function getLocaleByName(string $name): LocaleInterface
{
- $locale = $this->localeRepository->findOneByCode($this->localeNameConverter->convertNameToCode($localeName));
+ $locale = $this->localeRepository->findOneBy(['code' => $this->localeNameConverter->convertNameToCode($name)]);
Assert::isInstanceOf(
$locale,
LocaleInterface::class,
- sprintf('Cannot find "%s" locale.', $localeName)
+ sprintf('Cannot find "%s" locale.', $name)
);
return $locale;
diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingChannelsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingChannelsContext.php
index adc3714218..8dd545f873 100644
--- a/src/Sylius/Behat/Context/Ui/Admin/ManagingChannelsContext.php
+++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingChannelsContext.php
@@ -57,7 +57,7 @@ final class ManagingChannelsContext implements Context
}
/**
- * @Given I want to create a new channel
+ * @When I want to create a new channel
*/
public function iWantToCreateANewChannel()
{
diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Channel.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Channel.xml
index 9e055a5a5d..330eef0a49 100644
--- a/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Channel.xml
+++ b/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Channel.xml
@@ -42,25 +42,25 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+