diff --git a/NFe.Utils/InformacoesSuplementares/ExtinfNFeSupl.cs b/NFe.Utils/InformacoesSuplementares/ExtinfNFeSupl.cs index 2599c50b7..df249a72b 100644 --- a/NFe.Utils/InformacoesSuplementares/ExtinfNFeSupl.cs +++ b/NFe.Utils/InformacoesSuplementares/ExtinfNFeSupl.cs @@ -392,13 +392,7 @@ public static string ObterUrlConsulta(this infNFeSupl infNFeSupl, Classes.NFe nf /// public static string ObterUrlQrCode(this infNFeSupl infNFeSupl, Classes.NFe nfe, VersaoQrCode versaoQrCode, string cIdToken, string csc, ConfiguracaoCertificado _cfgCertificado = null) { - Func msgErro = parametro => $"O {parametro} não foi informado!"; - - if (string.IsNullOrEmpty(cIdToken)) - throw new ArgumentNullException(nameof(cIdToken), msgErro("token")); - - if (string.IsNullOrEmpty(csc)) - throw new ArgumentNullException(nameof(cIdToken), msgErro("CSC")); + ValidarPreenchimentoDasInformacoesDeTokenECscSeNecessario(versaoQrCode, cIdToken, csc); var versaoServico = Conversao.StringParaVersaoServico(nfe.infNFe.versao); switch (versaoQrCode) @@ -414,6 +408,19 @@ public static string ObterUrlQrCode(this infNFeSupl infNFeSupl, Classes.NFe nfe, } } + private static void ValidarPreenchimentoDasInformacoesDeTokenECscSeNecessario(VersaoQrCode versaoQrCode, string cIdToken, string csc) + { + if (versaoQrCode == VersaoQrCode.QrCodeVersao3) return; + + Func msgErro = parametro => $"O {parametro} não foi informado!"; + + if (string.IsNullOrEmpty(cIdToken)) + throw new ArgumentNullException(nameof(cIdToken), msgErro("token")); + + if (string.IsNullOrEmpty(csc)) + throw new ArgumentNullException(nameof(csc), msgErro("CSC")); + } + /// /// Obtém a URL para uso no QR-Code, versão 1.0 - leiaute 3.10 ///