mix sefaz.endpoints (sefaz_nfe v0.1.0)

Copy Markdown View Source

Audits priv/endpoints/nfe_4.00.json.

mix sefaz.endpoints
mix sefaz.endpoints --max-age 90

AD-004 makes the endpoint table data owned by the RFB, not by this repository, refreshed from the official portal. The portal blocks automated fetching, so this task deliberately does not scrape it: a scraper that silently returns a login page would replace a stale table with a wrong one. It audits what is vendored and prints the manual procedure instead.

Reports a non-zero exit when the snapshot is older than --max-age days (default 180) or fails a structural check, so CI can fail on a stale table rather than a production call discovering it.

Refresh procedure

  1. Open https://www.nfe.fazenda.gov.br/portal/webServices.aspx and read the table for layout 4.00, model 55.
  2. Update priv/endpoints/nfe_4.00.json: authorizers holds one entry per authorizer with homologation and production URLs per service, uf_authorizer maps each UF to its authorizer, uf_code the IBGE code the envelopes carry as cUF.
  3. Set snapshot_date to the date you read the portal.
  4. Run mix sefaz.endpoints and mix test.

The nfephp wsnfe_4.00_mod55.xml mirror is a useful cross-check, never the source of truth.

Summary

Functions

Every problem found in snapshot, as human-readable strings. Empty means it is usable.

Functions

audit(snapshot, max_age \\ 180)

@spec audit(map(), pos_integer()) :: [String.t()]

Every problem found in snapshot, as human-readable strings. Empty means it is usable.