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.Returns the SII lazy worker instance that provides access to all SII operations
getWorkers
Returns all available workers in this component.Returns an associative array with worker name as key:
sii_lazy: SiiLazyWorkerInterface
SII Operations
The SII Lazy Worker supports the following operations (jobs):Authentication
Authentication
Authenticates with SII web services to obtain a session token required for other operations.Job:
AuthenticateJobSend XML Document
Send XML Document
Sends a signed XML document (DTE) to SII for processing and validation.Job:
SendXmlDocumentJobValidate Document
Validate Document
Validates a document against SII business rules without sending it.Job:
ValidateDocumentJobValidate Document Signature
Validate Document Signature
Validates the digital signature of a document.Job:
ValidateDocumentSignatureJobCheck Document Status
Check Document Status
Checks the current processing status of a previously sent document.Job:
CheckXmlDocumentSentStatusJobRequest Status by Email
Request Status by Email
Requests that SII send the document status to the registered email.Job:
RequestXmlDocumentSentStatusByEmailJobConsume Web Service
Consume Web Service
Generic method to consume any SII web service endpoint.Job:
ConsumeWebserviceJobUsage Example
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 failuresSiiSendXmlDocumentException: Document submission errorsSiiValidateDocumentException: Document validation errorsSiiValidateDocumentSignatureException: Signature validation errorsSiiCheckXmlDocumentSentStatusException: Status check errorsSiiRequestXmlDocumentSentStatusByEmailException: Email request errorsSiiConsumeWebserviceException: Generic web service errorsIntegrationException: 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