diff --git a/src/Sylius/Bundle/CoreBundle/Form/Extension/ChannelTypeExtension.php b/src/Sylius/Bundle/CoreBundle/Form/Extension/ChannelTypeExtension.php
index 5d0ae50824b..4aeb887c3b2 100644
--- a/src/Sylius/Bundle/CoreBundle/Form/Extension/ChannelTypeExtension.php
+++ b/src/Sylius/Bundle/CoreBundle/Form/Extension/ChannelTypeExtension.php
@@ -17,6 +17,7 @@
use Sylius\Bundle\ChannelBundle\Form\Type\ChannelType;
use Sylius\Bundle\CoreBundle\Form\EventSubscriber\AddBaseCurrencySubscriber;
use Sylius\Bundle\CoreBundle\Form\EventSubscriber\ChannelFormSubscriber;
+use Sylius\Bundle\CoreBundle\Form\Type\ShopBillingDataType;
use Sylius\Bundle\CoreBundle\Form\Type\TaxCalculationStrategyChoiceType;
use Sylius\Bundle\CurrencyBundle\Form\Type\CurrencyChoiceType;
use Sylius\Bundle\LocaleBundle\Form\Type\LocaleChoiceType;
@@ -80,6 +81,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'label' => 'sylius.form.channel.account_verification_required',
'required' => false,
])
+ ->add('shopBillingData', ShopBillingDataType::class, [
+ 'label' => 'sylius.form.channel.shop_billing_data',
+ ])
->addEventSubscriber(new AddBaseCurrencySubscriber())
->addEventSubscriber(new ChannelFormSubscriber())
;
diff --git a/src/Sylius/Bundle/CoreBundle/Form/Type/ShopBillingDataType.php b/src/Sylius/Bundle/CoreBundle/Form/Type/ShopBillingDataType.php
new file mode 100644
index 00000000000..cb98bab3dec
--- /dev/null
+++ b/src/Sylius/Bundle/CoreBundle/Form/Type/ShopBillingDataType.php
@@ -0,0 +1,59 @@
+dataClass = $dataClass;
+ }
+
+ public function buildForm(FormBuilderInterface $builder, array $options): void
+ {
+ $builder
+ ->add('taxId', TextType::class, [
+ 'label' => 'sylius.form.channel.billing_data.tax_id',
+ 'required' => false,
+ ])
+ ->add('company', TextType::class, [
+ 'required' => false,
+ 'label' => 'sylius.form.channel.billing_data.company',
+ ])
+ ->add('countryCode', CountryCodeChoiceType::class, [
+ 'label' => 'sylius.form.channel.billing_data.country',
+ 'enabled' => true,
+ 'required' => false,
+ ])
+ ->add('street', TextType::class, [
+ 'label' => 'sylius.form.channel.billing_data.street',
+ 'required' => false,
+ ])
+ ->add('city', TextType::class, [
+ 'label' => 'sylius.form.channel.billing_data.city',
+ 'required' => false,
+ ])
+ ->add('postcode', TextType::class, [
+ 'label' => 'sylius.form.channel.billing_data.postcode',
+ 'required' => false,
+ ])
+ ;
+ }
+
+ public function configureOptions(OptionsResolver $resolver)
+ {
+ $resolver->setDefault('data_class', $this->dataClass);
+ }
+}
diff --git a/src/Sylius/Bundle/CoreBundle/Resources/config/doctrine/model/Channel.orm.xml b/src/Sylius/Bundle/CoreBundle/Resources/config/doctrine/model/Channel.orm.xml
index 56ccb710218..ac02d81001b 100644
--- a/src/Sylius/Bundle/CoreBundle/Resources/config/doctrine/model/Channel.orm.xml
+++ b/src/Sylius/Bundle/CoreBundle/Resources/config/doctrine/model/Channel.orm.xml
@@ -53,6 +53,12 @@
-
+
+
+
+
+
+
+
diff --git a/src/Sylius/Bundle/CoreBundle/Resources/config/doctrine/model/ShopBillingData.orm.xml b/src/Sylius/Bundle/CoreBundle/Resources/config/doctrine/model/ShopBillingData.orm.xml
new file mode 100644
index 00000000000..7eb88cc76df
--- /dev/null
+++ b/src/Sylius/Bundle/CoreBundle/Resources/config/doctrine/model/ShopBillingData.orm.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Sylius/Bundle/CoreBundle/Resources/config/services/form.xml b/src/Sylius/Bundle/CoreBundle/Resources/config/services/form.xml
index de59fb4e37b..4a5e4dc13c0 100644
--- a/src/Sylius/Bundle/CoreBundle/Resources/config/services/form.xml
+++ b/src/Sylius/Bundle/CoreBundle/Resources/config/services/form.xml
@@ -48,6 +48,7 @@
sylius
+
Sylius\Component\Core\Model\ShopBillingData
@@ -241,6 +242,11 @@
+
+ %sylius.model.shop_billing_data.class%
+
+
+
diff --git a/src/Sylius/Bundle/CoreBundle/Resources/translations/messages.en.yml b/src/Sylius/Bundle/CoreBundle/Resources/translations/messages.en.yml
index 7f87f59cb44..2c56f1e0f88 100644
--- a/src/Sylius/Bundle/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Sylius/Bundle/CoreBundle/Resources/translations/messages.en.yml
@@ -22,6 +22,13 @@ sylius:
name: Name
roles: Roles
channel:
+ billing_data:
+ city: City
+ company: Company
+ country: Country
+ postcode: Postcode
+ street: Street
+ tax_id: Tax ID
contact_email: Contact email
currencies: Currencies
currency_base: Base currency
@@ -31,6 +38,7 @@ sylius:
locales: Locales
payment_methods: Payment Methods
shipping_methods: Shipping Methods
+ shop_billing_data: Shop billing data
skipping_shipping_step_allowed: Skip shipping step if only one shipping method is available?
skipping_payment_step_allowed: Skip payment step if only one payment method is available?
tax_calculation_strategy: Tax calculation strategy
diff --git a/src/Sylius/Component/Core/Model/Channel.php b/src/Sylius/Component/Core/Model/Channel.php
index 441fb134685..a6624b51dd6 100644
--- a/src/Sylius/Component/Core/Model/Channel.php
+++ b/src/Sylius/Component/Core/Model/Channel.php
@@ -55,12 +55,16 @@ class Channel extends BaseChannel implements ChannelInterface
/** @var bool */
protected $accountVerificationRequired = true;
+ /** @var ShopBillingDataInterface|null */
+ protected $shopBillingData;
+
public function __construct()
{
parent::__construct();
$this->currencies = new ArrayCollection();
$this->locales = new ArrayCollection();
+ $this->shopBillingData = new ShopBillingData();
}
/**
@@ -278,4 +282,14 @@ public function setAccountVerificationRequired(bool $accountVerificationRequired
{
$this->accountVerificationRequired = $accountVerificationRequired;
}
+
+ public function getShopBillingData(): ShopBillingDataInterface
+ {
+ return $this->shopBillingData;
+ }
+
+ public function setShopBillingData(ShopBillingDataInterface $shopBillingData): void
+ {
+ $this->shopBillingData = $shopBillingData;
+ }
}
diff --git a/src/Sylius/Component/Core/Model/ChannelInterface.php b/src/Sylius/Component/Core/Model/ChannelInterface.php
index db2867c74db..439ae2a91cf 100644
--- a/src/Sylius/Component/Core/Model/ChannelInterface.php
+++ b/src/Sylius/Component/Core/Model/ChannelInterface.php
@@ -60,4 +60,8 @@ public function setSkippingPaymentStepAllowed(bool $skippingPaymentStepAllowed):
public function isAccountVerificationRequired(): bool;
public function setAccountVerificationRequired(bool $accountVerificationRequired): void;
+
+ public function getShopBillingData(): ShopBillingDataInterface;
+
+ public function setShopBillingData(ShopBillingDataInterface $shopBillingData): void;
}
diff --git a/src/Sylius/Component/Core/Model/ShopBillingData.php b/src/Sylius/Component/Core/Model/ShopBillingData.php
new file mode 100644
index 00000000000..064ed9be888
--- /dev/null
+++ b/src/Sylius/Component/Core/Model/ShopBillingData.php
@@ -0,0 +1,99 @@
+company;
+ }
+
+ public function setCompany(?string $company): void
+ {
+ $this->company = $company;
+ }
+
+ public function getTaxId(): ?string
+ {
+ return $this->taxId;
+ }
+
+ public function setTaxId(?string $taxId): void
+ {
+ $this->taxId = $taxId;
+ }
+
+ public function getCountryCode(): ?string
+ {
+ return $this->countryCode;
+ }
+
+ public function setCountryCode(?string $countryCode): void
+ {
+ $this->countryCode = $countryCode;
+ }
+
+ public function getStreet(): ?string
+ {
+ return $this->street;
+ }
+
+ public function setStreet(?string $street): void
+ {
+ $this->street = $street;
+ }
+
+ public function getCity(): ?string
+ {
+ return $this->city;
+ }
+
+ public function setCity(?string $city): void
+ {
+ $this->city = $city;
+ }
+
+ public function getPostcode(): ?string
+ {
+ return $this->postcode;
+ }
+
+ public function setPostcode(?string $postcode): void
+ {
+ $this->postcode = $postcode;
+ }
+}
diff --git a/src/Sylius/Component/Core/Model/ShopBillingDataInterface.php b/src/Sylius/Component/Core/Model/ShopBillingDataInterface.php
new file mode 100644
index 00000000000..42424f66d01
--- /dev/null
+++ b/src/Sylius/Component/Core/Model/ShopBillingDataInterface.php
@@ -0,0 +1,41 @@
+shouldImplement(ShopBillingDataInterface::class);
+ }
+
+ function its_company_is_mutable(): void
+ {
+ $this->setCompany('Ragnarok');
+ $this->getCompany()->shouldReturn('Ragnarok');
+ }
+
+ function its_tax_id_is_mutable(): void
+ {
+ $this->setTaxId('1100110011');
+ $this->getTaxId()->shouldReturn('1100110011');
+ }
+
+ function its_country_code_is_mutable(): void
+ {
+ $this->setCountryCode('US');
+ $this->getCountryCode()->shouldReturn('US');
+ }
+
+ function its_street_is_mutable(): void
+ {
+ $this->setStreet('Blue Street');
+ $this->getStreet()->shouldReturn('Blue Street');
+ }
+
+ function its_city_is_mutable(): void
+ {
+ $this->setCity('New York');
+ $this->getCity()->shouldReturn('New York');
+ }
+
+ function its_postcode_is_mutable(): void
+ {
+ $this->setPostcode('94111');
+ $this->getPostcode()->shouldReturn('94111');
+ }
+}
diff --git a/tests/Responses/Expected/channel/create_validation_fail_response.json b/tests/Responses/Expected/channel/create_validation_fail_response.json
index f135f8e205a..837984a1a9d 100644
--- a/tests/Responses/Expected/channel/create_validation_fail_response.json
+++ b/tests/Responses/Expected/channel/create_validation_fail_response.json
@@ -34,6 +34,16 @@
"skippingShippingStepAllowed": {},
"skippingPaymentStepAllowed": {},
"accountVerificationRequired": {},
+ "shopBillingData": {
+ "children": {
+ "taxId": {},
+ "company": {},
+ "countryCode": {},
+ "street": {},
+ "city": {},
+ "postcode": {}
+ }
+ },
"code": {
"errors": [
"Please enter channel code."
diff --git a/tests/Responses/Expected/channel/update_validation_fail_response.json b/tests/Responses/Expected/channel/update_validation_fail_response.json
index a945736d1ad..6a80359e715 100644
--- a/tests/Responses/Expected/channel/update_validation_fail_response.json
+++ b/tests/Responses/Expected/channel/update_validation_fail_response.json
@@ -26,6 +26,16 @@
"skippingShippingStepAllowed": {},
"skippingPaymentStepAllowed": {},
"accountVerificationRequired": {},
+ "shopBillingData": {
+ "children": {
+ "taxId": {},
+ "company": {},
+ "countryCode": {},
+ "street": {},
+ "city": {},
+ "postcode": {}
+ }
+ },
"code": {},
"baseCurrency": {}
}