The processed MDF-e documents (NFePHP's Complements for sped-mdfe), reached
through SefazNfe.Proc as mdfe_proc/2, mdfe_event_proc/2,
mdfe_cancel_register/2 and mdfe_close_register/2.
| Function | Result | Parts |
|---|---|---|
mdfe_proc/2 | mdfeProc | MDFe + protMDFe |
mdfe_event_proc/2 | procEventoMDFe | eventoMDFe + retEventoMDFe |
mdfe_cancel_register/2 | the same mdfeProc | + the cancellation's retEventoMDFe |
mdfe_close_register/2 | the same mdfeProc | + the encerramento's retEventoMDFe |
Bytes are spliced, never re-serialised, exactly as in SefazNfe.Proc (AD-011):
the signed MDFe (with its infMDFeSupl) and SEFAZ's own protMDFe or
retEventoMDFe are copied verbatim and wrapped in the MDF-e namespace.
What is checked
mdfe_proc/2: theprotMDFewhosechMDFeis the document's key (IdwithoutMDFe) and, when both carry one, whosedigValis the document'sDigestValue;cStat100 only (MDF-e has no denial).mdfe_event_proc/2: theretEventoMDFeof the samechMDFeandtpEvento;cStat135 or 136 (and 132 for an encerramento).- the registers:
cStat135, 136 or 155 (and 132 for an encerramento), the righttpEvento(110111, or 110112) and thechMDFeof themdfeProc.
Errors are those of SefazNfe.Proc with MDF-e names: :no_protocol,
:no_event, :no_event_return, :key_mismatch, :digest_mismatch,
:no_inf_mdfe, {:not_accepted, c_stat}, {:not_a_cancellation, tp_evento},
{:not_a_closure, tp_evento}, :not_an_mdfe_proc and {:xml, reason}.
Summary
Functions
Marks an authorized mdfeProc as cancelled by appending the cancellation's
retEventoMDFe after its protMDFe (NFePHP's cancelRegister).
Marks an authorized mdfeProc as closed (encerrado) by appending the
encerramento's retEventoMDFe (NFePHP's closeRegister). Same rules as
mdfe_cancel_register/2 for event 110112, with {:not_a_closure, tp_evento}.
procEventoMDFe: the signed eventoMDFe and the retEventoMDFe SEFAZ
answered it with.
mdfeProc: the signed MDFe and its protMDFe, from the answer of the
authorization or of a consultation.
Types
@type reason() :: term()
Functions
Marks an authorized mdfeProc as cancelled by appending the cancellation's
retEventoMDFe after its protMDFe (NFePHP's cancelRegister).
event_xml is the procEventoMDFe from mdfe_event_proc/2 or SEFAZ's answer
itself. Registering the same retEventoMDFe again returns the mdfeProc
unchanged. Unlike NFePHP, which returns the document untouched for anything
else, an answer that does not qualify is an error that says why.
Marks an authorized mdfeProc as closed (encerrado) by appending the
encerramento's retEventoMDFe (NFePHP's closeRegister). Same rules as
mdfe_cancel_register/2 for event 110112, with {:not_a_closure, tp_evento}.
procEventoMDFe: the signed eventoMDFe and the retEventoMDFe SEFAZ
answered it with.
mdfeProc: the signed MDFe and its protMDFe, from the answer of the
authorization or of a consultation.