From d01dd3052781fb81ba6e0fec6c9f69de4966c779 Mon Sep 17 00:00:00 2001 From: juniortada Date: Tue, 7 Aug 2018 10:37:47 -0300 Subject: [PATCH 01/11] =?UTF-8?q?[FIX]=20valida=C3=A7=C3=A3o=20com=20tipo?= =?UTF-8?q?=20str=20para=20natOp=20str?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynfe/processamento/serializacao.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index fdf13db2..d1fc7bf5 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -608,7 +608,7 @@ def _serializar_nota_fiscal(self, nota_fiscal, tag_raiz='infNFe', retorna_string Para as notas com finalidade de Ajuste ou Devolução o campo Forma de Pagamento deve ser preenchido com 90=Sem Pagamento. """ pag = etree.SubElement(raiz, 'pag') detpag = etree.SubElement(pag, 'detPag') - if nota_fiscal.finalidade_emissao == 3 or nota_fiscal.finalidade_emissao == 4: + if nota_fiscal.finalidade_emissao == '3' or nota_fiscal.finalidade_emissao == '4': etree.SubElement(detpag, 'tPag').text = '90' else: etree.SubElement(detpag, 'tPag').text = str(nota_fiscal.tipo_pagamento).zfill(2) From d27c491c8578f07bc775d28fbd02c909fb41b5c9 Mon Sep 17 00:00:00 2001 From: juniortada Date: Tue, 7 Aug 2018 10:41:46 -0300 Subject: [PATCH 02/11] [fix] add vPag para tPag = 90 (sem pagamento) --- pynfe/processamento/serializacao.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index d1fc7bf5..bd2ad3a8 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -610,6 +610,7 @@ def _serializar_nota_fiscal(self, nota_fiscal, tag_raiz='infNFe', retorna_string detpag = etree.SubElement(pag, 'detPag') if nota_fiscal.finalidade_emissao == '3' or nota_fiscal.finalidade_emissao == '4': etree.SubElement(detpag, 'tPag').text = '90' + etree.SubElement(detpag, 'vPag').text = '{:.2f}'.format(0) else: etree.SubElement(detpag, 'tPag').text = str(nota_fiscal.tipo_pagamento).zfill(2) etree.SubElement(detpag, 'vPag').text = '{:.2f}'.format(nota_fiscal.totais_icms_total_nota) From 742c2247ae0b42526179b811642be4205f05e2be Mon Sep 17 00:00:00 2001 From: juniortada Date: Wed, 22 Aug 2018 14:47:19 -0300 Subject: [PATCH 03/11] [add] nfce ba --- pynfe/processamento/comunicacao.py | 4 ++-- pynfe/utils/webservices.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pynfe/processamento/comunicacao.py b/pynfe/processamento/comunicacao.py index 6fffee4b..76745119 100644 --- a/pynfe/processamento/comunicacao.py +++ b/pynfe/processamento/comunicacao.py @@ -342,8 +342,8 @@ def _get_url(self, modelo, consulta): # nfe Ex: https://nfe.fazenda.pr.gov.br/nfe/NFeStatusServico3 self.url = NFE[self.uf.upper()][ambiente] + NFE[self.uf.upper()][consulta] elif modelo == 'nfce': - # PE é o unico UF que possiu NFE proprio e SVRS para NFCe - if self.uf.upper() == 'PE': + # PE e BA são as únicas UF'sque possuem NFE proprio e SVRS para NFCe + if self.uf.upper() == 'PE' or self.uf.upper() == 'BA': self.url = NFCE['SVRS'][ambiente] + NFCE['SVRS'][consulta] else: # nfce Ex: https://homologacao.nfce.fazenda.pr.gov.br/nfce/NFeStatusServico3 diff --git a/pynfe/utils/webservices.py b/pynfe/utils/webservices.py index 52b278eb..87aa6822 100644 --- a/pynfe/utils/webservices.py +++ b/pynfe/utils/webservices.py @@ -151,7 +151,10 @@ 'CHAVE': '', 'INUTILIZACAO': '', 'EVENTOS': '', - 'QR': '' + 'QR': 'sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx', + 'HTTPS': 'http://nfe.', + 'HOMOLOGACAO': 'http://hnfe.', + 'URL': 'nfe.sefaz.ba.gov.br/servicos/nfce/default.aspx' }, 'MG': { 'STATUS': '', From 87d9b665d12823acd5bda42c460194d1d0694a80 Mon Sep 17 00:00:00 2001 From: juniortada Date: Wed, 22 Aug 2018 15:12:30 -0300 Subject: [PATCH 04/11] =?UTF-8?q?[fix]=20corre=C3=A7=C3=A3o=20caracteres?= =?UTF-8?q?=20inv=C3=A1lidos=20qrcode=20nfce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynfe/processamento/serializacao.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index bd2ad3a8..05bec136 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -741,8 +741,8 @@ def gerar_qrcode(self, token, csc, xml, return_qr=False): etree.SubElement(info, 'urlChave').text = url_chave nfe.insert(1, info) # correção da tag qrCode, retira caracteres pois e CDATA - tnfe = etree.tostring(nfe, encoding='unicode') - etree.tostring(nfe.find(".//qrCode"), encoding='unicode') \ + # tnfe = etree.tostring(nfe, encoding='unicode') + tnfe = etree.tostring(nfe.find(".//qrCode"), encoding='unicode') \ .replace('\n','').replace('<','<').replace('>','>').replace('amp;','') nfe = etree.fromstring(tnfe) # retorna nfe com o qrcode incluido NT2015/002 e qrcode From 5e01540741b574528821cfe960670b40bc431fa1 Mon Sep 17 00:00:00 2001 From: juniortada Date: Wed, 22 Aug 2018 15:18:24 -0300 Subject: [PATCH 05/11] [fix] corrige em apenas uma linha --- pynfe/processamento/serializacao.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 05bec136..7367c736 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -741,8 +741,7 @@ def gerar_qrcode(self, token, csc, xml, return_qr=False): etree.SubElement(info, 'urlChave').text = url_chave nfe.insert(1, info) # correção da tag qrCode, retira caracteres pois e CDATA - # tnfe = etree.tostring(nfe, encoding='unicode') - tnfe = etree.tostring(nfe.find(".//qrCode"), encoding='unicode') \ + tnfe = etree.tostring(nfe, encoding='unicode') \ .replace('\n','').replace('<','<').replace('>','>').replace('amp;','') nfe = etree.fromstring(tnfe) # retorna nfe com o qrcode incluido NT2015/002 e qrcode From 9cbd7ed9aaa58f9c795a4c929780f4e8069a7c61 Mon Sep 17 00:00:00 2001 From: juniortada Date: Wed, 22 Aug 2018 15:21:50 -0300 Subject: [PATCH 06/11] [fix] corrige em apenas uma linha --- pynfe/processamento/serializacao.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 7367c736..20b23382 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -741,8 +741,7 @@ def gerar_qrcode(self, token, csc, xml, return_qr=False): etree.SubElement(info, 'urlChave').text = url_chave nfe.insert(1, info) # correção da tag qrCode, retira caracteres pois e CDATA - tnfe = etree.tostring(nfe, encoding='unicode') \ - .replace('\n','').replace('<','<').replace('>','>').replace('amp;','') + tnfe = etree.tostring(nfe, encoding='unicode').replace('\n','').replace('<','<').replace('>','>').replace('amp;','') nfe = etree.fromstring(tnfe) # retorna nfe com o qrcode incluido NT2015/002 e qrcode if return_qr: From a8874fc44be5d1b35ab6017077bf40eba4b78da9 Mon Sep 17 00:00:00 2001 From: juniortada Date: Wed, 22 Aug 2018 16:06:40 -0300 Subject: [PATCH 07/11] =?UTF-8?q?[fix]=20revertida=20as=20modifica=C3=A7?= =?UTF-8?q?=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynfe/processamento/serializacao.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 20b23382..bd2ad3a8 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -741,7 +741,9 @@ def gerar_qrcode(self, token, csc, xml, return_qr=False): etree.SubElement(info, 'urlChave').text = url_chave nfe.insert(1, info) # correção da tag qrCode, retira caracteres pois e CDATA - tnfe = etree.tostring(nfe, encoding='unicode').replace('\n','').replace('<','<').replace('>','>').replace('amp;','') + tnfe = etree.tostring(nfe, encoding='unicode') + etree.tostring(nfe.find(".//qrCode"), encoding='unicode') \ + .replace('\n','').replace('<','<').replace('>','>').replace('amp;','') nfe = etree.fromstring(tnfe) # retorna nfe com o qrcode incluido NT2015/002 e qrcode if return_qr: From 5cc6821faeb4dc808fea725eae3e49c9e7b79e3d Mon Sep 17 00:00:00 2001 From: juniortada Date: Mon, 27 Aug 2018 15:40:06 -0300 Subject: [PATCH 08/11] [fix] atualizado url qrcode BA --- pynfe/utils/webservices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pynfe/utils/webservices.py b/pynfe/utils/webservices.py index 87aa6822..5935362e 100644 --- a/pynfe/utils/webservices.py +++ b/pynfe/utils/webservices.py @@ -151,7 +151,7 @@ 'CHAVE': '', 'INUTILIZACAO': '', 'EVENTOS': '', - 'QR': 'sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx', + 'QR': 'sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx?', 'HTTPS': 'http://nfe.', 'HOMOLOGACAO': 'http://hnfe.', 'URL': 'nfe.sefaz.ba.gov.br/servicos/nfce/default.aspx' From b9cf2751f3668d278d487b4728bb8d5b0fae261b Mon Sep 17 00:00:00 2001 From: juniortada Date: Fri, 31 Aug 2018 03:04:41 -0300 Subject: [PATCH 09/11] [fix] atualizado url nfce go --- pynfe/utils/webservices.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pynfe/utils/webservices.py b/pynfe/utils/webservices.py index 5935362e..579d07e7 100644 --- a/pynfe/utils/webservices.py +++ b/pynfe/utils/webservices.py @@ -252,14 +252,14 @@ 'HOMOLOGACAO': 'http://homologacao.' }, 'GO': { - 'STATUS': 'sefaz.go.gov.br/nfe/services/v2/NfeStatusServico2', - 'AUTORIZACAO': 'sefaz.go.gov.br/nfe/services/v2/NfeAutorizacao', - 'RECIBO': 'sefaz.go.gov.br/nfe/services/v2/NfeRetAutorizacao', - 'CHAVE': 'sefaz.go.gov.br/nfe/services/v2/NfeConsulta2', - 'INUTILIZACAO': 'sefaz.go.gov.br/nfe/services/v2/NfeInutilizacao2', - 'EVENTOS': 'sefaz.go.gov.br/nfe/services/v2/RecepcaoEvento', + 'STATUS': 'sefaz.go.gov.br/nfe/services/NFeStatusServico4?wsdl', + 'AUTORIZACAO': 'sefaz.go.gov.br/nfe/services/NFeAutorizacao4?wsdl', + 'RECIBO': 'sefaz.go.gov.br/nfe/services/NFeRetAutorizacao4?wsdl', + 'CHAVE': 'sefaz.go.gov.br/nfe/services/NFeConsultaProtocolo4?wsdl', + 'INUTILIZACAO': 'sefaz.go.gov.br/nfe/services/NFeInutilizacao4?wsdl', + 'EVENTOS': 'sefaz.go.gov.br/nfe/services/NFeRecepcaoEvento4?wsdl', 'QR': 'sefaz.go.gov.br/nfeweb/sites/nfce/danfeNFCe?', - 'CADASTRO': 'sefaz.go.gov.br/nfe/services/v2/CadConsultaCadastro2', + 'CADASTRO': 'sefaz.go.gov.br/nfe/services/CadConsultaCadastro4?wsdl', 'HTTPS': 'http://nfe.', 'HOMOLOGACAO': 'http://homolog.' }, From bd068e35188dbd46bcc749d1fa5bac805962fe96 Mon Sep 17 00:00:00 2001 From: juniortada Date: Mon, 3 Sep 2018 13:20:10 -0300 Subject: [PATCH 10/11] [fix] teste url qrcode nfce 4.00 BA --- pynfe/processamento/serializacao.py | 7 +++++++ pynfe/utils/webservices.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index bd2ad3a8..a65596e0 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -727,6 +727,13 @@ def gerar_qrcode(self, token, csc, xml, return_qr=False): else: qrcode = NFCE[uf.upper()]['HTTPS'] + 'www.homologacao.' + NFCE[uf.upper()]['QR'] + url url_chave = NFCE[uf.upper()]['HTTPS'] + 'www.homologacao.' + NFCE[uf.upper()]['URL'] + url + # BA tem comportamento distindo para qrcode e url + elif uf.upper() == 'BA': + if tpamb == '1': + qrcode = NFCE[uf.upper()]['HTTPS'] + NFCE[uf.upper()]['QR'] + url + else: + qrcode = NFCE[uf.upper()]['HOMOLOGACAO'] + NFCE[uf.upper()]['QR'] + url + url_chave = url_chave = NFCE[uf.upper()]['URL'] # AC, AM, RR, PA, else: if tpamb == '1': diff --git a/pynfe/utils/webservices.py b/pynfe/utils/webservices.py index 579d07e7..270d40c8 100644 --- a/pynfe/utils/webservices.py +++ b/pynfe/utils/webservices.py @@ -151,10 +151,10 @@ 'CHAVE': '', 'INUTILIZACAO': '', 'EVENTOS': '', - 'QR': 'sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx?', + 'QR': 'sefaz.ba.gov.br/servicos/nfce/qrcode.aspx?', 'HTTPS': 'http://nfe.', 'HOMOLOGACAO': 'http://hnfe.', - 'URL': 'nfe.sefaz.ba.gov.br/servicos/nfce/default.aspx' + 'URL': 'http://hinternet.sefaz.ba.gov.br/nfce/consulta' }, 'MG': { 'STATUS': '', From 04ccedcf072b5d1b768dfba008b3ba63e1b89333 Mon Sep 17 00:00:00 2001 From: juniortada Date: Mon, 3 Sep 2018 13:24:12 -0300 Subject: [PATCH 11/11] =?UTF-8?q?[fix]=20atualizado=20readme=20vers=C3=A3o?= =?UTF-8?q?=204.00?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01f74364..eb455200 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -Atenção este repositório já esta em desenvolvimento para a versão NF-e 4.00, para a versão 3.10 utilize a última [release](https://github.com/leotada/PyNFe/releases). +Atualizado para a versão 4.00 NF-e/NFC-e ----------- Visão Geral