public bool Cancel(string issuer, string uuid) { var env = CreateEnvelope(issuer, uuid); string response = TryRequest(env); if (response.Length == 0) { throw new FiscoClicClientException("Bad response format."); } var doc = SoapEnvelope.FromXml(response); if (doc.Body.Length == 0) { throw new FiscoClicClientException("Bad response format."); } if (doc.Body[0] is CancelaCFDIResponse) { var res = doc.Body[0] as CancelaCFDIResponse; return(Convert.ToBoolean(res.Return)); } if (doc.Body[0] is SoapFault) { var fault = doc.Body[0] as SoapFault; throw new FiscoClicClientException(fault.FaultString, fault.Detail.Exception); } return(false); }
public TimbreFiscalDigital Stamp(string xml) { var env = CreateEnvelope(xml); string response = TryRequest(env); if (response.Length == 0) { throw new FiscoClicClientException("Bad response format."); } var doc = SoapEnvelope.FromXml(response); if (doc.Body.Length == 0) { throw new FiscoClicClientException("Bad response format."); } if (doc.Body[0] is TimbraCFDIXMLResponse) { var res = doc.Body[0] as TimbraCFDIXMLResponse; var tfd = TimbreFiscalDigital.FromXml(res.Return); return(new TimbreFiscalDigital { UUID = tfd.UUID, FechaTimbrado = tfd.FechaTimbrado, selloCFD = tfd.selloCFD, noCertificadoSAT = tfd.noCertificadoSAT, selloSAT = tfd.selloSAT }); } if (doc.Body[0] is SoapFault) { var fault = doc.Body[0] as SoapFault; throw new FiscoClicClientException(fault.FaultString, fault.Detail.Exception); } return(null); }