Skip to content

DgiRepresentacion

Generates the printable representation of a Uruguay Comprobante Fiscal Electronico (CFE), including its security code and the lookup QR code required by the DGI. It can take an already-issued CFE (identified by type, series and number, retrieving the signed XML stored in the database) or build a preview from a CFE in JSON format that has not been issued yet.

Returns HTML ready to print or convert to PDF, together with the QR image and the content it encodes.

FieldTypeRequiredDescription
credentials_idcredentialsYesdgi credential
tipo_cfetextNoType of the already-issued CFE (to fetch it from the database)
serietextNoSeries of the already-issued CFE
numerotextNoNumber of the already-issued CFE
cfejsonNoCFE as JSON to preview (if type/series/number are not provided)

Either tipo_cfe + serie + numero must be provided to represent an already-issued document, or cfe with items to preview one that has not been issued yet.

This module requires a dgi credential type with the following fields:

  • Certificate (.p12): advanced signature certificate in base64
  • Certificate password: password for the .p12 file
  • RUT: issuer’s tax ID
  • Company Name: issuer’s legal name
  • Environment: test (homologation) or prod (production)
{
"tipoCfe": 111,
"serie": "A",
"numero": 159,
"html": "<html>...printable representation...</html>",
"qrUrl": "https://efactura.dgi.gub.uy/...",
"qrImage": "data:image/png;base64,...",
"codigoSeguridad": "AB12CD34",
"digestValue": "sha1-abc123..."
}
{
"credentials_id": "cred-dgi-prod",
"tipo_cfe": "111",
"serie": "A",
"numero": "159"
}
{
"credentials_id": "cred-dgi-prod",
"cfe": {
"tipoCfe": 111,
"receptor": { "tipoDocumento": 2, "documento": "212345670010" },
"items": [
{ "descripcion": "Consulting service", "cantidad": 1, "precioUnitario": 1000, "indicadorIva": "22" }
]
}
}
  • When representing an already-issued CFE, the HTML includes the real security code stored at issuance; in a preview the code may be provisional.
  • The html field is meant to be rendered directly or passed to a node that converts it to PDF.
  • qrImage comes as a data URL, ready to embed in the HTML or send by email without uploading a separate file.
  • If the CFE cannot be found by type/series/number, the node returns an error; to preview one, cfe with at least one item must be provided.