Stubs for generating Verifactu Standard Invoices
This commit is contained in:
parent
032b64e65c
commit
1f4fae314c
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\EDocument\Standards\Verifactu\Models;
|
||||||
|
|
||||||
|
class BaseTypes
|
||||||
|
{
|
||||||
|
// Common types
|
||||||
|
public const VERSION_TYPE = 'string';
|
||||||
|
public const NIF_TYPE = 'string';
|
||||||
|
public const FECHA_TYPE = 'string'; // ISO 8601 date
|
||||||
|
public const TEXT_MAX_18_TYPE = 'string';
|
||||||
|
public const TEXT_MAX_20_TYPE = 'string';
|
||||||
|
public const TEXT_MAX_30_TYPE = 'string';
|
||||||
|
public const TEXT_MAX_50_TYPE = 'string';
|
||||||
|
public const TEXT_MAX_60_TYPE = 'string';
|
||||||
|
public const TEXT_MAX_64_TYPE = 'string';
|
||||||
|
public const TEXT_MAX_70_TYPE = 'string';
|
||||||
|
public const TEXT_MAX_100_TYPE = 'string';
|
||||||
|
public const TEXT_MAX_120_TYPE = 'string';
|
||||||
|
public const TEXT_MAX_500_TYPE = 'string';
|
||||||
|
public const IMPORTE_SGN_12_2_TYPE = 'float';
|
||||||
|
public const TIPO_HUELLA_TYPE = 'string';
|
||||||
|
public const TIPO_PERIODO_TYPE = 'string';
|
||||||
|
public const CLAVE_TIPO_FACTURA_TYPE = 'string';
|
||||||
|
public const CLAVE_TIPO_RECTIFICATIVA_TYPE = 'string';
|
||||||
|
public const SIMPLIFICADA_CUALIFICADA_TYPE = 'string';
|
||||||
|
public const COMPLETA_SIN_DESTINATARIO_TYPE = 'string';
|
||||||
|
public const MACRODATO_TYPE = 'string';
|
||||||
|
public const TERCEROS_O_DESTINATARIO_TYPE = 'string';
|
||||||
|
public const GENERADO_POR_TYPE = 'string';
|
||||||
|
public const SIN_REGISTRO_PREVIO_TYPE = 'string';
|
||||||
|
public const SUBSANACION_TYPE = 'string';
|
||||||
|
public const RECHAZO_PREVIO_TYPE = 'string';
|
||||||
|
public const FIN_REQUERIMIENTO_TYPE = 'string';
|
||||||
|
public const INCIDENCIA_TYPE = 'string';
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\EDocument\Standards\Verifactu\Models;
|
||||||
|
|
||||||
|
abstract class BaseXmlModel
|
||||||
|
{
|
||||||
|
public const XML_NAMESPACE = 'https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd';
|
||||||
|
protected const XML_NAMESPACE_PREFIX = 'sf';
|
||||||
|
protected const XML_DS_NAMESPACE = 'http://www.w3.org/2000/09/xmldsig#';
|
||||||
|
protected const XML_DS_NAMESPACE_PREFIX = 'ds';
|
||||||
|
|
||||||
|
protected function createElement(\DOMDocument $doc, string $name, ?string $value = null, array $attributes = []): \DOMElement
|
||||||
|
{
|
||||||
|
$element = $doc->createElementNS(self::XML_NAMESPACE, self::XML_NAMESPACE_PREFIX . ':' . $name);
|
||||||
|
if ($value !== null) {
|
||||||
|
$element->nodeValue = $value;
|
||||||
|
}
|
||||||
|
foreach ($attributes as $attrName => $attrValue) {
|
||||||
|
$element->setAttribute($attrName, $attrValue);
|
||||||
|
}
|
||||||
|
return $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function createDsElement(\DOMDocument $doc, string $name, ?string $value = null, array $attributes = []): \DOMElement
|
||||||
|
{
|
||||||
|
$element = $doc->createElementNS(self::XML_DS_NAMESPACE, self::XML_DS_NAMESPACE_PREFIX . ':' . $name);
|
||||||
|
if ($value !== null) {
|
||||||
|
$element->nodeValue = $value;
|
||||||
|
}
|
||||||
|
foreach ($attributes as $attrName => $attrValue) {
|
||||||
|
$element->setAttribute($attrName, $attrValue);
|
||||||
|
}
|
||||||
|
return $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getElementValue(\DOMElement $parent, string $name, string $namespace = self::XML_NAMESPACE): ?string
|
||||||
|
{
|
||||||
|
$elements = $parent->getElementsByTagNameNS($namespace, $name);
|
||||||
|
if ($elements->length > 0) {
|
||||||
|
return $elements->item(0)->nodeValue;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public function toXml(): string;
|
||||||
|
|
||||||
|
public static function fromXml($xml): self
|
||||||
|
{
|
||||||
|
if ($xml instanceof \DOMElement) {
|
||||||
|
return static::fromDOMElement($xml);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_string($xml)) {
|
||||||
|
throw new \InvalidArgumentException('Input must be either a string or DOMElement');
|
||||||
|
}
|
||||||
|
|
||||||
|
$doc = new \DOMDocument();
|
||||||
|
if (!$doc->loadXML($xml)) {
|
||||||
|
throw new \DOMException('Failed to load XML: Invalid XML format');
|
||||||
|
}
|
||||||
|
return static::fromDOMElement($doc->documentElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public static function fromDOMElement(\DOMElement $element): self;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\EDocument\Standards\Verifactu\Models;
|
||||||
|
|
||||||
|
class Cupon extends BaseXmlModel
|
||||||
|
{
|
||||||
|
protected string $idCupon;
|
||||||
|
protected string $fechaExpedicionCupon;
|
||||||
|
protected float $importeCupon;
|
||||||
|
protected ?string $descripcionCupon = null;
|
||||||
|
|
||||||
|
public function toXml(): string
|
||||||
|
{
|
||||||
|
$doc = new \DOMDocument('1.0', 'UTF-8');
|
||||||
|
$doc->formatOutput = true;
|
||||||
|
|
||||||
|
$root = $this->createElement($doc, 'Cupon');
|
||||||
|
$doc->appendChild($root);
|
||||||
|
|
||||||
|
// Add required elements
|
||||||
|
$root->appendChild($this->createElement($doc, 'IDCupon', $this->idCupon));
|
||||||
|
$root->appendChild($this->createElement($doc, 'FechaExpedicionCupon', $this->fechaExpedicionCupon));
|
||||||
|
$root->appendChild($this->createElement($doc, 'ImporteCupon', (string)$this->importeCupon));
|
||||||
|
|
||||||
|
// Add optional description
|
||||||
|
if ($this->descripcionCupon !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'DescripcionCupon', $this->descripcionCupon));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $doc->saveXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromDOMElement(\DOMElement $element): self
|
||||||
|
{
|
||||||
|
$cupon = new self();
|
||||||
|
$cupon->setIdCupon($cupon->getElementValue($element, 'IDCupon'));
|
||||||
|
$cupon->setFechaExpedicionCupon($cupon->getElementValue($element, 'FechaExpedicionCupon'));
|
||||||
|
$cupon->setImporteCupon((float)$cupon->getElementValue($element, 'ImporteCupon'));
|
||||||
|
|
||||||
|
$descripcionCupon = $cupon->getElementValue($element, 'DescripcionCupon');
|
||||||
|
if ($descripcionCupon !== null) {
|
||||||
|
$cupon->setDescripcionCupon($descripcionCupon);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cupon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdCupon(): string
|
||||||
|
{
|
||||||
|
return $this->idCupon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdCupon(string $idCupon): self
|
||||||
|
{
|
||||||
|
$this->idCupon = $idCupon;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFechaExpedicionCupon(): string
|
||||||
|
{
|
||||||
|
return $this->fechaExpedicionCupon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFechaExpedicionCupon(string $fechaExpedicionCupon): self
|
||||||
|
{
|
||||||
|
$this->fechaExpedicionCupon = $fechaExpedicionCupon;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImporteCupon(): float
|
||||||
|
{
|
||||||
|
return $this->importeCupon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setImporteCupon(float $importeCupon): self
|
||||||
|
{
|
||||||
|
$this->importeCupon = $importeCupon;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescripcionCupon(): ?string
|
||||||
|
{
|
||||||
|
return $this->descripcionCupon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescripcionCupon(?string $descripcionCupon): self
|
||||||
|
{
|
||||||
|
$this->descripcionCupon = $descripcionCupon;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,260 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\EDocument\Standards\Verifactu\Models;
|
||||||
|
|
||||||
|
class Desglose extends BaseXmlModel
|
||||||
|
{
|
||||||
|
protected ?array $desgloseFactura = null;
|
||||||
|
protected ?array $desgloseTipoOperacion = null;
|
||||||
|
protected ?array $desgloseIVA = null;
|
||||||
|
protected ?array $desgloseIGIC = null;
|
||||||
|
protected ?array $desgloseIRPF = null;
|
||||||
|
protected ?array $desgloseIS = null;
|
||||||
|
|
||||||
|
public function toXml(): string
|
||||||
|
{
|
||||||
|
$doc = new \DOMDocument('1.0', 'UTF-8');
|
||||||
|
$doc->formatOutput = true;
|
||||||
|
|
||||||
|
$root = $this->createElement($doc, 'Desglose');
|
||||||
|
$doc->appendChild($root);
|
||||||
|
|
||||||
|
// Create DetalleDesglose element
|
||||||
|
$detalleDesglose = $this->createElement($doc, 'DetalleDesglose');
|
||||||
|
|
||||||
|
// Handle regular invoice desglose
|
||||||
|
if ($this->desgloseFactura !== null) {
|
||||||
|
// Add Impuesto if present
|
||||||
|
if (isset($this->desgloseFactura['Impuesto'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'Impuesto', $this->desgloseFactura['Impuesto']));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add ClaveRegimen if present
|
||||||
|
if (isset($this->desgloseFactura['ClaveRegimen'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'ClaveRegimen', $this->desgloseFactura['ClaveRegimen']));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add either CalificacionOperacion or OperacionExenta
|
||||||
|
if (isset($this->desgloseFactura['OperacionExenta'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'OperacionExenta', $this->desgloseFactura['OperacionExenta']));
|
||||||
|
} else {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'CalificacionOperacion',
|
||||||
|
$this->desgloseFactura['CalificacionOperacion'] ?? 'S1'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add TipoImpositivo if present
|
||||||
|
if (isset($this->desgloseFactura['TipoImpositivo'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'TipoImpositivo',
|
||||||
|
number_format($this->desgloseFactura['TipoImpositivo'], 2, '.', '')));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add BaseImponibleOimporteNoSujeto (required)
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'BaseImponibleOimporteNoSujeto',
|
||||||
|
number_format($this->desgloseFactura['BaseImponible'], 2, '.', '')));
|
||||||
|
|
||||||
|
// Add BaseImponibleACoste if present
|
||||||
|
if (isset($this->desgloseFactura['BaseImponibleACoste'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'BaseImponibleACoste',
|
||||||
|
number_format($this->desgloseFactura['BaseImponibleACoste'], 2, '.', '')));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add CuotaRepercutida if present
|
||||||
|
if (isset($this->desgloseFactura['Cuota'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'CuotaRepercutida',
|
||||||
|
number_format($this->desgloseFactura['Cuota'], 2, '.', '')));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add TipoRecargoEquivalencia if present
|
||||||
|
if (isset($this->desgloseFactura['TipoRecargoEquivalencia'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'TipoRecargoEquivalencia',
|
||||||
|
number_format($this->desgloseFactura['TipoRecargoEquivalencia'], 2, '.', '')));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add CuotaRecargoEquivalencia if present
|
||||||
|
if (isset($this->desgloseFactura['CuotaRecargoEquivalencia'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'CuotaRecargoEquivalencia',
|
||||||
|
number_format($this->desgloseFactura['CuotaRecargoEquivalencia'], 2, '.', '')));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle simplified invoice desglose (IVA)
|
||||||
|
if ($this->desgloseIVA !== null) {
|
||||||
|
// Add Impuesto (required for IVA)
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'Impuesto', '01'));
|
||||||
|
|
||||||
|
// Add ClaveRegimen (required for simplified invoices)
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'ClaveRegimen', '02'));
|
||||||
|
|
||||||
|
// Add CalificacionOperacion (required)
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'CalificacionOperacion', 'S2'));
|
||||||
|
|
||||||
|
// Add TipoImpositivo if present
|
||||||
|
if (isset($this->desgloseIVA['TipoImpositivo'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'TipoImpositivo',
|
||||||
|
number_format($this->desgloseIVA['TipoImpositivo'], 2, '.', '')));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add BaseImponibleOimporteNoSujeto (required)
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'BaseImponibleOimporteNoSujeto',
|
||||||
|
number_format($this->desgloseIVA['BaseImponible'], 2, '.', '')));
|
||||||
|
|
||||||
|
// Add CuotaRepercutida if present
|
||||||
|
if (isset($this->desgloseIVA['Cuota'])) {
|
||||||
|
$detalleDesglose->appendChild($this->createElement($doc, 'CuotaRepercutida',
|
||||||
|
number_format($this->desgloseIVA['Cuota'], 2, '.', '')));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only add DetalleDesglose if it has child elements
|
||||||
|
if ($detalleDesglose->hasChildNodes()) {
|
||||||
|
$root->appendChild($detalleDesglose);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $doc->saveXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromDOMElement(\DOMElement $element): self
|
||||||
|
{
|
||||||
|
$desglose = new self();
|
||||||
|
|
||||||
|
// Parse DesgloseFactura
|
||||||
|
$desgloseFacturaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'DesgloseFactura')->item(0);
|
||||||
|
if ($desgloseFacturaElement) {
|
||||||
|
$desgloseFactura = [];
|
||||||
|
foreach ($desgloseFacturaElement->childNodes as $child) {
|
||||||
|
if ($child instanceof \DOMElement) {
|
||||||
|
$desgloseFactura[$child->localName] = $child->nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$desglose->setDesgloseFactura($desgloseFactura);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse DesgloseTipoOperacion
|
||||||
|
$desgloseTipoOperacionElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'DesgloseTipoOperacion')->item(0);
|
||||||
|
if ($desgloseTipoOperacionElement) {
|
||||||
|
$desgloseTipoOperacion = [];
|
||||||
|
foreach ($desgloseTipoOperacionElement->childNodes as $child) {
|
||||||
|
if ($child instanceof \DOMElement) {
|
||||||
|
$desgloseTipoOperacion[$child->localName] = $child->nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$desglose->setDesgloseTipoOperacion($desgloseTipoOperacion);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse DesgloseIVA
|
||||||
|
$desgloseIvaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'DesgloseIVA')->item(0);
|
||||||
|
if ($desgloseIvaElement) {
|
||||||
|
$desgloseIva = [];
|
||||||
|
foreach ($desgloseIvaElement->childNodes as $child) {
|
||||||
|
if ($child instanceof \DOMElement) {
|
||||||
|
$desgloseIva[$child->localName] = $child->nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$desglose->setDesgloseIVA($desgloseIva);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse DesgloseIGIC
|
||||||
|
$desgloseIgicElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'DesgloseIGIC')->item(0);
|
||||||
|
if ($desgloseIgicElement) {
|
||||||
|
$desgloseIgic = [];
|
||||||
|
foreach ($desgloseIgicElement->childNodes as $child) {
|
||||||
|
if ($child instanceof \DOMElement) {
|
||||||
|
$desgloseIgic[$child->localName] = $child->nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$desglose->setDesgloseIGIC($desgloseIgic);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse DesgloseIRPF
|
||||||
|
$desgloseIrpfElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'DesgloseIRPF')->item(0);
|
||||||
|
if ($desgloseIrpfElement) {
|
||||||
|
$desgloseIrpf = [];
|
||||||
|
foreach ($desgloseIrpfElement->childNodes as $child) {
|
||||||
|
if ($child instanceof \DOMElement) {
|
||||||
|
$desgloseIrpf[$child->localName] = $child->nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$desglose->setDesgloseIRPF($desgloseIrpf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse DesgloseIS
|
||||||
|
$desgloseIsElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'DesgloseIS')->item(0);
|
||||||
|
if ($desgloseIsElement) {
|
||||||
|
$desgloseIs = [];
|
||||||
|
foreach ($desgloseIsElement->childNodes as $child) {
|
||||||
|
if ($child instanceof \DOMElement) {
|
||||||
|
$desgloseIs[$child->localName] = $child->nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$desglose->setDesgloseIS($desgloseIs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $desglose;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDesgloseFactura(): ?array
|
||||||
|
{
|
||||||
|
return $this->desgloseFactura;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDesgloseFactura(?array $desgloseFactura): self
|
||||||
|
{
|
||||||
|
$this->desgloseFactura = $desgloseFactura;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDesgloseTipoOperacion(): ?array
|
||||||
|
{
|
||||||
|
return $this->desgloseTipoOperacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDesgloseTipoOperacion(?array $desgloseTipoOperacion): self
|
||||||
|
{
|
||||||
|
$this->desgloseTipoOperacion = $desgloseTipoOperacion;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDesgloseIVA(): ?array
|
||||||
|
{
|
||||||
|
return $this->desgloseIVA;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDesgloseIVA(?array $desgloseIVA): self
|
||||||
|
{
|
||||||
|
$this->desgloseIVA = $desgloseIVA;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDesgloseIGIC(): ?array
|
||||||
|
{
|
||||||
|
return $this->desgloseIGIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDesgloseIGIC(?array $desgloseIGIC): self
|
||||||
|
{
|
||||||
|
$this->desgloseIGIC = $desgloseIGIC;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDesgloseIRPF(): ?array
|
||||||
|
{
|
||||||
|
return $this->desgloseIRPF;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDesgloseIRPF(?array $desgloseIRPF): self
|
||||||
|
{
|
||||||
|
$this->desgloseIRPF = $desgloseIRPF;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDesgloseIS(): ?array
|
||||||
|
{
|
||||||
|
return $this->desgloseIS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDesgloseIS(?array $desgloseIS): self
|
||||||
|
{
|
||||||
|
$this->desgloseIS = $desgloseIS;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,233 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\EDocument\Standards\Verifactu\Models;
|
||||||
|
|
||||||
|
class Encadenamiento extends BaseXmlModel
|
||||||
|
{
|
||||||
|
protected ?string $primerRegistro = null;
|
||||||
|
protected ?EncadenamientoFacturaAnterior $registroAnterior = null;
|
||||||
|
protected ?EncadenamientoFacturaAnterior $registroPosterior = null;
|
||||||
|
|
||||||
|
public function toXml(): string
|
||||||
|
{
|
||||||
|
$doc = new \DOMDocument('1.0', 'UTF-8');
|
||||||
|
$root = $this->createElement($doc, 'Encadenamiento');
|
||||||
|
$doc->appendChild($root);
|
||||||
|
|
||||||
|
if ($this->primerRegistro !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'PrimerRegistro', 'S'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->registroAnterior !== null) {
|
||||||
|
$registroAnteriorXml = $this->registroAnterior->toXml();
|
||||||
|
$registroAnteriorDoc = new \DOMDocument();
|
||||||
|
$registroAnteriorDoc->loadXML($registroAnteriorXml);
|
||||||
|
$registroAnteriorNode = $doc->importNode($registroAnteriorDoc->documentElement, true);
|
||||||
|
$root->appendChild($registroAnteriorNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->registroPosterior !== null) {
|
||||||
|
$registroPosteriorXml = $this->registroPosterior->toXml();
|
||||||
|
$registroPosteriorDoc = new \DOMDocument();
|
||||||
|
$registroPosteriorDoc->loadXML($registroPosteriorXml);
|
||||||
|
$registroPosteriorNode = $doc->importNode($registroPosteriorDoc->documentElement, true);
|
||||||
|
$root->appendChild($registroPosteriorNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add namespace declaration to the root element
|
||||||
|
$root->setAttribute('xmlns:sf', self::XML_NAMESPACE);
|
||||||
|
$root->setAttribute('xmlns:ds', self::XML_DS_NAMESPACE);
|
||||||
|
|
||||||
|
return $doc->saveXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromXml($xml): BaseXmlModel
|
||||||
|
{
|
||||||
|
$encadenamiento = new self();
|
||||||
|
|
||||||
|
if (is_string($xml)) {
|
||||||
|
error_log("Loading XML in Encadenamiento::fromXml: " . $xml);
|
||||||
|
$dom = new \DOMDocument();
|
||||||
|
if (!$dom->loadXML($xml)) {
|
||||||
|
error_log("Failed to load XML in Encadenamiento::fromXml");
|
||||||
|
throw new \DOMException('Invalid XML');
|
||||||
|
}
|
||||||
|
$element = $dom->documentElement;
|
||||||
|
} else {
|
||||||
|
$element = $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Handle PrimerRegistro
|
||||||
|
$primerRegistro = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'PrimerRegistro')->item(0);
|
||||||
|
if ($primerRegistro) {
|
||||||
|
$encadenamiento->setPrimerRegistro($primerRegistro->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle RegistroAnterior
|
||||||
|
$registroAnterior = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'RegistroAnterior')->item(0);
|
||||||
|
if ($registroAnterior) {
|
||||||
|
$encadenamiento->setRegistroAnterior(EncadenamientoFacturaAnterior::fromDOMElement($registroAnterior));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $encadenamiento;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
error_log("Error parsing XML in Encadenamiento::fromXml: " . $e->getMessage());
|
||||||
|
throw new \InvalidArgumentException('Error parsing XML: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromDOMElement(\DOMElement $element): self
|
||||||
|
{
|
||||||
|
$encadenamiento = new self();
|
||||||
|
|
||||||
|
// Handle PrimerRegistro
|
||||||
|
$primerRegistro = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'PrimerRegistro')->item(0);
|
||||||
|
if ($primerRegistro) {
|
||||||
|
$encadenamiento->setPrimerRegistro($primerRegistro->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle RegistroAnterior
|
||||||
|
$registroAnterior = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'RegistroAnterior')->item(0);
|
||||||
|
if ($registroAnterior) {
|
||||||
|
$encadenamiento->setRegistroAnterior(EncadenamientoFacturaAnterior::fromDOMElement($registroAnterior));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $encadenamiento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPrimerRegistro(): ?string
|
||||||
|
{
|
||||||
|
return $this->primerRegistro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPrimerRegistro(?string $primerRegistro): self
|
||||||
|
{
|
||||||
|
if ($primerRegistro !== null && $primerRegistro !== 'S') {
|
||||||
|
throw new \InvalidArgumentException('PrimerRegistro must be "S" or null');
|
||||||
|
}
|
||||||
|
$this->primerRegistro = $primerRegistro;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRegistroAnterior(): ?EncadenamientoFacturaAnterior
|
||||||
|
{
|
||||||
|
return $this->registroAnterior;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRegistroAnterior(?EncadenamientoFacturaAnterior $registroAnterior): self
|
||||||
|
{
|
||||||
|
$this->registroAnterior = $registroAnterior;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRegistroPosterior(): ?EncadenamientoFacturaAnterior
|
||||||
|
{
|
||||||
|
return $this->registroPosterior;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRegistroPosterior(?EncadenamientoFacturaAnterior $registroPosterior): self
|
||||||
|
{
|
||||||
|
$this->registroPosterior = $registroPosterior;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EncadenamientoFacturaAnterior extends BaseXmlModel
|
||||||
|
{
|
||||||
|
protected string $idEmisorFactura;
|
||||||
|
protected string $numSerieFactura;
|
||||||
|
protected string $fechaExpedicionFactura;
|
||||||
|
protected string $huella;
|
||||||
|
|
||||||
|
public function toXml(): string
|
||||||
|
{
|
||||||
|
$doc = new \DOMDocument('1.0', 'UTF-8');
|
||||||
|
$doc->formatOutput = true;
|
||||||
|
|
||||||
|
$root = $this->createElement($doc, 'RegistroAnterior');
|
||||||
|
$doc->appendChild($root);
|
||||||
|
|
||||||
|
$root->appendChild($this->createElement($doc, 'IDEmisorFactura', $this->idEmisorFactura));
|
||||||
|
$root->appendChild($this->createElement($doc, 'NumSerieFactura', $this->numSerieFactura));
|
||||||
|
$root->appendChild($this->createElement($doc, 'FechaExpedicionFactura', $this->fechaExpedicionFactura));
|
||||||
|
$root->appendChild($this->createElement($doc, 'Huella', $this->huella));
|
||||||
|
|
||||||
|
return $doc->saveXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromDOMElement(\DOMElement $element): self
|
||||||
|
{
|
||||||
|
$registroAnterior = new self();
|
||||||
|
|
||||||
|
// Handle IDEmisorFactura
|
||||||
|
$idEmisorFactura = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'IDEmisorFactura')->item(0);
|
||||||
|
if ($idEmisorFactura) {
|
||||||
|
$registroAnterior->setIdEmisorFactura($idEmisorFactura->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle NumSerieFactura
|
||||||
|
$numSerieFactura = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'NumSerieFactura')->item(0);
|
||||||
|
if ($numSerieFactura) {
|
||||||
|
$registroAnterior->setNumSerieFactura($numSerieFactura->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle FechaExpedicionFactura
|
||||||
|
$fechaExpedicionFactura = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'FechaExpedicionFactura')->item(0);
|
||||||
|
if ($fechaExpedicionFactura) {
|
||||||
|
$registroAnterior->setFechaExpedicionFactura($fechaExpedicionFactura->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle Huella
|
||||||
|
$huella = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Huella')->item(0);
|
||||||
|
if ($huella) {
|
||||||
|
$registroAnterior->setHuella($huella->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $registroAnterior;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdEmisorFactura(): string
|
||||||
|
{
|
||||||
|
return $this->idEmisorFactura;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdEmisorFactura(string $idEmisorFactura): self
|
||||||
|
{
|
||||||
|
$this->idEmisorFactura = $idEmisorFactura;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNumSerieFactura(): string
|
||||||
|
{
|
||||||
|
return $this->numSerieFactura;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNumSerieFactura(string $numSerieFactura): self
|
||||||
|
{
|
||||||
|
$this->numSerieFactura = $numSerieFactura;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFechaExpedicionFactura(): string
|
||||||
|
{
|
||||||
|
return $this->fechaExpedicionFactura;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFechaExpedicionFactura(string $fechaExpedicionFactura): self
|
||||||
|
{
|
||||||
|
$this->fechaExpedicionFactura = $fechaExpedicionFactura;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHuella(): string
|
||||||
|
{
|
||||||
|
return $this->huella;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setHuella(string $huella): self
|
||||||
|
{
|
||||||
|
$this->huella = $huella;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\EDocument\Standards\Verifactu\Models;
|
||||||
|
|
||||||
|
class FacturaRectificativa
|
||||||
|
{
|
||||||
|
private string $tipoRectificativa;
|
||||||
|
private float $baseRectificada;
|
||||||
|
private float $cuotaRectificada;
|
||||||
|
private ?float $cuotaRecargoRectificado;
|
||||||
|
private array $facturasRectificadas;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
string $tipoRectificativa,
|
||||||
|
float $baseRectificada,
|
||||||
|
float $cuotaRectificada,
|
||||||
|
?float $cuotaRecargoRectificado = null
|
||||||
|
) {
|
||||||
|
$this->tipoRectificativa = $tipoRectificativa;
|
||||||
|
$this->baseRectificada = $baseRectificada;
|
||||||
|
$this->cuotaRectificada = $cuotaRectificada;
|
||||||
|
$this->cuotaRecargoRectificado = $cuotaRecargoRectificado;
|
||||||
|
$this->facturasRectificadas = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTipoRectificativa(): string
|
||||||
|
{
|
||||||
|
return $this->tipoRectificativa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBaseRectificada(): float
|
||||||
|
{
|
||||||
|
return $this->baseRectificada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCuotaRectificada(): float
|
||||||
|
{
|
||||||
|
return $this->cuotaRectificada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCuotaRecargoRectificado(): ?float
|
||||||
|
{
|
||||||
|
return $this->cuotaRecargoRectificado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addFacturaRectificada(string $nif, string $numSerie, string $fecha): void
|
||||||
|
{
|
||||||
|
$this->facturasRectificadas[] = [
|
||||||
|
'nif' => $nif,
|
||||||
|
'numSerie' => $numSerie,
|
||||||
|
'fecha' => $fecha
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFacturasRectificadas(): array
|
||||||
|
{
|
||||||
|
return $this->facturasRectificadas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toXml(\DOMDocument $doc): \DOMElement
|
||||||
|
{
|
||||||
|
$idFacturaRectificada = $doc->createElementNS('https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd', 'sf:IDFacturaRectificada');
|
||||||
|
|
||||||
|
// Add required elements in order with proper namespace
|
||||||
|
$idEmisorFactura = $doc->createElementNS('https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd', 'sf:IDEmisorFactura');
|
||||||
|
$idEmisorFactura->nodeValue = $this->facturasRectificadas[0]['nif'];
|
||||||
|
$idFacturaRectificada->appendChild($idEmisorFactura);
|
||||||
|
|
||||||
|
$numSerieFactura = $doc->createElementNS('https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd', 'sf:NumSerieFactura');
|
||||||
|
$numSerieFactura->nodeValue = $this->facturasRectificadas[0]['numSerie'];
|
||||||
|
$idFacturaRectificada->appendChild($numSerieFactura);
|
||||||
|
|
||||||
|
$fechaExpedicionFactura = $doc->createElementNS('https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd', 'sf:FechaExpedicionFactura');
|
||||||
|
$fechaExpedicionFactura->nodeValue = $this->facturasRectificadas[0]['fecha'];
|
||||||
|
$idFacturaRectificada->appendChild($fechaExpedicionFactura);
|
||||||
|
|
||||||
|
return $idFacturaRectificada;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,841 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\EDocument\Standards\Verifactu\Models;
|
||||||
|
|
||||||
|
class Invoice extends BaseXmlModel
|
||||||
|
{
|
||||||
|
protected string $idVersion;
|
||||||
|
protected string $idFactura;
|
||||||
|
protected ?string $refExterna = null;
|
||||||
|
protected string $nombreRazonEmisor;
|
||||||
|
protected ?string $subsanacion = null;
|
||||||
|
protected ?string $rechazoPrevio = null;
|
||||||
|
protected string $tipoFactura;
|
||||||
|
protected ?string $tipoRectificativa = null;
|
||||||
|
protected ?array $facturasRectificadas = null;
|
||||||
|
protected ?array $facturasSustituidas = null;
|
||||||
|
protected ?float $importeRectificacion = null;
|
||||||
|
protected ?string $fechaOperacion = null;
|
||||||
|
protected string $descripcionOperacion;
|
||||||
|
protected ?string $facturaSimplificadaArt7273 = null;
|
||||||
|
protected ?string $facturaSinIdentifDestinatarioArt61d = null;
|
||||||
|
protected ?string $macrodato = null;
|
||||||
|
protected ?string $emitidaPorTerceroODestinatario = null;
|
||||||
|
protected ?PersonaFisicaJuridica $tercero = null;
|
||||||
|
protected ?array $destinatarios = null;
|
||||||
|
protected ?string $cupon = null;
|
||||||
|
protected Desglose $desglose;
|
||||||
|
protected float $cuotaTotal;
|
||||||
|
protected float $importeTotal;
|
||||||
|
protected Encadenamiento $encadenamiento;
|
||||||
|
protected SistemaInformatico $sistemaInformatico;
|
||||||
|
protected string $fechaHoraHusoGenRegistro;
|
||||||
|
protected ?string $numRegistroAcuerdoFacturacion = null;
|
||||||
|
protected ?string $idAcuerdoSistemaInformatico = null;
|
||||||
|
protected string $tipoHuella;
|
||||||
|
protected string $huella;
|
||||||
|
protected ?string $signature = null;
|
||||||
|
protected ?FacturaRectificativa $facturaRectificativa = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// Initialize required properties
|
||||||
|
$this->desglose = new Desglose();
|
||||||
|
$this->encadenamiento = new Encadenamiento();
|
||||||
|
$this->sistemaInformatico = new SistemaInformatico();
|
||||||
|
$this->tipoFactura = 'F1'; // Default to normal invoice
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters and setters for all properties
|
||||||
|
public function getIdVersion(): string
|
||||||
|
{
|
||||||
|
return $this->idVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdVersion(string $idVersion): self
|
||||||
|
{
|
||||||
|
$this->idVersion = $idVersion;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdFactura(): string
|
||||||
|
{
|
||||||
|
return $this->idFactura;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdFactura(string $idFactura): self
|
||||||
|
{
|
||||||
|
$this->idFactura = $idFactura;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRefExterna(): ?string
|
||||||
|
{
|
||||||
|
return $this->refExterna;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRefExterna(?string $refExterna): self
|
||||||
|
{
|
||||||
|
$this->refExterna = $refExterna;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNombreRazonEmisor(): string
|
||||||
|
{
|
||||||
|
return $this->nombreRazonEmisor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNombreRazonEmisor(string $nombreRazonEmisor): self
|
||||||
|
{
|
||||||
|
$this->nombreRazonEmisor = $nombreRazonEmisor;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubsanacion(): ?string
|
||||||
|
{
|
||||||
|
return $this->subsanacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSubsanacion(?string $subsanacion): self
|
||||||
|
{
|
||||||
|
$this->subsanacion = $subsanacion;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRechazoPrevio(): ?string
|
||||||
|
{
|
||||||
|
return $this->rechazoPrevio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRechazoPrevio(?string $rechazoPrevio): self
|
||||||
|
{
|
||||||
|
$this->rechazoPrevio = $rechazoPrevio;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTipoFactura(): string
|
||||||
|
{
|
||||||
|
return $this->tipoFactura;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTipoFactura(string $tipoFactura): self
|
||||||
|
{
|
||||||
|
$this->tipoFactura = $tipoFactura;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTipoRectificativa(): ?string
|
||||||
|
{
|
||||||
|
return $this->tipoRectificativa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTipoRectificativa(?string $tipoRectificativa): self
|
||||||
|
{
|
||||||
|
$this->tipoRectificativa = $tipoRectificativa;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFacturasRectificadas(): ?array
|
||||||
|
{
|
||||||
|
return $this->facturasRectificadas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFacturasRectificadas(?array $facturasRectificadas): self
|
||||||
|
{
|
||||||
|
$this->facturasRectificadas = $facturasRectificadas;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFacturasSustituidas(): ?array
|
||||||
|
{
|
||||||
|
return $this->facturasSustituidas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFacturasSustituidas(?array $facturasSustituidas): self
|
||||||
|
{
|
||||||
|
$this->facturasSustituidas = $facturasSustituidas;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImporteRectificacion(): ?float
|
||||||
|
{
|
||||||
|
return $this->importeRectificacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setImporteRectificacion(?float $importeRectificacion): self
|
||||||
|
{
|
||||||
|
$this->importeRectificacion = $importeRectificacion;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFechaOperacion(): ?string
|
||||||
|
{
|
||||||
|
return $this->fechaOperacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFechaOperacion(?string $fechaOperacion): self
|
||||||
|
{
|
||||||
|
$this->fechaOperacion = $fechaOperacion;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescripcionOperacion(): string
|
||||||
|
{
|
||||||
|
return $this->descripcionOperacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescripcionOperacion(string $descripcionOperacion): self
|
||||||
|
{
|
||||||
|
$this->descripcionOperacion = $descripcionOperacion;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFacturaSimplificadaArt7273(): ?string
|
||||||
|
{
|
||||||
|
return $this->facturaSimplificadaArt7273;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFacturaSimplificadaArt7273(?string $facturaSimplificadaArt7273): self
|
||||||
|
{
|
||||||
|
$this->facturaSimplificadaArt7273 = $facturaSimplificadaArt7273;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFacturaSinIdentifDestinatarioArt61d(): ?string
|
||||||
|
{
|
||||||
|
return $this->facturaSinIdentifDestinatarioArt61d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFacturaSinIdentifDestinatarioArt61d(?string $facturaSinIdentifDestinatarioArt61d): self
|
||||||
|
{
|
||||||
|
$this->facturaSinIdentifDestinatarioArt61d = $facturaSinIdentifDestinatarioArt61d;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMacrodato(): ?string
|
||||||
|
{
|
||||||
|
return $this->macrodato;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMacrodato(?string $macrodato): self
|
||||||
|
{
|
||||||
|
$this->macrodato = $macrodato;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmitidaPorTerceroODestinatario(): ?string
|
||||||
|
{
|
||||||
|
return $this->emitidaPorTerceroODestinatario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEmitidaPorTerceroODestinatario(?string $emitidaPorTerceroODestinatario): self
|
||||||
|
{
|
||||||
|
$this->emitidaPorTerceroODestinatario = $emitidaPorTerceroODestinatario;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTercero(): ?PersonaFisicaJuridica
|
||||||
|
{
|
||||||
|
return $this->tercero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTercero(?PersonaFisicaJuridica $tercero): self
|
||||||
|
{
|
||||||
|
$this->tercero = $tercero;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDestinatarios(): ?array
|
||||||
|
{
|
||||||
|
return $this->destinatarios;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDestinatarios(?array $destinatarios): self
|
||||||
|
{
|
||||||
|
if ($destinatarios !== null && count($destinatarios) > 1000) {
|
||||||
|
throw new \InvalidArgumentException('Maximum number of recipients (1000) exceeded');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure all elements are PersonaFisicaJuridica instances
|
||||||
|
if ($destinatarios !== null) {
|
||||||
|
foreach ($destinatarios as $destinatario) {
|
||||||
|
if (!($destinatario instanceof PersonaFisicaJuridica)) {
|
||||||
|
throw new \InvalidArgumentException('All recipients must be instances of PersonaFisicaJuridica');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->destinatarios = $destinatarios;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCupon(): ?string
|
||||||
|
{
|
||||||
|
return $this->cupon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCupon(?string $cupon): self
|
||||||
|
{
|
||||||
|
$this->cupon = $cupon;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDesglose(): Desglose
|
||||||
|
{
|
||||||
|
return $this->desglose;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDesglose(Desglose $desglose): self
|
||||||
|
{
|
||||||
|
$this->desglose = $desglose;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCuotaTotal(): float
|
||||||
|
{
|
||||||
|
return $this->cuotaTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCuotaTotal(float $cuotaTotal): self
|
||||||
|
{
|
||||||
|
$this->cuotaTotal = $cuotaTotal;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImporteTotal(): float
|
||||||
|
{
|
||||||
|
return $this->importeTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setImporteTotal(float $importeTotal): self
|
||||||
|
{
|
||||||
|
$this->importeTotal = $importeTotal;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEncadenamiento(): Encadenamiento
|
||||||
|
{
|
||||||
|
return $this->encadenamiento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEncadenamiento(Encadenamiento $encadenamiento): self
|
||||||
|
{
|
||||||
|
$this->encadenamiento = $encadenamiento;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSistemaInformatico(): SistemaInformatico
|
||||||
|
{
|
||||||
|
return $this->sistemaInformatico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSistemaInformatico(SistemaInformatico $sistemaInformatico): self
|
||||||
|
{
|
||||||
|
$this->sistemaInformatico = $sistemaInformatico;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFechaHoraHusoGenRegistro(): string
|
||||||
|
{
|
||||||
|
return $this->fechaHoraHusoGenRegistro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFechaHoraHusoGenRegistro(string $fechaHoraHusoGenRegistro): self
|
||||||
|
{
|
||||||
|
$this->fechaHoraHusoGenRegistro = $fechaHoraHusoGenRegistro;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNumRegistroAcuerdoFacturacion(): ?string
|
||||||
|
{
|
||||||
|
return $this->numRegistroAcuerdoFacturacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNumRegistroAcuerdoFacturacion(?string $numRegistroAcuerdoFacturacion): self
|
||||||
|
{
|
||||||
|
$this->numRegistroAcuerdoFacturacion = $numRegistroAcuerdoFacturacion;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdAcuerdoSistemaInformatico(): ?string
|
||||||
|
{
|
||||||
|
return $this->idAcuerdoSistemaInformatico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdAcuerdoSistemaInformatico(?string $idAcuerdoSistemaInformatico): self
|
||||||
|
{
|
||||||
|
$this->idAcuerdoSistemaInformatico = $idAcuerdoSistemaInformatico;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTipoHuella(): string
|
||||||
|
{
|
||||||
|
return $this->tipoHuella;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTipoHuella(string $tipoHuella): self
|
||||||
|
{
|
||||||
|
$this->tipoHuella = $tipoHuella;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHuella(): string
|
||||||
|
{
|
||||||
|
return $this->huella;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setHuella(string $huella): self
|
||||||
|
{
|
||||||
|
$this->huella = $huella;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSignature(): ?string
|
||||||
|
{
|
||||||
|
return $this->signature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSignature(?string $signature): self
|
||||||
|
{
|
||||||
|
$this->signature = $signature;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFacturaRectificativa(): ?FacturaRectificativa
|
||||||
|
{
|
||||||
|
return $this->facturaRectificativa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFacturaRectificativa(FacturaRectificativa $facturaRectificativa): void
|
||||||
|
{
|
||||||
|
$this->facturaRectificativa = $facturaRectificativa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toXml(): string
|
||||||
|
{
|
||||||
|
// Validate required fields first, outside of try-catch
|
||||||
|
$requiredFields = [
|
||||||
|
'idVersion' => 'IDVersion',
|
||||||
|
'idFactura' => 'NumSerieFactura',
|
||||||
|
'nombreRazonEmisor' => 'NombreRazonEmisor',
|
||||||
|
'tipoFactura' => 'TipoFactura',
|
||||||
|
'descripcionOperacion' => 'DescripcionOperacion',
|
||||||
|
'cuotaTotal' => 'CuotaTotal',
|
||||||
|
'importeTotal' => 'ImporteTotal',
|
||||||
|
'fechaHoraHusoGenRegistro' => 'FechaHoraHusoGenRegistro',
|
||||||
|
'tipoHuella' => 'TipoHuella',
|
||||||
|
'huella' => 'Huella'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($requiredFields as $property => $fieldName) {
|
||||||
|
if (!isset($this->$property)) {
|
||||||
|
throw new \InvalidArgumentException("Missing required field: $fieldName");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$doc = new \DOMDocument('1.0', 'UTF-8');
|
||||||
|
$doc->preserveWhiteSpace = false;
|
||||||
|
$doc->formatOutput = true;
|
||||||
|
|
||||||
|
// Create root element with proper namespaces
|
||||||
|
$root = $doc->createElementNS(self::XML_NAMESPACE, self::XML_NAMESPACE_PREFIX . ':RegistroAlta');
|
||||||
|
$root->setAttribute('xmlns:ds', self::XML_DS_NAMESPACE);
|
||||||
|
$doc->appendChild($root);
|
||||||
|
|
||||||
|
// Add required elements in exact order according to schema
|
||||||
|
$root->appendChild($this->createElement($doc, 'IDVersion', $this->idVersion));
|
||||||
|
|
||||||
|
// Create IDFactura structure
|
||||||
|
$idFactura = $this->createElement($doc, 'IDFactura');
|
||||||
|
$idFactura->appendChild($this->createElement($doc, 'IDEmisorFactura', $this->tercero?->getNif() ?? 'B12345678'));
|
||||||
|
$idFactura->appendChild($this->createElement($doc, 'NumSerieFactura', $this->idFactura));
|
||||||
|
$idFactura->appendChild($this->createElement($doc, 'FechaExpedicionFactura', date('d-m-Y')));
|
||||||
|
$root->appendChild($idFactura);
|
||||||
|
|
||||||
|
if ($this->refExterna !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'RefExterna', $this->refExterna));
|
||||||
|
}
|
||||||
|
|
||||||
|
$root->appendChild($this->createElement($doc, 'NombreRazonEmisor', $this->nombreRazonEmisor));
|
||||||
|
|
||||||
|
if ($this->subsanacion !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'Subsanacion', $this->subsanacion));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->rechazoPrevio !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'RechazoPrevio', $this->rechazoPrevio));
|
||||||
|
}
|
||||||
|
|
||||||
|
$root->appendChild($this->createElement($doc, 'TipoFactura', $this->tipoFactura));
|
||||||
|
|
||||||
|
// Add TipoRectificativa and related elements for rectification invoices
|
||||||
|
if ($this->tipoFactura === 'R1' && $this->facturaRectificativa !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'TipoRectificativa', $this->facturaRectificativa->getTipoRectificativa()));
|
||||||
|
|
||||||
|
// Add FacturasRectificadas
|
||||||
|
$facturasRectificadas = $this->createElement($doc, 'FacturasRectificadas');
|
||||||
|
$facturasRectificadas->appendChild($this->facturaRectificativa->toXml($doc));
|
||||||
|
$root->appendChild($facturasRectificadas);
|
||||||
|
|
||||||
|
// Add ImporteRectificacion
|
||||||
|
$importeRectificacion = $this->createElement($doc, 'ImporteRectificacion');
|
||||||
|
$importeRectificacion->appendChild($this->createElement($doc, 'BaseRectificada',
|
||||||
|
number_format($this->facturaRectificativa->getBaseRectificada(), 2, '.', '')));
|
||||||
|
$importeRectificacion->appendChild($this->createElement($doc, 'CuotaRectificada',
|
||||||
|
number_format($this->facturaRectificativa->getCuotaRectificada(), 2, '.', '')));
|
||||||
|
|
||||||
|
if ($this->facturaRectificativa->getCuotaRecargoRectificado() !== null) {
|
||||||
|
$importeRectificacion->appendChild($this->createElement($doc, 'CuotaRecargoRectificado',
|
||||||
|
number_format($this->facturaRectificativa->getCuotaRecargoRectificado(), 2, '.', '')));
|
||||||
|
}
|
||||||
|
|
||||||
|
$root->appendChild($importeRectificacion);
|
||||||
|
}
|
||||||
|
|
||||||
|
$root->appendChild($this->createElement($doc, 'DescripcionOperacion', $this->descripcionOperacion));
|
||||||
|
|
||||||
|
if ($this->facturaSimplificadaArt7273 !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'FacturaSimplificadaArt7273', $this->facturaSimplificadaArt7273));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->facturaSinIdentifDestinatarioArt61d !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'FacturaSinIdentifDestinatarioArt61d', $this->facturaSinIdentifDestinatarioArt61d));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->macrodato !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'Macrodato', $this->macrodato));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->emitidaPorTerceroODestinatario !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'EmitidaPorTerceroODestinatario', $this->emitidaPorTerceroODestinatario));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add tercero if present
|
||||||
|
if ($this->tercero !== null) {
|
||||||
|
$terceroElement = $this->createElement($doc, 'Tercero');
|
||||||
|
$terceroElement->appendChild($this->createElement($doc, 'NombreRazon', $this->tercero->getRazonSocial()));
|
||||||
|
$terceroElement->appendChild($this->createElement($doc, 'NIF', $this->tercero->getNif()));
|
||||||
|
$root->appendChild($terceroElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add destinatarios if present
|
||||||
|
if ($this->destinatarios !== null && count($this->destinatarios) > 0) {
|
||||||
|
$destinatariosElement = $this->createElement($doc, 'Destinatarios');
|
||||||
|
foreach ($this->destinatarios as $destinatario) {
|
||||||
|
$idDestinatarioElement = $this->createElement($doc, 'IDDestinatario');
|
||||||
|
$idDestinatarioElement->appendChild($this->createElement($doc, 'NombreRazon', $destinatario->getNombreRazon() ?? $destinatario->getRazonSocial()));
|
||||||
|
|
||||||
|
// Handle either NIF or IDOtro
|
||||||
|
if ($destinatario->getNif() !== null) {
|
||||||
|
$idDestinatarioElement->appendChild($this->createElement($doc, 'NIF', $destinatario->getNif()));
|
||||||
|
} else {
|
||||||
|
$idOtroElement = $this->createElement($doc, 'IDOtro');
|
||||||
|
if ($destinatario->getPais() !== null) {
|
||||||
|
$idOtroElement->appendChild($this->createElement($doc, 'CodigoPais', $destinatario->getPais()));
|
||||||
|
}
|
||||||
|
$idOtroElement->appendChild($this->createElement($doc, 'IDType', $destinatario->getTipoIdentificacion()));
|
||||||
|
$idOtroElement->appendChild($this->createElement($doc, 'ID', $destinatario->getIdOtro()));
|
||||||
|
$idDestinatarioElement->appendChild($idOtroElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
$destinatariosElement->appendChild($idDestinatarioElement);
|
||||||
|
}
|
||||||
|
$root->appendChild($destinatariosElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add desglose
|
||||||
|
try {
|
||||||
|
$desgloseXml = $this->desglose->toXml();
|
||||||
|
$desgloseDoc = new \DOMDocument();
|
||||||
|
if (!$desgloseDoc->loadXML($desgloseXml)) {
|
||||||
|
error_log("Failed to load desglose XML");
|
||||||
|
throw new \DOMException('Failed to load desglose XML');
|
||||||
|
}
|
||||||
|
$desgloseNode = $doc->importNode($desgloseDoc->documentElement, true);
|
||||||
|
// Remove any existing namespace declarations
|
||||||
|
foreach (['xmlns:sf', 'xmlns:ds'] as $attr) {
|
||||||
|
if ($desgloseNode->hasAttribute($attr)) {
|
||||||
|
$desgloseNode->removeAttribute($attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$root->appendChild($desgloseNode);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
error_log("Error in desglose: " . $e->getMessage());
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add CuotaTotal and ImporteTotal
|
||||||
|
$root->appendChild($this->createElement($doc, 'CuotaTotal', number_format($this->cuotaTotal, 2, '.', '')));
|
||||||
|
$root->appendChild($this->createElement($doc, 'ImporteTotal', number_format($this->importeTotal, 2, '.', '')));
|
||||||
|
|
||||||
|
// Add encadenamiento
|
||||||
|
try {
|
||||||
|
$encadenamientoXml = $this->encadenamiento->toXml();
|
||||||
|
$encadenamientoDoc = new \DOMDocument();
|
||||||
|
if (!$encadenamientoDoc->loadXML($encadenamientoXml)) {
|
||||||
|
error_log("Failed to load encadenamiento XML");
|
||||||
|
throw new \DOMException('Failed to load encadenamiento XML');
|
||||||
|
}
|
||||||
|
$encadenamientoNode = $doc->importNode($encadenamientoDoc->documentElement, true);
|
||||||
|
$root->appendChild($encadenamientoNode);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
error_log("Error in encadenamiento: " . $e->getMessage());
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add sistema informatico
|
||||||
|
$sistemaElement = $this->createElement($doc, 'SistemaInformatico');
|
||||||
|
$sistemaElement->appendChild($this->createElement($doc, 'NombreRazon', $this->sistemaInformatico->getNombreRazon()));
|
||||||
|
$sistemaElement->appendChild($this->createElement($doc, 'NIF', $this->sistemaInformatico->getNif()));
|
||||||
|
$sistemaElement->appendChild($this->createElement($doc, 'NombreSistemaInformatico', $this->sistemaInformatico->getNombreSistemaInformatico()));
|
||||||
|
$sistemaElement->appendChild($this->createElement($doc, 'IdSistemaInformatico', $this->sistemaInformatico->getIdSistemaInformatico()));
|
||||||
|
$sistemaElement->appendChild($this->createElement($doc, 'Version', $this->sistemaInformatico->getVersion()));
|
||||||
|
$sistemaElement->appendChild($this->createElement($doc, 'NumeroInstalacion', $this->sistemaInformatico->getNumeroInstalacion()));
|
||||||
|
$sistemaElement->appendChild($this->createElement($doc, 'TipoUsoPosibleSoloVerifactu', $this->sistemaInformatico->getTipoUsoPosibleSoloVerifactu()));
|
||||||
|
$sistemaElement->appendChild($this->createElement($doc, 'TipoUsoPosibleMultiOT', $this->sistemaInformatico->getTipoUsoPosibleMultiOT()));
|
||||||
|
$sistemaElement->appendChild($this->createElement($doc, 'IndicadorMultiplesOT', $this->sistemaInformatico->getIndicadorMultiplesOT()));
|
||||||
|
$root->appendChild($sistemaElement);
|
||||||
|
|
||||||
|
// Add remaining required fields
|
||||||
|
$root->appendChild($this->createElement($doc, 'FechaHoraHusoGenRegistro', $this->fechaHoraHusoGenRegistro));
|
||||||
|
|
||||||
|
if ($this->numRegistroAcuerdoFacturacion !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'NumRegistroAcuerdoFacturacion', $this->numRegistroAcuerdoFacturacion));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->idAcuerdoSistemaInformatico !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'IDAcuerdoSistemaInformatico', $this->idAcuerdoSistemaInformatico));
|
||||||
|
}
|
||||||
|
|
||||||
|
$root->appendChild($this->createElement($doc, 'TipoHuella', $this->tipoHuella));
|
||||||
|
$root->appendChild($this->createElement($doc, 'Huella', $this->huella));
|
||||||
|
|
||||||
|
// Add signature if present
|
||||||
|
if ($this->signature !== null) {
|
||||||
|
$signatureElement = $this->createDsElement($doc, 'Signature', $this->signature);
|
||||||
|
$root->appendChild($signatureElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml = $doc->saveXML($root);
|
||||||
|
// error_log("Generated XML: " . $xml);
|
||||||
|
return $xml;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
error_log("Error in toXml: " . $e->getMessage());
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromXml($xml): self
|
||||||
|
{
|
||||||
|
if ($xml instanceof \DOMElement) {
|
||||||
|
return static::fromDOMElement($xml);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_string($xml)) {
|
||||||
|
throw new \InvalidArgumentException('Input must be either a string or DOMElement');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable user error handling for XML parsing
|
||||||
|
$previousErrorSetting = libxml_use_internal_errors(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$doc = new \DOMDocument();
|
||||||
|
if (!$doc->loadXML($xml)) {
|
||||||
|
$errors = libxml_get_errors();
|
||||||
|
libxml_clear_errors();
|
||||||
|
throw new \DOMException('Failed to load XML: ' . ($errors ? $errors[0]->message : 'Invalid XML format'));
|
||||||
|
}
|
||||||
|
return static::fromDOMElement($doc->documentElement);
|
||||||
|
} finally {
|
||||||
|
// Restore previous error handling setting
|
||||||
|
libxml_use_internal_errors($previousErrorSetting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromDOMElement(\DOMElement $element): self
|
||||||
|
{
|
||||||
|
$invoice = new self();
|
||||||
|
|
||||||
|
// Parse IDVersion
|
||||||
|
$idVersionElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'IDVersion')->item(0);
|
||||||
|
if ($idVersionElement) {
|
||||||
|
$invoice->setIDVersion($idVersionElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse IDFactura
|
||||||
|
$idFacturaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'IDFactura')->item(0);
|
||||||
|
if ($idFacturaElement) {
|
||||||
|
$numSerieFacturaElement = $idFacturaElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'NumSerieFactura')->item(0);
|
||||||
|
if ($numSerieFacturaElement) {
|
||||||
|
$invoice->setIdFactura($numSerieFacturaElement->nodeValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse RefExterna
|
||||||
|
$refExternaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'RefExterna')->item(0);
|
||||||
|
if ($refExternaElement) {
|
||||||
|
$invoice->setRefExterna($refExternaElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse NombreRazonEmisor
|
||||||
|
$nombreRazonEmisorElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'NombreRazonEmisor')->item(0);
|
||||||
|
if ($nombreRazonEmisorElement) {
|
||||||
|
$invoice->setNombreRazonEmisor($nombreRazonEmisorElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse EmitidaPorTerceroODestinatario
|
||||||
|
$emitidaPorTerceroElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'EmitidaPorTerceroODestinatario')->item(0);
|
||||||
|
if ($emitidaPorTerceroElement) {
|
||||||
|
$invoice->setEmitidaPorTerceroODestinatario($emitidaPorTerceroElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse TipoFactura
|
||||||
|
$tipoFacturaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'TipoFactura')->item(0);
|
||||||
|
if ($tipoFacturaElement) {
|
||||||
|
$invoice->setTipoFactura($tipoFacturaElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse TipoRectificativa
|
||||||
|
$tipoRectificativaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'TipoRectificativa')->item(0);
|
||||||
|
if ($tipoRectificativaElement) {
|
||||||
|
$invoice->setTipoRectificativa($tipoRectificativaElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse DescripcionOperacion
|
||||||
|
$descripcionOperacionElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'DescripcionOperacion')->item(0);
|
||||||
|
if ($descripcionOperacionElement) {
|
||||||
|
$invoice->setDescripcionOperacion($descripcionOperacionElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse FacturaSimplificadaArt7273
|
||||||
|
$facturaSimplificadaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'FacturaSimplificadaArt7273')->item(0);
|
||||||
|
if ($facturaSimplificadaElement) {
|
||||||
|
$invoice->setFacturaSimplificadaArt7273($facturaSimplificadaElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse FacturaSinIdentifDestinatarioArt61d
|
||||||
|
$facturaSinIdentifElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'FacturaSinIdentifDestinatarioArt61d')->item(0);
|
||||||
|
if ($facturaSinIdentifElement) {
|
||||||
|
$invoice->setFacturaSinIdentifDestinatarioArt61d($facturaSinIdentifElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse Macrodato
|
||||||
|
$macrodatoElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Macrodato')->item(0);
|
||||||
|
if ($macrodatoElement) {
|
||||||
|
$invoice->setMacrodato($macrodatoElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse Tercero
|
||||||
|
$terceroElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Tercero')->item(0);
|
||||||
|
if ($terceroElement) {
|
||||||
|
$tercero = new PersonaFisicaJuridica();
|
||||||
|
|
||||||
|
// Get NombreRazon
|
||||||
|
$nombreRazonElement = $terceroElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'NombreRazon')->item(0);
|
||||||
|
if ($nombreRazonElement) {
|
||||||
|
$tercero->setRazonSocial($nombreRazonElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get NIF
|
||||||
|
$nifElement = $terceroElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'NIF')->item(0);
|
||||||
|
if ($nifElement) {
|
||||||
|
$tercero->setNif($nifElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$invoice->setTercero($tercero);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse Desglose
|
||||||
|
$desgloseElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Desglose')->item(0);
|
||||||
|
if ($desgloseElement) {
|
||||||
|
$invoice->setDesglose(Desglose::fromDOMElement($desgloseElement));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse CuotaTotal
|
||||||
|
$cuotaTotalElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'CuotaTotal')->item(0);
|
||||||
|
if ($cuotaTotalElement) {
|
||||||
|
$invoice->setCuotaTotal((float)$cuotaTotalElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse ImporteTotal
|
||||||
|
$importeTotalElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'ImporteTotal')->item(0);
|
||||||
|
if ($importeTotalElement) {
|
||||||
|
$invoice->setImporteTotal((float)$importeTotalElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse Encadenamiento
|
||||||
|
$encadenamientoElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Encadenamiento')->item(0);
|
||||||
|
if ($encadenamientoElement) {
|
||||||
|
$invoice->setEncadenamiento(Encadenamiento::fromDOMElement($encadenamientoElement));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse SistemaInformatico
|
||||||
|
$sistemaInformaticoElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'SistemaInformatico')->item(0);
|
||||||
|
if ($sistemaInformaticoElement) {
|
||||||
|
$invoice->setSistemaInformatico(SistemaInformatico::fromDOMElement($sistemaInformaticoElement));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse FechaHoraHusoGenRegistro
|
||||||
|
$fechaHoraElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'FechaHoraHusoGenRegistro')->item(0);
|
||||||
|
if ($fechaHoraElement) {
|
||||||
|
$invoice->setFechaHoraHusoGenRegistro($fechaHoraElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse TipoHuella
|
||||||
|
$tipoHuellaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'TipoHuella')->item(0);
|
||||||
|
if ($tipoHuellaElement) {
|
||||||
|
$invoice->setTipoHuella($tipoHuellaElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse Huella
|
||||||
|
$huellaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Huella')->item(0);
|
||||||
|
if ($huellaElement) {
|
||||||
|
$invoice->setHuella($huellaElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse Destinatarios
|
||||||
|
$destinatariosElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Destinatarios')->item(0);
|
||||||
|
if ($destinatariosElement) {
|
||||||
|
$destinatarios = [];
|
||||||
|
$idDestinatarioElements = $destinatariosElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'IDDestinatario');
|
||||||
|
foreach ($idDestinatarioElements as $idDestinatarioElement) {
|
||||||
|
$destinatario = new PersonaFisicaJuridica();
|
||||||
|
|
||||||
|
// Get NombreRazon
|
||||||
|
$nombreRazonElement = $idDestinatarioElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'NombreRazon')->item(0);
|
||||||
|
if ($nombreRazonElement) {
|
||||||
|
$destinatario->setNombreRazon($nombreRazonElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get either NIF or IDOtro
|
||||||
|
$nifElement = $idDestinatarioElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'NIF')->item(0);
|
||||||
|
if ($nifElement) {
|
||||||
|
$destinatario->setNif($nifElement->nodeValue);
|
||||||
|
} else {
|
||||||
|
$idOtroElement = $idDestinatarioElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'IDOtro')->item(0);
|
||||||
|
if ($idOtroElement) {
|
||||||
|
$codigoPaisElement = $idOtroElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'CodigoPais')->item(0);
|
||||||
|
$idTypeElement = $idOtroElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'IDType')->item(0);
|
||||||
|
$idElement = $idOtroElement->getElementsByTagNameNS(self::XML_NAMESPACE, 'ID')->item(0);
|
||||||
|
|
||||||
|
if ($codigoPaisElement) {
|
||||||
|
$destinatario->setPais($codigoPaisElement->nodeValue);
|
||||||
|
}
|
||||||
|
if ($idTypeElement) {
|
||||||
|
$destinatario->setTipoIdentificacion($idTypeElement->nodeValue);
|
||||||
|
}
|
||||||
|
if ($idElement) {
|
||||||
|
$destinatario->setIdOtro($idElement->nodeValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$destinatarios[] = $destinatario;
|
||||||
|
}
|
||||||
|
$invoice->setDestinatarios($destinatarios);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $invoice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,211 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\EDocument\Standards\Verifactu\Models;
|
||||||
|
|
||||||
|
use App\Services\EDocument\Standards\Verifactu\Models\BaseXmlModel;
|
||||||
|
|
||||||
|
class PersonaFisicaJuridica extends BaseXmlModel
|
||||||
|
{
|
||||||
|
protected ?string $nif = null;
|
||||||
|
protected ?string $nombreRazon = null;
|
||||||
|
protected ?string $apellidos = null;
|
||||||
|
protected ?string $nombre = null;
|
||||||
|
protected ?string $razonSocial = null;
|
||||||
|
protected ?string $tipoIdentificacion = null;
|
||||||
|
protected ?string $idOtro = null;
|
||||||
|
protected ?string $pais = null;
|
||||||
|
|
||||||
|
public function getNif(): ?string
|
||||||
|
{
|
||||||
|
return $this->nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNif(?string $nif): self
|
||||||
|
{
|
||||||
|
$this->nif = $nif;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNombreRazon(): ?string
|
||||||
|
{
|
||||||
|
return $this->nombreRazon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNombreRazon(?string $nombreRazon): self
|
||||||
|
{
|
||||||
|
$this->nombreRazon = $nombreRazon;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getApellidos(): ?string
|
||||||
|
{
|
||||||
|
return $this->apellidos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setApellidos(?string $apellidos): self
|
||||||
|
{
|
||||||
|
$this->apellidos = $apellidos;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNombre(): ?string
|
||||||
|
{
|
||||||
|
return $this->nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNombre(?string $nombre): self
|
||||||
|
{
|
||||||
|
$this->nombre = $nombre;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRazonSocial(): ?string
|
||||||
|
{
|
||||||
|
return $this->razonSocial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRazonSocial(?string $razonSocial): self
|
||||||
|
{
|
||||||
|
$this->razonSocial = $razonSocial;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTipoIdentificacion(): ?string
|
||||||
|
{
|
||||||
|
return $this->tipoIdentificacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTipoIdentificacion(?string $tipoIdentificacion): self
|
||||||
|
{
|
||||||
|
$this->tipoIdentificacion = $tipoIdentificacion;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdOtro(): ?string
|
||||||
|
{
|
||||||
|
return $this->idOtro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdOtro(?string $idOtro): self
|
||||||
|
{
|
||||||
|
$this->idOtro = $idOtro;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPais(): ?string
|
||||||
|
{
|
||||||
|
return $this->pais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPais(?string $pais): self
|
||||||
|
{
|
||||||
|
$this->pais = $pais;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toXml(): string
|
||||||
|
{
|
||||||
|
$doc = new \DOMDocument('1.0', 'UTF-8');
|
||||||
|
$doc->formatOutput = true;
|
||||||
|
|
||||||
|
$root = $this->createElement($doc, 'PersonaFisicaJuridica');
|
||||||
|
$doc->appendChild($root);
|
||||||
|
|
||||||
|
if ($this->nif !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'NIF', $this->nif));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->nombreRazon !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'NombreRazon', $this->nombreRazon));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->apellidos !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'Apellidos', $this->apellidos));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->nombre !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'Nombre', $this->nombre));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->razonSocial !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'RazonSocial', $this->razonSocial));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->tipoIdentificacion !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'TipoIdentificacion', $this->tipoIdentificacion));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->idOtro !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'IDOtro', $this->idOtro));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->pais !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'Pais', $this->pais));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $doc->saveXML($root);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a PersonaFisicaJuridica instance from XML string or DOMElement
|
||||||
|
*/
|
||||||
|
public static function fromXml($xml): BaseXmlModel
|
||||||
|
{
|
||||||
|
if (is_string($xml)) {
|
||||||
|
$doc = new \DOMDocument();
|
||||||
|
$doc->loadXML($xml);
|
||||||
|
$element = $doc->documentElement;
|
||||||
|
} else {
|
||||||
|
$element = $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::fromDOMElement($element);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromDOMElement(\DOMElement $element): self
|
||||||
|
{
|
||||||
|
$persona = new self();
|
||||||
|
|
||||||
|
$nifElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'NIF')->item(0);
|
||||||
|
if ($nifElement) {
|
||||||
|
$persona->setNif($nifElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$nombreRazonElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'NombreRazon')->item(0);
|
||||||
|
if ($nombreRazonElement) {
|
||||||
|
$persona->setNombreRazon($nombreRazonElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$apellidosElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Apellidos')->item(0);
|
||||||
|
if ($apellidosElement) {
|
||||||
|
$persona->setApellidos($apellidosElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$nombreElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Nombre')->item(0);
|
||||||
|
if ($nombreElement) {
|
||||||
|
$persona->setNombre($nombreElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$razonSocialElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'RazonSocial')->item(0);
|
||||||
|
if ($razonSocialElement) {
|
||||||
|
$persona->setRazonSocial($razonSocialElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tipoIdentificacionElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'TipoIdentificacion')->item(0);
|
||||||
|
if ($tipoIdentificacionElement) {
|
||||||
|
$persona->setTipoIdentificacion($tipoIdentificacionElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$idOtroElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'IDOtro')->item(0);
|
||||||
|
if ($idOtroElement) {
|
||||||
|
$persona->setIdOtro($idOtroElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$paisElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Pais')->item(0);
|
||||||
|
if ($paisElement) {
|
||||||
|
$persona->setPais($paisElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $persona;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,233 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\EDocument\Standards\Verifactu\Models;
|
||||||
|
|
||||||
|
class SistemaInformatico extends BaseXmlModel
|
||||||
|
{
|
||||||
|
protected string $nombreRazon;
|
||||||
|
protected ?string $nif = null;
|
||||||
|
protected ?string $idOtro = null;
|
||||||
|
protected string $nombreSistemaInformatico;
|
||||||
|
protected string $idSistemaInformatico;
|
||||||
|
protected string $version;
|
||||||
|
protected string $numeroInstalacion;
|
||||||
|
protected string $tipoUsoPosibleSoloVerifactu = 'S';
|
||||||
|
protected string $tipoUsoPosibleMultiOT = 'S';
|
||||||
|
protected string $indicadorMultiplesOT = 'S';
|
||||||
|
|
||||||
|
public function toXml(): string
|
||||||
|
{
|
||||||
|
$doc = new \DOMDocument('1.0', 'UTF-8');
|
||||||
|
$doc->formatOutput = true;
|
||||||
|
|
||||||
|
$root = $this->createElement($doc, 'SistemaInformatico');
|
||||||
|
$doc->appendChild($root);
|
||||||
|
|
||||||
|
// Add nombreRazon
|
||||||
|
$root->appendChild($this->createElement($doc, 'NombreRazon', $this->nombreRazon));
|
||||||
|
|
||||||
|
// Add either NIF or IDOtro
|
||||||
|
if ($this->nif !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'NIF', $this->nif));
|
||||||
|
} elseif ($this->idOtro !== null) {
|
||||||
|
$root->appendChild($this->createElement($doc, 'IDOtro', $this->idOtro));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add remaining elements
|
||||||
|
$root->appendChild($this->createElement($doc, 'NombreSistemaInformatico', $this->nombreSistemaInformatico));
|
||||||
|
$root->appendChild($this->createElement($doc, 'IdSistemaInformatico', $this->idSistemaInformatico));
|
||||||
|
$root->appendChild($this->createElement($doc, 'Version', $this->version));
|
||||||
|
$root->appendChild($this->createElement($doc, 'NumeroInstalacion', $this->numeroInstalacion));
|
||||||
|
$root->appendChild($this->createElement($doc, 'TipoUsoPosibleSoloVerifactu', $this->tipoUsoPosibleSoloVerifactu));
|
||||||
|
$root->appendChild($this->createElement($doc, 'TipoUsoPosibleMultiOT', $this->tipoUsoPosibleMultiOT));
|
||||||
|
$root->appendChild($this->createElement($doc, 'IndicadorMultiplesOT', $this->indicadorMultiplesOT));
|
||||||
|
|
||||||
|
return $doc->saveXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a SistemaInformatico instance from XML string
|
||||||
|
*/
|
||||||
|
public static function fromXml($xml): BaseXmlModel
|
||||||
|
{
|
||||||
|
if (is_string($xml)) {
|
||||||
|
$doc = new \DOMDocument();
|
||||||
|
$doc->loadXML($xml);
|
||||||
|
$element = $doc->documentElement;
|
||||||
|
} else {
|
||||||
|
$element = $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::fromDOMElement($element);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromDOMElement(\DOMElement $element): self
|
||||||
|
{
|
||||||
|
$sistemaInformatico = new self();
|
||||||
|
|
||||||
|
// Parse NombreRazon
|
||||||
|
$nombreRazonElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'NombreRazon')->item(0);
|
||||||
|
if ($nombreRazonElement) {
|
||||||
|
$sistemaInformatico->setNombreRazon($nombreRazonElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse NIF or IDOtro
|
||||||
|
$nifElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'NIF')->item(0);
|
||||||
|
if ($nifElement) {
|
||||||
|
$sistemaInformatico->setNif($nifElement->nodeValue);
|
||||||
|
} else {
|
||||||
|
$idOtroElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'IDOtro')->item(0);
|
||||||
|
if ($idOtroElement) {
|
||||||
|
$sistemaInformatico->setIdOtro($idOtroElement->nodeValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse remaining elements
|
||||||
|
$nombreSistemaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'NombreSistemaInformatico')->item(0);
|
||||||
|
if ($nombreSistemaElement) {
|
||||||
|
$sistemaInformatico->setNombreSistemaInformatico($nombreSistemaElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$idSistemaElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'IdSistemaInformatico')->item(0);
|
||||||
|
if ($idSistemaElement) {
|
||||||
|
$sistemaInformatico->setIdSistemaInformatico($idSistemaElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$versionElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'Version')->item(0);
|
||||||
|
if ($versionElement) {
|
||||||
|
$sistemaInformatico->setVersion($versionElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$numeroInstalacionElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'NumeroInstalacion')->item(0);
|
||||||
|
if ($numeroInstalacionElement) {
|
||||||
|
$sistemaInformatico->setNumeroInstalacion($numeroInstalacionElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tipoUsoPosibleSoloVerifactuElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'TipoUsoPosibleSoloVerifactu')->item(0);
|
||||||
|
if ($tipoUsoPosibleSoloVerifactuElement) {
|
||||||
|
$sistemaInformatico->setTipoUsoPosibleSoloVerifactu($tipoUsoPosibleSoloVerifactuElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tipoUsoPosibleMultiOTElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'TipoUsoPosibleMultiOT')->item(0);
|
||||||
|
if ($tipoUsoPosibleMultiOTElement) {
|
||||||
|
$sistemaInformatico->setTipoUsoPosibleMultiOT($tipoUsoPosibleMultiOTElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$indicadorMultiplesOTElement = $element->getElementsByTagNameNS(self::XML_NAMESPACE, 'IndicadorMultiplesOT')->item(0);
|
||||||
|
if ($indicadorMultiplesOTElement) {
|
||||||
|
$sistemaInformatico->setIndicadorMultiplesOT($indicadorMultiplesOTElement->nodeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sistemaInformatico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNombreRazon(): string
|
||||||
|
{
|
||||||
|
return $this->nombreRazon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNombreRazon(string $nombreRazon): self
|
||||||
|
{
|
||||||
|
$this->nombreRazon = $nombreRazon;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNif(): ?string
|
||||||
|
{
|
||||||
|
return $this->nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNif(?string $nif): self
|
||||||
|
{
|
||||||
|
$this->nif = $nif;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdOtro(): ?string
|
||||||
|
{
|
||||||
|
return $this->idOtro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdOtro(?string $idOtro): self
|
||||||
|
{
|
||||||
|
$this->idOtro = $idOtro;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNombreSistemaInformatico(): string
|
||||||
|
{
|
||||||
|
return $this->nombreSistemaInformatico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNombreSistemaInformatico(string $nombreSistemaInformatico): self
|
||||||
|
{
|
||||||
|
$this->nombreSistemaInformatico = $nombreSistemaInformatico;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdSistemaInformatico(): string
|
||||||
|
{
|
||||||
|
return $this->idSistemaInformatico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdSistemaInformatico(string $idSistemaInformatico): self
|
||||||
|
{
|
||||||
|
$this->idSistemaInformatico = $idSistemaInformatico;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVersion(): string
|
||||||
|
{
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setVersion(string $version): self
|
||||||
|
{
|
||||||
|
$this->version = $version;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNumeroInstalacion(): string
|
||||||
|
{
|
||||||
|
return $this->numeroInstalacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNumeroInstalacion(string $numeroInstalacion): self
|
||||||
|
{
|
||||||
|
$this->numeroInstalacion = $numeroInstalacion;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTipoUsoPosibleSoloVerifactu(): string
|
||||||
|
{
|
||||||
|
return $this->tipoUsoPosibleSoloVerifactu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTipoUsoPosibleSoloVerifactu(string $tipoUsoPosibleSoloVerifactu): self
|
||||||
|
{
|
||||||
|
$this->tipoUsoPosibleSoloVerifactu = $tipoUsoPosibleSoloVerifactu;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTipoUsoPosibleMultiOT(): string
|
||||||
|
{
|
||||||
|
return $this->tipoUsoPosibleMultiOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTipoUsoPosibleMultiOT(string $tipoUsoPosibleMultiOT): self
|
||||||
|
{
|
||||||
|
$this->tipoUsoPosibleMultiOT = $tipoUsoPosibleMultiOT;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIndicadorMultiplesOT(): string
|
||||||
|
{
|
||||||
|
return $this->indicadorMultiplesOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIndicadorMultiplesOT(string $indicadorMultiplesOT): self
|
||||||
|
{
|
||||||
|
$this->indicadorMultiplesOT = $indicadorMultiplesOT;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\EInvoice\Verifactu\Models;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use App\Services\EDocument\Standards\Verifactu\Models\BaseXmlModel;
|
||||||
|
|
||||||
|
abstract class BaseModelTest extends TestCase
|
||||||
|
{
|
||||||
|
protected function assertXmlEquals(string $expectedXml, string $actualXml): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
$this->normalizeXml($expectedXml),
|
||||||
|
$this->normalizeXml($actualXml)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function normalizeXml(string $xml): string
|
||||||
|
{
|
||||||
|
$doc = new \DOMDocument('1.0');
|
||||||
|
$doc->preserveWhiteSpace = false;
|
||||||
|
$doc->formatOutput = true;
|
||||||
|
if (!$doc->loadXML($xml)) {
|
||||||
|
throw new \DOMException('Failed to load XML in normalizeXml');
|
||||||
|
}
|
||||||
|
return $doc->saveXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function assertValidatesAgainstXsd(string $xml, string $xsdPath): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$doc = new \DOMDocument();
|
||||||
|
$doc->preserveWhiteSpace = false;
|
||||||
|
$doc->formatOutput = true;
|
||||||
|
if (!$doc->loadXML($xml, LIBXML_NOBLANKS)) {
|
||||||
|
throw new \DOMException('Failed to load XML in assertValidatesAgainstXsd');
|
||||||
|
}
|
||||||
|
|
||||||
|
libxml_use_internal_errors(true);
|
||||||
|
$result = $doc->schemaValidate($xsdPath);
|
||||||
|
if (!$result) {
|
||||||
|
foreach (libxml_get_errors() as $error) {
|
||||||
|
}
|
||||||
|
libxml_clear_errors();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertTrue(
|
||||||
|
$result,
|
||||||
|
'XML does not validate against XSD schema'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTestXsdPath(): string
|
||||||
|
{
|
||||||
|
return __DIR__ . '/../schema/SuministroInformacion.xsd';
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- editado con XMLSpy v2019 sp1 (x64) (http://www.altova.com) por AEAT (Agencia Estatal de Administracion Tributaria ((AEAT))) -->
|
||||||
|
<!-- edited with XMLSpy v2009 sp1 (http://www.altova.com) by PC Corporativo (AGENCIA TRIBUTARIA) -->
|
||||||
|
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:sfLRC="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/ConsultaLR.xsd" xmlns:sf="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" targetNamespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/ConsultaLR.xsd" elementFormDefault="qualified">
|
||||||
|
<import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" schemaLocation="SuministroInformacion.xsd"/>
|
||||||
|
<!-- edited with XMLSpy v2009 sp1 (http://www.altova.com) by PC Corporativo (AGENCIA TRIBUTARIA) -->
|
||||||
|
<element name="ConsultaFactuSistemaFacturacion" type="sfLRC:ConsultaFactuSistemaFacturacionType">
|
||||||
|
<annotation>
|
||||||
|
<documentation>Servicio de consulta Registros Facturacion</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<complexType name="ConsultaFactuSistemaFacturacionType">
|
||||||
|
<sequence>
|
||||||
|
<element name="Cabecera" type="sf:CabeceraConsultaSf"/>
|
||||||
|
<element name="FiltroConsulta" type="sfLRC:LRFiltroRegFacturacionType"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="LRFiltroRegFacturacionType">
|
||||||
|
<sequence>
|
||||||
|
<!-- <element name="PeriodoImputacion" type="sf:PeriodoImputacionType"/> -->
|
||||||
|
<element name="NumSerieFactura" type="sf:TextoIDFacturaType" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Nº Serie+Nº Factura de la Factura del Emisor.</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="Contraparte" type="sf:ContraparteConsultaType" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Contraparte del NIF de la cabecera que realiza la consulta.
|
||||||
|
Obligado si la cosulta la realiza el Destinatario de los registros de facturacion.
|
||||||
|
Destinatario si la cosulta la realiza el Obligado dde los registros de facturacion.</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="FechaExpedicionFactura" type="sf:FechaExpedicionConsultaType" minOccurs="0"/>
|
||||||
|
<element name="SistemaInformatico" type="sf:SistemaInformaticoType" minOccurs="0"/>
|
||||||
|
<element name="ClavePaginacion" type="sf:IDFacturaExpedidaBCType" minOccurs="0"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
</schema>
|
||||||
|
|
@ -0,0 +1,823 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- editado con XMLSpy v2019 sp1 (x64) (http://www.altova.com) por AEAT (Agencia Estatal de Administracion Tributaria ((AEAT))) -->
|
||||||
|
<!-- edited with XMLSpy v2009 sp1 (http://www.altova.com) by PC Corporativo (AGENCIA TRIBUTARIA) -->
|
||||||
|
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:sf="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/EventosSIF.xsd" targetNamespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/EventosSIF.xsd" elementFormDefault="qualified">
|
||||||
|
<import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/>
|
||||||
|
<element name="RegistroEvento">
|
||||||
|
<complexType>
|
||||||
|
<sequence>
|
||||||
|
<element name="IDVersion" type="sf:VersionType"/>
|
||||||
|
<element name="Evento" type="sf:EventoType"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
<complexType name="EventoType">
|
||||||
|
<sequence>
|
||||||
|
<element name="SistemaInformatico" type="sf:SistemaInformaticoType"/>
|
||||||
|
<element name="ObligadoEmision" type="sf:PersonaFisicaJuridicaESType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Obligado a expedir la factura. </documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="EmitidaPorTerceroODestinatario" type="sf:TercerosODestinatarioType" minOccurs="0"/>
|
||||||
|
<element name="TerceroODestinatario" type="sf:PersonaFisicaJuridicaType" minOccurs="0"/>
|
||||||
|
<element name="FechaHoraHusoGenEvento" type="dateTime">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Formato: YYYY-MM-DDThh:mm:ssTZD (ej: 2024-01-01T19:20:30+01:00) (ISO 8601)</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="TipoEvento" type="sf:TipoEventoType"/>
|
||||||
|
<element name="DatosPropiosEvento" type="sf:DatosPropiosEventoType" minOccurs="0"/>
|
||||||
|
<element name="OtrosDatosEvento" type="sf:TextMax100Type" minOccurs="0"/>
|
||||||
|
<element name="Encadenamiento" type="sf:EncadenamientoType"/>
|
||||||
|
<element name="TipoHuella" type="sf:TipoHuellaType"/>
|
||||||
|
<element name="HuellaEvento" type="sf:TextMax64Type"/>
|
||||||
|
<element ref="ds:Signature"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="SistemaInformaticoType">
|
||||||
|
<sequence>
|
||||||
|
<sequence>
|
||||||
|
<element name="NombreRazon" type="sf:TextMax120Type"/>
|
||||||
|
<choice>
|
||||||
|
<element name="NIF" type="sf:NIFType"/>
|
||||||
|
<element name="IDOtro" type="sf:IDOtroType"/>
|
||||||
|
</choice>
|
||||||
|
</sequence>
|
||||||
|
<element name="NombreSistemaInformatico" type="sf:TextMax30Type" minOccurs="0"/>
|
||||||
|
<element name="IdSistemaInformatico" type="sf:TextMax2Type"/>
|
||||||
|
<element name="Version" type="sf:TextMax50Type"/>
|
||||||
|
<element name="NumeroInstalacion" type="sf:TextMax100Type"/>
|
||||||
|
<element name="TipoUsoPosibleSoloVerifactu" type="sf:SiNoType" minOccurs="0"/>
|
||||||
|
<element name="TipoUsoPosibleMultiOT" type="sf:SiNoType" minOccurs="0"/>
|
||||||
|
<element name="IndicadorMultiplesOT" type="sf:SiNoType" minOccurs="0"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="DatosPropiosEventoType">
|
||||||
|
<choice>
|
||||||
|
<element name="LanzamientoProcesoDeteccionAnomaliasRegFacturacion" type="sf:LanzamientoProcesoDeteccionAnomaliasRegFacturacionType"/>
|
||||||
|
<element name="DeteccionAnomaliasRegFacturacion" type="sf:DeteccionAnomaliasRegFacturacionType"/>
|
||||||
|
<element name="LanzamientoProcesoDeteccionAnomaliasRegEvento" type="sf:LanzamientoProcesoDeteccionAnomaliasRegEventoType"/>
|
||||||
|
<element name="DeteccionAnomaliasRegEvento" type="sf:DeteccionAnomaliasRegEventoType"/>
|
||||||
|
<element name="ExportacionRegFacturacionPeriodo" type="sf:ExportacionRegFacturacionPeriodoType"/>
|
||||||
|
<element name="ExportacionRegEventoPeriodo" type="sf:ExportacionRegEventoPeriodoType"/>
|
||||||
|
<element name="ResumenEventos" type="sf:ResumenEventosType"/>
|
||||||
|
</choice>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="EncadenamientoType">
|
||||||
|
<choice>
|
||||||
|
<element name="PrimerEvento" type="sf:TextMax1Type"/>
|
||||||
|
<element name="EventoAnterior" type="sf:RegEventoAntType"/>
|
||||||
|
</choice>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="LanzamientoProcesoDeteccionAnomaliasRegFacturacionType">
|
||||||
|
<sequence>
|
||||||
|
<element name="RealizadoProcesoSobreIntegridadHuellasRegFacturacion" type="sf:SiNoType"/>
|
||||||
|
<element name="NumeroDeRegistrosFacturacionProcesadosSobreIntegridadHuellas" type="sf:DigitosMax7Type" minOccurs="0"/>
|
||||||
|
<element name="RealizadoProcesoSobreIntegridadFirmasRegFacturacion" type="sf:SiNoType"/>
|
||||||
|
<element name="NumeroDeRegistrosFacturacionProcesadosSobreIntegridadFirmas" type="sf:DigitosMax7Type" minOccurs="0"/>
|
||||||
|
<element name="RealizadoProcesoSobreTrazabilidadCadenaRegFacturacion" type="sf:SiNoType"/>
|
||||||
|
<element name="NumeroDeRegistrosFacturacionProcesadosSobreTrazabilidadCadena" type="sf:DigitosMax7Type" minOccurs="0"/>
|
||||||
|
<element name="RealizadoProcesoSobreTrazabilidadFechasRegFacturacion" type="sf:SiNoType"/>
|
||||||
|
<element name="NumeroDeRegistrosFacturacionProcesadosSobreTrazabilidadFechas" type="sf:DigitosMax7Type" minOccurs="0"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="DeteccionAnomaliasRegFacturacionType">
|
||||||
|
<sequence>
|
||||||
|
<element name="TipoAnomalia" type="sf:TipoAnomaliaType"/>
|
||||||
|
<element name="OtrosDatosAnomalia" type="sf:TextMax100Type" minOccurs="0"/>
|
||||||
|
<element name="RegistroFacturacionAnomalo" type="sf:IDFacturaExpedidaType" minOccurs="0"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="LanzamientoProcesoDeteccionAnomaliasRegEventoType">
|
||||||
|
<sequence>
|
||||||
|
<element name="RealizadoProcesoSobreIntegridadHuellasRegEvento" type="sf:SiNoType"/>
|
||||||
|
<element name="NumeroDeRegistrosEventoProcesadosSobreIntegridadHuellas" type="sf:DigitosMax5Type" minOccurs="0"/>
|
||||||
|
<element name="RealizadoProcesoSobreIntegridadFirmasRegEvento" type="sf:SiNoType"/>
|
||||||
|
<element name="NumeroDeRegistrosEventoProcesadosSobreIntegridadFirmas" type="sf:DigitosMax5Type" minOccurs="0"/>
|
||||||
|
<element name="RealizadoProcesoSobreTrazabilidadCadenaRegEvento" type="sf:SiNoType"/>
|
||||||
|
<element name="NumeroDeRegistrosEventoProcesadosSobreTrazabilidadCadena" type="sf:DigitosMax5Type" minOccurs="0"/>
|
||||||
|
<element name="RealizadoProcesoSobreTrazabilidadFechasRegEvento" type="sf:SiNoType"/>
|
||||||
|
<element name="NumeroDeRegistrosEventoProcesadosSobreTrazabilidadFechas" type="sf:DigitosMax5Type" minOccurs="0"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="DeteccionAnomaliasRegEventoType">
|
||||||
|
<sequence>
|
||||||
|
<element name="TipoAnomalia" type="sf:TipoAnomaliaType"/>
|
||||||
|
<element name="OtrosDatosAnomalia" type="sf:TextMax100Type" minOccurs="0"/>
|
||||||
|
<element name="RegEventoAnomalo" type="sf:RegEventoType" minOccurs="0"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="ExportacionRegFacturacionPeriodoType">
|
||||||
|
<sequence>
|
||||||
|
<element name="FechaHoraHusoInicioPeriodoExport" type="dateTime">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Formato: YYYY-MM-DDThh:mm:ssTZD (ej: 2024-01-01T19:20:30+01:00) (ISO 8601)</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="FechaHoraHusoFinPeriodoExport" type="dateTime">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Formato: YYYY-MM-DDThh:mm:ssTZD (ej: 2024-01-01T19:20:30+01:00) (ISO 8601)</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="RegistroFacturacionInicialPeriodo" type="sf:IDFacturaExpedidaHuellaType"/>
|
||||||
|
<element name="RegistroFacturacionFinalPeriodo" type="sf:IDFacturaExpedidaHuellaType"/>
|
||||||
|
<element name="NumeroDeRegistrosFacturacionAltaExportados" type="sf:DigitosMax9Type"/>
|
||||||
|
<element name="SumaCuotaTotalAlta" type="sf:ImporteSgn12.2Type"/>
|
||||||
|
<element name="SumaImporteTotalAlta" type="sf:ImporteSgn12.2Type"/>
|
||||||
|
<element name="NumeroDeRegistrosFacturacionAnulacionExportados" type="sf:DigitosMax9Type"/>
|
||||||
|
<element name="RegistrosFacturacionExportadosDejanDeConservarse" type="sf:SiNoType"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="ExportacionRegEventoPeriodoType">
|
||||||
|
<sequence>
|
||||||
|
<element name="FechaHoraHusoInicioPeriodoExport" type="dateTime">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Formato: YYYY-MM-DDThh:mm:ssTZD (ej: 2024-01-01T19:20:30+01:00) (ISO 8601)</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="FechaHoraHusoFinPeriodoExport" type="dateTime">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Formato: YYYY-MM-DDThh:mm:ssTZD (ej: 2024-01-01T19:20:30+01:00) (ISO 8601)</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="RegistroEventoInicialPeriodo" type="sf:RegEventoType"/>
|
||||||
|
<element name="RegistroEventoFinalPeriodo" type="sf:RegEventoType"/>
|
||||||
|
<element name="NumeroDeRegEventoExportados" type="sf:DigitosMax7Type"/>
|
||||||
|
<element name="RegEventoExportadosDejanDeConservarse" type="sf:SiNoType"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="ResumenEventosType">
|
||||||
|
<sequence>
|
||||||
|
<element name="TipoEvento" type="sf:TipoEventoAgrType" maxOccurs="20"/>
|
||||||
|
<element name="RegistroFacturacionInicialPeriodo" type="sf:IDFacturaExpedidaHuellaType" minOccurs="0"/>
|
||||||
|
<element name="RegistroFacturacionFinalPeriodo" type="sf:IDFacturaExpedidaHuellaType" minOccurs="0"/>
|
||||||
|
<element name="NumeroDeRegistrosFacturacionAltaGenerados" type="sf:DigitosMax6Type"/>
|
||||||
|
<element name="SumaCuotaTotalAlta" type="sf:ImporteSgn12.2Type"/>
|
||||||
|
<element name="SumaImporteTotalAlta" type="sf:ImporteSgn12.2Type"/>
|
||||||
|
<element name="NumeroDeRegistrosFacturacionAnulacionGenerados" type="sf:DigitosMax6Type"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="RegEventoType">
|
||||||
|
<sequence>
|
||||||
|
<element name="TipoEvento" type="sf:TipoEventoType"/>
|
||||||
|
<element name="FechaHoraHusoEvento" type="dateTime">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Formato: YYYY-MM-DDThh:mm:ssTZD (ej: 2024-01-01T19:20:30+01:00) (ISO 8601)</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="HuellaEvento" type="sf:TextMax64Type"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="RegEventoAntType">
|
||||||
|
<sequence>
|
||||||
|
<element name="TipoEvento" type="sf:TipoEventoType"/>
|
||||||
|
<element name="FechaHoraHusoGenEvento" type="dateTime">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Formato: YYYY-MM-DDThh:mm:ssTZD (ej: 2024-01-01T19:20:30+01:00) (ISO 8601)</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="HuellaEvento" type="sf:TextMax64Type"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="TipoEventoAgrType">
|
||||||
|
<sequence>
|
||||||
|
<element name="TipoEvento" type="sf:TipoEventoType"/>
|
||||||
|
<element name="NumeroDeEventos" type="sf:DigitosMax4Type"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<!-- Datos de persona Física o jurídica : Denominación, representación, identificación (NIF) -->
|
||||||
|
<complexType name="PersonaFisicaJuridicaESType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Datos de una persona física o jurídica Española con un NIF asociado</documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="NombreRazon" type="sf:TextMax120Type"/>
|
||||||
|
<element name="NIF" type="sf:NIFType"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<simpleType name="NIFType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">NIF</documentation>
|
||||||
|
</annotation>
|
||||||
|
<restriction base="string">
|
||||||
|
<length value="9"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Datos de persona Física o jurídica : Denominación, representación, identificación (NIF/Otro) -->
|
||||||
|
<complexType name="PersonaFisicaJuridicaType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Datos de una persona física o jurídica Española o Extranjera</documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="NombreRazon" type="sf:TextMax120Type"/>
|
||||||
|
<choice>
|
||||||
|
<element name="NIF" type="sf:NIFType"/>
|
||||||
|
<element name="IDOtro" type="sf:IDOtroType"/>
|
||||||
|
</choice>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<!-- Datos de persona Física o jurídica : Denominación, representación, identificación (NIF/Otro) -->
|
||||||
|
<complexType name="IDOtroType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Identificador de persona Física o jurídica distinto del NIF
|
||||||
|
(Código pais, Tipo de Identificador, y hasta 15 caractéres)
|
||||||
|
No se permite CodigoPais=ES e IDType=01-NIFContraparte
|
||||||
|
para ese caso, debe utilizarse NIF en lugar de IDOtro.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="CodigoPais" type="sf:CountryType2" minOccurs="0"/>
|
||||||
|
<element name="IDType" type="sf:PersonaFisicaJuridicaIDTypeType"/>
|
||||||
|
<element name="ID" type="sf:TextMax20Type"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<!-- Tercero o Destinatario -->
|
||||||
|
<simpleType name="TercerosODestinatarioType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="D">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Destinatario</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="T">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Tercero</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<simpleType name="SiNoType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="S"/>
|
||||||
|
<enumeration value="N"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<simpleType name="VersionType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="1.0"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Cadena de 120 caracteres -->
|
||||||
|
<simpleType name="TextMax120Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="120"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Cadena de 100 caracteres -->
|
||||||
|
<simpleType name="TextMax100Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="100"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Cadena de 64 caracteres -->
|
||||||
|
<simpleType name="TextMax64Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="64"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Cadena de 60 caracteres -->
|
||||||
|
<simpleType name="TextMax60Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="60"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Cadena de 50 caracteres -->
|
||||||
|
<simpleType name="TextMax50Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="50"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Cadena de 30 caracteres -->
|
||||||
|
<simpleType name="TextMax30Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="30"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Cadena de 20 caracteres -->
|
||||||
|
<simpleType name="TextMax20Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="20"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Cadena de 2 caracteres -->
|
||||||
|
<simpleType name="TextMax2Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="2"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Cadena de 1 caracteres -->
|
||||||
|
<simpleType name="TextMax1Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="1"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Definición de un tipo simple restringido a 9 dígitos -->
|
||||||
|
<simpleType name="DigitosMax9Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="9"/>
|
||||||
|
<pattern value="\d{1,9}"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Definición de un tipo simple restringido a 7 dígitos -->
|
||||||
|
<simpleType name="DigitosMax7Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="7"/>
|
||||||
|
<pattern value="\d{1,7}"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Definición de un tipo simple restringido a 6 dígitos -->
|
||||||
|
<simpleType name="DigitosMax6Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="6"/>
|
||||||
|
<pattern value="\d{1,6}"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Definición de un tipo simple restringido a 5 dígitos -->
|
||||||
|
<simpleType name="DigitosMax5Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="5"/>
|
||||||
|
<pattern value="\d{1,5}"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Definición de un tipo simple restringido a 4 dígitos -->
|
||||||
|
<simpleType name="DigitosMax4Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<maxLength value="4"/>
|
||||||
|
<pattern value="\d{1,4}"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Fecha (dd-mm-yyyy) -->
|
||||||
|
<simpleType name="fecha">
|
||||||
|
<restriction base="string">
|
||||||
|
<length value="10"/>
|
||||||
|
<pattern value="\d{2,2}-\d{2,2}-\d{4,4}"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Importe de 15 dígitos (12+2) "." como separador decimal -->
|
||||||
|
<simpleType name="ImporteSgn12.2Type">
|
||||||
|
<restriction base="string">
|
||||||
|
<pattern value="(\+|-)?\d{1,12}(\.\d{0,2})?"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Tipo de identificador fiscal de persona Física o jurídica -->
|
||||||
|
<simpleType name="PersonaFisicaJuridicaIDTypeType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="02">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">NIF-IVA</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="03">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Pasaporte</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="04">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">IDEnPaisResidencia</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="05">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Certificado Residencia</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="06">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Otro documento Probatorio</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="07">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">No Censado</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Tipo Hash -->
|
||||||
|
<simpleType name="TipoHuellaType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="01">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">SHA-256</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<simpleType name="TipoEventoType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="01">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Inicio del funcionamiento del sistema informático como «NO VERI*FACTU».</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="02">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Fin del funcionamiento del sistema informático como «NO VERI*FACTU».</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="03">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Lanzamiento del proceso de detección de anomalías en los registros de facturación.</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="04">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Detección de anomalías en la integridad, inalterabilidad y trazabilidad de registros de facturación.</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="05">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Lanzamiento del proceso de detección de anomalías en los registros de evento.</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="06">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Detección de anomalías en la integridad, inalterabilidad y trazabilidad de registros de evento.</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="07">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Restauración de copia de seguridad, cuando ésta se gestione desde el propio sistema informático de facturación.</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="08">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Exportación de registros de facturación generados en un periodo.</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="09">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Exportación de registros de evento generados en un periodo.</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="10">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Registro resumen de eventos</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="90">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Otros tipos de eventos a registrar voluntariamente por la persona o entidad productora del sistema informático.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<simpleType name="TipoAnomaliaType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="01">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Integridad-huella</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="02">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Integridad-firma</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="03">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Integridad - Otros</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="04">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-cadena-registro - Reg. no primero pero con reg. anterior no anotado o inexistente</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="05">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-cadena-registro - Reg. no último pero con reg. posterior no anotado o inexistente</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="06">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-cadena-registro - Otros</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="07">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-cadena-huella - Huella del reg. no se corresponde con la 'huella del reg. anterior' almacenada en el registro posterior</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="08">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-cadena-huella - Campo 'huella del reg. anterior' no se corresponde con la huella del reg. anterior</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="09">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-cadena-huella - Otros</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="10">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-cadena - Otros</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="11">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-fechas - Fecha-hora anterior a la fecha del reg. anterior</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="12">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-fechas - Fecha-hora posterior a la fecha del reg. posterior</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="13">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-fechas - Reg. con fecha-hora de generación posterior a la fecha-hora actual del sistema</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="14">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad-fechas - Otros</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="15">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Trazabilidad - Otros</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="90">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Otros</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<complexType name="IDFacturaExpedidaType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Datos de identificación de factura expedida para operaciones de consulta</documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="IDEmisorFactura" type="sf:NIFType"/>
|
||||||
|
<element name="NumSerieFactura" type="sf:TextMax60Type"/>
|
||||||
|
<element name="FechaExpedicionFactura" type="sf:fecha"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="IDFacturaExpedidaHuellaType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Datos de encadenamiento </documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="IDEmisorFactura" type="sf:NIFType"/>
|
||||||
|
<element name="NumSerieFactura" type="sf:TextMax60Type"/>
|
||||||
|
<element name="FechaExpedicionFactura" type="sf:fecha"/>
|
||||||
|
<element name="Huella" type="sf:TextMax64Type"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<!-- ISO 3166-1 alpha-2 codes -->
|
||||||
|
<simpleType name="CountryType2">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="AF"/>
|
||||||
|
<enumeration value="AL"/>
|
||||||
|
<enumeration value="DE"/>
|
||||||
|
<enumeration value="AD"/>
|
||||||
|
<enumeration value="AO"/>
|
||||||
|
<enumeration value="AI"/>
|
||||||
|
<enumeration value="AQ"/>
|
||||||
|
<enumeration value="AG"/>
|
||||||
|
<enumeration value="SA"/>
|
||||||
|
<enumeration value="DZ"/>
|
||||||
|
<enumeration value="AR"/>
|
||||||
|
<enumeration value="AM"/>
|
||||||
|
<enumeration value="AW"/>
|
||||||
|
<enumeration value="AU"/>
|
||||||
|
<enumeration value="AT"/>
|
||||||
|
<enumeration value="AZ"/>
|
||||||
|
<enumeration value="BS"/>
|
||||||
|
<enumeration value="BH"/>
|
||||||
|
<enumeration value="BD"/>
|
||||||
|
<enumeration value="BB"/>
|
||||||
|
<enumeration value="BE"/>
|
||||||
|
<enumeration value="BZ"/>
|
||||||
|
<enumeration value="BJ"/>
|
||||||
|
<enumeration value="BM"/>
|
||||||
|
<enumeration value="BY"/>
|
||||||
|
<enumeration value="BO"/>
|
||||||
|
<enumeration value="BA"/>
|
||||||
|
<enumeration value="BW"/>
|
||||||
|
<enumeration value="BV"/>
|
||||||
|
<enumeration value="BR"/>
|
||||||
|
<enumeration value="BN"/>
|
||||||
|
<enumeration value="BG"/>
|
||||||
|
<enumeration value="BF"/>
|
||||||
|
<enumeration value="BI"/>
|
||||||
|
<enumeration value="BT"/>
|
||||||
|
<enumeration value="CV"/>
|
||||||
|
<enumeration value="KY"/>
|
||||||
|
<enumeration value="KH"/>
|
||||||
|
<enumeration value="CM"/>
|
||||||
|
<enumeration value="CA"/>
|
||||||
|
<enumeration value="CF"/>
|
||||||
|
<enumeration value="CC"/>
|
||||||
|
<enumeration value="CO"/>
|
||||||
|
<enumeration value="KM"/>
|
||||||
|
<enumeration value="CG"/>
|
||||||
|
<enumeration value="CD"/>
|
||||||
|
<enumeration value="CK"/>
|
||||||
|
<enumeration value="KP"/>
|
||||||
|
<enumeration value="KR"/>
|
||||||
|
<enumeration value="CI"/>
|
||||||
|
<enumeration value="CR"/>
|
||||||
|
<enumeration value="HR"/>
|
||||||
|
<enumeration value="CU"/>
|
||||||
|
<enumeration value="TD"/>
|
||||||
|
<enumeration value="CZ"/>
|
||||||
|
<enumeration value="CL"/>
|
||||||
|
<enumeration value="CN"/>
|
||||||
|
<enumeration value="CY"/>
|
||||||
|
<enumeration value="CW"/>
|
||||||
|
<enumeration value="DK"/>
|
||||||
|
<enumeration value="DM"/>
|
||||||
|
<enumeration value="DO"/>
|
||||||
|
<enumeration value="EC"/>
|
||||||
|
<enumeration value="EG"/>
|
||||||
|
<enumeration value="AE"/>
|
||||||
|
<enumeration value="ER"/>
|
||||||
|
<enumeration value="SK"/>
|
||||||
|
<enumeration value="SI"/>
|
||||||
|
<enumeration value="ES"/>
|
||||||
|
<enumeration value="US"/>
|
||||||
|
<enumeration value="EE"/>
|
||||||
|
<enumeration value="ET"/>
|
||||||
|
<enumeration value="FO"/>
|
||||||
|
<enumeration value="PH"/>
|
||||||
|
<enumeration value="FI"/>
|
||||||
|
<enumeration value="FJ"/>
|
||||||
|
<enumeration value="FR"/>
|
||||||
|
<enumeration value="GA"/>
|
||||||
|
<enumeration value="GM"/>
|
||||||
|
<enumeration value="GE"/>
|
||||||
|
<enumeration value="GS"/>
|
||||||
|
<enumeration value="GH"/>
|
||||||
|
<enumeration value="GI"/>
|
||||||
|
<enumeration value="GD"/>
|
||||||
|
<enumeration value="GR"/>
|
||||||
|
<enumeration value="GL"/>
|
||||||
|
<enumeration value="GU"/>
|
||||||
|
<enumeration value="GT"/>
|
||||||
|
<enumeration value="GG"/>
|
||||||
|
<enumeration value="GN"/>
|
||||||
|
<enumeration value="GQ"/>
|
||||||
|
<enumeration value="GW"/>
|
||||||
|
<enumeration value="GY"/>
|
||||||
|
<enumeration value="HT"/>
|
||||||
|
<enumeration value="HM"/>
|
||||||
|
<enumeration value="HN"/>
|
||||||
|
<enumeration value="HK"/>
|
||||||
|
<enumeration value="HU"/>
|
||||||
|
<enumeration value="IN"/>
|
||||||
|
<enumeration value="ID"/>
|
||||||
|
<enumeration value="IR"/>
|
||||||
|
<enumeration value="IQ"/>
|
||||||
|
<enumeration value="IE"/>
|
||||||
|
<enumeration value="IM"/>
|
||||||
|
<enumeration value="IS"/>
|
||||||
|
<enumeration value="IL"/>
|
||||||
|
<enumeration value="IT"/>
|
||||||
|
<enumeration value="JM"/>
|
||||||
|
<enumeration value="JP"/>
|
||||||
|
<enumeration value="JE"/>
|
||||||
|
<enumeration value="JO"/>
|
||||||
|
<enumeration value="KZ"/>
|
||||||
|
<enumeration value="KE"/>
|
||||||
|
<enumeration value="KG"/>
|
||||||
|
<enumeration value="KI"/>
|
||||||
|
<enumeration value="KW"/>
|
||||||
|
<enumeration value="LA"/>
|
||||||
|
<enumeration value="LS"/>
|
||||||
|
<enumeration value="LV"/>
|
||||||
|
<enumeration value="LB"/>
|
||||||
|
<enumeration value="LR"/>
|
||||||
|
<enumeration value="LY"/>
|
||||||
|
<enumeration value="LI"/>
|
||||||
|
<enumeration value="LT"/>
|
||||||
|
<enumeration value="LU"/>
|
||||||
|
<enumeration value="XG"/>
|
||||||
|
<enumeration value="MO"/>
|
||||||
|
<enumeration value="MK"/>
|
||||||
|
<enumeration value="MG"/>
|
||||||
|
<enumeration value="MY"/>
|
||||||
|
<enumeration value="MW"/>
|
||||||
|
<enumeration value="MV"/>
|
||||||
|
<enumeration value="ML"/>
|
||||||
|
<enumeration value="MT"/>
|
||||||
|
<enumeration value="FK"/>
|
||||||
|
<enumeration value="MP"/>
|
||||||
|
<enumeration value="MA"/>
|
||||||
|
<enumeration value="MH"/>
|
||||||
|
<enumeration value="MU"/>
|
||||||
|
<enumeration value="MR"/>
|
||||||
|
<enumeration value="YT"/>
|
||||||
|
<enumeration value="UM"/>
|
||||||
|
<enumeration value="MX"/>
|
||||||
|
<enumeration value="FM"/>
|
||||||
|
<enumeration value="MD"/>
|
||||||
|
<enumeration value="MC"/>
|
||||||
|
<enumeration value="MN"/>
|
||||||
|
<enumeration value="ME"/>
|
||||||
|
<enumeration value="MS"/>
|
||||||
|
<enumeration value="MZ"/>
|
||||||
|
<enumeration value="MM"/>
|
||||||
|
<enumeration value="NA"/>
|
||||||
|
<enumeration value="NR"/>
|
||||||
|
<enumeration value="CX"/>
|
||||||
|
<enumeration value="NP"/>
|
||||||
|
<enumeration value="NI"/>
|
||||||
|
<enumeration value="NE"/>
|
||||||
|
<enumeration value="NG"/>
|
||||||
|
<enumeration value="NU"/>
|
||||||
|
<enumeration value="NF"/>
|
||||||
|
<enumeration value="NO"/>
|
||||||
|
<enumeration value="NC"/>
|
||||||
|
<enumeration value="NZ"/>
|
||||||
|
<enumeration value="IO"/>
|
||||||
|
<enumeration value="OM"/>
|
||||||
|
<enumeration value="NL"/>
|
||||||
|
<enumeration value="BQ"/>
|
||||||
|
<enumeration value="PK"/>
|
||||||
|
<enumeration value="PW"/>
|
||||||
|
<enumeration value="PA"/>
|
||||||
|
<enumeration value="PG"/>
|
||||||
|
<enumeration value="PY"/>
|
||||||
|
<enumeration value="PE"/>
|
||||||
|
<enumeration value="PN"/>
|
||||||
|
<enumeration value="PF"/>
|
||||||
|
<enumeration value="PL"/>
|
||||||
|
<enumeration value="PT"/>
|
||||||
|
<enumeration value="PR"/>
|
||||||
|
<enumeration value="QA"/>
|
||||||
|
<enumeration value="GB"/>
|
||||||
|
<enumeration value="RW"/>
|
||||||
|
<enumeration value="RO"/>
|
||||||
|
<enumeration value="RU"/>
|
||||||
|
<enumeration value="SB"/>
|
||||||
|
<enumeration value="SV"/>
|
||||||
|
<enumeration value="WS"/>
|
||||||
|
<enumeration value="AS"/>
|
||||||
|
<enumeration value="KN"/>
|
||||||
|
<enumeration value="SM"/>
|
||||||
|
<enumeration value="SX"/>
|
||||||
|
<enumeration value="PM"/>
|
||||||
|
<enumeration value="VC"/>
|
||||||
|
<enumeration value="SH"/>
|
||||||
|
<enumeration value="LC"/>
|
||||||
|
<enumeration value="ST"/>
|
||||||
|
<enumeration value="SN"/>
|
||||||
|
<enumeration value="RS"/>
|
||||||
|
<enumeration value="SC"/>
|
||||||
|
<enumeration value="SL"/>
|
||||||
|
<enumeration value="SG"/>
|
||||||
|
<enumeration value="SY"/>
|
||||||
|
<enumeration value="SO"/>
|
||||||
|
<enumeration value="LK"/>
|
||||||
|
<enumeration value="SZ"/>
|
||||||
|
<enumeration value="ZA"/>
|
||||||
|
<enumeration value="SD"/>
|
||||||
|
<enumeration value="SS"/>
|
||||||
|
<enumeration value="SE"/>
|
||||||
|
<enumeration value="CH"/>
|
||||||
|
<enumeration value="SR"/>
|
||||||
|
<enumeration value="TH"/>
|
||||||
|
<enumeration value="TW"/>
|
||||||
|
<enumeration value="TZ"/>
|
||||||
|
<enumeration value="TJ"/>
|
||||||
|
<enumeration value="PS"/>
|
||||||
|
<enumeration value="TF"/>
|
||||||
|
<enumeration value="TL"/>
|
||||||
|
<enumeration value="TG"/>
|
||||||
|
<enumeration value="TK"/>
|
||||||
|
<enumeration value="TO"/>
|
||||||
|
<enumeration value="TT"/>
|
||||||
|
<enumeration value="TN"/>
|
||||||
|
<enumeration value="TC"/>
|
||||||
|
<enumeration value="TM"/>
|
||||||
|
<enumeration value="TR"/>
|
||||||
|
<enumeration value="TV"/>
|
||||||
|
<enumeration value="UA"/>
|
||||||
|
<enumeration value="UG"/>
|
||||||
|
<enumeration value="UY"/>
|
||||||
|
<enumeration value="UZ"/>
|
||||||
|
<enumeration value="VU"/>
|
||||||
|
<enumeration value="VA"/>
|
||||||
|
<enumeration value="VE"/>
|
||||||
|
<enumeration value="VN"/>
|
||||||
|
<enumeration value="VG"/>
|
||||||
|
<enumeration value="VI"/>
|
||||||
|
<enumeration value="WF"/>
|
||||||
|
<enumeration value="YE"/>
|
||||||
|
<enumeration value="DJ"/>
|
||||||
|
<enumeration value="ZM"/>
|
||||||
|
<enumeration value="ZW"/>
|
||||||
|
<enumeration value="QU"/>
|
||||||
|
<enumeration value="XB"/>
|
||||||
|
<enumeration value="XU"/>
|
||||||
|
<enumeration value="XN"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
</schema>
|
||||||
|
|
@ -0,0 +1,195 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- editado con XMLSpy v2019 sp1 (x64) (http://www.altova.com) por AEAT (Agencia Estatal de Administracion Tributaria ((AEAT))) -->
|
||||||
|
<!-- edited with XMLSpy v2009 sp1 (http://www.altova.com) by PC Corporativo (AGENCIA TRIBUTARIA) -->
|
||||||
|
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:sfLRRC="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/RespuestaConsultaLR.xsd" xmlns:sf="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" targetNamespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/RespuestaConsultaLR.xsd" elementFormDefault="qualified">
|
||||||
|
<import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" schemaLocation="SuministroInformacion.xsd"/>
|
||||||
|
<!-- edited with XMLSpy v2009 sp1 (http://www.altova.com) by PC Corporativo (AGENCIA TRIBUTARIA) -->
|
||||||
|
<element name="RespuestaConsultaFactuSistemaFacturacion" type="sfLRRC:RespuestaConsultaFactuSistemaFacturacionType">
|
||||||
|
<annotation>
|
||||||
|
<documentation>Servicio de consulta de regIstros de facturacion</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<complexType name="RespuestaConsultaFactuSistemaFacturacionType">
|
||||||
|
<complexContent>
|
||||||
|
<extension base="sfLRRC:RespuestaConsultaType">
|
||||||
|
<sequence>
|
||||||
|
<element name="RegistroRespuestaConsultaFactuSistemaFacturacion" type="sfLRRC:RegistroRespuestaConsultaRegFacturacionType" minOccurs="0" maxOccurs="10000"/>
|
||||||
|
<element name="ClavePaginacion" type="sf:IDFacturaExpedidaBCType" minOccurs="0"/>
|
||||||
|
</sequence>
|
||||||
|
</extension>
|
||||||
|
</complexContent>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="EstadoRegFactuType">
|
||||||
|
<sequence>
|
||||||
|
<element name="TimestampUltimaModificacion" type="dateTime"/>
|
||||||
|
<element name="EstadoRegistro" type="sfLRRC:EstadoRegistroType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">
|
||||||
|
Estado del registro almacenado en el sistema. Los estados posibles son: Correcta, AceptadaConErrores y Anulada
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="CodigoErrorRegistro" type="sfLRRC:ErrorDetalleType" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">
|
||||||
|
Código del error de registro, en su caso.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="DescripcionErrorRegistro" type="sf:TextMax500Type" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">
|
||||||
|
Descripción detallada del error de registro, en su caso.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="RegistroRespuestaConsultaRegFacturacionType">
|
||||||
|
<sequence>
|
||||||
|
<element name="IDFactura" type="sf:IDFacturaExpedidaType"/>
|
||||||
|
<element name="DatosRegistroFacturacion" type="sfLRRC:RespuestaDatosRegistroFacturacionType"/>
|
||||||
|
<element name="DatosPresentacion" type="sf:DatosPresentacion2Type" minOccurs="0"/>
|
||||||
|
<element name="EstadoRegistro" type="sfLRRC:EstadoRegFactuType" />
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="RespuestaConsultaType">
|
||||||
|
<sequence>
|
||||||
|
<element name="Cabecera" type="sf:CabeceraConsultaSf"/>
|
||||||
|
<element name="PeriodoImputacion">
|
||||||
|
<complexType>
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Período al que corresponden los apuntes. todos los apuntes deben corresponder al mismo período impositivo </documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="Ejercicio" type="sf:YearType"/>
|
||||||
|
<element name="Periodo" type="sf:TipoPeriodoType"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
<element name="IndicadorPaginacion" type="sfLRRC:IndicadorPaginacionType"/>
|
||||||
|
<element name="ResultadoConsulta" type="sfLRRC:ResultadoConsultaType"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<!-- Datos del registro de facturacion -->
|
||||||
|
<complexType name="RespuestaDatosRegistroFacturacionType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Apunte correspondiente al libro de facturas expedidas. </documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="RefExterna" type="sf:TextMax70Type" minOccurs="0"/>
|
||||||
|
<element name="Subsanacion" type="sf:SubsanacionType" minOccurs="0"/>
|
||||||
|
<element name="RechazoPrevio" type="sf:RechazoPrevioType" minOccurs="0"/>
|
||||||
|
<element name="SinRegistroPrevio" type="sf:SinRegistroPrevioType" minOccurs="0"/>
|
||||||
|
<element name="GeneradoPor" type="sf:GeneradoPorType" minOccurs="0"/>
|
||||||
|
<element name="Generador" type="sf:PersonaFisicaJuridicaType" minOccurs="0"/>
|
||||||
|
<element name="TipoFactura" type="sf:ClaveTipoFacturaType" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Clave del tipo de factura </documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="TipoRectificativa" type="sf:ClaveTipoRectificativaType" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Identifica si el tipo de factura rectificativa es por sustitución o por diferencia </documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="FacturasRectificadas" minOccurs="0">
|
||||||
|
<complexType>
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">El ID de las facturas rectificadas, únicamente se rellena en el caso de rectificación de facturas</documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="IDFacturaRectificada" type="sf:IDFacturaARType" maxOccurs="1000"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
<element name="FacturasSustituidas" minOccurs="0">
|
||||||
|
<complexType>
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">El ID de las facturas sustituidas, únicamente se rellena en el caso de facturas sustituidas</documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="IDFacturaSustituida" type="sf:IDFacturaARType" maxOccurs="1000"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
<element name="ImporteRectificacion" type="sf:DesgloseRectificacionType" minOccurs="0"/>
|
||||||
|
<element name="FechaOperacion" type="sf:fecha" minOccurs="0"/>
|
||||||
|
<element name="DescripcionOperacion" type="sf:TextMax500Type" minOccurs="0"/>
|
||||||
|
<element name="FacturaSimplificadaArt7273" type="sf:SimplificadaCualificadaType" minOccurs="0"/>
|
||||||
|
<element name="FacturaSinIdentifDestinatarioArt61d" type="sf:CompletaSinDestinatarioType" minOccurs="0"/>
|
||||||
|
<element name="Macrodato" type="sf:MacrodatoType" minOccurs="0"/>
|
||||||
|
<element name="EmitidaPorTerceroODestinatario" type="sf:TercerosODestinatarioType" minOccurs="0"/>
|
||||||
|
<element name="Tercero" type="sf:PersonaFisicaJuridicaType" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Tercero que expida la factura y/o genera el registro de alta. </documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="Destinatarios" minOccurs="0">
|
||||||
|
<complexType>
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Contraparte de la operación. Cliente</documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="IDDestinatario" type="sf:PersonaFisicaJuridicaType" maxOccurs="1000"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
<element name="Cupon" type="sf:CuponType" minOccurs="0"/>
|
||||||
|
<element name="Desglose" type="sf:DesgloseType" minOccurs="0"/>
|
||||||
|
<element name="CuotaTotal" type="sf:ImporteSgn12.2Type" minOccurs="0"/>
|
||||||
|
<element name="ImporteTotal" type="sf:ImporteSgn12.2Type" minOccurs="0"/>
|
||||||
|
<element name="Encadenamiento" minOccurs="0">
|
||||||
|
<complexType>
|
||||||
|
<choice>
|
||||||
|
<element name="PrimerRegistro" type="sf:PrimerRegistroCadenaType"/>
|
||||||
|
<element name="RegistroAnterior" type="sf:EncadenamientoFacturaAnteriorType"/>
|
||||||
|
</choice>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
<element name="FechaHoraHusoGenRegistro" type="dateTime" minOccurs="0"/>
|
||||||
|
<element name="NumRegistroAcuerdoFacturacion" type="sf:TextMax15Type" minOccurs="0"/>
|
||||||
|
<element name="IdAcuerdoSistemaInformatico" type="sf:TextMax16Type" minOccurs="0"/>
|
||||||
|
<element name="TipoHuella" type="sf:TipoHuellaType" minOccurs="0"/>
|
||||||
|
<element name="Huella" type="sf:TextMax64Type" minOccurs="0"/>
|
||||||
|
<element name="NifRepresentante" type="sf:NIFType" minOccurs="0"/>
|
||||||
|
<element name="FechaFinVeriFactu" type="sf:fecha" minOccurs="0"/>
|
||||||
|
<element name="Incidencia" type="sf:IncidenciaType" minOccurs="0"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<simpleType name="IndicadorPaginacionType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="S"/>
|
||||||
|
<enumeration value="N"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<simpleType name="ResultadoConsultaType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="ConDatos"/>
|
||||||
|
<enumeration value="SinDatos"/>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<simpleType name="ErrorDetalleType">
|
||||||
|
<restriction base="integer"/>
|
||||||
|
</simpleType>
|
||||||
|
<!-- Estado del registro almacenado en el sistema -->
|
||||||
|
<simpleType name="EstadoRegistroType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="Correcta">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">El registro se almacenado sin errores</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="AceptadaConErrores">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">El registro se almacenado tiene algunos errores. Ver detalle del error</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="Anulada">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">El registro almacenado ha sido anulado</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
</schema>
|
||||||
|
|
@ -0,0 +1,139 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- editado con XMLSpy v2019 sp1 (x64) (http://www.altova.com) por Puesto de Trabajo (Agencia Estatal de Administracion Tributaria ((AEAT))) -->
|
||||||
|
<!-- edited with XMLSpy v2009 sp1 (http://www.altova.com) by PC Corporativo (AGENCIA TRIBUTARIA) -->
|
||||||
|
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:sfR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/RespuestaSuministro.xsd" xmlns:sf="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" xmlns:sfLR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" targetNamespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/RespuestaSuministro.xsd" elementFormDefault="qualified">
|
||||||
|
<import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" schemaLocation="SuministroInformacion.xsd"/>
|
||||||
|
<import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" schemaLocation="SuministroLR.xsd"/>
|
||||||
|
<element name="RespuestaRegFactuSistemaFacturacion" type="sfR:RespuestaRegFactuSistemaFacturacionType"/>
|
||||||
|
<complexType name="RespuestaBaseType">
|
||||||
|
<sequence>
|
||||||
|
<element name="CSV" type="string" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> CSV asociado al envío generado por AEAT. Solo se genera si no hay rechazo del envio</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="DatosPresentacion" type="sf:DatosPresentacionType" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Se devuelven datos de la presentacion realizada. Solo se genera si no hay rechazo del envio </documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="Cabecera" type="sf:CabeceraType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Se devuelve la cabecera que se incluyó en el envío. </documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="TiempoEsperaEnvio" type="sf:Tipo6Type"/>
|
||||||
|
<element name="EstadoEnvio" type="sfR:EstadoEnvioType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">
|
||||||
|
Estado del envío en conjunto.
|
||||||
|
Si los datos de cabecera y todos los registros son correctos,el estado es correcto.
|
||||||
|
En caso de estructura y cabecera correctos donde todos los registros son incorrectos, el estado es incorrecto
|
||||||
|
En caso de estructura y cabecera correctos con al menos un registro incorrecto, el estado global es parcialmente correcto.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="RespuestaRegFactuSistemaFacturacionType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Respuesta a un envío de registro de facturacion</documentation>
|
||||||
|
</annotation>
|
||||||
|
<complexContent>
|
||||||
|
<extension base="sfR:RespuestaBaseType">
|
||||||
|
<sequence>
|
||||||
|
<element name="RespuestaLinea" type="sfR:RespuestaExpedidaType" minOccurs="0" maxOccurs="1000">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">
|
||||||
|
Estado detallado de cada línea del suministro.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
</sequence>
|
||||||
|
</extension>
|
||||||
|
</complexContent>
|
||||||
|
</complexType>
|
||||||
|
<complexType name="RespuestaExpedidaType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> Respuesta a un envío </documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<element name="IDFactura" type="sf:IDFacturaExpedidaType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es"> ID Factura Expedida </documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="Operacion" type="sf:OperacionType"/>
|
||||||
|
<element name="RefExterna" type="sf:TextMax70Type" minOccurs="0"/>
|
||||||
|
<element name="EstadoRegistro" type="sfR:EstadoRegistroType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">
|
||||||
|
Estado del registro. Correcto o Incorrecto
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="CodigoErrorRegistro" type="sfR:ErrorDetalleType" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">
|
||||||
|
Código del error de registro, en su caso.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="DescripcionErrorRegistro" type="sf:TextMax1500Type" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">
|
||||||
|
Descripción detallada del error de registro, en su caso.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
<element name="RegistroDuplicado" type="sf:RegistroDuplicadoType" minOccurs="0">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">
|
||||||
|
Solo en el caso de que se rechace el registro por duplicado se devuelve este nodo con la informacion registrada en el sistema para este registro
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</element>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
<simpleType name="EstadoEnvioType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="Correcto">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Correcto</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="ParcialmenteCorrecto">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Parcialmente correcto. Ver detalle de errores</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="Incorrecto">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Incorrecto</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<simpleType name="EstadoRegistroType">
|
||||||
|
<restriction base="string">
|
||||||
|
<enumeration value="Correcto">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Correcto</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="AceptadoConErrores">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Aceptado con Errores. Ver detalle del error</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="Incorrecto">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Incorrecto</documentation>
|
||||||
|
</annotation>
|
||||||
|
</enumeration>
|
||||||
|
</restriction>
|
||||||
|
</simpleType>
|
||||||
|
<simpleType name="ErrorDetalleType">
|
||||||
|
<restriction base="integer"/>
|
||||||
|
</simpleType>
|
||||||
|
</schema>
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- editado con XMLSpy v2019 sp1 (x64) (http://www.altova.com) por AEAT (Agencia Estatal de Administracion Tributaria ((AEAT))) -->
|
||||||
|
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:sfLR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" xmlns:sf="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" xmlns:sfR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/RespuestaSuministro.xsd" xmlns:sfLRC="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/ConsultaLR.xsd" xmlns:sfLRRC="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/RespuestaConsultaLR.xsd" xmlns:sfWdsl="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SistemaFacturacion.wsdl" xmlns:ns="http://www.w3.org/2000/09/xmldsig#" targetNamespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SistemaFacturacion.wsdl">
|
||||||
|
<wsdl:types>
|
||||||
|
<xs:schema targetNamespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SistemaFacturacion.wsdl" elementFormDefault="qualified" xmlns:sfWdsl="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SistemaFacturacion.wsdl" xmlns:sf="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" xmlns:sfLR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" xmlns:sfLRC="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/ConsultaLR.xsd" xmlns:sfLRRC="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/RespuestaConsultaLR.xsd">
|
||||||
|
<xs:import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" schemaLocation="SuministroInformacion.xsd"/>
|
||||||
|
<xs:import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" schemaLocation="SuministroLR.xsd"/>
|
||||||
|
<xs:import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/ConsultaLR.xsd" schemaLocation="ConsultaLR.xsd"/>
|
||||||
|
<xs:import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/RespuestaConsultaLR.xsd" schemaLocation="RespuestaConsultaLR.xsd"/>
|
||||||
|
<xs:import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/RespuestaSuministro.xsd" schemaLocation="RespuestaSuministro.xsd"/>
|
||||||
|
</xs:schema>
|
||||||
|
</wsdl:types>
|
||||||
|
<wsdl:message name="EntradaRegFactuSistemaFacturacion">
|
||||||
|
<wsdl:part name="RegFactuSistemaFacturacion" element="sfLR:RegFactuSistemaFacturacion"/>
|
||||||
|
</wsdl:message>
|
||||||
|
<wsdl:message name="EntradaConsultaFactuSistemaFacturacion">
|
||||||
|
<wsdl:part name="ConsultaFactuSistemaFacturacion" element="sfLRC:ConsultaFactuSistemaFacturacion"/>
|
||||||
|
</wsdl:message>
|
||||||
|
<wsdl:message name="RespuestaRegFactuSistemaFacturacion">
|
||||||
|
<wsdl:part name="RespuestaRegFactuSistemaFacturacion" element="sfR:RespuestaRegFactuSistemaFacturacion"/>
|
||||||
|
</wsdl:message>
|
||||||
|
<wsdl:message name="RespuestaConsultaFactuSistemaFacturacion">
|
||||||
|
<wsdl:part name="RespuestaConsultaFactuSistemaFacturacion" element="sfLRRC:RespuestaConsultaFactuSistemaFacturacion"/>
|
||||||
|
</wsdl:message>
|
||||||
|
<wsdl:portType name="sfPortTypeVerifactu">
|
||||||
|
<wsdl:operation name="RegFactuSistemaFacturacion">
|
||||||
|
<wsdl:input message="sfWdsl:EntradaRegFactuSistemaFacturacion"/>
|
||||||
|
<wsdl:output message="sfWdsl:RespuestaRegFactuSistemaFacturacion"/>
|
||||||
|
</wsdl:operation>
|
||||||
|
<wsdl:operation name="ConsultaFactuSistemaFacturacion">
|
||||||
|
<wsdl:input message="sfWdsl:EntradaConsultaFactuSistemaFacturacion"/>
|
||||||
|
<wsdl:output message="sfWdsl:RespuestaConsultaFactuSistemaFacturacion"/>
|
||||||
|
</wsdl:operation>
|
||||||
|
</wsdl:portType>
|
||||||
|
<wsdl:portType name="sfPortTypePorRequerimiento">
|
||||||
|
<wsdl:operation name="RegFactuSistemaFacturacion">
|
||||||
|
<wsdl:input message="sfWdsl:EntradaRegFactuSistemaFacturacion"/>
|
||||||
|
<wsdl:output message="sfWdsl:RespuestaRegFactuSistemaFacturacion"/>
|
||||||
|
</wsdl:operation>
|
||||||
|
</wsdl:portType>
|
||||||
|
<wsdl:binding name="sfVerifactu" type="sfWdsl:sfPortTypeVerifactu">
|
||||||
|
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||||
|
<wsdl:operation name="RegFactuSistemaFacturacion">
|
||||||
|
<soap:operation soapAction=""/>
|
||||||
|
<wsdl:input>
|
||||||
|
<soap:body use="literal"/>
|
||||||
|
</wsdl:input>
|
||||||
|
<wsdl:output>
|
||||||
|
<soap:body use="literal"/>
|
||||||
|
</wsdl:output>
|
||||||
|
</wsdl:operation>
|
||||||
|
<wsdl:operation name="ConsultaFactuSistemaFacturacion">
|
||||||
|
<soap:operation soapAction=""/>
|
||||||
|
<wsdl:input>
|
||||||
|
<soap:body use="literal"/>
|
||||||
|
</wsdl:input>
|
||||||
|
<wsdl:output>
|
||||||
|
<soap:body use="literal"/>
|
||||||
|
</wsdl:output>
|
||||||
|
</wsdl:operation>
|
||||||
|
</wsdl:binding>
|
||||||
|
<wsdl:binding name="sfRequerimiento" type="sfWdsl:sfPortTypePorRequerimiento">
|
||||||
|
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||||
|
<wsdl:operation name="RegFactuSistemaFacturacion">
|
||||||
|
<soap:operation soapAction=""/>
|
||||||
|
<wsdl:input>
|
||||||
|
<soap:body use="literal"/>
|
||||||
|
</wsdl:input>
|
||||||
|
<wsdl:output>
|
||||||
|
<soap:body use="literal"/>
|
||||||
|
</wsdl:output>
|
||||||
|
</wsdl:operation>
|
||||||
|
</wsdl:binding>
|
||||||
|
<wsdl:service name="sfVerifactu">
|
||||||
|
<!-- Sistemas que emiten facturas verificables. Entorno de PRODUCCION -->
|
||||||
|
<wsdl:port name="SistemaVerifactu" binding="sfWdsl:sfVerifactu">
|
||||||
|
<soap:address location="https://www1.agenciatributaria.gob.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP"/>
|
||||||
|
</wsdl:port>
|
||||||
|
<!-- Sistemas que emiten facturas verificables. Entorno de PRODUCCION para acceso con certificado de sello -->
|
||||||
|
<wsdl:port name="SistemaVerifactuSello" binding="sfWdsl:sfVerifactu">
|
||||||
|
<soap:address location="https://www10.agenciatributaria.gob.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP"/>
|
||||||
|
</wsdl:port>
|
||||||
|
<!-- Sistemas que emiten facturas verificables. Entorno de PRUEBAS -->
|
||||||
|
<wsdl:port name="SistemaVerifactuPruebas" binding="sfWdsl:sfVerifactu">
|
||||||
|
<soap:address location="https://prewww1.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP"/>
|
||||||
|
</wsdl:port>
|
||||||
|
<!-- Sistemas que emiten facturas verificables. Entorno de PRUEBAS para acceso con certificado de sello -->
|
||||||
|
<wsdl:port name="SistemaVerifactuSelloPruebas" binding="sfWdsl:sfVerifactu">
|
||||||
|
<soap:address location="https://prewww10.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP"/>
|
||||||
|
</wsdl:port>
|
||||||
|
</wsdl:service>
|
||||||
|
<wsdl:service name="sfRequerimiento">
|
||||||
|
<!-- Sistemas que emiten facturas NO verificables. (Remision bajo requerimiento). Entorno de PRODUCCION -->
|
||||||
|
<wsdl:port name="SistemaRequerimiento" binding="sfWdsl:sfRequerimiento">
|
||||||
|
<soap:address location="https://www1.agenciatributaria.gob.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/RequerimientoSOAP"/>
|
||||||
|
</wsdl:port>
|
||||||
|
<!-- Sistemas que emiten facturas NO verificables. (Remision bajo requerimiento). Entorno de PRODUCCION para acceso con certificado de sello -->
|
||||||
|
<wsdl:port name="SistemaRequerimientoSello" binding="sfWdsl:sfRequerimiento">
|
||||||
|
<soap:address location="https://www10.agenciatributaria.gob.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/RequerimientoSOAP"/>
|
||||||
|
</wsdl:port>
|
||||||
|
<!-- Sistemas que emiten facturas NO verificables. (Remision bajo requerimiento). Entorno de PRUEBAS -->
|
||||||
|
<wsdl:port name="SistemaRequerimientoPruebas" binding="sfWdsl:sfRequerimiento">
|
||||||
|
<soap:address location="https://prewww1.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/RequerimientoSOAP"/>
|
||||||
|
</wsdl:port>
|
||||||
|
<!-- Sistemas que emiten facturas NO verificables. (Remision bajo requerimiento). Entorno de PRUEBAS para acceso con certificado de sello -->
|
||||||
|
<wsdl:port name="SistemaRequerimientoSelloPruebas" binding="sfWdsl:sfRequerimiento">
|
||||||
|
<soap:address location="https://prewww10.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/RequerimientoSOAP"/>
|
||||||
|
</wsdl:port>
|
||||||
|
</wsdl:service>
|
||||||
|
</wsdl:definitions>
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- editado con XMLSpy v2019 sp1 (x64) (http://www.altova.com) por Puesto de Trabajo (Agencia Estatal de Administracion Tributaria ((AEAT))) -->
|
||||||
|
<!-- edited with XMLSpy v2009 sp1 (http://www.altova.com) by PC Corporativo (AGENCIA TRIBUTARIA) -->
|
||||||
|
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:sfLR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" xmlns:sf="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" targetNamespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" elementFormDefault="qualified">
|
||||||
|
<import namespace="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" schemaLocation="SuministroInformacion.xsd"/>
|
||||||
|
<element name="RegFactuSistemaFacturacion">
|
||||||
|
<complexType>
|
||||||
|
<sequence>
|
||||||
|
<element name="Cabecera" type="sf:CabeceraType"/>
|
||||||
|
<element name="RegistroFactura" type="sfLR:RegistroFacturaType" maxOccurs="1000"/>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
<complexType name="RegistroFacturaType">
|
||||||
|
<annotation>
|
||||||
|
<documentation xml:lang="es">Datos correspondientes a los registros de facturacion</documentation>
|
||||||
|
</annotation>
|
||||||
|
<sequence>
|
||||||
|
<choice>
|
||||||
|
<element ref="sf:RegistroAlta"/>
|
||||||
|
<element ref="sf:RegistroAnulacion"/>
|
||||||
|
</choice>
|
||||||
|
</sequence>
|
||||||
|
</complexType>
|
||||||
|
</schema>
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||||
|
xmlns:sum="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroL
|
||||||
|
R.xsd"
|
||||||
|
xmlns:sum1="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/Suministro
|
||||||
|
Informacion.xsd"
|
||||||
|
xmlns:xd="http://www.w3.org/2000/09/xmldsig#">
|
||||||
|
<soapenv:Header />
|
||||||
|
<soapenv:Body>
|
||||||
|
<sum:RegFactuSistemaFacturacion>
|
||||||
|
<sum:Cabecera>
|
||||||
|
<sum1:ObligadoEmision>
|
||||||
|
<sum1:NombreRazon>XXXXX</sum1:NombreRazon>
|
||||||
|
<sum1:NIF>AAAA</sum1:NIF>
|
||||||
|
</sum1:ObligadoEmision>
|
||||||
|
</sum:Cabecera>
|
||||||
|
<sum:RegistroFactura>
|
||||||
|
<sum1:RegistroAlta>
|
||||||
|
<sum1:IDVersion>1.0</sum1:IDVersion>
|
||||||
|
<sum1:IDFactura>
|
||||||
|
<sum1:IDEmisorFactura>AAAA</sum1:IDEmisorFactura>
|
||||||
|
<sum1:NumSerieFactura>12345</sum1:NumSerieFactura>
|
||||||
|
<sum1:FechaExpedicionFactura>13-09-2024</sum1:FechaExpedicionFactura>
|
||||||
|
</sum1:IDFactura>
|
||||||
|
<sum1:NombreRazonEmisor>XXXXX</sum1:NombreRazonEmisor>
|
||||||
|
<sum1:TipoFactura>F1</sum1:TipoFactura>
|
||||||
|
<sum1:DescripcionOperacion>Descripc</sum1:DescripcionOperacion>
|
||||||
|
<sum1:Destinatarios>
|
||||||
|
<sum1:IDDestinatario>
|
||||||
|
<sum1:NombreRazon>YYYY</sum1:NombreRazon>
|
||||||
|
<sum1:NIF>BBBB</sum1:NIF>
|
||||||
|
</sum1:IDDestinatario>
|
||||||
|
</sum1:Destinatarios>
|
||||||
|
<sum1:Desglose>
|
||||||
|
<sum1:DetalleDesglose>
|
||||||
|
<sum1:ClaveRegimen>01</sum1:ClaveRegimen>
|
||||||
|
<sum1:CalificacionOperacion>S1</sum1:CalificacionOperacion>
|
||||||
|
<sum1:TipoImpositivo>4</sum1:TipoImpositivo>
|
||||||
|
<sum1:BaseImponibleOimporteNoSujeto>10</sum1:BaseImponibleOimporteNoSujeto>
|
||||||
|
<sum1:CuotaRepercutida>0.4</sum1:CuotaRepercutida>
|
||||||
|
</sum1:DetalleDesglose>
|
||||||
|
<sum1:DetalleDesglose>
|
||||||
|
<sum1:ClaveRegimen>01</sum1:ClaveRegimen>
|
||||||
|
<sum1:CalificacionOperacion>S1</sum1:CalificacionOperacion>
|
||||||
|
<sum1:TipoImpositivo>21</sum1:TipoImpositivo>
|
||||||
|
<sum1:BaseImponibleOimporteNoSujeto>100</sum1:BaseImponibleOimporteNoSujeto>
|
||||||
|
<sum1:CuotaRepercutida>21</sum1:CuotaRepercutida>
|
||||||
|
</sum1:DetalleDesglose>
|
||||||
|
</sum1:Desglose>
|
||||||
|
<sum1:CuotaTotal>21.4</sum1:CuotaTotal>
|
||||||
|
<sum1:ImporteTotal>131.4</sum1:ImporteTotal>
|
||||||
|
<sum1:Encadenamiento>
|
||||||
|
<sum1:RegistroAnterior>
|
||||||
|
<sum1:IDEmisorFactura>AAAA</sum1:IDEmisorFactura>
|
||||||
|
<sum1:NumSerieFactura>44</sum1:NumSerieFactura>
|
||||||
|
<sum1:FechaExpedicionFactura>13-09-2024</sum1:FechaExpedicionFactura>
|
||||||
|
<sum1:Huella>HuellaRegistroAnterior</sum1:Huella>
|
||||||
|
</sum1:RegistroAnterior>
|
||||||
|
</sum1:Encadenamiento>
|
||||||
|
<sum1:SistemaInformatico>
|
||||||
|
<sum1:NombreRazon>SSSS</sum1:NombreRazon>
|
||||||
|
<sum1:NIF>NNNN</sum1:NIF>
|
||||||
|
<sum1:NombreSistemaInformatico>NombreSistemaInformatico</sum1:NombreSistemaInformatico>
|
||||||
|
<sum1:IdSistemaInformatico>77</sum1:IdSistemaInformatico>
|
||||||
|
<sum1:Version>1.0.03</sum1:Version>
|
||||||
|
<sum1:NumeroInstalacion>383</sum1:NumeroInstalacion>
|
||||||
|
<sum1:TipoUsoPosibleSoloVerifactu>N</sum1:TipoUsoPosibleSoloVerifactu>
|
||||||
|
<sum1:TipoUsoPosibleMultiOT>S</sum1:TipoUsoPosibleMultiOT>
|
||||||
|
<sum1:IndicadorMultiplesOT>S</sum1:IndicadorMultiplesOT>
|
||||||
|
</sum1:SistemaInformatico>
|
||||||
|
<sum1:FechaHoraHusoGenRegistro>2024-09-13T19:20:30+01:00</sum1:FechaHoraHusoGenRegistro>
|
||||||
|
<sum1:TipoHuella>01</sum1:TipoHuella>
|
||||||
|
<sum1:Huella>Huella</sum1:Huella>
|
||||||
|
</sum1:RegistroAlta>
|
||||||
|
</sum:RegistroFactura>
|
||||||
|
</sum:RegFactuSistemaFacturacion>
|
||||||
|
</soapenv:Body>
|
||||||
|
</soapenv:Envelope>
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||||
|
xmlns:sum="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroL
|
||||||
|
R.xsd"
|
||||||
|
xmlns:sum1="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/Suministro
|
||||||
|
Informacion.xsd"
|
||||||
|
xmlns:xd="http://www.w3.org/2000/09/xmldsig#">
|
||||||
|
<soapenv:Header />
|
||||||
|
<soapenv:Body>
|
||||||
|
<sum:RegFactuSistemaFacturacion>
|
||||||
|
<sum:Cabecera>
|
||||||
|
<sum1:ObligadoEmision>
|
||||||
|
<sum1:NombreRazon>XXXXX</sum1:NombreRazon>
|
||||||
|
<sum1:NIF>AAAA</sum1:NIF>
|
||||||
|
</sum1:ObligadoEmision>
|
||||||
|
</sum:Cabecera>
|
||||||
|
<sum:RegistroFactura>
|
||||||
|
<sum1:RegistroAnulacion>
|
||||||
|
<sum1:IDVersion>1.0</sum1:IDVersion>
|
||||||
|
<sum1:IDFactura>
|
||||||
|
<sum1:IDEmisorFacturaAnulada>AAAA</sum1:IDEmisorFacturaAnulada>
|
||||||
|
<sum1:NumSerieFacturaAnulada>12345</sum1:NumSerieFacturaAnulada>
|
||||||
|
<sum1:FechaExpedicionFacturaAnulada>13-09-2024</sum1:FechaExpedicionFacturaAnulada>
|
||||||
|
</sum1:IDFactura>
|
||||||
|
<sum1:Encadenamiento>
|
||||||
|
<sum1:RegistroAnterior>
|
||||||
|
<sum1:IDEmisorFactura>AAAA</sum1:IDEmisorFactura>
|
||||||
|
<sum1:NumSerieFactura>44</sum1:NumSerieFactura>
|
||||||
|
<sum1:FechaExpedicionFactura>13-09-2024</sum1:FechaExpedicionFactura>
|
||||||
|
<sum1:Huella>HuellaRegistroAnterior</sum1:Huella>
|
||||||
|
</sum1:RegistroAnterior>
|
||||||
|
</sum1:Encadenamiento>
|
||||||
|
<sum1:SistemaInformatico>
|
||||||
|
<sum1:NombreRazon>SSSS</sum1:NombreRazon>
|
||||||
|
<sum1:NIF>NNNN</sum1:NIF>
|
||||||
|
<sum1:NombreSistemaInformatico>NombreSistemaInformatico</sum1:NombreSistemaInformatico>
|
||||||
|
<sum1:IdSistemaInformatico>77</sum1:IdSistemaInformatico>
|
||||||
|
<sum1:Version>1.0.03</sum1:Version>
|
||||||
|
<sum1:NumeroInstalacion>383</sum1:NumeroInstalacion>
|
||||||
|
<sum1:TipoUsoPosibleSoloVerifactu>N</sum1:TipoUsoPosibleSoloVerifactu>
|
||||||
|
<sum1:TipoUsoPosibleMultiOT>S</sum1:TipoUsoPosibleMultiOT>
|
||||||
|
<sum1:IndicadorMultiplesOT>S</sum1:IndicadorMultiplesOT>
|
||||||
|
</sum1:SistemaInformatico>
|
||||||
|
<sum1:FechaHoraHusoGenRegistro>2024-09-13T19:20:30+01:00</sum1:FechaHoraHusoGenRegistro>
|
||||||
|
<sum1:TipoHuella>01</sum1:TipoHuella>
|
||||||
|
<sum1:Huella>Huella</sum1:Huella>
|
||||||
|
</sum1:RegistroAnulacion>
|
||||||
|
</sum:RegistroFactura>
|
||||||
|
</sum:RegFactuSistemaFacturacion>
|
||||||
|
</soapenv:Body>
|
||||||
|
</soapenv:Envelope>
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||||
|
xmlns:sum="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroL
|
||||||
|
R.xsd"
|
||||||
|
xmlns:sum1="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/Suministro
|
||||||
|
Informacion.xsd"
|
||||||
|
xmlns:xd="http://www.w3.org/2000/09/xmldsig#">
|
||||||
|
<soapenv:Header />
|
||||||
|
<soapenv:Body>
|
||||||
|
<sum:RegFactuSistemaFacturacion>
|
||||||
|
<sum:Cabecera>
|
||||||
|
<sum1:ObligadoEmision>
|
||||||
|
<sum1:NombreRazon>XXXXX</sum1:NombreRazon>
|
||||||
|
<sum1:NIF>AAAA</sum1:NIF>
|
||||||
|
</sum1:ObligadoEmision>
|
||||||
|
</sum:Cabecera>
|
||||||
|
<sum:RegistroFactura>
|
||||||
|
<sum1:RegistroAlta>
|
||||||
|
<sum1:IDVersion>1.0</sum1:IDVersion>
|
||||||
|
<sum1:IDFactura>
|
||||||
|
<sum1:IDEmisorFactura>AAAA</sum1:IDEmisorFactura>
|
||||||
|
<sum1:NumSerieFactura>12345</sum1:NumSerieFactura>
|
||||||
|
<sum1:FechaExpedicionFactura>13-09-2024</sum1:FechaExpedicionFactura>
|
||||||
|
</sum1:IDFactura>
|
||||||
|
<sum1:NombreRazonEmisor>XXXXX</sum1:NombreRazonEmisor>
|
||||||
|
<sum1:Subsanacion>S</sum1:Subsanacion>
|
||||||
|
<sum1:TipoFactura>F1</sum1:TipoFactura>
|
||||||
|
<sum1:DescripcionOperacion>Descripc</sum1:DescripcionOperacion>
|
||||||
|
<sum1:Destinatarios>
|
||||||
|
<sum1:IDDestinatario>
|
||||||
|
<sum1:NombreRazon>YYYY</sum1:NombreRazon>
|
||||||
|
<sum1:NIF>BBBB</sum1:NIF>
|
||||||
|
</sum1:IDDestinatario>
|
||||||
|
</sum1:Destinatarios>
|
||||||
|
<sum1:Desglose>
|
||||||
|
<sum1:DetalleDesglose>
|
||||||
|
<sum1:ClaveRegimen>01</sum1:ClaveRegimen>
|
||||||
|
<sum1:CalificacionOperacion>S1</sum1:CalificacionOperacion>
|
||||||
|
<sum1:TipoImpositivo>4</sum1:TipoImpositivo>
|
||||||
|
<sum1:BaseImponibleOimporteNoSujeto>10</sum1:BaseImponibleOimporteNoSujeto>
|
||||||
|
<sum1:CuotaRepercutida>0.4</sum1:CuotaRepercutida>
|
||||||
|
</sum1:DetalleDesglose>
|
||||||
|
<sum1:DetalleDesglose>
|
||||||
|
<sum1:ClaveRegimen>01</sum1:ClaveRegimen>
|
||||||
|
<sum1:CalificacionOperacion>S1</sum1:CalificacionOperacion>
|
||||||
|
<sum1:TipoImpositivo>21</sum1:TipoImpositivo>
|
||||||
|
<sum1:BaseImponibleOimporteNoSujeto>100</sum1:BaseImponibleOimporteNoSujeto>
|
||||||
|
<sum1:CuotaRepercutida>21</sum1:CuotaRepercutida>
|
||||||
|
</sum1:DetalleDesglose>
|
||||||
|
</sum1:Desglose>
|
||||||
|
<sum1:CuotaTotal>21.4</sum1:CuotaTotal>
|
||||||
|
<sum1:ImporteTotal>131.4</sum1:ImporteTotal>
|
||||||
|
<sum1:Encadenamiento>
|
||||||
|
<sum1:RegistroAnterior>
|
||||||
|
<sum1:IDEmisorFactura>AAAA</sum1:IDEmisorFactura>
|
||||||
|
<sum1:NumSerieFactura>44</sum1:NumSerieFactura>
|
||||||
|
<sum1:FechaExpedicionFactura>13-09-2024</sum1:FechaExpedicionFactura>
|
||||||
|
<sum1:Huella>HuellaRegistroAnterior</sum1:Huella>
|
||||||
|
</sum1:RegistroAnterior>
|
||||||
|
</sum1:Encadenamiento>
|
||||||
|
<sum1:SistemaInformatico>
|
||||||
|
<sum1:NombreRazon>SSSS</sum1:NombreRazon>
|
||||||
|
<sum1:NIF>NNNN</sum1:NIF>
|
||||||
|
<sum1:NombreSistemaInformatico>NombreSistemaInformatico</sum1:NombreSistemaInformatico>
|
||||||
|
<sum1:IdSistemaInformatico>77</sum1:IdSistemaInformatico>
|
||||||
|
<sum1:Version>1.0.03</sum1:Version>
|
||||||
|
<sum1:NumeroInstalacion>383</sum1:NumeroInstalacion>
|
||||||
|
<sum1:TipoUsoPosibleSoloVerifactu>N</sum1:TipoUsoPosibleSoloVerifactu>
|
||||||
|
<sum1:TipoUsoPosibleMultiOT>S</sum1:TipoUsoPosibleMultiOT>
|
||||||
|
<sum1:IndicadorMultiplesOT>S</sum1:IndicadorMultiplesOT>
|
||||||
|
</sum1:SistemaInformatico>
|
||||||
|
<sum1:FechaHoraHusoGenRegistro>2024-09-13T19:20:30+01:00</sum1:FechaHoraHusoGenRegistro>
|
||||||
|
<sum1:TipoHuella>01</sum1:TipoHuella>
|
||||||
|
<sum1:Huella>Huella</sum1:Huella>
|
||||||
|
</sum1:RegistroAlta>
|
||||||
|
</sum:RegistroFactura>
|
||||||
|
</sum:RegFactuSistemaFacturacion>
|
||||||
|
</soapenv:Body>
|
||||||
|
</soapenv:Envelope>
|
||||||
Loading…
Reference in New Issue