Beispiel #1
0
        public bool Timbrar(Timbrado timbrado)
        {
            Timbre t = timbrado.Timbrar(this);
            if(t == null)
                return false;

            this.Timbre = t;
            return true;
        }
Beispiel #2
0
 private void Init()
 {
     this.Version = "3.0";
     this.Emisor = new Emisor();
     this.Receptor = new Receptor();
     this.Conceptos = new ConceptosHandler();
     this.Impuestos = new ImpuestosHandler();
     this.Timbre = null;
 }
Beispiel #3
0
        private Timbre TimbrarBin(byte[] cfdi)
        {
            this.Error = string.Empty;
            RequestTimbradoCFDType request = new RequestTimbradoCFDType();
            request.InfoBasica = new InfoBasicaType();
            request.InfoBasica.RfcEmisor = this.RfcEmisor;
            request.InfoBasica.RfcReceptor = this.RfcReceptor;
            request.Documento = new DocumentoType();
            request.Documento.Tipo = DocumentoTypeTipo.XML;
            request.Documento.Version = this.Version;
            request.Documento.Archivo = cfdi;

            TimbradoCFDI proxy = new TimbradoCFDI();
            proxy.Url = this.Url;
            proxy.ClientCertificates.Add(this.Certificado);
            TimbreFiscalDigital tfd = null;

            try
            {
                System.Net.ServicePointManager.ServerCertificateValidationCallback += (s, c, ch, e) => true;
                tfd = proxy.timbradoCFD(request);
            }

            catch(System.Web.Services.Protocols.SoapException e)
            {
                this.Error = e.Message;
                return null;
            }

            catch(Exception e)
            {
                this.Error = e.Message;
                return null;
            }

            Timbre timbre = new Timbre();
            timbre.FechaTimbrado = tfd.FechaTimbrado;
            timbre.NoCertificadoSat = tfd.noCertificadoSAT;
            timbre.SelloCfd = tfd.selloCFD;
            timbre.SelloSat = tfd.selloSAT;
            timbre.UUID = tfd.UUID;
            timbre.Version = tfd.version;

            return timbre;
        }