diff --git a/app/Services/EDocument/Standards/Verifactu/Types/Cabecera.php b/app/Services/EDocument/Standards/Verifactu/Types/Cabecera.php index 1d1116bc83..d206fb1d25 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/Cabecera.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/Cabecera.php @@ -2,18 +2,24 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class Cabecera { /** @var PersonaFisicaJuridicaES */ + #[SerializedName('sum1:ObligadoEmision')] protected $ObligadoEmision; /** @var PersonaFisicaJuridicaES|null */ + #[SerializedName('sum1:Representante')] protected $Representante; /** @var array{FechaFinVeriFactu?: string}|null */ + #[SerializedName('sum1:RemisionVoluntaria')] protected $RemisionVoluntaria; /** @var array{RefRequerimiento: string, FinRequerimiento?: string}|null */ + #[SerializedName('sum1:RemisionRequerimiento')] protected $RemisionRequerimiento; public function getObligadoEmision(): PersonaFisicaJuridicaES diff --git a/app/Services/EDocument/Standards/Verifactu/Types/DesgloseRectificacion.php b/app/Services/EDocument/Standards/Verifactu/Types/DesgloseRectificacion.php index 59eba880c7..3acc8aef3f 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/DesgloseRectificacion.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/DesgloseRectificacion.php @@ -2,15 +2,20 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class DesgloseRectificacion { /** @var float */ + #[SerializedName('sum1:BaseRectificada')] protected $BaseRectificada; /** @var float */ + #[SerializedName('sum1:CuotaRectificada')] protected $CuotaRectificada; /** @var float|null */ + #[SerializedName('sum1:CuotaRecargoRectificada')] protected $CuotaRecargoRectificada; public function getBaseRectificada(): float diff --git a/app/Services/EDocument/Standards/Verifactu/Types/IDFacturaExpedida.php b/app/Services/EDocument/Standards/Verifactu/Types/IDFacturaExpedida.php index 7226ae3d8e..5e5e257930 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/IDFacturaExpedida.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/IDFacturaExpedida.php @@ -2,15 +2,20 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class IDFacturaExpedida { /** @var string NIF format */ + #[SerializedName('sum1:IDEmisorFactura')] protected $IDEmisorFactura; /** @var string */ + #[SerializedName('sum1:NumSerieFactura')] protected $NumSerieFactura; /** @var string Date format YYYY-MM-DD */ + #[SerializedName('sum1:FechaExpedicionFactura')] protected $FechaExpedicionFactura; public function getIDEmisorFactura(): string diff --git a/app/Services/EDocument/Standards/Verifactu/Types/ImporteSgn14_2.php b/app/Services/EDocument/Standards/Verifactu/Types/ImporteSgn14_2.php index 146ba67711..1b23a930b5 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/ImporteSgn14_2.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/ImporteSgn14_2.php @@ -3,12 +3,14 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; use App\Services\EDocument\Standards\Verifactu\Types\Common\TextTypes; +use Symfony\Component\Serializer\Annotation\SerializedName; class ImporteSgn14_2 { use TextTypes; /** @var string */ + #[SerializedName('sum1:Value')] protected $Value; public function __construct(string $value) diff --git a/app/Services/EDocument/Standards/Verifactu/Types/Incidencia.php b/app/Services/EDocument/Standards/Verifactu/Types/Incidencia.php index 35dc3b4c39..8409a5ce63 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/Incidencia.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/Incidencia.php @@ -2,21 +2,28 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class Incidencia { /** @var string */ + #[SerializedName('sum1:Codigo')] protected $Codigo; /** @var string */ + #[SerializedName('sum1:Descripcion')] protected $Descripcion; /** @var string|null Max length 120 characters */ + #[SerializedName('sum1:NombreRazon')] protected $NombreRazon; /** @var string|null NIF format */ + #[SerializedName('sum1:NIF')] protected $NIF; /** @var string|null */ + #[SerializedName('sum1:FechaHora')] protected $FechaHora; public function getCodigo(): string diff --git a/app/Services/EDocument/Standards/Verifactu/Types/ObligadoEmision.php b/app/Services/EDocument/Standards/Verifactu/Types/ObligadoEmision.php index 4842105905..7b8b84043d 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/ObligadoEmision.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/ObligadoEmision.php @@ -2,39 +2,52 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class ObligadoEmision extends PersonaFisicaJuridicaES { /** @var string|null */ + #[SerializedName('sum1:TipoPersona')] protected $TipoPersona; /** @var string|null */ + #[SerializedName('sum1:RazonSocialCompleta')] protected $RazonSocialCompleta; /** @var string|null */ + #[SerializedName('sum1:NombreComercial')] protected $NombreComercial; /** @var string|null */ + #[SerializedName('sum1:CodigoPostal')] protected $CodigoPostal; /** @var string|null */ + #[SerializedName('sum1:Direccion')] protected $Direccion; /** @var string|null */ + #[SerializedName('sum1:Poblacion')] protected $Poblacion; /** @var string|null */ + #[SerializedName('sum1:Provincia')] protected $Provincia; /** @var string|null */ + #[SerializedName('sum1:Pais')] protected $Pais; /** @var string|null */ + #[SerializedName('sum1:Telefono')] protected $Telefono; /** @var string|null */ + #[SerializedName('sum1:Email')] protected $Email; /** @var string|null */ + #[SerializedName('sum1:Web')] protected $Web; public function getTipoPersona(): ?string diff --git a/app/Services/EDocument/Standards/Verifactu/Types/OperacionExenta.php b/app/Services/EDocument/Standards/Verifactu/Types/OperacionExenta.php index 45b70ea392..7bd3503261 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/OperacionExenta.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/OperacionExenta.php @@ -2,6 +2,8 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class OperacionExenta { public const E1 = 'E1'; // EXENTA por Art. 20 @@ -12,6 +14,7 @@ class OperacionExenta public const E6 = 'E6'; // EXENTA por otros /** @var string */ + #[SerializedName('sum1:Value')] protected $Value; public function __construct(string $value) diff --git a/app/Services/EDocument/Standards/Verifactu/Types/RechazoPrevio.php b/app/Services/EDocument/Standards/Verifactu/Types/RechazoPrevio.php index 72a6d4d4ca..f9640fb91c 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/RechazoPrevio.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/RechazoPrevio.php @@ -2,15 +2,20 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class RechazoPrevio { /** @var string */ + #[SerializedName('sum1:NumRegistroAcuerdoFacturacion')] protected $NumRegistroAcuerdoFacturacion; /** @var string */ + #[SerializedName('sum1:FechaRegistroAcuerdoFacturacion')] protected $FechaRegistroAcuerdoFacturacion; /** @var string */ + #[SerializedName('sum1:MotivoRechazo')] protected $MotivoRechazo; public function getNumRegistroAcuerdoFacturacion(): string diff --git a/app/Services/EDocument/Standards/Verifactu/Types/RegFactuSistemaFacturacion.php b/app/Services/EDocument/Standards/Verifactu/Types/RegFactuSistemaFacturacion.php index fb79f89a1a..7a9083c705 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/RegFactuSistemaFacturacion.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/RegFactuSistemaFacturacion.php @@ -2,33 +2,37 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class RegFactuSistemaFacturacion { - /** @var PersonaFisicaJuridicaES */ - protected $ObligadoEmision; + /** @var Cabecera */ + #[SerializedName('sum:Cabecera')] + protected $Cabecera; - /** @var RegistroAlta */ - protected $RegistroAlta; + /** @var RegistroFactura */ + #[SerializedName('sum:RegistroFactura')] + protected $RegistroFactura; - public function getObligadoEmision(): PersonaFisicaJuridicaES + public function getCabecera(): Cabecera { - return $this->ObligadoEmision; + return $this->Cabecera; } - public function setObligadoEmision(PersonaFisicaJuridicaES $obligadoEmision): self + public function setCabecera(Cabecera $cabecera): self { - $this->ObligadoEmision = $obligadoEmision; + $this->Cabecera = $cabecera; return $this; } - public function getRegistroAlta(): RegistroAlta + public function getRegistroFactura(): RegistroFactura { - return $this->RegistroAlta; + return $this->RegistroFactura; } - public function setRegistroAlta(RegistroAlta $registroAlta): self + public function setRegistroFactura(RegistroFactura $registroFactura): self { - $this->RegistroAlta = $registroAlta; + $this->RegistroFactura = $registroFactura; return $this; } } \ No newline at end of file diff --git a/app/Services/EDocument/Standards/Verifactu/Types/RegistroAlta.php b/app/Services/EDocument/Standards/Verifactu/Types/RegistroAlta.php index a9d0649760..fb17c564a2 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/RegistroAlta.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/RegistroAlta.php @@ -2,48 +2,64 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class RegistroAlta { /** @var string */ + #[SerializedName('sum1:IDVersion')] protected $IDVersion; /** @var IDFactura */ + #[SerializedName('sum1:IDFactura')] protected $IDFactura; /** @var string */ + #[SerializedName('sum1:NombreRazonEmisor')] protected $NombreRazonEmisor; /** @var string */ + #[SerializedName('sum1:TipoFactura')] protected $TipoFactura; /** @var string */ + #[SerializedName('sum1:DescripcionOperacion')] protected $DescripcionOperacion; /** @var Destinatarios */ + #[SerializedName('sum1:Destinatarios')] protected $Destinatarios; /** @var Desglose */ + #[SerializedName('sum1:Desglose')] protected $Desglose; /** @var float */ + #[SerializedName('sum1:CuotaTotal')] protected $CuotaTotal; /** @var float */ + #[SerializedName('sum1:ImporteTotal')] protected $ImporteTotal; /** @var Encadenamiento|null */ + #[SerializedName('sum1:Encadenamiento')] protected $Encadenamiento; /** @var SistemaInformatico */ + #[SerializedName('sum1:SistemaInformatico')] protected $SistemaInformatico; /** @var string */ + #[SerializedName('sum1:FechaHoraHusoGenRegistro')] protected $FechaHoraHusoGenRegistro; /** @var string */ + #[SerializedName('sum1:TipoHuella')] protected $TipoHuella; /** @var string */ + #[SerializedName('sum1:Huella')] protected $Huella; public function getIDVersion(): string diff --git a/app/Services/EDocument/Standards/Verifactu/Types/RegistroAnterior.php b/app/Services/EDocument/Standards/Verifactu/Types/RegistroAnterior.php index 6fd84de975..ae91ef4525 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/RegistroAnterior.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/RegistroAnterior.php @@ -2,9 +2,12 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class RegistroAnterior extends IDFactura { /** @var string */ + #[SerializedName('sum1:Huella')] protected $Huella; public function getHuella(): string diff --git a/app/Services/EDocument/Standards/Verifactu/Types/RegistroFacturacionAnulacion.php b/app/Services/EDocument/Standards/Verifactu/Types/RegistroFacturacionAnulacion.php index c1037762b1..d01b0a441c 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/RegistroFacturacionAnulacion.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/RegistroFacturacionAnulacion.php @@ -2,42 +2,56 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class RegistroFacturacionAnulacion { /** @var string */ + #[SerializedName('sum1:IDVersion')] protected $IDVersion; /** @var IDFacturaAR */ + #[SerializedName('sum1:IDFactura')] protected $IDFactura; /** @var string|null Max length 70 characters */ + #[SerializedName('sum1:RefExterna')] protected $RefExterna; /** @var string Max length 120 characters */ + #[SerializedName('sum1:NombreRazonEmisor')] protected $NombreRazonEmisor; /** @var string|null Max length 2000 characters */ + #[SerializedName('sum1:MotivoAnulacion')] protected $MotivoAnulacion; /** @var SistemaInformatico */ + #[SerializedName('sum1:SistemaInformatico')] protected $SistemaInformatico; /** @var string */ + #[SerializedName('sum1:Huella')] protected $Huella; /** @var string|null */ + #[SerializedName('sum1:Signature')] protected $Signature; /** @var string */ + #[SerializedName('sum1:FechaHoraHusoGenRegistro')] protected $FechaHoraHusoGenRegistro; /** @var string|null Max length 15 characters */ + #[SerializedName('sum1:NumRegistroAcuerdoFacturacion')] protected $NumRegistroAcuerdoFacturacion; /** @var string|null Max length 16 characters */ + #[SerializedName('sum1:IDAcuerdoSistemaInformatico')] protected $IDAcuerdoSistemaInformatico; /** @var string */ + #[SerializedName('sum1:TipoHuella')] protected $TipoHuella; public function getIDVersion(): string diff --git a/app/Services/EDocument/Standards/Verifactu/Types/SistemaInformatico.php b/app/Services/EDocument/Standards/Verifactu/Types/SistemaInformatico.php index 9083ab49d4..07c37b8f5d 100644 --- a/app/Services/EDocument/Standards/Verifactu/Types/SistemaInformatico.php +++ b/app/Services/EDocument/Standards/Verifactu/Types/SistemaInformatico.php @@ -2,27 +2,36 @@ namespace App\Services\EDocument\Standards\Verifactu\Types; +use Symfony\Component\Serializer\Annotation\SerializedName; + class SistemaInformatico extends PersonaFisicaJuridicaES { /** @var string */ + #[SerializedName('sum1:NombreSistemaInformatico')] protected $NombreSistemaInformatico; /** @var string */ + #[SerializedName('sum1:IdSistemaInformatico')] protected $IdSistemaInformatico; /** @var string */ + #[SerializedName('sum1:Version')] protected $Version; /** @var string */ + #[SerializedName('sum1:NumeroInstalacion')] protected $NumeroInstalacion; /** @var string */ + #[SerializedName('sum1:TipoUsoPosibleSoloVerifactu')] protected $TipoUsoPosibleSoloVerifactu; /** @var string */ + #[SerializedName('sum1:TipoUsoPosibleMultiOT')] protected $TipoUsoPosibleMultiOT; /** @var string */ + #[SerializedName('sum1:IndicadorMultiplesOT')] protected $IndicadorMultiplesOT; public function getNombreSistemaInformatico(): string diff --git a/app/Services/EDocument/Standards/Verifactu/Types/SoapBody.php b/app/Services/EDocument/Standards/Verifactu/Types/SoapBody.php new file mode 100644 index 0000000000..823d38a979 --- /dev/null +++ b/app/Services/EDocument/Standards/Verifactu/Types/SoapBody.php @@ -0,0 +1,23 @@ +RegFactuSistemaFacturacion; + } + + public function setRegFactuSistemaFacturacion(RegFactuSistemaFacturacion $regFactuSistemaFacturacion): self + { + $this->RegFactuSistemaFacturacion = $regFactuSistemaFacturacion; + return $this; + } +} diff --git a/app/Services/EDocument/Standards/Verifactu/Types/SoapEnvelope.php b/app/Services/EDocument/Standards/Verifactu/Types/SoapEnvelope.php new file mode 100644 index 0000000000..5cd219b2ab --- /dev/null +++ b/app/Services/EDocument/Standards/Verifactu/Types/SoapEnvelope.php @@ -0,0 +1,38 @@ +Header; + } + + public function setHeader(SoapHeader $header): self + { + $this->Header = $header; + return $this; + } + + public function getBody(): SoapBody + { + return $this->Body; + } + + public function setBody(SoapBody $body): self + { + $this->Body = $body; + return $this; + } +} diff --git a/app/Services/EDocument/Standards/Verifactu/Types/SoapHeader.php b/app/Services/EDocument/Standards/Verifactu/Types/SoapHeader.php new file mode 100644 index 0000000000..a3c5dc2675 --- /dev/null +++ b/app/Services/EDocument/Standards/Verifactu/Types/SoapHeader.php @@ -0,0 +1,10 @@ + true,\Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::SKIP_NULL_VALUES => true]), new JsonEncoder()]; + + $serializer = new Serializer($normalizers, $encoders); + + $parent_class = SoapEnvelope::class; + + $invoice = $serializer->deserialize($document, $parent_class, 'xml', [\Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::SKIP_NULL_VALUES => true]); + + // nlog($invoice); +echo(print_r($invoice, true)); + + } +} \ No newline at end of file diff --git a/tests/Feature/Verifactu/invoice.xml b/tests/Feature/Verifactu/invoice.xml new file mode 100644 index 0000000000..afdccc681e --- /dev/null +++ b/tests/Feature/Verifactu/invoice.xml @@ -0,0 +1,76 @@ + + + + + + + + XXXXX + AAAA + + + + + 1.0 + + AAAA + 12345 + 13-09-2024 + + XXXXX + F1 + Descripc + + + YYYY + BBBB + + + + + 01 + S1 + 4 + 10 + 0.4 + + + 01 + S1 + 21 + 100 + 21 + + + 21.4 + 131.4 + + + AAAA + 44 + 13-09-2024 + HuellaRegistroAnterior + + + + SSSS + NNNN + NombreSistemaInformatico + 77 + 1.0.03 + 383 + N + S + S + + 2024-09-13T19:20:30+01:00 + 01 + Huella + + + + + \ No newline at end of file