internal IdeCancelamento()
 {
     Id        = 0;
     Pedido    = new PedidoCancelamento();
     Signature = new DFeSignature();
     DataHora  = DateTime.Now;
 }
Exemplo n.º 2
0
 public TesteXml()
 {
     XmlItems      = new List <IXmlItem>();
     XmlProd       = new DFeCollection <TesteXml4>();
     TesteListEnum = new DFeCollection <TesteEnum>();
     TesteDateTime = new DFeCollection <DateTime>();
     Xml5          = new TesteXml5();
     Signature     = new DFeSignature();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdeRps"/> class.
 /// </summary>
 internal IdeRpsSubtituida()
 {
     NumeroRps         = string.Empty;
     NumeroNfse        = string.Empty;
     Serie             = string.Empty;
     NFSeSubstituidora = string.Empty;
     Tipo = TipoRps.RPS;
     DataEmissaoNfseSubstituida = null;
     Signature = new DFeSignature();
 }
        /// <summary>
        /// Retornar o XML da assinatura ou nulo caso não tenha nada.
        /// </summary>
        /// <param name="signature">The signature.</param>
        /// <returns>XElement.</returns>
        protected XElement WriteSignature(DFeSignature signature)
        {
            if (signature.SignatureValue.IsEmpty() || signature.SignedInfo.Reference.DigestValue.IsEmpty() ||
                signature.KeyInfo.X509Data.X509Certificate.IsEmpty())
            {
                return(null);
            }

            var ms         = new MemoryStream();
            var serializer = DFeSerializer.CreateSerializer <DFeSignature>();

            if (!serializer.Serialize(signature, ms))
            {
                return(null);
            }

            return(XElement.Load(ms));
        }
Exemplo n.º 5
0
 public NotaFiscal()
 {
     Id = 0;
     IdentificacaoRps  = new IdeRps();
     IdentificacaoNFSe = new IdeNFSe();
     RpsSubstituido    = new IdeRpsSubtituida();
     Servico           = new DadosServico();
     Prestador         = new DadosPrestador();
     Tomador           = new DadosTomador();
     Intermediario     = new DadosIntermediario();
     ConstrucaoCivil   = new DadosConstrucaoCivil();
     Pagamento         = new DadosPagamento();
     OrgaoGerador      = new IdeOrgaoGerador();
     Signature         = new DFeSignature();
     Cancelamento      = new IdeCancelamento();
     Transportadora    = new DadosTransportadora();
     Emails            = new EmailCollection();
 }
Exemplo n.º 6
0
        /// <summary>
        ///     Gera a assinatura do xml e retorna uma instancia da classe <see cref="DFeSignature" />.
        /// </summary>
        public static DFeSignature AssinarDocumento <TDocument>(this DFeSignDocument <TDocument> document, X509Certificate2 certificado, bool comments, SignDigest digest, SaveOptions options, out string signedXml) where TDocument : class
        {
            Guard.Against <ArgumentException>(!typeof(TDocument).HasAttribute <DFeSignInfoElement>(), "Atributo [DFeSignInfoElement] não encontrado.");

            var xml    = document.GetXml(options, Encoding.UTF8);
            var xmlDoc = new XmlDocument {
                PreserveWhitespace = true
            };

            xmlDoc.LoadXml(xml);

            var signatureInfo = typeof(TDocument).GetAttribute <DFeSignInfoElement>();
            var xmlSignature  = GerarAssinatura(xmlDoc, signatureInfo.SignElement, signatureInfo.SignAtribute, certificado, comments, digest);

            // Adiciona a assinatura no documento e retorna o xml assinado no parametro signedXml
            var element = xmlDoc.ImportNode(xmlSignature, true);

            xmlDoc.DocumentElement?.AppendChild(element);
            signedXml = xmlDoc.AsString(!options.HasFlag(SaveOptions.DisableFormatting), !options.HasFlag(SaveOptions.OmitDeclaration));

            return(DFeSignature.Load(xmlSignature.OuterXml));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NotaFiscal"/> class.
        /// </summary>
        public NotaFiscal(ConfiguracoesNFSe config, bool prestadorPadrão = true)
        {
            Guard.Against <ACBrException>(config == null, "Configurações não podem ser nulas");

            this.config = config;

            Id = 0;
            IdentificacaoRps  = new IdeRps();
            IdentificacaoNFSe = new IdeNFSe();
            RpsSubstituido    = new IdeRpsSubtituida();
            Servico           = new DadosServico();
            Prestador         = prestadorPadrão ? config.PrestadorPadrao : new DadosPrestador();
            Tomador           = new DadosTomador();
            Intermediario     = new DadosIntermediario();
            ConstrucaoCivil   = new DadosConstrucaoCivil();
            Pagamento         = new DadosPagamento();
            OrgaoGerador      = new IdeOrgaoGerador();
            Signature         = new DFeSignature();
            Cancelamento      = new IdeCancelamento();
            Transportadora    = new DadosTransportadora();
            Emails            = new EmailCollection();
        }
Exemplo n.º 8
0
        public NotaServico(ConfigNFSe config)
        {
            Guard.Against <ACBrDFeException>(config == null, "Configurações não podem ser nulas");

            this.config = config;

            Id = 0;
            IdentificacaoRps  = new IdeRps();
            IdentificacaoNFSe = new IdeNFSe();
            RpsSubstituido    = new IdeRpsSubtituida();
            Servico           = new DadosServico();
            EnderecoPrestacao = new Endereco();
            Prestador         = new DadosPrestador();
            Tomador           = new DadosTomador();
            Intermediario     = new DadosIntermediario();
            ConstrucaoCivil   = new DadosConstrucaoCivil();
            Material          = new DadosMateriais();
            Pagamento         = new DadosPagamento();
            OrgaoGerador      = new IdeOrgaoGerador();
            Signature         = new DFeSignature();
            Cancelamento      = new IdeCancelamento();
            Transportadora    = new DadosTransportadora();
            Emails            = new EmailCollection();
        }
Exemplo n.º 9
0
 public NFeInutilizacaoResult()
 {
     InfInut   = new NFeInfInut();
     Signature = new DFeSignature();
 }
Exemplo n.º 10
0
 /// <summary>
 ///     Assina o xml.
 /// </summary>
 /// <param name="certificado">Certificado digital</param>
 /// <param name="options">Options.</param>
 /// <param name="comments">if set to <c>true</c> [comments].</param>
 /// <param name="digest">Digest.</param>
 protected void AssinarDocumento(X509Certificate2 certificado, SaveOptions options, bool comments, SignDigest digest)
 {
     Signature = SigningManager.AssinarDocumento(this, certificado, comments, digest, options, out var xml);
     Xml       = xml;
 }
Exemplo n.º 11
0
 public CTeRetEventoCTe()
 {
     InfEvento = new CTeRetInfEvento();
     Signature = new DFeSignature();
 }
Exemplo n.º 12
0
 public NFeProtNFe()
 {
     Signature = new DFeSignature();
     InfProt   = new NFeInfProt();
 }
Exemplo n.º 13
0
 public CTeRetCancCte()
 {
     InfCanc   = new CTeInfCanc();
     Signature = new DFeSignature();
 }
Exemplo n.º 14
0
 public CTeEventoCTe()
 {
     InfEvento = new CTeInfEventoEnv();
     Signature = new DFeSignature();
 }
Exemplo n.º 15
0
 public NFeRetEvento()
 {
     InfEvento = new NFeRetInfEvento();
     Signature = new DFeSignature();
 }
Exemplo n.º 16
0
 public CTe()
 {
     Signature = new DFeSignature();
     InfCTe    = new CTeInfCTe();
 }
Exemplo n.º 17
0
 public CTeProtCTe()
 {
     Signature = new DFeSignature();
     InfProt   = new CTeInfProt();
 }
Exemplo n.º 18
0
 public NFe()
 {
     _infNFe    = new infNFe(this);
     InfNFeSupl = new infNFeSupl();
     Signature  = new DFeSignature();
 }
 public InutilizaoServiceResult()
 {
     InfInut   = new InfInutRet();
     Signature = new DFeSignature();
 }
Exemplo n.º 20
0
 internal PedidoCancelamento()
 {
     Id = 0;
     IdentificacaoNFSe = new IdeNFSe();
     Signature         = new DFeSignature();
 }
Exemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CFe" /> class.
 /// </summary>
 public CFeCanc()
 {
     InfCFe    = new CancInfCFe();
     Signature = new DFeSignature();
 }
Exemplo n.º 22
0
 public CFe()
 {
     infCFe    = new InfCFe(this);
     Signature = new DFeSignature();
 }
Exemplo n.º 23
0
 public CTeInutCTe()
 {
     infInut   = new CTeInfInutEnv();
     Signature = new DFeSignature();
 }