-
-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ajustada busca da url de envio quando estiver em contingência #280
Conversation
Nesta linha (linha 101): não deveria ser? Pois dessa forma aplicada estaria enviando para o servidor virtual do RS, e não para o servidor virtual de contingência RS. O que faria os demais estados que utilizam o Ambiente Nacional (que vão cair nesse else if) parariam de funcionar. |
Olá @lucastumeleiro, blz? |
@@ -108,6 +105,9 @@ public static String getUrl(ConfiguracoesNfe config, DocumentoEnum tipoDocumento | |||
secao = tipoDocumento.getTipo() + "_SVC-AN_" | |||
+ (config.getAmbiente().equals(AmbienteEnum.HOMOLOGACAO) ? "H" : "P"); | |||
} | |||
}else if (!tipoServico.equals(ServicosEnum.URL_CONSULTANFCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Não poderia entrar no if SVC acima se for NFC-e.
Não existe contingência SVC para NFC-e, deve ser por isso que estava invertido.
ServicosEnum.URL_CONSULTANFCE
e ServicosEnum.URL_QRCODE
tem que olhar a "Sefaz Original" e não a SVC.
para testar o problema é só usar config.setContigenciaSVC(true)
e tentar emitir uma NFC-e.
Há dois caminhos, a lib entender que SVC + NFC-e não faz sentido (ao não tentar SVC quando for URL_CONSULTANFCE
/ URL_QRCODE
) OU quem consome a Lib controlar para que não defina ContigenciaSVC
quando for NFC-e.
Não sei o que o @Samuel-Oliveira pensa sobre isso.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Samuel-Oliveira faz sentido pra você?
@ismaellawrenz, o que acha?
Ao invés disso:
} else if (config.isContigenciaSVC()) {
...
} else if (!tipoServico.equals(ServicosEnum.URL_CONSULTANFCE)
&& !tipoServico.equals(ServicosEnum.URL_QRCODE) && ObjetoUtil.verifica(url).isPresent()) {
...
}
Usar isso:
} else if (!tipoServico.equals(ServicosEnum.URL_CONSULTANFCE)
&& !tipoServico.equals(ServicosEnum.URL_QRCODE)
&& config.isContigenciaSVC()) {
...
} else if (!tipoServico.equals(ServicosEnum.URL_CONSULTANFCE)
&& !tipoServico.equals(ServicosEnum.URL_QRCODE) && ObjetoUtil.verifica(url).isPresent()) {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Olá @jardelnovaes, faz sentido sim.
Eu ainda incluiria uma verificação para garantir que somente NF-e busque URLs em contingência.
Ficaria assim:
} else if (!tipoServico.equals(ServicosEnum.URL_CONSULTANFCE)
&& !tipoServico.equals(ServicosEnum.URL_QRCODE)
&& config.isContigenciaSVC() && tipoDocumento.equals(DocumentoEnum.NFE)) {
...
} else if (!tipoServico.equals(ServicosEnum.URL_CONSULTANFCE)
&& !tipoServico.equals(ServicosEnum.URL_QRCODE) && ObjetoUtil.verifica(url).isPresent()) {
...
}
Vamos aguardar para saber o que o @Samuel-Oliveira acha.
eu tive esse problema agora pouco, de selecionar a url errada. no meu caso foi um cancelamento. A nota foi emitida pelo ambiente nacional, mas para cancelar so vinha a url do svrs retornando chave inexistente. No meu caso eu nao alterei a ordem do if, eu apenas inclui o teste se nao esta em contingencia Apos fazer o teste o codigo entrou no else if do config.isContingenciaSCV() |
Ola Senhores. |
Obrigado @Samuel-Oliveira. |
Merge feito pessoal. |
Apenas inverti a ordem dos ifs, para que antes de verificar se encontrou a url, verifique se esta contingência.
Assim é como estava antes do commit, a lib sempre encontrava a url, com isso não chegava na verificação da contingência.
Testei a implementação com certificado de SC, como ativei contingência usou o ambiente nacional para autorizar.
Lembrando que esta contingência é apenas para quando for uma NF-e e tpEmissao=6 ou 7.