Skip to content

fix(mde client): send the envEvento and evento elements, not their types - #168

Merged
rvalyi merged 2 commits into
akretion:masterfrom
antoniospneto:master-fix-mde-envelope
Oct 7, 2026
Merged

rvalyi merged 2 commits into
akretion:masterfrom
antoniospneto:master-fix-mde-envelope

Conversation

@antoniospneto

Copy link
Copy Markdown
Contributor

O lote e o evento do MD-e eram montados com os tipos TenvEvento/Tevento, que serializam como <ns2:TEnvEvento> e <TEvento xmlns=""> com os filhos prefixados ns1:. A SEFAZ recusa o lote com 404 – Uso de prefixo de namespace não permitido. Este PR monta os elementos globais EnvEvento/Evento (como o evento de cancelamento do cliente de NF-e) e a regex do placeholder aceita atributos.

Teste A/B no Ambiente Nacional de homologação (pela OCA/l10n-brazil#4147), mesma ciência da operação:

caminho lote enviado resposta
erpbrasil.edoc <envEvento xmlns=".../nfe"> lote 128, evento 575
nfelib 3.0.0 <ns2:TEnvEvento> 404
este PR <envEvento ...> lote 128, evento 575

(o 575 é regra de negócio esperada: a chave usada é de nota emitida pelo próprio autor.)

O teste mockado da ciência agora confere o envEvento/evento no payload. Mesmo tipo de problema do #167, no cliente de MD-e.

🤖 Generated with Claude Code

The batch and the event were built with the TenvEvento and Tevento
complex types, which serialize as <ns2:TEnvEvento> and <TEvento
xmlns=""> with ns1 prefixed children: the SEFAZ rejects the batch with
cStat 404 (Uso de prefixo de namespace nao permitido). Build the
EnvEvento and Evento global elements instead, as the cancel event of
the NF-e client does, and match the placeholder with attributes too.

The mocked ciencia test now asserts the outgoing envEvento/evento.
Checked against the AN homologation environment: the same ciencia da
operacao went from cStat 404 to the answer the erpbrasil.edoc path
gets (lote 128 processed, event judged on its business rules).

@rvalyi rvalyi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boa! Realmente esse eu nao tinha testado ainda.

@rvalyi
rvalyi merged commit f17c7f6 into akretion:master Oct 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants