コード例 #1
0
        public async Task FirmaEnvio(string mensaje, string detalleMensaje)
        {
            string accessToken = await ConsumoApi.ObtenerAutentificacionPostReceptor();

            string[] valoresDocumento = HttpContext.Current.Session["ValoresDocumentos"] as string[];
            string   urlValidacion    = await ConsumoApi.EnviarDocumentoPostReceptor(accessToken, valoresDocumento, mensaje, detalleMensaje);

            string desconexion = await ConsumoApi.DeconexionGet(accessToken);
        }
コード例 #2
0
        private async void MetodoConsumo()
        {
            try
            {
                switch (paso)
                {
                case 1:
                    tokenAccess = await ConsumoApi.ObtenerAutentificacionPost();

                    if (tokenAccess != string.Empty && tokenAccess != "false")
                    {
                        Mostrar(tokenAccess);
                        paso++;
                        timer1.Start();
                    }
                    else
                    {
                        MessageBox.Show("ERROR OBTENIENDO AUTENTIFICACION");
                    }
                    break;

                case 2:
                    ComprobanteElectronicoCRI       objComprobanteElectronicoCRI = new ComprobanteElectronicoCRI();
                    TributarioCr.EngineDocumentoXml Metodo = new TributarioCr.EngineDocumentoXml();
                    objComprobanteElectronicoCRI = Metodo.ObjComprobanteElectronicoCRI(tipoDocumento);
                    urlValidacion = await ConsumoApi.EnviarDocumentoPost(tokenAccess, objComprobanteElectronicoCRI, tipoDocumento);

                    if (urlValidacion != string.Empty && urlValidacion != "false")
                    {
                        Mostrar(urlValidacion);
                        paso++;
                        timer1.Start();
                    }
                    else
                    {
                        MessageBox.Show("ERROR ENVIANDO DOCUMENTO");
                    }
                    break;

                case 3:
                    ConsumidorApi.Validacion validacion = new ConsumidorApi.Validacion();
                    validacion = await ConsumoApi.ValidarDocumentoGet(urlValidacion, tokenAccess);

                    Mostrar(validacion.IndEstado);
                    Mostrar(validacion.RespuestaXml);
                    Mostrar(Comprobante.DecodeBase64(validacion.RespuestaXml));
                    paso++;
                    timer1.Start();
                    break;

                case 4:
                    desconexion = await ConsumoApi.DeconexionGet(tokenAccess);

                    Mostrar(desconexion);
                    paso = 0;
                    timer1.Stop();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }