Skip to content

Commit ae5c228

Browse files
felps-devclaude
andauthored
feat: LLM navigation support + Reforma Tributaria IBS/CBS/IS (NT 2025.002-RTC) (#448)
* docs: Add source maps for large files and CLAUDE.md for LLM navigation Source maps provide section-by-section breakdowns with exact line ranges for all files over 200 lines, enabling LLMs to navigate directly to specific code sections instead of reading entire files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: Add Reforma Tributaria IBS/CBS/IS support (EC 132/2023) Add core XML infrastructure for Brazil's dual VAT system (IVA Dual): - CST enumerations for IBS, CBS and IS in flags.py - Product-level and invoice-level entity fields in notafiscal.py - XML serialization (impostoMisto group) in serializacao.py - Totals accumulation and vNF formula updated - 5 test cases covering all serialization scenarios - Documentation in docs/reforma_tributaria.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: Fix ruff format issues in serializacao.py and reforma tributaria tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: Move source maps to docs/ and rename CLAUDE.md to AGENTS.md Address PR #448 review feedback: consolidate documentation files under docs/ directory and use model-agnostic AGENTS.md naming. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Correct Reforma Tributaria IBSCBS serialization per NT 2025.002-RTC schema Remove impostoMisto wrapper — IBSCBS is now direct child of <imposto>. Unify entity field naming to ibscbs_* pattern with shared vBC. Add IBSCBSTot totals with nested gIBS/gCBS structure, cMunFGIBS in <ide>, finNFe 5/6, and IS entity fields ready for 2027. Update docs and source maps. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: Add cMunFGIBS header serialization tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: Fix ruff format in serializacao.py and reforma tributaria tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0713cae commit ae5c228

15 files changed

Lines changed: 2003 additions & 0 deletions

AGENTS.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# AGENTS.md - PyNFe
2+
3+
Brazilian electronic fiscal document library (NF-e, NFC-e, NFS-e, MDF-e, CT-e) for SEFAZ webservice communication.
4+
5+
## Source Map Navigation (MANDATORY)
6+
7+
**Before reading any large file (>200 lines), you MUST first read its `{filename}_map.md` file** in the `docs/` directory. The source map contains:
8+
- Section-by-section breakdown with exact line ranges
9+
- Class/method index with purpose descriptions
10+
- Field group documentation
11+
12+
This allows you to navigate directly to the specific line-window you need instead of reading the entire file.
13+
14+
### Available Source Maps
15+
16+
| Source Map | File | Lines | Description |
17+
|------------|------|-------|-------------|
18+
| `docs/serializacao_map.md` | `pynfe/processamento/serializacao.py` | 2630 | XML serialization (NF-e, MDF-e, QR codes) |
19+
| `docs/comunicacao_map.md` | `pynfe/processamento/comunicacao.py` | 1348 | SEFAZ webservice communication |
20+
| `docs/autorizador_nfse_map.md` | `pynfe/processamento/autorizador_nfse.py` | 538 | NFS-e authorization (Betha/Ginfes) |
21+
| `docs/notafiscal_map.md` | `pynfe/entidades/notafiscal.py` | 1253 | Invoice entities and tax fields |
22+
| `docs/manifesto_map.md` | `pynfe/entidades/manifesto.py` | 447 | MDF-e manifest entities |
23+
| `docs/evento_map.md` | `pynfe/entidades/evento.py` | 237 | Event entities (cancel, correction, etc.) |
24+
| `docs/flags_map.md` | `pynfe/utils/flags.py` | 645 | Constants, namespaces, tax codes |
25+
| `docs/webservices_map.md` | `pynfe/utils/webservices.py` | 572 | SEFAZ endpoint URLs by state |
26+
| `docs/utils_map.md` | `pynfe/utils/__init__.py` | 253 | Utility functions (municipality lookup, signing) |
27+
28+
### How to Use Source Maps
29+
30+
1. **Read the `_map.md` file first** to understand the file structure
31+
2. **Identify the line range** you need from the map tables
32+
3. **Read only that section** using `offset` and `limit` parameters
33+
4. Example: To understand ICMS CST 60 serialization, read `docs/serializacao_map.md`, find it's at lines 747-770, then read `pynfe/processamento/serializacao.py` with `offset=747, limit=25`
34+
35+
## Project Structure
36+
37+
```
38+
docs/ # Documentation and source maps (*_map.md, reforma_tributaria.md)
39+
pynfe/
40+
├── entidades/ # Domain entities (data models)
41+
│ ├── base.py # Base entity class with kwargs init
42+
│ ├── certificado.py # A1 certificate handling
43+
│ ├── cliente.py # Customer entity
44+
│ ├── emitente.py # Issuer entity
45+
│ ├── evento.py # Event entities (cancel, correction, MDF-e events)
46+
│ ├── manifesto.py # MDF-e manifest entity
47+
│ ├── notafiscal.py # NF-e/NFC-e invoice entity + products + taxes
48+
│ ├── produto.py # Product entity (standalone)
49+
│ ├── servico.py # Service entity (NFS-e)
50+
│ └── transportadora.py # Carrier entity
51+
├── processamento/ # Core processing logic
52+
│ ├── assinatura.py # XML digital signing with A1 certificates
53+
│ ├── autorizador_nfse.py # NFS-e serialization (Betha/Ginfes PyXB bindings)
54+
│ ├── comunicacao.py # SEFAZ SOAP webservice communication
55+
│ ├── serializacao.py # XML serialization (entities → SEFAZ XML)
56+
│ └── validacao.py # XML schema validation
57+
├── utils/ # Utilities
58+
│ ├── __init__.py # Municipality lookup, XML signing helpers
59+
│ ├── flags.py # Constants, namespaces, tax code enumerations
60+
│ ├── webservices.py # SEFAZ endpoint URLs by state/environment
61+
│ ├── bar_code_128.py # Code 128 barcode generation for DANFE
62+
│ ├── xml_writer.py # XML element writing helpers
63+
│ └── nfse/ # NFS-e provider-specific PyXB bindings (GENERATED - do not edit)
64+
│ ├── betha/ # Betha provider bindings (13,941+ lines)
65+
│ └── ginfes/ # Ginfes provider bindings (8,028+ lines)
66+
├── data/ # Reference data files
67+
│ ├── IBPT/ # Tax tables by state (CSV)
68+
│ ├── ISSQN/ # Service tax classification
69+
│ ├── MunIBGE/ # Municipality IBGE codes by UF
70+
│ └── XSDs/ # XML Schema definitions (NF-e, NFC-e, NFS-e, MDF-e, CT-e)
71+
tests/ # Test suite (37 test files)
72+
```
73+
74+
## Key Concepts
75+
76+
- **NF-e** (modelo 55): Standard electronic invoice
77+
- **NFC-e** (modelo 65): Consumer electronic invoice (retail)
78+
- **NFS-e**: Municipal service invoice (Betha/Ginfes providers)
79+
- **MDF-e** (modelo 58): Transport manifest
80+
- **CT-e**: Transport knowledge document (partial support)
81+
- **SEFAZ**: State tax authority webservices
82+
- **Homologacao**: Test environment (`_ambiente=2`)
83+
- **SVRS/SVAN**: Virtual SEFAZ environments for states without own webservices
84+
85+
## Commands
86+
87+
```bash
88+
# Run tests
89+
pytest tests/
90+
91+
# Run specific test
92+
pytest tests/test_nfe_serializacao_geral.py
93+
94+
# Lint
95+
ruff check pynfe/
96+
97+
# Format
98+
ruff format pynfe/
99+
```
100+
101+
## Dependencies
102+
103+
- `lxml` — XML processing
104+
- `signxml` — XML digital signatures
105+
- `cryptography` / `pyopenssl` — Certificate handling
106+
- `requests` — HTTP communication with SEFAZ
107+
- `suds-community` — SOAP client (NFS-e only)
108+
- `PyXB-X` — XML Schema bindings (NFS-e only)
109+
110+
## Important Notes
111+
112+
- Files under `pynfe/utils/nfse/` are **auto-generated** PyXB bindings — do not edit manually
113+
- The `pynfe/data/` directory contains reference data files that should not be modified casually
114+
- Tax code serialization follows strict SEFAZ XML schema ordering — field order matters
115+
- Each Brazilian state has its own SEFAZ endpoint configuration in `webservices.py`

docs/autorizador_nfse_map.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Source Map: `autorizador_nfse.py` (538 lines)
2+
3+
NFS-e authorization and serialization for Betha and Ginfes providers.
4+
5+
## Classes Overview
6+
7+
| Class | Lines | Purpose |
8+
|-------|-------|---------|
9+
| `InterfaceAutorizador` | 5-11 | Abstract interface (consultar_rps, cancelar) |
10+
| `SerializacaoBetha` | 14-200 | Betha NFS-e XML generation using PyXB bindings |
11+
| `SerializacaoGinfes` | ~202-538 | Ginfes NFS-e XML generation using PyXB bindings |
12+
13+
## `SerializacaoBetha` — Lines 14-200
14+
15+
### Methods
16+
| Method | Lines | Purpose |
17+
|--------|-------|---------|
18+
| `__init__()` | 15-18 | Import Betha NFS-e v2.02 schema |
19+
| `gerar()` | 20-94 | Generate NFS-e XML (service, provider, customer, RPS) |
20+
| `consultar_rps()` | 96-130 | Query NFS-e by RPS |
21+
| `consultar_faixa()` | ~132-160 | Query NFS-e by range |
22+
| `cancelar()` | ~162-200 | Cancel NFS-e |
23+
24+
## `SerializacaoGinfes` — Lines ~202-538
25+
26+
### Methods
27+
| Method | Lines | Purpose |
28+
|--------|-------|---------|
29+
| `__init__()` | ~202-210 | Import Ginfes schema modules |
30+
| `cabecalho()` | ~212-220 | Generate XML header |
31+
| `serializar_lote_assincrono()` | ~222-310 | Serialize async batch (RPS list) |
32+
| `consultar_nfse()` | ~312-360 | Query NFS-e by provider/period |
33+
| `consultar_lote()` | ~362-390 | Query batch by number |
34+
| `consultar_rps()` | ~392-420 | Query NFS-e by RPS |
35+
| `consultar_situacao_lote()` | ~422-450 | Query batch status |
36+
| `cancelar()` / `cancelar_v2()` | ~452-538 | Cancel NFS-e (v2 and v3) |

docs/comunicacao_map.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Source Map: `comunicacao.py` (1348 lines)
2+
3+
SEFAZ webservice communication for NF-e, NFC-e, NFS-e, MDF-e and CT-e.
4+
5+
## Classes Overview
6+
7+
| Class | Lines | Purpose |
8+
|-------|-------|---------|
9+
| `Comunicacao` | 31-47 | Abstract base class |
10+
| `ComunicacaoSefaz` | 50-612 | NF-e/NFC-e SEFAZ communication |
11+
| `ComunicacaoNfse` | 615-845 | NFS-e municipal communication (Betha/Ginfes) |
12+
| `ComunicacaoMDFe` | 848-1119 | MDF-e SEFAZ communication |
13+
| `ComunicacaoCTe` | 1121-1348 | CT-e SEFAZ communication |
14+
15+
---
16+
17+
## `Comunicacao` (base) — Lines 31-47
18+
19+
Stores `uf`, `certificado`, `certificado_senha`, `_ambiente` (1=prod, 2=homolog).
20+
21+
## `ComunicacaoSefaz` — Lines 50-612
22+
23+
### Public Methods
24+
| Method | Lines | Purpose |
25+
|--------|-------|---------|
26+
| `autorizacao()` | 56-130 | Send NF-e for authorization (sync/async) |
27+
| `consulta_recibo()` | 132-155 | Query batch processing result |
28+
| `consulta_nota()` | 157-175 | Query NF-e status by access key |
29+
| `consulta_distribuicao()` | 177-231 | DF-e distribution query (distNSU, consNSU, consChNFe) |
30+
| `consulta_cadastro()` | 233-292 | Taxpayer registration query |
31+
| `evento()` | 294-320 | Send NF-e events (cancel, correction letter) |
32+
| `status_servico()` | 322-335 | Check SEFAZ server status |
33+
| `inutilizacao()` | 337-410 | Number range invalidation |
34+
35+
### Internal Methods
36+
| Method | Lines | Purpose |
37+
|--------|-------|---------|
38+
| `_get_url_an()` | 412-424 | Get national environment URL (AN) |
39+
| `_get_url()` | 426-551 | **URL resolver** — routes to correct SEFAZ by UF, model, environment, contingency |
40+
| `_construir_xml_soap()` | 553-570 | Build SOAP XML envelope |
41+
| `_post_header()` | 572-581 | HTTP headers (PE requires SOAPAction) |
42+
| `_post()` | 583-612 | Execute HTTPS POST with A1 certificate |
43+
44+
### URL Routing Detail (`_get_url`)
45+
| Section | Lines | States |
46+
|---------|-------|--------|
47+
| Contingency SVRS | 429-462 | AM, BA, CE, GO, MA, MS, MT, PE, PR |
48+
| Contingency SVAN | 463-476 | AC, AL, AP, DF, ES, MG, PA, PB, PI, RJ, RN, RO, RR, RS, SC, SE, SP, TO |
49+
| Own webservices | 480-501 | PR, MS, SP, AM, CE, BA, GO, MG, MT, PE, RS |
50+
| SVRS states | 504-533 | AC, AL, AP, DF, ES, PB, PI, RJ, RN, RO, RR, SC, SE, TO, PA |
51+
| SVAN (MA only) | 536-548 | MA |
52+
53+
---
54+
55+
## `ComunicacaoNfse` — Lines 615-845
56+
57+
### Public Methods
58+
| Method | Lines | Purpose |
59+
|--------|-------|---------|
60+
| `autorizacao()` | 635-644 | Generate NFS-e (Betha only) |
61+
| `enviar_lote()` | 646-655 | Send batch (Ginfes only) |
62+
| `consultar()` | 657-666 | Query NFS-e (Ginfes only) |
63+
| `consultar_rps()` | 668-678 | Query by RPS (Betha + Ginfes) |
64+
| `consultar_faixa()` | 680-687 | Query range (Betha only) |
65+
| `consultar_lote()` | 689-698 | Query batch (Ginfes only) |
66+
| `consultar_situacao_lote()` | 700-707 | Query batch status (Ginfes only) |
67+
| `cancelar()` | 709-722 | Cancel NFS-e (Betha + Ginfes) |
68+
69+
### Internal Methods
70+
| Method | Lines | Purpose |
71+
|--------|-------|---------|
72+
| `_cabecalho()` / `_cabecalho2()` | 724-762 | WSDL request header XML |
73+
| `_cabecalho_ginfes()` | 764-768 | Ginfes-specific header via XSD |
74+
| `_get_url()` | 770-780 | URL resolver for NFS-e |
75+
| `_post()` | 782-804 | HTTP (no cert) WSDL communication |
76+
| `_post_https()` | 806-845 | HTTPS (with cert) WSDL communication |
77+
78+
---
79+
80+
## `ComunicacaoMDFe` — Lines 848-1119
81+
82+
### Public Methods
83+
| Method | Lines | Purpose |
84+
|--------|-------|---------|
85+
| `autorizacao()` | 874-956 | Send MDF-e for authorization (sync/async) |
86+
| `status_servico()` | 958-965 | Check MDF-e server status |
87+
| `consulta()` | 967-976 | Query MDF-e by access key |
88+
| `consulta_nao_encerrados()` | 978-990 | Query non-closed MDF-e |
89+
| `consulta_recibo()` | 992-1000 | Query batch processing result |
90+
| `evento()` | 1002-1017 | Send MDF-e events (cancel, close, add driver, add DF-e, payment) |
91+
92+
### Internal Methods
93+
| Method | Lines | Purpose |
94+
|--------|-------|---------|
95+
| `_construir_xml_soap()` | 1019-1044 | Build SOAP XML with header |
96+
| `_post_header()` | 1046-1061 | HTTP headers |
97+
| `_post()` | 1063-1099 | Execute HTTPS POST with cert |
98+
| `_cabecalho_soap()` | 1101-1107 | SOAP header with cUF and versaoDados |
99+
| `_get_url()` | 1109-1118 | URL resolver (SVRS only) |
100+
101+
---
102+
103+
## `ComunicacaoCTe` — Lines 1121-1348
104+
105+
### Public Methods
106+
| Method | Lines | Purpose |
107+
|--------|-------|---------|
108+
| `status_servico()` | 1136-1147 | Check CT-e server status |
109+
| `consulta_distribuicao()` | 1149-1200 | CT-e distribution query |
110+
| `consulta()` | 1202-1211 | Query CT-e by access key |
111+
112+
### Internal Methods
113+
| Method | Lines | Purpose |
114+
|--------|-------|---------|
115+
| `_get_url_an()` | 1213-1219 | National environment URL |
116+
| `_cabecalho_soap()` | 1221-1227 | SOAP header |
117+
| `_get_url()` | 1229-1281 | **URL resolver** — own (MT, MS, MG, PR, RS, SP), SVRS, SVSP |
118+
| `_construir_xml_soap()` | 1283-1304 | Build SOAP XML envelope |
119+
| `_post_header()` | 1306-1313 | HTTP headers |
120+
| `_post()` | 1315-1348 | Execute HTTPS POST with cert |

docs/evento_map.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Source Map: `evento.py` (237 lines)
2+
3+
Event entity models for NF-e and MDF-e lifecycle operations.
4+
5+
## Classes Overview
6+
7+
| Class | Lines | Purpose |
8+
|-------|-------|---------|
9+
| `Evento` | 11-46 | Base event class |
10+
| `EventoCancelarNota` | 49-60 | NF-e cancellation (tp_evento=110111) |
11+
| `EventoCartaCorrecao` | 63-90 | NF-e correction letter (tp_evento=110110) |
12+
| `EventoManifestacaoDest` | 93-130 | Recipient manifestation (confirm/unknown/not performed/unaware) |
13+
| `EventoOperacaoNaoRealizada` | ~132-145 | Operation not performed |
14+
| `EventoCancelarMDFe` | ~147-160 | MDF-e cancellation |
15+
| `EventoEncerrarMDFe` | ~162-180 | MDF-e closure |
16+
| `EventoIncluirCondutorMDFe` | ~182-195 | Add driver to MDF-e |
17+
| `EventoIncluirDFeMDFe` | ~197-215 | Add DF-e to MDF-e |
18+
| `EventoPagamentoMDFe` | ~217-237 | MDF-e operation payment |
19+
20+
## `Evento` (base) — Lines 11-46
21+
22+
Fields: `id`, `orgao`, `cnpj`, `chave`, `data_emissao`, `uf`, `tp_evento`, `n_seq_evento`, `descricao`.
23+
24+
Property `identificador` builds: `"ID" + tp_evento + chave + n_seq_evento(2 digits)`.
25+
26+
## Key Event Types
27+
28+
| Class | tp_evento | descricao |
29+
|-------|-----------|-----------|
30+
| `EventoCancelarNota` | 110111 | "Cancelamento" |
31+
| `EventoCartaCorrecao` | 110110 | "Carta de Correcao" |
32+
| `EventoManifestacaoDest` | 210200-210240 | Various manifestation types |
33+
| `EventoOperacaoNaoRealizada` | 110112 | "Operacao nao Realizada" |
34+
| `EventoCancelarMDFe` | 110111 | "Cancelamento" (MDF-e) |
35+
| `EventoEncerrarMDFe` | 110112 | "Encerramento" |
36+
| `EventoIncluirCondutorMDFe` | 110114 | "Inclusão Condutor" |
37+
| `EventoIncluirDFeMDFe` | 110115 | "Inclusao DF-e" |
38+
| `EventoPagamentoMDFe` | 110116 | "Pagamento Operacao MDF-e" |

docs/flags_map.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Source Map: `flags.py` (681 lines)
2+
3+
Constants, namespaces, tax code enumerations, and state codes used throughout PyNFe.
4+
5+
## Sections
6+
7+
| Section | Lines | Purpose |
8+
|---------|-------|---------|
9+
| Namespaces | 1-24 | XML namespaces for NF-e, NFS-e, MDF-e, CT-e, SOAP, signatures |
10+
| XSD paths | 26-39 | Paths to XML Schema files |
11+
| ICMS types | 42-84 | `ICMS_TIPOS_TRIBUTACAO` — all CST/CSOSN codes |
12+
| ICMS origins | 86-123 | `ICMS_ORIGENS` — product origin codes (0-8) |
13+
| ICMS modalities | 125-140 | `ICMS_MODALIDADES` and `ICMS_ST_MODALIDADES` |
14+
| ICMS exemption reasons | 142-161 | `ICMS_MOTIVO_DESONERACAO` |
15+
| NF-e status | 163-182 | `NF_STATUS` and `MDFE_STATUS` tuples |
16+
| NF-e enumerations | 184-248 | Document types, emission processes, DANFE types, payment forms, emission forms, **emission purposes (incl. finNFe 5/6)**, referenced types, specific products, environments |
17+
| IPI types | 250-270 | `IPI_TIPOS_TRIBUTACAO` and `IPI_TIPOS_CALCULO` |
18+
| PIS types | 272-407 | `PIS_TIPOS_TRIBUTACAO` — all CST codes (01-99) |
19+
| COFINS types | 411-548 | `COFINS_TIPOS_TRIBUTACAO` — all CST codes (01-99) |
20+
| Reforma Tributaria | 550-582 | `IBS_CBS_TIPOS_TRIBUTACAO` (15 CSTs, 3-digit) and `IS_TIPOS_TRIBUTACAO` (7 CSTs, 2-digit) — IVA Dual (EC 132/2023) |
21+
| Freight modalities | 584-591 | `MODALIDADES_FRETE` (0-9) |
22+
| Process origins | 593-599 | `ORIGENS_PROCESSO` |
23+
| State codes | 601-633 | `CODIGOS_ESTADOS` — UF to IBGE code mapping |
24+
| Card brands | 635-664 | `BANDEIRA_CARTAO` (01-99) |
25+
| Payment methods | 666-681 | `FORMAS_PAGAMENTO` (01-99) |
26+
27+
## Key Constants
28+
29+
| Constant | Value | Used For |
30+
|----------|-------|----------|
31+
| `NAMESPACE_NFE` | `http://www.portalfiscal.inf.br/nfe` | NF-e XML |
32+
| `NAMESPACE_MDFE` | `http://www.portalfiscal.inf.br/mdfe` | MDF-e XML |
33+
| `NAMESPACE_CTE` | `http://www.portalfiscal.inf.br/cte` | CT-e XML |
34+
| `VERSAO_PADRAO` | `4.00` | NF-e version |
35+
| `VERSAO_MDFE` | `3.00` | MDF-e version |
36+
| `VERSAO_CTE` | `3.00` | CT-e version |
37+
| `VERSAO_QRCODE` | `2` | QR Code version |
38+
| `CODIGO_BRASIL` | `1058` | Country code for Brazil |

docs/manifesto_map.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Source Map: `manifesto.py` (447 lines)
2+
3+
Entity models for MDF-e (Manifesto de Documentos Fiscais Eletrônicos).
4+
5+
## Classes Overview
6+
7+
| Class | Lines | Purpose |
8+
|-------|-------|---------|
9+
| `Manifesto` | 12-200 | Main MDF-e entity |
10+
| `ManifestoEmitente` | ~203-230 | MDF-e issuer |
11+
| `ManifestoMunicipioCarrega` | ~232-240 | Loading municipality |
12+
| `ManifestoPercurso` | ~242-248 | Route waypoint (UF) |
13+
| `ManifestoModalRodoviario` | ~250-290 | Road transport modal |
14+
| `ManifestoCIOT` | ~292-300 | CIOT (toll system) |
15+
| `ManifestoPedagio` | ~302-315 | Toll information |
16+
| `ManifestoContratante` | ~317-330 | Contractor info |
17+
| `ManifestoVeiculoTracao` | ~332-360 | Traction vehicle |
18+
| `ManifestoVeiculoReboque` | ~362-385 | Trailer vehicle |
19+
| `ManifestoProprietario` | ~387-400 | Vehicle owner |
20+
| `ManifestoCondutor` | ~402-410 | Driver |
21+
| `ManifestoDocumentos` | ~412-425 | Linked documents (NF-e/CT-e) |
22+
| `ManifestoSeguradora` | ~427-440 | Insurance |
23+
| `ManifestoTotais` | ~442-447 | Totals (weight, cargo value) |
24+
25+
## `Manifesto` — Lines 12-200
26+
27+
### Field Groups
28+
| Section | Lines | Fields |
29+
|---------|-------|--------|
30+
| Identity | 12-68 | uf, tipo_emitente, tipo_transportador, modelo (58), serie, numero_mdfe, codigo_numerico_aleatorio, modal, data_emissao, forma_emissao, processo_emissao, UFIni, UFFim |
31+
| Read-only | 65-72 | digest_value, protocolo, data |
32+
| Relationships | 74-110 | municipio_carrega, percurso, dhIniViagem, emitente, modal_rodoviario, documentos, seguradora, produto, totais, lacres, responsavel_tecnico |
33+
| Additional info | ~112-120 | informacoes_adicionais_interesse_fisco, informacoes_complementares_interesse_contribuinte |
34+
35+
### Methods
36+
| Method | Lines | Purpose |
37+
|--------|-------|---------|
38+
| `__init__()` | ~122-140 | Initialize all list fields |
39+
| `adicionar_*()` | ~142-185 | Add municipio_carrega, percurso, emitente, modal_rodoviario, documento, seguradora, produto, totais, lacre, responsavel_tecnico |
40+
| `_codigo_numerico_aleatorio()` | ~187-190 | Generate random 8-digit code |
41+
| `_dv_codigo_numerico()` | ~192-200 | Calculate check digit (mod 11) |
42+
| `identificador_unico` (property) | ~200+ | Build 44-char MDF-e access key |

0 commit comments

Comments
 (0)