0b646027165811b9510e568c979edd423ec79de6
IMPORTANT (F2 review): the service promises to validate structural coherence (sums, required leiaute fields) per design spec decision #3, but the one sum that can genuinely diverge -- pagamento.valor vs the document total -- was unchecked. The lib documents SEFAZ rejects this with 'Valor do Pagamento difere do total' (sowai_fiscal.xml_builder). Adds PagamentoTotalMismatchError, computed in the completeness block (before allocate_fiscal_number) by reusing sowai_fiscal.xml_builder. soma_itens_quantizados -- the SAME function the lib's own _build_total uses for vNF/vProd, avoiding a second source of truth for the same total. Decimal-exact comparison (never float), both sides quantized to cents the same way _build_pag does. Router maps it to 409 pagamento_total_diverge. Test: tests/emission/test_emissao.py:: test_pagamento_divergente_do_total_dos_itens_e_409_e_nao_queima_numero -- pagamento.valor != Σ itens -> 409 pagamento_total_diverge, no fiscal number consumed. The existing golden-backed happy-path tests (already balanced) continue to prove the matching-totals case still succeeds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Description
Serviço fiscal compartilhado SowAI: emissão NF-e (e futuramente NFS-e/NFC-e) multi-produto via REST. Embute a lib sowai-fiscal; dono de documentos/certificados/séries. F2+ do plano Estágio 2.
280 KiB
Languages
Python
96.9%
Makefile
2.2%
Dockerfile
0.6%
Mako
0.3%