diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..3abb1fb --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @webgriffe/wg-devs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d20e138..1ef5c64 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: - 'dependabot/**' pull_request: ~ release: - types: [created] + types: [ created ] schedule: - cron: "0 1 * * 6" # Run at 1am every Saturday @@ -21,11 +21,11 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.4"] - symfony: ["^7.3"] - sylius: ["~2.2.0"] - node: ["22.x"] - mysql: ["8.4"] + php: [ "8.3", "8.4" ] + symfony: [ "^7.4" ] + sylius: [ "~2.2.1" ] + node: [ "22.x" ] + mysql: [ "8.4" ] env: APP_ENV: test @@ -42,7 +42,7 @@ jobs: with: php-version: "${{ matrix.php }}" extensions: intl - tools: flex,symfony + tools: flex, symfony coverage: none - @@ -66,10 +66,6 @@ jobs: name: Output PHP version for Symfony CLI run: php -v | head -n 1 | awk '{ print $2 }' > .php-version - - - name: Validate composer.json - run: composer validate --ansi --strict - - name: Get Composer cache directory id: composer-cache @@ -102,11 +98,7 @@ jobs: run: composer install --no-interaction - - name: Validate container - run: vendor/bin/console lint:container - - - - name: Run ECS + name: RUN EasyCodingStandard run: vendor/bin/ecs check - @@ -117,10 +109,6 @@ jobs: name: Run Psalm run: vendor/bin/psalm - - - name: Run PHPSpec - run: vendor/bin/phpspec run --ansi -f progress --no-interaction - - name: Run unit tests run: vendor/bin/phpunit --colors=always --testsuite=unit @@ -149,10 +137,6 @@ jobs: (vendor/bin/console doctrine:database:create -vvv) (vendor/bin/console doctrine:schema:create -vvv) - - - name: Validate database schema - run: vendor/bin/console doctrine:schema:validate - - name: Prepare test application assets run: | @@ -168,24 +152,32 @@ jobs: run: vendor/bin/console sylius:fixtures:load -n - - name: Run Non-unit PHPUnit tests - run: vendor/bin/phpunit --colors=always --testsuite=non-unit + name: Validate composer.json + run: composer validate --ansi --strict - - name: Install certificates - run: symfony server:ca:install || true + name: Validate container + run: vendor/bin/console lint:container + + - + name: Run Non-unit PHPUnit tests + run: vendor/bin/phpunit --colors=always --testsuite=non-unit - name: Run Chrome Headless run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & + - + name: Install certificates + run: symfony server:ca:install || true + - name: Run webserver run: symfony server:start --port=8080 --daemon - name: Run Behat - run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun + run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun - name: Upload Behat logs diff --git a/README.md b/README.md index 6486e95..887b7dc 100644 --- a/README.md +++ b/README.md @@ -11,20 +11,6 @@ ## Installation -0. This plugin requires the [MyOnlineStore/ViesBundle](https://github.com/MyOnlineStore/ViesBundle) but this is not actually compatible with Symfony 7, there is an open PR: https://github.com/MyOnlineStore/ViesBundle/pull/18 - - Thus, you have to run the following command to require a fork of the bundle which is compatible with Symfony 7: - - ```bash - composer config repositories.sandwich/vies-bundle git https://github.com/mmenozzi/ViesBundle.git - ``` - - and you have to run this command too to allow "dev" versions of the bundle (we need the "dev-patch-1" version): - - ```bash - composer config minimum-stability dev - ``` - 1. Require the plugin: ```bash @@ -41,22 +27,22 @@ 3. Add the plugin's configs by creating the `config/packages/webgriffe_sylius_italian_invoiceable_order_plugin.yaml` file with the following content: ```yaml imports: - - { resource: "@WebgriffeSyliusItalianInvoiceableOrderPlugin/config/config.yaml" } + - { resource: "@WebgriffeSyliusItalianInvoiceableOrderPlugin/config/config.php" } ``` -3. By default, the parameter `app.taxation.eu_zone_code` is set to "EU", as it must be the code of a zone representing the EU. This is used to determine if an order is invoiced to a company within the EU or not. Please change this parameter according to your Sylius's zone configuration if needed: +4. By default, the parameter `webgriffe_sylius_italian_invoiceable_order.taxation.eu_zone_code` is set to "EU", as it must be the code of a zone representing the EU. This is used to determine if an order is invoiced to a company within the EU or not. Please change this parameter according to your Sylius's zone configuration if needed: ```yaml # config/services.yaml parameters: - app.taxation.eu_zone_code: 'EU' # Change it if needed + webgriffe_sylius_italian_invoiceable_order.taxation.eu_zone_code: 'EU' # Change it if needed ``` -4. Your `Address` entity must implement the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressInterface` and the `Symfony\Component\Validator\GroupSequenceProviderInterface`. You can use the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressTrait` as implementation for both interfaces. +5. Your `Address` entity must implement the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressInterface` and the `Symfony\Component\Validator\GroupSequenceProviderInterface`. You can use the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressTrait` as implementation for both interfaces. -5. Your `Order` entity must implement the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderInterface`. You can use the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderTrait` as default implementation for the interface. +6. Your `Order` entity must implement the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderInterface`. You can use the `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderTrait` as default implementation for the interface. -6. You need to import the `Address` and `Order` validator configuration into your project by copying the configuration files provided by this plugin: +7. You need to import the `Address` and `Order` validator configuration into your project by copying the configuration files provided by this plugin: ```bash mkdir -p config/validator/ @@ -77,12 +63,21 @@ ```bash sed -i '' 's/Tests\\Webgriffe\\SyliusItalianInvoiceableOrderPlugin/App/g' config/validator/Address.xml config/validator/Order.xml ``` + + If you already have some validator file for these entities you have to merge the configuration manually. + + *NB* Please, note that currently these validation rules are applied in strict mode. This means that if the VIES + service is not available for some reason, the validation of the VAT number will fail. This could occur frequently on + specific countries like Germany or France due + to this problem: https://viesapi.eu/vies-problems-with-verifying-companies-from-germany-de/. + If you want to avoid this strict behavior you can change the `strict` option of the + `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Validator\Constraints\EuropeanVatNumber` constraint to `false` in the + validation configuration file. This way, if the VIES service is not available, the VAT number will be considered + valid and the checkout will not be blocked. - If you alread have some validator file for these entities you have to merge the configuration manually. - -7. Configure Sylius to use the `Italian tax calculation` tax calculation strategy. +8. Configure Sylius to use the `Italian tax calculation` tax calculation strategy. -8. To properly enable group sequence validation of your Address entity you must set the `Default` validation group instead of the `sylius` validation group: +9. To properly enable group sequence validation of your Address entity you must set the `Default` validation group instead of the `sylius` validation group: ```yaml # config/parameters.yaml @@ -93,28 +88,27 @@ For more information see [here](https://symfony.com/doc/current/validation/sequence_provider.html). -9. Run migration +10. Run migration ```bash - bin/console cache:clear bin/console doctrine:migrations:migrate ``` -10. Add invoiceable fields to the address show template for admin. To do so you have to override this template: +11. Add invoiceable fields to the address show template for admin. To do so you have to override this template: ```bash vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/templates/shared/helper/address.html.twig ``` - + by copying directly our implementation provided in the plugin: ```bash mkdir -p templates/bundles/SyliusAdminBundle/shared/helper/ cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig ``` - + or by copying the original template and adding the invoiceable fields by yourself. In this case your template should look like the following: - + ```twig {% macro address(address) %}
diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..961f1fe --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,11 @@ +# Upgrade plugin guide + +## Upgrade from version 1.x to 2.x + +- The service `app.taxation.italian_tax_calculation_strategy` has been renamed to `webgriffe_sylius_italian_invoiceable_order.strategy.taxation.tax_calculation.italian_tax_calculation_strategy`. +- The class `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianTaxCalculationStrategy` has been moved to `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Taxation\ItalianTaxCalculationStrategy`. +- The package `sandwich/vies-bundle` has been removed. +- The constraint `Symfony\Component\Validator\Constraints\Sandwich\ViesBundle\Validator\Constraint\VatNumber` has been replaced with `Webgriffe\SyliusItalianInvoiceableOrderPlugin\Validator\Constraints\EuropeanVatNumber`. Please update your validation rules accordingly with search and replace. + Please, note also that now is available a new strict option that allows you to block the checkout step if the VIES service is not available. You can enable it by setting the `strict` option to `true` in your validation rules. +- The file `@WebgriffeSyliusItalianInvoiceableOrderPlugin/config/config.yaml` has been renamed to `@WebgriffeSyliusItalianInvoiceableOrderPlugin/config/config.php`. +- The parameter `app.taxation.eu_zone_code` has been renamed to `webgriffe_sylius_italian_invoiceable_order.taxation.eu_zone_code`. diff --git a/composer.json b/composer.json index f6a668b..9682583 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,6 @@ "require": { "php": "^8.2", "dragonbe/vies": "^2.3.2", - "sandwich/vies-bundle": "dev-patch-1", "sylius/sylius": "^2.2", "webmozart/assert": "^1.9" }, @@ -30,7 +29,7 @@ "friends-of-behat/suite-settings-extension": "^1.1", "friends-of-behat/symfony-extension": "^2.6", "friends-of-behat/variadic-extension": "^1.6", - "phpspec/phpspec": "^8.0", + "payum/payum-bundle": "2.6.*", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.12", "phpstan/phpstan-doctrine": "^1.3", @@ -44,13 +43,13 @@ "sylius-labs/suite-tags-extension": "~0.2", "sylius/sylius-rector": "^2.0", "sylius/test-application": "^2.0.0@alpha", - "symfony/browser-kit": "^6.4 || ^7.1", - "symfony/debug-bundle": "^6.4 || ^7.1", - "symfony/dotenv": "^6.4 || ^7.1", - "symfony/http-client": "^6.4 || ^7.1", - "symfony/intl": "^6.4 || ^7.1", - "symfony/runtime": "^6.4 || ^7.1", - "symfony/web-profiler-bundle": "^6.4 || ^7.1", + "symfony/browser-kit": "^6.4 || ^7.4", + "symfony/debug-bundle": "^6.4 || ^7.4", + "symfony/dotenv": "^6.4 || ^7.4", + "symfony/http-client": "^6.4 || ^7.4", + "symfony/intl": "^6.4 || ^7.4", + "symfony/runtime": "^6.4 || ^7.4", + "symfony/web-profiler-bundle": "^6.4 || ^7.4", "symfony/webpack-encore-bundle": "^2.2", "vimeo/psalm": "^6.13" }, @@ -82,12 +81,6 @@ } } }, - "repositories": { - "sandwich/vies-bundle": { - "type": "git", - "url": "https://github.com/mmenozzi/ViesBundle.git" - } - }, "autoload": { "psr-4": { "Webgriffe\\SyliusItalianInvoiceableOrderPlugin\\": "src/" @@ -116,13 +109,11 @@ "ecs": "ecs check src/ tests/Behat/", "phpstan": "phpstan analyse -c phpstan.neon -l max src/", "phpunit": "phpunit", - "phpspec": "phpspec run", "behat": "behat --strict -vvv --no-interaction || behat --strict -vvv --no-interaction --rerun", "suite": [ "@ecs", "@phpstan", "@phpunit", - "@phpspec", "@behat" ], "auto-scripts": { diff --git a/config/config.php b/config/config.php new file mode 100644 index 0000000..599190b --- /dev/null +++ b/config/config.php @@ -0,0 +1,13 @@ +parameters(); + $parameters->set('sylius.form.type.address.validation_groups', [ 'Default' ]); + $parameters->set('webgriffe_sylius_italian_invoiceable_order.taxation.eu_zone_code', 'EU'); + + $containerConfigurator->import('packages/*.php'); +}; diff --git a/config/config.yaml b/config/config.yaml deleted file mode 100644 index d2a2a46..0000000 --- a/config/config.yaml +++ /dev/null @@ -1,5 +0,0 @@ -imports: - - { resource: 'twig_hooks/**/*.yaml' } - -parameters: - sylius.form.type.address.validation_groups: [ 'Default' ] diff --git a/config/packages/sylius_admin_twig_hooks.php b/config/packages/sylius_admin_twig_hooks.php new file mode 100644 index 0000000..fbf10cc --- /dev/null +++ b/config/packages/sylius_admin_twig_hooks.php @@ -0,0 +1,32 @@ +extension('sylius_twig_hooks', [ + 'hooks' => [ + 'sylius_admin.order.update.content.form.billing_address' => [ + 'billingRecipientType' => [ + 'template' => '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/billingRecipientType.html.twig', + 'priority' => 1000, + ], + 'invoiceableBillingData' => [ + 'template' => '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/invoiceableBillingData.html.twig', + 'priority' => 650, + ], + ], + 'sylius_admin.order.update.content.form.shipping_address' => [ + 'billingRecipientType' => [ + 'template' => '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/billingRecipientType.html.twig', + 'priority' => 1000, + ], + 'invoiceableBillingData' => [ + 'template' => '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/invoiceableBillingData.html.twig', + 'priority' => 650, + ], + ], + ], + ]); +}; diff --git a/config/packages/sylius_shop_twig_hooks.php b/config/packages/sylius_shop_twig_hooks.php new file mode 100644 index 0000000..dff8eda --- /dev/null +++ b/config/packages/sylius_shop_twig_hooks.php @@ -0,0 +1,34 @@ +extension('sylius_twig_hooks', [ + 'hooks' => [ + 'sylius_shop.shared.address' => [ + 'company' => [ + 'enabled' => false, + ], + 'name' => [ + 'enabled' => false, + ], + 'billingAddressInfo' => [ + 'template' => '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shop/shared/address/billingAddressInfo.html.twig', + 'priority' => 1000, + ], + ], + 'sylius_shop.shared.form.address' => [ + 'billingRecipientType' => [ + 'template' => '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shop/shared/form/address/billingRecipientType.html.twig', + 'priority' => 1000, + ], + 'invoiceableBillingData' => [ + 'template' => '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shop/shared/form/address/invoiceableBillingData.html.twig', + 'priority' => 650, + ], + ], + ], + ]); +}; diff --git a/config/services.php b/config/services.php new file mode 100644 index 0000000..8cc3ee1 --- /dev/null +++ b/config/services.php @@ -0,0 +1,9 @@ +import('services/*.php'); +}; diff --git a/config/services.yaml b/config/services.yaml deleted file mode 100644 index 94946d5..0000000 --- a/config/services.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "services/**/*.yaml" } diff --git a/config/services/comparator.php b/config/services/comparator.php new file mode 100644 index 0000000..d4207d3 --- /dev/null +++ b/config/services/comparator.php @@ -0,0 +1,18 @@ +services(); + + $services->set('webgriffe_sylius_italian_invoiceable_order.address_comparator', ItalianInvoiceableAddressComparatorDecorator::class) + ->decorate('sylius.comparator.address') + ->args([ + service('.inner'), + ]) + ; +}; diff --git a/config/services/form.php b/config/services/form.php new file mode 100644 index 0000000..12180d6 --- /dev/null +++ b/config/services/form.php @@ -0,0 +1,18 @@ +services(); + + $services->set('webgriffe_sylius_italian_invoiceable_order.form.extension.italian_invoiceable_address', ItalianInvoiceableAddressTypeExtension::class) + ->tag('form.type_extension', [ + 'extended_type' => AddressType::class, + ]) + ; +}; diff --git a/config/services/modifier.php b/config/services/modifier.php new file mode 100644 index 0000000..5464f30 --- /dev/null +++ b/config/services/modifier.php @@ -0,0 +1,15 @@ +services(); + + $services->set('webgriffe_sylius_italian_invoiceable_order.modifier.address_form_values', AddressFormValuesModifier::class) + ->tag('sylius_shop.modifier.address_form_values') + ; +}; diff --git a/config/services/services.yaml b/config/services/services.yaml deleted file mode 100644 index 7ea3265..0000000 --- a/config/services/services.yaml +++ /dev/null @@ -1,31 +0,0 @@ -parameters: - app.taxation.eu_zone_code: 'EU' - -services: - webgriffe_sylius_italian_invoiceable_order.form.extension.italian_invoiceable_address: - class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Form\Extension\ItalianInvoiceableAddressTypeExtension - tags: - - { name: form.type_extension, extended_type: Sylius\Bundle\AddressingBundle\Form\Type\AddressType } - - webgriffe_sylius_italian_invoiceable_order.address_comparator: - class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Comparator\ItalianInvoiceableAddressComparatorDecorator - decorates: sylius.comparator.address - arguments: - - '@webgriffe_sylius_italian_invoiceable_order.address_comparator.inner' - - app.taxation.italian_tax_calculation_strategy: - class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianTaxCalculationStrategy - arguments: - - 'italian_tax_calculation_strategy' - - [ - '@sylius.applicator.taxation.order_item_units', - '@sylius.applicator.taxation.order_shipment' - ] - - '%app.taxation.eu_zone_code%' - tags: - - { name: sylius.taxation.calculation_strategy, type: italian_tax_calculation_strategy, label: 'Italian tax calculation' } - - webgriffe_sylius_italian_invoiceable_order.modifier.address_form_values: - class: Webgriffe\SyliusItalianInvoiceableOrderPlugin\Modifier\AddressFormValuesModifier - tags: - - { name: sylius_shop.modifier.address_form_values } diff --git a/config/services/taxation.php b/config/services/taxation.php new file mode 100644 index 0000000..7d0ccbf --- /dev/null +++ b/config/services/taxation.php @@ -0,0 +1,23 @@ +services(); + + $services->set('webgriffe_sylius_italian_invoiceable_order.strategy.taxation.tax_calculation.italian_tax_calculation_strategy', ItalianTaxCalculationStrategy::class) + ->args([ + 'italian_tax_calculation_strategy', + tagged_iterator('sylius.taxation.item_units.applicator'), + param('webgriffe_sylius_italian_invoiceable_order.taxation.eu_zone_code'), + ]) + ->tag('sylius.taxation.calculation_strategy', [ + 'type' => 'italian_tax_calculation_strategy', + 'label' => 'Italian tax calculation', + ]) + ; +}; diff --git a/config/services/validator.php b/config/services/validator.php new file mode 100644 index 0000000..09422ba --- /dev/null +++ b/config/services/validator.php @@ -0,0 +1,21 @@ +services(); + + $services->set('webgriffe_sylius_italian_invoiceable_order.validator.european_vat_number', EuropeanVatNumberValidator::class) + ->args([ + service('webgriffe_sylius_italian_invoiceable_order.vies'), + service('logger'), + ]) + ->tag('validator.constraint_validator', [ + 'alias' => 'webgriffe_sylius_italian_invoiceable_order.european_vat_number_validator', + ]) + ; +}; diff --git a/config/services/vies.php b/config/services/vies.php new file mode 100644 index 0000000..2c12afc --- /dev/null +++ b/config/services/vies.php @@ -0,0 +1,13 @@ +services(); + + $services->set('webgriffe_sylius_italian_invoiceable_order.vies', Vies::class); +}; diff --git a/config/twig_hooks/.gitignore b/config/twig_hooks/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/config/twig_hooks/admin/order/update.yaml b/config/twig_hooks/admin/order/update.yaml deleted file mode 100644 index eef9861..0000000 --- a/config/twig_hooks/admin/order/update.yaml +++ /dev/null @@ -1,16 +0,0 @@ -sylius_twig_hooks: - hooks: - 'sylius_admin.order.update.content.form.billing_address': - billingRecipientType: - template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/billingRecipientType.html.twig' - priority: 1000 - invoiceableBillingData: - template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/invoiceableBillingData.html.twig' - priority: 650 - 'sylius_admin.order.update.content.form.shipping_address': - billingRecipientType: - template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/billingRecipientType.html.twig' - priority: 1000 - invoiceableBillingData: - template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/admin/shared/form/address/invoiceableBillingData.html.twig' - priority: 650 diff --git a/config/twig_hooks/shop/address.yaml b/config/twig_hooks/shop/address.yaml deleted file mode 100644 index 27ff383..0000000 --- a/config/twig_hooks/shop/address.yaml +++ /dev/null @@ -1,10 +0,0 @@ -sylius_twig_hooks: - hooks: - 'sylius_shop.shared.address': - company: - enabled: false - name: - enabled: false - billingAddressInfo: - template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shop/shared/address/billingAddressInfo.html.twig' - priority: 1000 diff --git a/config/twig_hooks/shop/form/address.yaml b/config/twig_hooks/shop/form/address.yaml deleted file mode 100644 index 3b45e65..0000000 --- a/config/twig_hooks/shop/form/address.yaml +++ /dev/null @@ -1,9 +0,0 @@ -sylius_twig_hooks: - hooks: - 'sylius_shop.shared.form.address': - billingRecipientType: - template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shop/shared/form/address/billingRecipientType.html.twig' - priority: 1000 - invoiceableBillingData: - template: '@WebgriffeSyliusItalianInvoiceableOrderPlugin/shop/shared/form/address/invoiceableBillingData.html.twig' - priority: 650 diff --git a/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature b/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature index 67d6c9b..fa03e34 100644 --- a/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature +++ b/features/checkout/invoiceable_address_book/having_new_invoiceable_address_saved_in_address_book.feature @@ -1,40 +1,40 @@ @invoiceable_address_book Feature: Having new invoiceable addresses saved in the address book after checkout - In order to ease my address management - As a Customer - I want new invoiceable addresses provided during checkout to be saved in my address book + In order to ease my address management + As a Customer + I want new invoiceable addresses provided during checkout to be saved in my address book - Background: - Given the store operates on a single channel in "Italy" - And the store has a product "Lannister Coat" priced at "$19.99" - And the store ships everywhere for free - And the store allows paying with "Cash on Delivery" - And I am a logged in customer - And I added product "Lannister Coat" to the cart + Background: + Given the store operates on a single channel in "Italy" + And the store has a product "Lannister Coat" priced at "$19.99" + And the store ships everywhere for free + And the store allows paying with "Cash on Delivery" + And I am a logged in customer + And I added product "Lannister Coat" to the cart - @ui - Scenario: Invoiceable address already existent in my book don't get saved again - Given I have an address for the company "GoT SpA" - "Jon Snow" - "Viale Italia", "42100", "Reggio Emilia" - "Italy" - And this address has also all the invoiceable information valid for an italian company - And I am at the checkout addressing step - When I specify the billing address for the company "GoT SpA" - "Jon Snow" - "Viale Italia", "42100", "Reggio Emilia" - "Italy" - And I specify the same invoiceable information of the address I have in my address book - And I complete the addressing step - And I proceed with "Free" shipping method and "Cash on Delivery" payment - And I confirm my order - And I should see the thank you page - Then I should have a single address in my address book + @ui + Scenario: Invoiceable address already existent in my book don't get saved again + Given I have an address for the company "GoT SpA" - "Jon Snow" - "Viale Italia", "42100", "Reggio Emilia" - "Italy" + And this address has also all the invoiceable information valid for an italian company + And I am at the checkout addressing step + When I specify the billing address for the company "GoT SpA" - "Jon Snow" - "Viale Italia", "42100", "Reggio Emilia" - "Italy" + And I specify the same invoiceable information of the address I have in my address book + And I complete the addressing step + And I proceed with "Free" shipping method and "Cash on Delivery" payment + And I confirm my order + And I should see the thank you page + Then I should have a single address in my address book - @ui - Scenario: Different invoiceable address information provided during checkout are saved in my book as new address - Given I have an address for the company "GoT SpA" - "Jon Snow" - "Viale Italia", "42100", "Reggio Emilia" - "Italy" - And this address has also all the invoiceable information valid for an italian company - And I am at the checkout addressing step - When I specify the billing address for the company "GoT SpA" - "Jon Snow" - "Viale Italia", "42100", "Reggio Emilia" - "Italy" - And I specify the same invoiceable information of the address I have in my address book - But I specify a different SDI code from that of the address I have in the address book - And I complete the addressing step - And I proceed with "Free" shipping method and "Cash on Delivery" payment - And I confirm my order - And I should see the thank you page - Then I should have 2 addresses in my address book + @ui + Scenario: Different invoiceable address information provided during checkout are saved in my book as new address + Given I have an address for the company "GoT SpA" - "Jon Snow" - "Viale Italia", "42100", "Reggio Emilia" - "Italy" + And this address has also all the invoiceable information valid for an italian company + And I am at the checkout addressing step + When I specify the billing address for the company "GoT SpA" - "Jon Snow" - "Viale Italia", "42100", "Reggio Emilia" - "Italy" + And I specify the same invoiceable information of the address I have in my address book + But I specify a different SDI code from that of the address I have in the address book + And I complete the addressing step + And I proceed with "Free" shipping method and "Cash on Delivery" payment + And I confirm my order + And I should see the thank you page + Then I should have 2 addresses in my address book diff --git a/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature b/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature index 6ba0a52..814721f 100644 --- a/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature +++ b/features/checkout/tax_calculation/applying_correct_taxes_based_on_customer.feature @@ -1,89 +1,89 @@ @applying_taxes Feature: Apply correct taxes based on order address - In order to pay proper amount when buying goods - As a Customer or Visitor - I want to have correct taxes applied to my order + In order to pay proper amount when buying goods + As a Customer or Visitor + I want to have correct taxes applied to my order - Background: - Given the store operates on a single channel worldwide - And the store uses the "Italian tax calculation strategy" tax calculation strategy - And there is a tax zone "EU" containing all European Union countries - And there is a tax zone "Extra EU" containing all countries outside the European Union - And there is a shipping zone "Global" containing all countries of the world - And the store ships everywhere for Free - And the store allows paying Offline - And the store has "IVA 22%" tax rate of 22% for "IVA Ordinaria" within the "EU" zone - And the store has a product "PHP T-Shirt" priced at "$100.00" - And it belongs to "IVA Ordinaria" tax category + Background: + Given the store operates on a single channel worldwide + And the store uses the "Italian tax calculation strategy" tax calculation strategy + And there is a tax zone "EU" containing all European Union countries + And there is a tax zone "Extra EU" containing all countries outside the European Union + And there is a shipping zone "Global" containing all countries of the world + And the store ships everywhere for Free + And the store allows paying Offline + And the store has "IVA 22%" tax rate of 22% for "IVA Ordinaria" within the "EU" zone + And the store has a product "PHP T-Shirt" priced at "$100.00" + And it belongs to "IVA Ordinaria" tax category - @ui - Scenario: Paying taxes while ordering as an italian individual - Given I added product "PHP T-Shirt" to the cart - And I am at the checkout addressing step - And I specify the email as "italian-individual@email.com" - And I specify a valid italian individual billing address - And I complete the addressing step - And I proceed with "Free" shipping method and "Offline" payment - Then I should be on the checkout complete step - And my order total should be "$122.00" - And my tax total should be "$22.00" + @ui + Scenario: Paying taxes while ordering as an italian individual + Given I added product "PHP T-Shirt" to the cart + And I am at the checkout addressing step + And I specify the email as "italian-individual@email.com" + And I specify a valid italian individual billing address + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$122.00" + And my tax total should be "$22.00" - @ui - Scenario: Paying taxes while ordering as an italian company - Given I added product "PHP T-Shirt" to the cart - And I am at the checkout addressing step - And I specify the email as "italian-company@email.com" - And I specify a valid italian company billing address - And I complete the addressing step - And I proceed with "Free" shipping method and "Offline" payment - Then I should be on the checkout complete step - And my order total should be "$122.00" - And my tax total should be "$22.00" + @ui + Scenario: Paying taxes while ordering as an italian company + Given I added product "PHP T-Shirt" to the cart + And I am at the checkout addressing step + And I specify the email as "italian-company@email.com" + And I specify a valid italian company billing address + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$122.00" + And my tax total should be "$22.00" - @ui - Scenario: Paying taxes while ordering as an EU individual - Given I added product "PHP T-Shirt" to the cart - And I am at the checkout addressing step - And I specify the email as "german-individual@email.com" - And I specify a valid german individual billing address - And I complete the addressing step - And I proceed with "Free" shipping method and "Offline" payment - Then I should be on the checkout complete step - And my order total should be "$122.00" - And my tax total should be "$22.00" + @ui + Scenario: Paying taxes while ordering as an EU individual + Given I added product "PHP T-Shirt" to the cart + And I am at the checkout addressing step + And I specify the email as "german-individual@email.com" + And I specify a valid german individual billing address + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$122.00" + And my tax total should be "$22.00" - @ui - Scenario: Not paying taxes while ordering as an EU company - Given I added product "PHP T-Shirt" to the cart - And I am at the checkout addressing step - And I specify the email as "german-company@email.com" - And I specify a valid german company billing address - And I complete the addressing step - And I proceed with "Free" shipping method and "Offline" payment - Then I should be on the checkout complete step - And my order total should be "$100.00" - And my tax total should be "$0.00" + @ui + Scenario: Not paying taxes while ordering as an EU company + Given I added product "PHP T-Shirt" to the cart + And I am at the checkout addressing step + And I specify the email as "german-company@email.com" + And I specify a valid german company billing address + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$100.00" + And my tax total should be "$0.00" - @ui - Scenario: Not paying taxes while ordering as an extra EU individual - Given I added product "PHP T-Shirt" to the cart - And I am at the checkout addressing step - And I specify the email as "usa-individual@email.com" - And I specify a valid US individual billing address - And I complete the addressing step - And I proceed with "Free" shipping method and "Offline" payment - Then I should be on the checkout complete step - And my order total should be "$100.00" - And my tax total should be "$0.00" + @ui + Scenario: Not paying taxes while ordering as an extra EU individual + Given I added product "PHP T-Shirt" to the cart + And I am at the checkout addressing step + And I specify the email as "usa-individual@email.com" + And I specify a valid US individual billing address + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$100.00" + And my tax total should be "$0.00" - @ui - Scenario: Not paying taxes while ordering as an extra EU company - Given I added product "PHP T-Shirt" to the cart - And I am at the checkout addressing step - And I specify the email as "usa-company@email.com" - And I specify a valid US company billing address - And I complete the addressing step - And I proceed with "Free" shipping method and "Offline" payment - Then I should be on the checkout complete step - And my order total should be "$100.00" - And my tax total should be "$0.00" + @ui + Scenario: Not paying taxes while ordering as an extra EU company + Given I added product "PHP T-Shirt" to the cart + And I am at the checkout addressing step + And I specify the email as "usa-company@email.com" + And I specify a valid US company billing address + And I complete the addressing step + And I proceed with "Free" shipping method and "Offline" payment + Then I should be on the checkout complete step + And my order total should be "$100.00" + And my tax total should be "$0.00" diff --git a/psalm.xml b/psalm.xml index 5611b5f..fe41ae9 100644 --- a/psalm.xml +++ b/psalm.xml @@ -5,7 +5,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" - phpVersion="8.4" >