diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 670a6872..14f9767f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,8 @@ jobs: "3.9", "3.10", "3.11", - "3.12" + "3.12", + "3.13" ] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 15d8d0b3..2e74622b 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ ## PyNFe [![Active Development](https://img.shields.io/badge/Maintenance%20Level-Actively%20Developed-brightgreen.svg)](https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d) -![status](https://img.shields.io/badge/status-stable-green.svg) ![https://github.com/TadaSoftware/PyNFe/actions](https://github.com/TadaSoftware/PyNFe/workflows/PyNFe%20CI/badge.svg?branch=main) ![pyversions](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue) +![status](https://img.shields.io/badge/status-stable-green.svg) ![https://github.com/TadaSoftware/PyNFe/actions](https://github.com/TadaSoftware/PyNFe/actions/workflows/ci.yml/badge.svg) ![pyversions](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue) [![PyPI version](https://badge.fury.io/py/pynfe.svg)](https://badge.fury.io/py/pynfe) + Biblioteca de interface com os webservices de Nota Fiscal Eletrônica (NF-e) e Nota Fiscal de Consumidor Eletrônica (NFC-e) da SEFAZ e Receita Federal do Brasil, Nota Fiscal de Serviço Eletrônica (NFS-e) para Prefeituras e Manifesto de Documentos Fiscais Eletrônicos (MDF-e). - **NF-e** visa substituir as notas fiscais séries 1 e 1A. diff --git a/pynfe/processamento/comunicacao.py b/pynfe/processamento/comunicacao.py index ec4d0c79..4647eb19 100644 --- a/pynfe/processamento/comunicacao.py +++ b/pynfe/processamento/comunicacao.py @@ -238,26 +238,34 @@ def consulta_distribuicao( return self._post(url, xml) - def consulta_cadastro(self, modelo, documento, tipo='CNPJ'): + def consulta_cadastro(self, modelo, documento, tipo='CNPJ', uf=None): """ Consulta de cadastro :param modelo: Modelo da nota :param documento: Documento (CNPJ, CPF ou IE) :tipo do documento: CNPJ, CPF, IE + :param uf: UF :return: """ # UF que utilizam a SVRS - Sefaz Virtual do RS: - # Para serviço de Consulta Cadastro: AC, RN, PB, SC - lista_svrs = ["AC", "RN", "PB", "SC", "PA", "CE"] + lista_svrs = ["AC", "AL", "AP", "CE", + "DF", "ES", "PA", "PB", + "PI", "RJ", "RN", "RO", + "RR", "SC", "SE", "TO"] + + # Se não informada UF nos parâmetros da função, + # utiliza a UF do construtor + if not uf: + uf = self.uf # RS implementa um método diferente na consulta de cadastro # usa o mesmo url para produção e homologação # não tem url para NFCE - if self.uf.upper() == "RS": + if uf.upper() == "RS": url = NFE["RS"]["CADASTRO"] - elif self.uf.upper() in lista_svrs: + elif uf.upper() in lista_svrs: url = NFE["SVRS"]["CADASTRO"] - elif self.uf.upper() == "SVC-RS": + elif uf.upper() == "SVC-RS": url = NFE["SVC-RS"]["CADASTRO"] else: url = self._get_url(modelo=modelo, consulta="CADASTRO") @@ -265,7 +273,7 @@ def consulta_cadastro(self, modelo, documento, tipo='CNPJ'): raiz = etree.Element("ConsCad", versao="2.00", xmlns=NAMESPACE_NFE) info = etree.SubElement(raiz, "infCons") etree.SubElement(info, "xServ").text = "CONS-CAD" - etree.SubElement(info, "UF").text = self.uf.upper() + etree.SubElement(info, "UF").text = uf.upper() # Monta tipo de documento CNPJ, CPF ou IE etree.SubElement(info, tipo.upper()).text = documento diff --git a/setup.py b/setup.py index 812ef1a8..475aa298 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name="PyNFe", - version="0.5.0", + version="0.5.1", author="TadaSoftware", author_email="tadasoftware@gmail.com", description="Interface library with the Brazilian Electronic Invoice web services",