Browse Source

Merge pull request #46 from TadaSoftware/master

merge from master
pull/48/head
Junior Tada 7 years ago
committed by GitHub
parent
commit
8ad01f1470
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 4
      pynfe/processamento/comunicacao.py
  3. 10
      pynfe/processamento/serializacao.py
  4. 19
      pynfe/utils/webservices.py

2
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 Visão Geral

4
pynfe/processamento/comunicacao.py

@ -342,8 +342,8 @@ class ComunicacaoSefaz(Comunicacao):
# nfe Ex: https://nfe.fazenda.pr.gov.br/nfe/NFeStatusServico3 # nfe Ex: https://nfe.fazenda.pr.gov.br/nfe/NFeStatusServico3
self.url = NFE[self.uf.upper()][ambiente] + NFE[self.uf.upper()][consulta] self.url = NFE[self.uf.upper()][ambiente] + NFE[self.uf.upper()][consulta]
elif modelo == 'nfce': 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] self.url = NFCE['SVRS'][ambiente] + NFCE['SVRS'][consulta]
else: else:
# nfce Ex: https://homologacao.nfce.fazenda.pr.gov.br/nfce/NFeStatusServico3 # nfce Ex: https://homologacao.nfce.fazenda.pr.gov.br/nfce/NFeStatusServico3

10
pynfe/processamento/serializacao.py

@ -608,8 +608,9 @@ class SerializacaoXML(Serializacao):
Para as notas com finalidade de Ajuste ou Devolução o campo Forma de Pagamento deve ser preenchido com 90=Sem Pagamento. """ 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') pag = etree.SubElement(raiz, 'pag')
detpag = etree.SubElement(pag, 'detPag') 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' etree.SubElement(detpag, 'tPag').text = '90'
etree.SubElement(detpag, 'vPag').text = '{:.2f}'.format(0)
else: else:
etree.SubElement(detpag, 'tPag').text = str(nota_fiscal.tipo_pagamento).zfill(2) 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) etree.SubElement(detpag, 'vPag').text = '{:.2f}'.format(nota_fiscal.totais_icms_total_nota)
@ -726,6 +727,13 @@ class SerializacaoQrcode(object):
else: else:
qrcode = NFCE[uf.upper()]['HTTPS'] + 'www.homologacao.' + NFCE[uf.upper()]['QR'] + url 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 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, # AC, AM, RR, PA,
else: else:
if tpamb == '1': if tpamb == '1':

19
pynfe/utils/webservices.py

@ -151,7 +151,10 @@ NFCE = {
'CHAVE': '', 'CHAVE': '',
'INUTILIZACAO': '', 'INUTILIZACAO': '',
'EVENTOS': '', 'EVENTOS': '',
'QR': ''
'QR': 'sefaz.ba.gov.br/servicos/nfce/qrcode.aspx?',
'HTTPS': 'http://nfe.',
'HOMOLOGACAO': 'http://hnfe.',
'URL': 'http://hinternet.sefaz.ba.gov.br/nfce/consulta'
}, },
'MG': { 'MG': {
'STATUS': '', 'STATUS': '',
@ -249,14 +252,14 @@ NFCE = {
'HOMOLOGACAO': 'http://homologacao.' 'HOMOLOGACAO': 'http://homologacao.'
}, },
'GO': { '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?', '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.', 'HTTPS': 'http://nfe.',
'HOMOLOGACAO': 'http://homolog.' 'HOMOLOGACAO': 'http://homolog.'
}, },

Loading…
Cancel
Save