SefazNfe.Events (sefaz_nfe v0.1.0)

Copy Markdown View Source

Builders for the MOC's post-authorization events and for inutilização.

These are the only documents this library composes. AD-001 keeps NF-e XML with the ERP because it carries tax arithmetic; an event carries none — it is a key, a protocol and a justification — so composing it here does not make this a second fiscal engine.

Each element is signed on its own Id, whose shape the MOC fixes: ID plus the event code, the access key and the two digit sequence for an event, and ID plus code, UF, year, CNPJ, model, series and number range for a voided range. A malformed Id is rejected by schema validation, so it is built here rather than left to the caller.

Summary

Functions

Event 110111, cancelling an authorized NF-e.

Event 110110, the Carta de Correção Eletrônica.

Manifestação do destinatário: events 210200, 210210, 210220 and 210240.

The four manifestação types this library builds.

inutNFe for NFeInutilizacao4.

Functions

cancel(opts)

@spec cancel(map()) :: binary()

Event 110111, cancelling an authorized NF-e.

correction(opts)

@spec correction(map()) :: binary()

Event 110110, the Carta de Correção Eletrônica.

xCondUso is the fixed legal text the MOC requires verbatim; SEFAZ rejects the event if it differs, so it is not a caller's field.

manifestation(type, opts)

@spec manifestation(atom(), map()) :: binary()

Manifestação do destinatário: events 210200, 210210, 210220 and 210240.

This is how a recipient answers a document that DistDFe delivered, and it is what unlocks the full XML of a note you only received a summary of. Unlike cancel and CCe, these are processed by the Ambiente Nacional rather than by the issuing state, so cOrgao is 91.

:not_performed requires a justification; the other three take none.

manifestation_types()

@spec manifestation_types() :: [atom()]

The four manifestação types this library builds.

void_numbers(opts)

@spec void_numbers(map()) :: binary()

inutNFe for NFeInutilizacao4.