using NfProcessorApp.Domain.Entities; using Unimake.Business.DFe.Xml.NFe; namespace NfProcessorApp.Handlers { public class NFResult { public string FilePath { get; set; } public string NumeroNF { get; set; } public string CNPJ_Comprador { get; set; } public string CNPJ_Vendedor { get; set; } public bool IsValid { get; set; } public static NFResult FromPath(string filePath) { var inf = new NfeProc().LoadFromFile(filePath).NFe.InfNFe.First(); if (inf == null) { return Invalid(filePath); } var nf = new NF(inf); return new NFResult { FilePath = filePath, NumeroNF = nf.Numero_NF.ToString(), CNPJ_Comprador = nf.CNPJ_Comprador, CNPJ_Vendedor = nf.CNPJ_Vendedor, IsValid = false }; } public static NFResult Invalid(string filePath) => new() { FilePath = filePath, IsValid = false }; } }