flexible-ux / verifactu-bundle
Symfony bundle to deal with Veri*Factu Spanish digital invoicing law
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/flexible-ux/verifactu-bundle
Requires
- php: >=8.2
- ext-libxml: *
- josemmo/verifactu-php: ^0.3
- symfony/config: ^6.4|^7.0
- symfony/dependency-injection: ^6.4|^7.0
- symfony/filesystem: ^6.4|^7.0
- symfony/http-kernel: ^6.4|^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.92
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9.6
- symfony/phpunit-bridge: ^6.4|^7.0
README
VerifactuBundle is Symfony bundle to deal with Veri*Factu Spanish digital
invoicing law. This bundle relies on josemmo/verifactu-php PHP library.
Disclaimer
This Symfony bundle is provided without a responsible declaration, as it is not an Invoicing Computer System ("Sistema Informático de Facturación" or "SIF" as known reference in Spain's law). This is a third-party tool to integrate into your SIF with Veri*Factu API. It is your responsibility to audit its code and use it in accordance with the applicable regulations.
For more information, see Artículo 13 del RD 1007/2023.
Installation
VerifactuBundle requires PHP 8.2 or higher and Symfony 6.4 or higher. Run the following command to install it in your application:
composer require flexible-ux/verifactu-bundle
Configure the bundle in your config/packages/flux_verifactu.yaml file:
flux_verifactu: aeat_client: is_prod_environment: false # only set to true to make real AEAT API calls, be careful here pfx_certificate_filepath: '%your_pfx_certificate_filepath%' pfx_certificate_password: '%pfx_certificate_password%' # SIF (developer) credentials computer_system: vendor_name: '%your_vendor_name%' vendor_nif: '%your_vendor_nif%' # 9 digits (Spanish NIF or CIF) name: '%your_name%' id: 'ID' # only 2 letters version: '%your_version%' installation_number: '%your_installation_number%' only_supports_verifactu: false supports_multiple_taxpayers: false has_multiple_taxpayers: false # Taxpayer credentials fiscal_identifier: name: '%your_name%' nif: '%your_nif%' # 9 digits (Spanish NIF or CIF)
Usage
AeatClientHandler Service (WIP, for now is only a Proof-Of-Concept)
You can inject the AeatClientHandler service in your app. Make sendRegistrationRecordToAeatClient method calls to send registration records to AEAT API. Your Invoice model (or entity) must implement Flux\VerifactuBundle\Contract\RegistrationRecordInterface.
use Flux\VerifactuBundle\Handler\AeatClientHandler; class AppTestController { public function test(Invoice $invoice, AeatClientHandler $aeatClientHandler) { $registrationRecord = $aeatClientHandler->buildRegistrationRecordDtoFromInterface($invoice); $aeatClientHandler->sendRegistrationRecordToAeatClient($registrationRecord); // for now only returns 'OK' or 'KO' as string (please, `keep aeat_client.is_prod_environment` configuration as `false`) // ... } }
Code Style
php ./vendor/bin/php-cs-fixer fix src/
Code Analysis
php ./vendor/bin/phpstan analyse
Testing
php ./vendor/bin/phpunit tests/