Пример #1
0
        public bool Cancel(string issuer, string uuid)
        {
            using (var ws = new WSTFDClient(binding, address)) {
                var response = ws.CancelarCFDI(Username, Password, issuer, new string[] { uuid }, PrivateKey, PrivateKeyPassword);

                if (!response.OperacionExitosa)
                {
                    var code    = string.Empty;
                    var details = response.MensajeErrorDetallado;

                    if (response.DetallesCancelacion != null && response.DetallesCancelacion.Length > 0)
                    {
                        code = response.DetallesCancelacion [0].CodigoResultado;

                        if (!string.IsNullOrWhiteSpace(details))
                        {
                            details += "\n";
                        }

                        details = response.DetallesCancelacion [0].MensajeResultado;
                    }

                    throw new FelClientException(code, response.MensajeError, details);
                }

                return(true);
            }
        }
Пример #2
0
        public TimbreFiscalDigital Stamp(string id, string xml)
        {
            using (var ws = new WSTFDClient(binding, address)) {
                var response = ws.TimbrarCFDI(Username, Password, xml, id);

                if (!response.OperacionExitosa)
                {
                    throw new FelClientException(response.CodigoRespuesta,
                                                 response.MensajeError,
                                                 response.MensajeErrorDetallado);
                }

                return(new TimbreFiscalDigital {
                    UUID = response.Timbre.UUID,
                    FechaTimbrado = response.Timbre.FechaTimbrado,
                    selloCFD = response.Timbre.SelloCFD,
                    noCertificadoSAT = response.Timbre.NumeroCertificadoSAT,
                    selloSAT = response.Timbre.SelloSAT
                });
            }
        }