Download the PHP package webgriffe/sylius-italian-invoiceable-order-plugin without Composer
On this page you can find all versions of the php package webgriffe/sylius-italian-invoiceable-order-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webgriffe/sylius-italian-invoiceable-order-plugin
More information about webgriffe/sylius-italian-invoiceable-order-plugin
Files in webgriffe/sylius-italian-invoiceable-order-plugin
Package sylius-italian-invoiceable-order-plugin
Short Description Sylius plugin which allows Italian merchants to collect invoice data for their orders.
License MIT
Informations about the package sylius-italian-invoiceable-order-plugin
Italian Invoiceable Order Plugin
Sylius plugin which allows Italian merchants to collect invoice data for their orders such as tax code, VAT number, SDI code, etc... as well as allowing the merchant to only apply taxes to those customers that can (and must) pay taxes in advance.
Installation
-
Require the plugin:
-
If they have not been added automatically, you have to add these bundles to
config/bundles.phpfile: -
Add the plugin's configs by creating the
config/packages/webgriffe_sylius_italian_invoiceable_order_plugin.yamlfile with the following content: -
By default, the parameter
webgriffe_sylius_italian_invoiceable_order.taxation.eu_zone_codeis 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: -
Your
Addressentity must implement theWebgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressInterfaceand theSymfony\Component\Validator\GroupSequenceProviderInterface. You can use theWebgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableAddressTraitas implementation for both interfaces. -
Your
Orderentity must implement theWebgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderInterface. You can use theWebgriffe\SyliusItalianInvoiceableOrderPlugin\Model\ItalianInvoiceableOrderTraitas default implementation for the interface. -
You need to import the
AddressandOrdervalidator configuration into your project by copying the configuration files provided by this plugin:WAIT! We are not done with this step yet. You must edit these files to change the namespace
Tests\Webgriffe\SyliusItalianInvoiceableOrderPluginto your own project namespace: there are 3 references that you have to change among these files.If you have the "App" as the base namespace of your app, this command should be enough:
Linux:
MacOS:
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
strictoption of theWebgriffe\SyliusItalianInvoiceableOrderPlugin\Validator\Constraints\EuropeanVatNumberconstraint tofalsein 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. -
Configure Sylius to use the
Italian tax calculationtax calculation strategy. -
To properly enable group sequence validation of your Address entity you must set the
Defaultvalidation group instead of thesyliusvalidation group:For more information see here.
-
Run migration
-
Add invoiceable fields to the address show template for admin. To do so you have to override this template:
by copying directly our implementation provided in the plugin:
or by copying the original template and adding the invoiceable fields by yourself. In this case your template should look like the following:
Features
Once installed this plugin will allow the users of the shop to enter all the invoicing information needed by an Italian company to properly invoice the order. In addition, this plugin checks the billing data of the order and uses them to decide whether the customer has to pay taxes or not.
This plugin will add the following fields to your address form:
- Billing recipient type, which allows the user to specify if the billing address is for a company or for an individual. This field will be required for every address used as the billing address for an order.
- Tax code, which in Italy is known as "Codice Fiscale". It's, more or less, like the social security number (SSN) in the US but in Italy both companies and individuals have a tax code. This field will be required for Italian individuals and companies and validated according the proper checksum algorithm.
- VAT Number, which in Italy is known as "Partita IVA". It's another identification number but for companies only not only in Italy but also in the EU. This field will be required for Italian companies and validated according the proper checksum algorithm. This field will be also required for EU companies and validated using the EU's VIES service using the MyOnlineStore/ViesBundle.
- SDI Code, where SDI stands for "Sistema Di Interscambio". It's a code that is needed to be able to properly generate an "electronic invoice" which is mandatory in Italy since January the 1st of 2019. This field will be required for Italian companies and validated according the proper rules of the Italian IRS (called "Agenzia delle Entrate" in Italy).
- PEC address, where PEC stands for "Posta Elettronica Certificata" (the Italian translation of "certified email"). It's like an email address but for a special email type meant to provide a legal equivalent of the traditional mail. See here for more information. This field will not be required even for Italian companies, but if entered it must be a valid email address.
This plugin will also require the Sylius's company field to be populated if the billing recipient type is set to company.
This plugin also replaces the Sylius's Sylius\Component\Addressing\Comparator\AddressComparatorInterface implementation by decorating it and by comparing also invoiceable fields. So different invoiceable address information provided during checkout are saved in the customer address book as new addresses.
This plugin also allows to select an invoiceable address from the address book in the checkout and properly fill the address form with all the invoicing information.
Contributing
To contribute you need to:
-
Clone this repository into you development environment and go to the plugin's root directory,
-
Then, from the plugin's root directory, run the following commands:
-
Copy
tests/TestApplication/.envintests/TestApplication/.env.localand set configuration specific for your development environment. -
Link node_modules:
-
Run docker (create a
compose.override.ymlif you need to customize services): -
Then, from the plugin's root directory, run the following commands:
-
Run your local server:
- Now at http://localhost:8080/ you have a full Sylius testing application which runs the plugin
Static checks
-
Coding Standard
-
Psalm
- PHPStan
Testing
After your changes you must ensure that the tests are still passing.
First setup your test database:
And build assets:
The current CI suite runs the following tests:
-
PHPUnit
-
PHPSpec
-
Behat (non-JS scenarios)
-
Behat (JS scenarios)
-
Start Headless Chrome:
-
Install SSL certificates (only once needed) and run test application's webserver on
127.0.0.1:8080: - Run Behat:
License
This library is under the MIT license. See the complete license in the LICENSE file.
Credits
Developed by Webgriffe®.
All versions of sylius-italian-invoiceable-order-plugin with dependencies
dragonbe/vies Version ^2.3.2
sylius/sylius Version ^2.2
webmozart/assert Version ^1.9
