Skip to content

Conversation

@ilie
Copy link

@ilie ilie commented Nov 27, 2025

Summary

  • Made IdSistemaInformatico configurable via VERIFACTU_SYSTEM_ID environment variable
  • Removed hardcoded value from AeatClient to prevent AEAT test rejections

Problem

While testing I would clear the database multiple times and reseed it back tih this command: php artisan migrate:fresh -- seed.
AEAT pre-production environment is so strict that it will reject the same invoice twice, or even create a new invoicing serie and tried again while testing, AEAT would reject invoices with the error that the same invoice with the same NIF cannot be
declared as the first invoice when using the same NIF and IdSistemaInformatico. This prevented testing.

Solution

  • Added system_id configuration in config/verifactu.php with default value '01'
  • Updated AeatClient.php to read from config instead of hardcoded value
  • Allows different test instances to use different system IDs via environment variables

Benefits

  • It allows you to have multiple invoicing systems using LaravelVeriFactu package that are independent on eachother.

Changes

  • config/verifactu.php: Added system_id config key
  • src/Services/AeatClient.php:261: Changed hardcoded '01' to config('verifactu.system_id', '01')

Test plan

  • Set different VERIFACTU_SYSTEM_ID values in different environments
  • Verify AEAT accepts first invoices from each unique system ID
  • Confirm default value '01' is used when environment variable is not set

…ariables for multiple instances under the same VAT Issuer.
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant