SefazNfe.Endpoints (sefaz_nfe v0.1.0)

Copy Markdown View Source

Resolves {uf, environment, service} to a SOAP URL.

Snapshot in priv/endpoints/nfe_4.00.json (nfephp mirror of the RFB table). Source of truth remains https://www.nfe.fazenda.gov.br/portal/webServices.aspx

Summary

Functions

IBGE code for uf, which the 4.00 envelopes carry as cUF.

Resolves the SOAP URL for {uf, environment, service}.

Types

environment()

@type environment() :: :homologation | :production

service()

@type service() ::
  :nfe_autorizacao
  | :nfe_ret_autorizacao
  | :nfe_consulta_protocolo
  | :nfe_status_servico
  | :nfe_recepcao_evento
  | :nfe_inutilizacao
  | :nfe_distribuicao_dfe

Functions

snapshot_date()

@spec snapshot_date() :: String.t()

uf_code(uf)

@spec uf_code(String.t() | atom()) ::
  {:ok, pos_integer()} | {:error, {:unknown_uf, String.t()}}

IBGE code for uf, which the 4.00 envelopes carry as cUF.

The Ambiente Nacional is 91.

url(uf, environment, service)

@spec url(String.t() | atom(), environment(), service()) ::
  {:ok, String.t()}
  | {:error, {:unknown_endpoint, String.t(), service()}}
  | {:error, {:invalid_environment, term()}}
  | {:error, {:unknown_service, term()}}

Resolves the SOAP URL for {uf, environment, service}.

The three failures are distinct on purpose: {:unknown_endpoint, uf, service} is a UF this snapshot cannot resolve, while {:invalid_environment, _} and {:unknown_service, _} mean the caller passed something that is not an environment or not a 4.00 service at all.