Skip to main content
The Integration Component (billing.integration) manages all communication with the Chilean tax authority (SII), including authentication, document submission, and status verification.

Overview

This component provides a unified interface for interacting with SII web services. It handles authentication, XML document submission, validation, and status tracking.

Workers

The Integration Component contains the following workers:

SII Lazy Worker

Lazy-loading worker for SII web service operations including authentication, document sending, validation, and status checking

Main Methods

getSiiLazyWorker

Returns the SII Lazy Worker for performing operations with SII web services.
return
SiiLazyWorkerInterface
Returns the SII lazy worker instance that provides access to all SII operations
use libredte\lib\Core\Package\Billing\Component\Integration\IntegrationComponent;

// Get the SII worker
$siiWorker = $integrationComponent->getSiiLazyWorker();

// The worker provides access to various SII jobs:
// - Authentication
// - Send XML documents
// - Validate documents
// - Check document status
// - Request status by email
// - Validate document signatures

getWorkers

Returns all available workers in this component.
return
array
Returns an associative array with worker name as key:
  • sii_lazy: SiiLazyWorkerInterface

SII Operations

The SII Lazy Worker supports the following operations (jobs):
Authenticates with SII web services to obtain a session token required for other operations.Job: AuthenticateJob
Sends a signed XML document (DTE) to SII for processing and validation.Job: SendXmlDocumentJob
Validates a document against SII business rules without sending it.Job: ValidateDocumentJob
Validates the digital signature of a document.Job: ValidateDocumentSignatureJob
Checks the current processing status of a previously sent document.Job: CheckXmlDocumentSentStatusJob
Requests that SII send the document status to the registered email.Job: RequestXmlDocumentSentStatusByEmailJob
Generic method to consume any SII web service endpoint.Job: ConsumeWebserviceJob

Usage Example

use libredte\lib\Core\Package\Billing\Component\Integration\IntegrationComponent;
use libredte\lib\Core\Package\Billing\Component\Integration\Enum\SiiAmbiente;

// Get the integration component
$integrationComponent = $billingPackage->getIntegrationComponent();
$siiWorker = $integrationComponent->getSiiLazyWorker();

// Authenticate with SII (required before other operations)
// Authentication is typically handled automatically by the worker

// Send a document to SII
// The worker will handle authentication, submission, and return the response

Environment Support

The component supports both SII environments:
  • Certification: For testing and development (SiiAmbiente::CERTIFICACION)
  • Production: For real tax documents (SiiAmbiente::PRODUCCION)

Error Handling

The component throws specific exceptions for different error scenarios:
  • SiiAuthenticateException: Authentication failures
  • SiiSendXmlDocumentException: Document submission errors
  • SiiValidateDocumentException: Document validation errors
  • SiiValidateDocumentSignatureException: Signature validation errors
  • SiiCheckXmlDocumentSentStatusException: Status check errors
  • SiiRequestXmlDocumentSentStatusByEmailException: Email request errors
  • SiiConsumeWebserviceException: Generic web service errors
  • IntegrationException: General integration errors

Source Reference

Namespace: libredte\lib\Core\Package\Billing\Component\Integration\IntegrationComponent Location: /workspace/source/src/Package/Billing/Component/Integration/IntegrationComponent.php:38

Build docs developers (and LLMs) love