コード例 #1
0
        public bool Cancel(string issuer, string uuid)
        {
            using (var ws = new TimbradoSoapClient(binding, address)) {
                var    response        = ws.CancelaCFDI(Username, issuer, uuid.ToUpper());
                string err_number      = response[1].ToString();
                string err_description = response[2].ToString();

                if (err_number != "0")
                {
                    throw new ProFactClientException(err_number, err_description);
                }
            }

            return(true);
        }
コード例 #2
0
        public bool SaveIssuer(string issuer, byte[] certificate, byte[] privateKey, string password)
        {
            using (var ws = new TimbradoSoapClient(binding, address)) {
                var response = ws.RegistraEmisor(Username, issuer, Convert.ToBase64String(certificate),
                                                 Convert.ToBase64String(privateKey), password);
                string err_number      = response[1].ToString();
                string err_description = response[2].ToString();

                if (err_number != "0")
                {
                    throw new ProFactClientException(err_number, err_description);
                }
            }

            return(true);
        }
コード例 #3
0
        public TimbreFiscalDigital GetStamp(string issuer, string uuid)
        {
            string xml_response     = null;
            TimbreFiscalDigital tfd = null;

            using (var ws = new TimbradoSoapClient(binding, address)) {
                var    response        = ws.ObtieneCFDI(Username, issuer, uuid.ToUpper());
                string err_number      = response[1].ToString();
                string err_description = response[2].ToString();

                if (err_number != "0")
                {
                    throw new ProFactClientException(err_number, err_description);
                }

                xml_response = response[3].ToString();
            }

            var cfd = Comprobante.FromXml(xml_response);

            foreach (var item in cfd.Complemento)
            {
                if (item is TimbreFiscalDigital)
                {
                    tfd = item as TimbreFiscalDigital;
                    break;
                }
            }

            if (tfd == null)
            {
                throw new ProFactClientException("TimbreFiscalDigital not found.");
            }

            return(new TimbreFiscalDigital {
                UUID = tfd.UUID,
                FechaTimbrado = tfd.FechaTimbrado,
                SelloCFD = tfd.SelloCFD,
                NoCertificadoSAT = tfd.NoCertificadoSAT,
                SelloSAT = tfd.SelloSAT,
                Leyenda = tfd.Leyenda,
                RfcProvCertif = tfd.RfcProvCertif
            });
        }
コード例 #4
0
        public Acuse CancelAck(string issuer, string uuid)
        {
            string xml_response = null;

            using (var ws = new TimbradoSoapClient(binding, address)) {
                var    response        = ws.CancelaCFDIAck(Username, issuer, uuid.ToUpper());
                string err_number      = response [1].ToString();
                string err_description = response [2].ToString();

                if (err_number != "0")
                {
                    throw new ProFactClientException(err_number, err_description);
                }

                xml_response = response [3].ToString();
            }

            return(Acuse.FromXml(xml_response));
        }
コード例 #5
0
        /*
         * TimbradoSoapClient Reponse Array
         *
         * Index 0: Exception type
         * Index 1: Error number
         * Index 2: Result description
         * Index 3: Stamped xml document
         * Index 4: Byte array for QRCode image
         * Index 5: Stamp string
         *
         */
        public TimbreFiscalDigital StampBase64String(string id, string base64Xml)
        {
            string xml_response = null;
            TimbreFiscalDigital tfd = null;

            using (var ws = new TimbradoSoapClient (binding, address)) {
                var response = ws.TimbraCFDI (Username, base64Xml, id);
                string err_number = response [1].ToString ();
                string err_description = response [2].ToString ();

                if (err_number != "0") {
                    throw new ProFactClientException (err_number, err_description);
                }

                xml_response = response [3].ToString ();
            }

            var cfd = Comprobante.FromXml (xml_response);

            foreach (var item in cfd.Complemento) {
                if (item is TimbreFiscalDigital) {
                    tfd = item as TimbreFiscalDigital;
                    break;
                }
            }

            if (tfd == null) {
                throw new ProFactClientException ("TimbreFiscalDigital not found.");
            }

            return new TimbreFiscalDigital {
                UUID = tfd.UUID,
                FechaTimbrado = tfd.FechaTimbrado,
                selloCFD = tfd.selloCFD,
                noCertificadoSAT = tfd.noCertificadoSAT,
                selloSAT = tfd.selloSAT
            };
        }
コード例 #6
0
        public bool SaveIssuer(string issuer, byte[] certificate, byte[] privateKey, string password)
        {
            using (var ws = new TimbradoSoapClient (binding, address)) {
                var response = ws.RegistraEmisor (Username, issuer, Convert.ToBase64String (certificate),
                                                  Convert.ToBase64String (privateKey), password);
                string err_number = response [1].ToString ();
                string err_description = response [2].ToString ();

                if (err_number != "0") {
                    throw new ProFactClientException (err_number, err_description);
                }
            }

            return true;
        }
コード例 #7
0
        public bool Cancel(string issuer, string uuid)
        {
            using (var ws = new TimbradoSoapClient (binding, address)) {
                var response = ws.CancelaCFDI (Username, issuer, uuid.ToUpper ());
                string err_number = response [1].ToString ();
                string err_description = response [2].ToString ();

                if (err_number != "0") {
                    throw new ProFactClientException (err_number, err_description);
                }
            }

            return true;
        }