DispatcherWorker
extends AbstractWorker
in package
implements
DispatcherWorkerInterface
Clase para la gestión de sobres de documentos (para envíos/transferencias).
Attributes
- #[Worker]
- $name: 'dispatcher'
- $component: 'document'
- $package: 'billing'
Table of Contents
Interfaces
- DispatcherWorkerInterface
- Interfaz para el worker que maneja el envío de los documentos.
Properties
- $documentBagManagerWorker : DocumentBagManagerWorkerInterface
- $signatureService : SignatureServiceInterface
- $xmlService : XmlServiceInterface
Methods
- __construct() : mixed
- create() : DocumentEnvelopeInterface
- Crea un sobre con los datos de la bolsa de un documento tributario.
- loadXml() : DocumentEnvelopeInterface
- Realiza la carga del sobre de documentos desde un string XML.
- normalize() : DocumentEnvelopeInterface
- Normaliza un sobre con datos de los documentos tributarios transferidos.
- validate() : XmlDocumentInterface
- Realiza la validación del sobre de documentos tributarios.
- validateSchema() : XmlDocumentInterface
- Valida el esquema del XML del sobre de documentos tributarios.
- validateSignature() : XmlDocumentInterface
- Valida la firma electrónica del sobre de documentos tributarios.
- ensureCaratula() : void
- ensureDocuments() : void
- Se asegura que exista un arreglo con las bolsas de los documentos tributarios si no está definida y existe un documento XML en el sobre.
- ensureEmisor() : void
- ensureMandatario() : void
- ensureReceptor() : void
- ensureSobreEnvio() : void
- ensureXmlDocument() : void
- getResumen() : array<string|int, mixed>
- Obtiene el resumen de los documentos que hay en el sobre.
- getXmlDocument() : XmlDocumentInterface
- Obtiene el documento XML a partir de la fuente.
- sign() : void
- Firma el sobre de documentos.
Properties
$documentBagManagerWorker
private
DocumentBagManagerWorkerInterface
$documentBagManagerWorker
$signatureService
private
SignatureServiceInterface
$signatureService
$xmlService
private
XmlServiceInterface
$xmlService
Methods
__construct()
public
__construct(XmlServiceInterface $xmlService, SignatureServiceInterface $signatureService, DocumentBagManagerWorkerInterface $documentBagManagerWorker[, iterable<string|int, mixed> $jobs = [] ][, iterable<string|int, mixed> $handlers = [] ]) : mixed
Parameters
- $xmlService : XmlServiceInterface
- $signatureService : SignatureServiceInterface
- $documentBagManagerWorker : DocumentBagManagerWorkerInterface
- $jobs : iterable<string|int, mixed> = []
- $handlers : iterable<string|int, mixed> = []
create()
Crea un sobre con los datos de la bolsa de un documento tributario.
public
create(DocumentBagInterface $bag) : DocumentEnvelopeInterface
Parameters
- $bag : DocumentBagInterface
Attributes
- #[ApiResource]
- $parametersExample: ['bag' => ['xmlDocument' => '', 'certificate' => ['data' => '', 'password' => ''], 'emisor' => ['autorizacionDte' => ['fechaResolucion' => '2014-08-22', 'numeroResolucion' => 80]]]]
Return values
DocumentEnvelopeInterfaceloadXml()
Realiza la carga del sobre de documentos desde un string XML.
public
loadXml(string $xml) : DocumentEnvelopeInterface
Parameters
- $xml : string
-
Datos del sobre de documentos tributarios.
Return values
DocumentEnvelopeInterface —Contenedor con los datos del sobre.
normalize()
Normaliza un sobre con datos de los documentos tributarios transferidos.
public
normalize(DocumentEnvelopeInterface $envelope) : DocumentEnvelopeInterface
Parameters
- $envelope : DocumentEnvelopeInterface
Return values
DocumentEnvelopeInterfacevalidate()
Realiza la validación del sobre de documentos tributarios.
public
validate(DocumentEnvelopeInterface|XmlDocumentInterface|string $source) : XmlDocumentInterface
Parameters
- $source : DocumentEnvelopeInterface|XmlDocumentInterface|string
Attributes
- #[ApiResource]
- $parametersExample: ['source' => '']
Return values
XmlDocumentInterfacevalidateSchema()
Valida el esquema del XML del sobre de documentos tributarios.
public
validateSchema(DocumentEnvelopeInterface|XmlDocumentInterface|string $source) : XmlDocumentInterface
Parameters
- $source : DocumentEnvelopeInterface|XmlDocumentInterface|string
Return values
XmlDocumentInterfacevalidateSignature()
Valida la firma electrónica del sobre de documentos tributarios.
public
validateSignature(DocumentEnvelopeInterface|XmlDocumentInterface|string $source) : XmlDocumentInterface
Parameters
- $source : DocumentEnvelopeInterface|XmlDocumentInterface|string
Return values
XmlDocumentInterfaceensureCaratula()
protected
ensureCaratula(DocumentEnvelopeInterface $envelope) : void
Parameters
- $envelope : DocumentEnvelopeInterface
ensureDocuments()
Se asegura que exista un arreglo con las bolsas de los documentos tributarios si no está definida y existe un documento XML en el sobre.
protected
ensureDocuments(DocumentEnvelopeInterface $envelope) : void
Parameters
- $envelope : DocumentEnvelopeInterface
ensureEmisor()
protected
ensureEmisor(DocumentEnvelopeInterface $envelope) : void
Parameters
- $envelope : DocumentEnvelopeInterface
ensureMandatario()
protected
ensureMandatario(DocumentEnvelopeInterface $envelope) : void
Parameters
- $envelope : DocumentEnvelopeInterface
ensureReceptor()
protected
ensureReceptor(DocumentEnvelopeInterface $envelope) : void
Parameters
- $envelope : DocumentEnvelopeInterface
ensureSobreEnvio()
protected
ensureSobreEnvio(DocumentEnvelopeInterface $envelope) : void
Parameters
- $envelope : DocumentEnvelopeInterface
ensureXmlDocument()
protected
ensureXmlDocument(DocumentEnvelopeInterface $envelope) : void
Parameters
- $envelope : DocumentEnvelopeInterface
getResumen()
Obtiene el resumen de los documentos que hay en el sobre.
protected
getResumen(DocumentEnvelopeInterface $envelope) : array<string|int, mixed>
Esto se usa para para generar los tags del XML SubTotDTE
.
Parameters
- $envelope : DocumentEnvelopeInterface
Return values
array<string|int, mixed> —Arreglo con el resumen de documentos por tipo.
getXmlDocument()
Obtiene el documento XML a partir de la fuente.
protected
getXmlDocument(DocumentEnvelopeInterface|XmlDocumentInterface|string $source) : XmlDocumentInterface
Parameters
- $source : DocumentEnvelopeInterface|XmlDocumentInterface|string
Return values
XmlDocumentInterfacesign()
Firma el sobre de documentos.
protected
sign(DocumentEnvelopeInterface $envelope) : void
Parameters
- $envelope : DocumentEnvelopeInterface