Exemple #1
0
        public string CadenaComprobante(string clave, string consecutivo, string tipoIdEmisor, string numeroIdEmisor, string tipoIdReceptor, string numeroIdReceptor, XmlDocument documentoXml)
        {
            string resultado = string.Empty;

            try
            {
                EsquemaComprobante comprobante = new EsquemaComprobante();
                comprobante = CrearComprobante(clave, consecutivo, tipoIdEmisor, numeroIdEmisor, tipoIdReceptor, numeroIdReceptor, documentoXml);
                resultado   = new JavaScriptSerializer().Serialize(comprobante);
            }
            catch (Exception ex)
            {
                throw new Exception("Error en metodo CadenaComprobante", ex);
            }
            return(resultado);
        }
Exemple #2
0
        public EsquemaComprobante CrearComprobante(string clave, string consecutivo, string tipoIdEmisor, string numeroIdEmisor, string tipoIdReceptor, string numeroIdReceptor, XmlDocument documentoXml)
        {
            EsquemaComprobante comprobante = new EsquemaComprobante()
            {
                clave  = clave,
                fecha  = DateTime.UtcNow.ToString(EngineData.dateFormat),
                emisor = new EsquemaComprobante.EmisorType()
                {
                    tipoIdentificacion   = tipoIdEmisor,
                    numeroIdentificacion = numeroIdEmisor
                },
                receptor = new EsquemaComprobante.ReceptorType()
                {
                    tipoIdentificacion   = tipoIdReceptor,
                    numeroIdentificacion = numeroIdReceptor
                },
                callbackUrl    = Valor.UrlDevolucionLlamadaEmisor(),
                comprobanteXml = ConvertirBase64(documentoXml)
            };

            return(comprobante);
        }