Beispiel #1
0
        public bool Cancel(string issuer, string recipient, string uuid, string total, string cert, string privKey, string privKeyPassword)
        {
            using (var ws = new WSTimbradoSOAPClient(binding, address)) {
                var    response        = ws.CancelarCFDI(Username, Password, issuer, recipient, uuid.ToUpper(), total, cert, privKey, privKeyPassword);
                string err_number      = response.codigo;
                string err_description = response.mensaje;

                if (err_number != "201" && err_number != "214")
                {
                    throw new DFactureClientException(err_number, err_description);
                }
            }

            return(true);
        }
Beispiel #2
0
        public TimbreFiscalDigital GetStamp(string issuer, string uuid)
        {
            string xml_response     = null;
            TimbreFiscalDigital tfd = null;

            using (var ws = new WSTimbradoSOAPClient(binding, address)) {
                var    response        = ws.RecuperarXML(Username, Password, uuid.ToUpper());
                string err_number      = response.codigo;
                string err_description = response.mensaje;

                if (err_number != "100")
                {
                    throw new DFactureClientException(err_number, err_description);
                }

                xml_response = Encoding.UTF8.GetString(Convert.FromBase64String(response.xml));
            }

            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 DFactureClientException("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
            });
        }