billing.trading_parties) manages all commercial entities involved in electronic tax documents, including issuers, receivers, taxpayers, and authorized representatives.
Overview
This component provides comprehensive management of trading parties (partes comerciales), handling their creation, validation, and relationships in the context of Chilean electronic invoicing.Workers
The Trading Parties Component contains the following worker:Mandatario Manager
Manages authorized representatives (mandatarios) who can act on behalf of taxpayers
Main Methods
getMandatarioManagerWorker
Returns the mandatario manager worker for managing authorized representatives.Returns the mandatario manager worker instance
getWorkers
Returns all available workers.Returns an associative array with worker names as keys:
mandatario_manager: MandatarioManagerWorkerInterface
Entities
The component manages the following entities:Emisor (Issuer)
Represents the party issuing a tax document. Properties:- RUT (tax ID)
- Business name (razón social)
- Trade name (nombre de fantasía)
- Economic activity code (giro)
- Address information
- Contact information
- DTE authorization details
libredte\lib\Core\Package\Billing\Component\TradingParties\Entity\Emisor
Factory: libredte\lib\Core\Package\Billing\Component\TradingParties\Factory\EmisorFactory
Receptor (Receiver)
Represents the party receiving a tax document. Properties:- RUT (tax ID)
- Business name (razón social)
- Economic activity code (giro)
- Address information
- Contact information
libredte\lib\Core\Package\Billing\Component\TradingParties\Entity\Receptor
Factory: libredte\lib\Core\Package\Billing\Component\TradingParties\Factory\ReceptorFactory
Contribuyente (Taxpayer)
Represents a general taxpayer (can be either issuer or receiver). Properties:- RUT (tax ID)
- Business name
- Tax information
- Legal entity details
libredte\lib\Core\Package\Billing\Component\TradingParties\Entity\Contribuyente
Factory: libredte\lib\Core\Package\Billing\Component\TradingParties\Factory\ContribuyenteFactory
Mandatario (Authorized Representative)
Represents an authorized person who can sign documents on behalf of a taxpayer. Properties:- RUT (tax ID of representative)
- Name
- Authorization details
- Scope of authorization
libredte\lib\Core\Package\Billing\Component\TradingParties\Entity\Mandatario
Factory: libredte\lib\Core\Package\Billing\Component\TradingParties\Factory\MandatarioFactory
PersonaNatural (Natural Person)
Represents an individual taxpayer (natural person as opposed to legal entity). Entity:libredte\lib\Core\Package\Billing\Component\TradingParties\Entity\PersonaNatural
AutorizacionDte (DTE Authorization)
Represents authorization details for issuing electronic tax documents. Properties:- Authorized document types
- Authorization date
- Resolution number
- DTE exchange email (CorreoIntercambioDte)
libredte\lib\Core\Package\Billing\Component\TradingParties\Entity\AutorizacionDte
Factories
The component provides factories for creating trading party entities:EmisorFactory
Creates issuer instances from various data sources.ReceptorFactory
Creates receiver instances from various data sources.MandatarioFactory
Creates authorized representative instances.ContribuyenteFactory
Creates general taxpayer instances.Providers
The component includes provider interfaces for loading trading parties from external sources:EmisorProvider
Interface for providing issuer data from databases, APIs, or other sources. Interface:libredte\lib\Core\Package\Billing\Component\TradingParties\Contract\EmisorProviderInterface
Fake Implementation: libredte\lib\Core\Package\Billing\Component\TradingParties\Service\FakeEmisorProvider
ReceptorProvider
Interface for providing receiver data from databases, APIs, or other sources. Interface:libredte\lib\Core\Package\Billing\Component\TradingParties\Contract\ReceptorProviderInterface
Fake Implementation: libredte\lib\Core\Package\Billing\Component\TradingParties\Service\FakeReceptorProvider
Usage Examples
Creating an Issuer
Creating a Receiver
Managing Mandatarios
Traits
The component provides helpful traits:CorreoIntercambioDteInfoTrait
Provides methods for handling DTE exchange email information. Trait:libredte\lib\Core\Package\Billing\Component\TradingParties\Trait\CorreoIntercambioDteInfoTrait
Error Handling
The component throws specific exceptions:TradingPartiesException: General trading parties errors
Source Reference
Namespace:libredte\lib\Core\Package\Billing\Component\TradingParties\TradingPartiesComponent
Location: /workspace/source/src/Package/Billing/Component/TradingParties/TradingPartiesComponent.php:38