BatchProcessorWorker
extends AbstractWorker
in package
implements
BatchProcessorWorkerInterface
uses
StrategiesAwareTrait
Clase para los procesadores de documentos en lote.
Las estrategias (BatchProcessorStrategyInterface) son parsers: transforman
los datos de entrada del lote (un CSV, una planilla, etc.) en el listado de
documentos tributarios. El worker toma ese listado y crea los documentos, uno
a uno.
Attributes
- #[Worker]
- $name: 'batch_processor'
- $component: 'document'
- $package: 'billing'
Table of Contents
Interfaces
- BatchProcessorWorkerInterface
- Interfaz para los procesadores de documentos en lote.
Properties
- $optionsSchema : array<string, array<string|int, mixed>|bool>
- Esquema de las opciones.
- $builderWorker : BuilderWorkerInterface
- $cafFaker : CafFakerWorkerInterface
- $documentBagManagerWorker : DocumentBagManagerWorkerInterface
Methods
- __construct() : mixed
- Constructor del worker y sus dependencias.
- getOptionsSchema() : array<string|int, mixed>
- {@inheritDoc}
- parse() : DocumentBatchInterface
- Parsea los datos de entrada del lote, con la estrategia solicitada.
- process() : DocumentBatchInterface
- Procesa masivamente documentos tributarios electrónicos.
- completeParsedData() : array<string|int, mixed>
- Completa los datos del documento parseado desde el archivo masivo.
- parseDocuments() : array<string|int, mixed>
- Parsea los datos de entrada del lote, con la estrategia que se haya solicitado, y entrega los datos de los documentos que se deben crear.
Properties
$optionsSchema
Esquema de las opciones.
protected
array<string, array<string|int, mixed>|bool>
$optionsSchema
= ['__allowUndefinedKeys' => true, 'strategy' => ['types' => 'string', 'default' => 'spreadsheet.csv'], 'complete' => ['types' => 'bool', 'default' => true], 'stamp' => ['types' => 'bool', 'default' => true]]
$builderWorker
private
BuilderWorkerInterface
$builderWorker
$cafFaker
private
CafFakerWorkerInterface
$cafFaker
$documentBagManagerWorker
private
DocumentBagManagerWorkerInterface
$documentBagManagerWorker
Methods
__construct()
Constructor del worker y sus dependencias.
public
__construct(CafFakerWorkerInterface $cafFaker, DocumentBagManagerWorkerInterface $documentBagManagerWorker, BuilderWorkerInterface $builderWorker[, iterable<string|int, mixed> $jobs = [] ][, iterable<string|int, mixed> $handlers = [] ][, iterable<string|int, mixed> $strategies = [] ]) : mixed
Parameters
- $cafFaker : CafFakerWorkerInterface
- $documentBagManagerWorker : DocumentBagManagerWorkerInterface
- $builderWorker : BuilderWorkerInterface
- $jobs : iterable<string|int, mixed> = []
- $handlers : iterable<string|int, mixed> = []
- $strategies : iterable<string|int, mixed> = []
getOptionsSchema()
{@inheritDoc}
public
getOptionsSchema() : array<string|int, mixed>
Return values
array<string|int, mixed>parse()
Parsea los datos de entrada del lote, con la estrategia solicitada.
public
parse(DocumentBatchInterface $batch) : DocumentBatchInterface
Parameters
- $batch : DocumentBatchInterface
-
Contenedor del lote a procesar.
Attributes
- #[Operation]
- $parameters: ['batch' => ['example' => ['emisor' => ['rut' => '76192083-9', 'razon_social' => 'SASCO SpA'], 'inputData' => '...', 'options' => ['batch_processor' => ['strategy' => 'spreadsheet.csv', 'complete' => true]]]]]
Return values
DocumentBatchInterface —Contenedor del lote con los datos de cada documento parseado.
process()
Procesa masivamente documentos tributarios electrónicos.
public
process(DocumentBatchInterface $batch) : DocumentBatchInterface
Parameters
- $batch : DocumentBatchInterface
-
Contenedor del lote a procesar.
Return values
DocumentBatchInterfacecompleteParsedData()
Completa los datos del documento parseado desde el archivo masivo.
private
completeParsedData(DocumentBatchInterface $batch, array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $batch : DocumentBatchInterface
- $data : array<string|int, mixed>
Return values
array<string|int, mixed>parseDocuments()
Parsea los datos de entrada del lote, con la estrategia que se haya solicitado, y entrega los datos de los documentos que se deben crear.
private
parseDocuments(DocumentBatchInterface $batch) : array<string|int, mixed>
Parameters
- $batch : DocumentBatchInterface