Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

Missing enum for BreakdownDetail->regimeKey (ClaveRegimen) field. This adds type-safe constants for all AEAT-defined VAT special regime codes.

Changes

  • New enum: src/models/enums/RegimeType.php with all 17 regime codes (01-20, gaps included per AEAT spec)
  • Updated BreakdownDetail: Changed $regimeKey from string|null to RegimeType|null with validation
  • Updated InvoiceSerializer: Access enum value for XML serialization
  • Updated README: Added import, usage example, and enum documentation

Usage

use eseperio\verifactu\models\BreakdownDetail;
use eseperio\verifactu\models\enums\RegimeType;

$detail = new BreakdownDetail();
$detail->regimeKey = RegimeType::GENERAL;        // 01 - Operación de régimen general
$detail->regimeKey = RegimeType::EXPORT;         // 02 - Exportación
$detail->regimeKey = RegimeType::TRAVEL_AGENCIES; // 05 - Agencias de viajes
$detail->regimeKey = RegimeType::CASH_BASIS;     // 07 - Criterio de caja

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/Bacon/BaconQrCode/zipball/36a1cb2b81493fa5b82e50bf8068bf84d1542563
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JfM1FM /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/DASPRiD/Enum/zipball/b5874fa9ed0043116c72162ec7f4fb50e02e7cce
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JfM1FM /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phar-io/manifest/zipball/c581d4941e196459bf76c945a8ca922963a66708
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan/zipball/f5628342a5610aeecaf9b1374e32751b2146d16c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JfM1FM /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Pa4uQ2 /usr/bin/composer install --prefer-source --no-interaction (http block)
  • https://api.github.com/repos/robrichards/xmlseclibs/zipball/2bdfd742624d739dfadbd415f00181b4a77aaf07
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/9f7c12369107fdb7a91016bf88f27d39872a88ea
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/complexity/zipball/72cbad467aed5fc740e4e4c00218f4f4a6ad4297
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/ded04261fddbfb6755b7176685fd7975b874a128
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JfM1FM /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/e16b906e486daae949005a62576318be23e31670
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JfM1FM /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/42e62627beea4652e6ee8a070a90e7044c57fb7a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5bbaa6fec73ca99e5e86a44728cc8f517ffda878
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2b64fcfd962e68d303f86608aca2cf882adbca74
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JfM1FM /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/68153740a6f11fc82a96e260ef47041967ee1c58
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JfM1FM /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/c8104a729707d949f2132fad0a41c42b7cac080f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/0zO1fN /usr/bin/composer install --no-interaction (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Enum para Tipos de régimen de IVA</issue_title>
<issue_description>Realizando pruebas, ha visto que no hay un enum para el tipo de regimen de IVA (Para BreakdownDetail->regimeKey).
En la librería de josemmo, crearon un enum para ello:

<?php
namespace josemmo\Verifactu\Models\Records;

/**
 * Claves de Régimen Especial o Trascendencia Adicional
 */
enum RegimeType: string {
    /** Operación de régimen general. */
    case C01 = '01';

    /** Exportación. */
    case C02 = '02';

    /** Operaciones a las que se aplique el régimen especial de bienes usados, objetos de arte, antigüedades y objetos de colección. */
    case C03 = '03';

    /** Régimen especial del oro de inversión. */
    case C04 = '04';

    /** Régimen especial de las agencias de viajes. */
    case C05 = '05';

    /** Régimen especial grupo de entidades en IVA (Nivel Avanzado) */
    case C06 = '06';

    /** Régimen especial del criterio de caja. */
    case C07 = '07';

    /** Operaciones sujetas al IPSI / IGIC (Impuesto sobre la Producción, los Servicios y la Importación / Impuesto General Indirecto Canario). */
    case C08 = '08';

    /** Facturación de las prestaciones de servicios de agencias de viaje que actúan como mediadoras en nombre y por cuenta ajena (D.A 4ª RD1619/2012) */
    case C09 = '09';

    /** Cobros por cuenta de terceros de honorarios profesionales o de derechos derivados de la propiedad industrial, de autor u otros por cuenta de sus socios, asociados o colegiados efectuados por sociedades, asociaciones, colegios profesionales u otras entidades que realicen estas funciones de cobro. */
    case C10 = '10';

    /** Operaciones de arrendamiento de local de negocio. */
    case C11 = '11';

    /** Factura con IVA pendiente de devengo en certificaciones de obra cuyo destinatario sea una Administración Pública. */
    case C14 = '14';

    /** Factura con IVA pendiente de devengo en operaciones de tracto sucesivo. */
    case C15 = '15';

    /** Operación acogida a alguno de los regímenes previstos en el Capítulo XI del Título IX (OSS e IOSS) */
    case C17 = '17';

    /** Recargo de equivalencia. */
    case C18 = '18';

    /** Operaciones de actividades incluidas en el Régimen Especial de Agricultura, Ganadería y Pesca (REAGYP) */
    case C19 = '19';

    /** Régimen simplificado */
    case C20 = '20';
}

https://github.com/josemmo/Verifactu-PHP/blob/main/src/Models/Records/RegimeType.php</issue_description>

<agent_instructions>Add this dictionary dictionary to enums and also mention it exist wherever it may be needed, like, for example, if is useful to be provided in examples. </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@Eseperio Gracias por el aporte. Lo añado

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add enum for VAT regime types Add RegimeType enum for VAT regime keys (ClaveRegimen) Nov 28, 2025
Copilot AI requested a review from Eseperio November 28, 2025 12:48
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.

Enum para Tipos de régimen de IVA

2 participants