Skip to content

Repository files navigation

sefaz_nfe

Elixir library for SEFAZ NF-e communication (modelo 55): sign, authorize, consult, DistDFe.

It does not calculate taxes. The ERP (or Nexus Pro) builds the XML; this library talks to SEFAZ.

Status: spec only. No production emission yet. Homologação against a real CNPJ is the first proof.

Package shell

Public API is in SefazNfe (authorize/1, ret_autorizacao/1, status_servico/1, dist_dfe/1, consulta_protocolo/1, cancela/1, cce/1, inutiliza/1).

Input is validated and the UF URL is resolved from priv/endpoints/nfe_4.00.json. SOAP/XMLDSig still return {:error, :not_implemented} — no network in mix test.

OTP (Elixir 1.20 / OTP 29): Task.Supervisor isolates SOAP, Registry + DistDFe poller per CNPJ (Process.set_label/1), timeouts via Duration + to_timeout/1, JSON stdlib.

{:ok, cert} = SefazNfe.Certificate.load(pfx_binary, "senha")
SefazNfe.status_servico(%{cert: cert, uf: "SP", ambiente: :homologacao})
# => {:error, :not_implemented}

{:ok, url} = SefazNfe.Endpoints.url("SP", :homologacao, :nfe_autorizacao)

What this is

ERP / Nexus  →  XML (cálculo ICMS, IBS/CBS, totais)
sefaz_nfe    →  A1, XMLDSig, SOAP 4.00, cStat, DistDFe
SEFAZ        →  autorização / rejeição / documentos distribuídos

Same split as Focus/ACBr: they guarantee transport, not fiscal arithmetic.

Docs

Official sources

Endpoint table and schemas are owned by the RFB / ENCAT, not by this repo:

License

Apache-2.0

About

Elixir library for SEFAZ NF-e transport (sign, authorize, DistDFe). No tax calculation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages