示例#1
0
    private void ReprocesarPago(string xml)
    {
        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.LoadXml(xml);
        XmlNode nodeCharge = xmlDoc.SelectSingleNode("//CHARGE");
        string  encData    = nodeCharge.Attributes["ENC_DATA"].InnerText;
        string  date       = nodeCharge.Attributes["DATE"].InnerText;
        string  idIventure = nodeCharge.Attributes["ORDER_ID"].InnerText;
        string  codigo     = nodeCharge.Attributes["RESPONSE_CODE"].InnerText;
        string  data       = encData;

        string[] campos  = data.Split("|".ToCharArray());
        string   sAmount = "-1";

        for (int i = 0; i < campos.Length; i++)
        {
            if (campos[i].StartsWith("egp_Amount="))
            {
                sAmount = campos[i].Substring("egp_Amount=".Length);
            }
        }
        System.Globalization.CultureInfo cultureEN_US = new System.Globalization.CultureInfo("en-US");
        try
        {
            FacadeDao.ProcesarPago(Convert.ToInt32(idIventure), Convert.ToDouble(sAmount, cultureEN_US), Convert.ToDateTime(date, cultureEN_US));
            Response.Redirect("MisIventures.aspx");
        }
        catch (Exception ex) {
            Label3.Text = ex.Message;
        }
    }
示例#2
0
 private void ProcesarPago()
 {
     if (CodigosEPAY.IsAuthorized(Request.Form["MessageDescrip"]))
     {
         FacadeDao.ProcesarPago(Convert.ToInt32(Request.Form["OrderCode"]));
     }
 }
示例#3
0
 private void ProcesarConfirmacion()
 {
     if (Request.QueryString["egp_data"] != null && Request.QueryString["MerchantId"] != null)
     {
         //string data = Core.NpsEncripterHelper.Decrypt(Request.QueryString["egp_data"], ConfigurationManager.AppSettings["Key"]);
         Proveedor prov = null;
         prov = FacadeDao.GetProveedor(Request.QueryString["MerchantId"]);
         if (prov != null)
         {
             string   data     = Core.NpsEncripterHelper.Decrypt(Request.QueryString["egp_data"], prov.ClaveEncNPS);
             string[] campos   = data.Split("|".ToCharArray());
             string   codigo   = "-11111";
             string   sOrderId = "-1";
             string   sAmount  = "-1";
             for (int i = 0; i < campos.Length; i++)
             {
                 if (campos[i].StartsWith("egp_ResponseCode="))
                 {
                     codigo = campos[i].Substring("egp_ResponseCode=".Length);
                 }
                 else if (campos[i].StartsWith("egp_OrderID="))
                 {
                     sOrderId = campos[i].Substring("egp_OrderID=".Length);
                 }
                 else if (campos[i].StartsWith("egp_Amount="))
                 {
                     sAmount = campos[i].Substring("egp_Amount=".Length);
                 }
             }
             string descripcion = CodigosNPS.GetDescripcion(Convert.ToInt32(codigo));
             int    orderId;
             double amount;
             System.Globalization.CultureInfo cultureEN_US = new System.Globalization.CultureInfo("en-US");
             if (codigo == "-1")
             {
                 amount  = Convert.ToDouble(sAmount, cultureEN_US);
                 orderId = Convert.ToInt32(sOrderId);
                 if (FacadeDao.IventurePagado(orderId))
                 {
                     Response.Clear();
                     Response.Write("-1");
                 }
                 else
                 {
                     FacadeDao.ProcesarPago(orderId, amount);
                     Response.Clear();
                     Response.Write("1");
                 }
             }
         }
         else
         {
             throw new Exception("No se encontró un proveedor con merchantId = " + Request.QueryString["idGateway"]);
         }
     }
     else if (Request.QueryString["egp_data"] == null)
     {
         throw new Exception("No se encontró el parámetro egp_data");
     }
     else
     {               //Request.QueryString["MerchantId"] == null
         throw new Exception("No se encontró el parámetro idGateway");
     }
 }
示例#4
0
    private void ProcesarPago()
    {
        if (Request["egp_data"] != null && Request.QueryString["IdIventure"] != null)
        {
            Core.Iventure iventure = FacadeDao.GetIventure(Convert.ToInt32(Request.QueryString["IdIventure"]));
            if (iventure != null)
            {
                //string data = Core.NpsEncripterHelper.Decrypt(Request["egp_data"], ConfigurationManager.AppSettings["Key"]);
                //string data = Core.NpsEncripterHelper.Decrypt(Request["egp_data"], iventure.Proveedor.ClaveEncNPS);
                string data = Core.NpsEncripterHelper.Decrypt(Request["egp_data"], "298887645747869742751484443145062435617099358761");
                //"298887645747869742751484443145062435617099358761"
                string[] campos = data.Split("|".ToCharArray());
                string   codigo = "-11111";
                string   sOrderId = "-1";
                string   sAmount = "-1";
                string   sFecha = "", sHora = "", sTrans = "", sAuthorizCode = "";
                DateTime fechaPago;
                for (int i = 0; i < campos.Length; i++)
                {
                    if (campos[i].StartsWith("egp_ResponseCode="))
                    {
                        codigo = campos[i].Substring("egp_ResponseCode=".Length);
                    }
                    else if (campos[i].StartsWith("egp_OrderID="))
                    {
                        sOrderId = campos[i].Substring("egp_OrderID=".Length);
                    }
                    else if (campos[i].StartsWith("egp_Amount="))
                    {
                        sAmount = campos[i].Substring("egp_Amount=".Length);
                    }
                    else if (campos[i].StartsWith("egp_FechaTrn_srv="))
                    {
                        sFecha = campos[i].Substring("egp_FechaTrn_srv=".Length);
                    }
                    else if (campos[i].StartsWith("egp_HoraTrn_srv="))
                    {
                        sHora = campos[i].Substring("egp_HoraTrn_srv=".Length);
                    }
                    else if (campos[i].StartsWith("egp_TrnID="))
                    {
                        sTrans = campos[i].Substring("egp_TrnID=".Length);
                    }
                    else if (campos[i].StartsWith("egp_AuthorizCode="))
                    {
                        sAuthorizCode = campos[i].Substring("egp_AuthorizCode=".Length);
                    }
                }
                fechaPago = GetFechaPago(sFecha, sHora);

                string sufijo  = "";
                string detalle = iventure.DetalleAereo;
                if (iventure.DetalleAereo.Length > 30)
                {
                    sufijo  = " ...";
                    detalle = iventure.DetalleAereo.Substring(0, 30);
                }
                lblDescripcion.Text = detalle + sufijo;
                lblFecha.Text       = fechaPago.ToShortDateString();
                lblHora.Text        = fechaPago.ToShortTimeString();
                lblTrans.Text       = sTrans;
                lblIdIventure.Text  = sOrderId;
                lblCodAut.Text      = sAuthorizCode;
                imgEmpresa.ImageUrl = iventure.Proveedor.UrlImagen;
                int    orderId, authorizCode;
                Int64  trnID;
                double amount;

                System.Globalization.CultureInfo cultureEN_US = new System.Globalization.CultureInfo("en-US");
                if (codigo == "-1")
                {
                    amount          = Convert.ToDouble(sAmount, cultureEN_US);
                    lblImporte.Text = amount.ToString(new System.Globalization.CultureInfo("es-ar"));
                    orderId         = Convert.ToInt32(sOrderId);
                    authorizCode    = Convert.ToInt32(sAuthorizCode);
                    trnID           = Convert.ToInt64(sTrans);
                    FacadeDao.ProcesarPago(orderId, amount, fechaPago, trnID, authorizCode);
                }
            }
        }
        else if (Request["egp_data"] == null)
        {
            lblData.Text = "No se encontraron valores en egp_data";
        }
        else
        {         //Request.QueryString["IdIventure"] != null
            lblData.Text = "No se encontraron valores en IdIventure";
        }
    }