Exemple #1
0
        async Task <RetConsReciNFe> ConsultarRespostaFinal(RetEnviNFe retTransmissao, bool homologacao)
        {
            var gerenciador = new GerenciadorGeral <ConsReciNFe, RetConsReciNFe>(
                retTransmissao.Estado, Operacoes.RespostaAutorizar, homologacao, true);
            var envio = new ConsReciNFe(retTransmissao.TipoAmbiente, retTransmissao.DadosRecibo.NumeroRecibo);

            return(await gerenciador.EnviarAsync(envio));
        }
Exemple #2
0
        private bool RetornoRecibo(RetEnviNFe retEnviNFe)
        {
            retEnviNFe.Salvar(ObterCaminhoArquivo($"{retEnviNFe.InfRec.NRec}{SufixoProRec}.xml"));

            if (retEnviNFe.CStat == "103")
            {
                NumRecibo = retEnviNFe.InfRec.NRec;
                Mensagem  = $"{retEnviNFe.CStat}-{retEnviNFe.XMotivo}";
                return(true);
            }

            Erro = $"{retEnviNFe.CStat}-{retEnviNFe.XMotivo}";
            return(false);
        }
Exemple #3
0
        async Task <RetConsReciNFe> ConsultarRespostaFinal(RetEnviNFe retTransmissao, bool homologacao)
        {
            if (retTransmissao == null)
            {
                throw new AnaliseErro("O resultado da transmissão inicial não é válido.");
            }
            GerenciadorGeral <ConsReciNFe, RetConsReciNFe> gerenciador;

            try
            {
                gerenciador = new GerenciadorGeral <ConsReciNFe, RetConsReciNFe>(
                    retTransmissao.Estado, Operacoes.RespostaAutorizar, homologacao, false);
            }
            catch (Exception e)
            {
                throw new AnaliseErro("Erro durante a criação do gerenciador.", e);
            }

            ConsReciNFe envio;

            try
            {
                envio = new ConsReciNFe(retTransmissao.TipoAmbiente, retTransmissao.DadosRecibo.NumeroRecibo);
            }
            catch (Exception e)
            {
                throw new AnaliseErro("Erro durante a criação do envio.", e);
            }

            try
            {
                return(await gerenciador.EnviarAsync(envio));
            }
            catch (Exception e)
            {
                throw new AnaliseErro("Erro durante o envio.", e);
            }
        }