Skip to content

Commit 428818e

Browse files
author
Vinicius Cunha
committed
fix(nfe): ajusta validação de preenchimento do idToken e CSC para não ser realizada se a versão do Qr-Code for a 3.
1 parent 1989e5d commit 428818e

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

NFe.Utils/InformacoesSuplementares/ExtinfNFeSupl.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,7 @@ public static string ObterUrlConsulta(this infNFeSupl infNFeSupl, Classes.NFe nf
392392
/// </summary>
393393
public static string ObterUrlQrCode(this infNFeSupl infNFeSupl, Classes.NFe nfe, VersaoQrCode versaoQrCode, string cIdToken, string csc, ConfiguracaoCertificado _cfgCertificado = null)
394394
{
395-
Func<string, string> msgErro = parametro => $"O {parametro} não foi informado!";
396-
397-
if (string.IsNullOrEmpty(cIdToken))
398-
throw new ArgumentNullException(nameof(cIdToken), msgErro("token"));
399-
400-
if (string.IsNullOrEmpty(csc))
401-
throw new ArgumentNullException(nameof(cIdToken), msgErro("CSC"));
395+
ValidarPreenchimentoDasInformacoesDeTokenECscSeNecessario(versaoQrCode, cIdToken, csc);
402396

403397
var versaoServico = Conversao.StringParaVersaoServico(nfe.infNFe.versao);
404398
switch (versaoQrCode)
@@ -414,6 +408,19 @@ public static string ObterUrlQrCode(this infNFeSupl infNFeSupl, Classes.NFe nfe,
414408
}
415409
}
416410

411+
private static void ValidarPreenchimentoDasInformacoesDeTokenECscSeNecessario(VersaoQrCode versaoQrCode, string cIdToken, string csc)
412+
{
413+
if (versaoQrCode == VersaoQrCode.QrCodeVersao3) return;
414+
415+
Func<string, string> msgErro = parametro => $"O {parametro} não foi informado!";
416+
417+
if (string.IsNullOrEmpty(cIdToken))
418+
throw new ArgumentNullException(nameof(cIdToken), msgErro("token"));
419+
420+
if (string.IsNullOrEmpty(csc))
421+
throw new ArgumentNullException(nameof(csc), msgErro("CSC"));
422+
}
423+
417424
/// <summary>
418425
/// Obtém a URL para uso no QR-Code, versão 1.0 - leiaute 3.10
419426
/// </summary>

0 commit comments

Comments
 (0)