Aqui está a descrição do bug para o issue no GitHub:
Title: NotaFiscalPagamentos.t_band defined as int causes schema rejection by SEFAZ
Description:
The field t_band in NotaFiscalPagamentos is defined as int():
class NotaFiscalPagamentos(Entidade):
t_band = int()
This causes the serializer to emit the value without zero-padding, e.g. <tBand>1</tBand>, while the SEFAZ NF-e schema requires a 2-digit string, e.g. <tBand>01</tBand>.
Steps to reproduce:
- Create a payment with
t_band=1 (Visa)
- Serialize and transmit the NF-e
- SEFAZ rejects with:
Rejeicao: Falha no Schema XML da NFe (Elemento: enviNFe/NFe[1]/infNFe/pag/detPag/card/tBand/)
Expected behavior:
tBand should be serialized as a zero-padded 2-digit string ("01" to "09", "99").
Suggested fix:
In _serializar_pagamentos, replace:
xmlw.write_txt(card, "tBand", item.t_band, False)
With:
if item.t_band is not None and item.t_band != "":
etree.SubElement(card, "tBand").text = str(item.t_band).zfill(2)
Or change the field type in NotaFiscalPagamentos:
t_band = str() # was int()
And document that the caller is responsible for passing a zero-padded 2-digit string.
Environment:
- PyNFe version: 0.6.0
- Python: 3.12
Evidencia

Aqui está a descrição do bug para o issue no GitHub:
Title:
NotaFiscalPagamentos.t_banddefined asintcauses schema rejection by SEFAZDescription:
The field
t_bandinNotaFiscalPagamentosis defined asint():This causes the serializer to emit the value without zero-padding, e.g.
<tBand>1</tBand>, while the SEFAZ NF-e schema requires a 2-digit string, e.g.<tBand>01</tBand>.Steps to reproduce:
t_band=1(Visa)Rejeicao: Falha no Schema XML da NFe (Elemento: enviNFe/NFe[1]/infNFe/pag/detPag/card/tBand/)Expected behavior:
tBandshould be serialized as a zero-padded 2-digit string ("01"to"09","99").Suggested fix:
In
_serializar_pagamentos, replace:With:
Or change the field type in
NotaFiscalPagamentos:And document that the caller is responsible for passing a zero-padded 2-digit string.
Environment:
Evidencia