HaciendaRepresentacion
Description
Section titled “Description”Generates the printable representation of a Hacienda electronic document with its QR code, computed from the 50-digit numeric key. It can take an already-issued document (by passing its key, it recovers the data saved in the database) or receive a document in JSON to preview the representation before issuing it. Returns a self-contained HTML, ready to print or export to PDF.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | Hacienda credential |
| clave | text | No | Numeric key (50 digits) of the issued document (fetches data from the database) |
| comprobante | json | No | Document in JSON to preview (if no key is provided) |
Credentials
Section titled “Credentials”This module requires a hacienda credential type with the following fields:
- Certificate (.p12): the issuer’s digital certificate
- Certificate password
- Issuer’s cedula/tax ID (9 to 12 digits)
- ATV user and password (Hacienda’s IDP)
- Environment: sandbox (testing) or production
Output
Section titled “Output”{ "clave": "50601012600310123456700100001010000000001100000001", "html": "...", "qrImage": "data:image/png;base64,..."}Usage Example
Section titled “Usage Example”{ "credentials_id": "cred-hacienda-prod", "clave": "50601012600310123456700100001010000000001100000001"}- If a key is passed, the node fetches the already-issued document from the database (type, sequential, receptor, totals) and builds the QR with its real status.
- If there is no issued document yet, a document in JSON with its items can be passed to preview the representation before sending it to Hacienda.
- The HTML is self-contained (styles included) and meant to be printed or exported to PDF directly.
- If the key is not found in the database, the node returns an error instead of generating a representation with empty data.
Related Nodes
Section titled “Related Nodes”- HaciendaEmitirFactura - Issue the invoice
- HaciendaEmitirNota - Issue a credit or debit note
- HaciendaConsultarEstado - Query the document’s status