Exemplo n.º 1
0
        public static string getdatosEncriptadosMPOS(string Amount, string Tarjeta)
        {
            // MJM 26/02/2014 INICIO

            Carrito_Pago objPago;

            // Esto se declara de nuevo, no se usa el que está definido a nivel de clase porque los WebMethods no lo ven.
            DLLGestionVenta.ProcesarVenta mObjVenta;

            mObjVenta = new DLLGestionVenta.ProcesarVenta();
            Int64 idCarrito = Int64.Parse(HttpContext.Current.Session["IdCarrito"].ToString());

            mObjVenta.ConexString = System.Configuration.ConfigurationManager.ConnectionStrings["MC_TDAConnectionString"].ToString();

            objPago = new Carrito_Pago();

            objPago.IdCarrito       = idCarrito;
            objPago.TipoPago        = System.Configuration.ConfigurationManager.AppSettings["TarjetaTipo"].ToString();
            objPago.TipoPagoDetalle = Tarjeta;
            objPago.NumTarjeta      = "";
            objPago.Importe         = float.Parse(Amount, NumberStyles.Currency, CultureInfo.GetCultureInfo("es-MX"));

            Int64 idCarritoPago = mObjVenta.PagoCarrito(objPago, false);

            HttpContext.Current.Session["IdCarritoPago"] = idCarritoPago;

            // MJM 26/02/2014 FIN

            string sVd      = "";
            string semilla  = HttpContext.Current.Session[Constantes.Session.Semilla].ToString();
            rc4    encripta = new rc4();

            XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();

            namespaces.Add(string.Empty, string.Empty);

            xmlmpos oObject = getMPOSSession(Amount);

            XmlSerializer    xmlSerializer = new XmlSerializer(oObject.GetType());
            StringWriterUtf8 text          = new StringWriterUtf8();

            xmlSerializer.Serialize(text, oObject, namespaces);

            sVd = text.ToString();
            sVd = sVd.Replace("\r\n", "");
            // sVd = R4.Encrypt(semilla,sVd); //TODO: Comprobar que esta clase RC4 funciona correctamente.
            sVd = encripta.StringToHexString(encripta.Salaa(sVd, semilla));
            return(sVd);
        }
Exemplo n.º 2
0
        private static xmlmpos getMPOSSession(string Amount)
        {
            xmlmpos oObject = new xmlmpos();

            if (HttpContext.Current.Session[Constantes.Session.IdCompany] != null)
            {
                oObject.amount    = Amount.Replace(",", "");
                oObject.reference = HttpContext.Current.Session["IdCarrito"].ToString() + "/" + AVE.Contexto.IdTienda + " /" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();
                //"5122013974"; //TODO: Falta definir como conseguir la referencia
                oObject.id_company  = HttpContext.Current.Session[Constantes.Session.IdCompany].ToString();
                oObject.id_branch   = HttpContext.Current.Session[Constantes.Session.IdBranch].ToString();
                oObject.cd_merchant = HttpContext.Current.Session[Constantes.Session.CdMerchant].ToString();
                oObject.currency    = "MXN"; //TODO: Falta definir como conseguir la moneda
                oObject.country     = HttpContext.Current.Session[Constantes.Session.Country].ToString();
                oObject.cd_user     = HttpContext.Current.Session[Constantes.Session.CdUser].ToString();
                oObject.password    = HttpContext.Current.Session[Constantes.Session.CdPassword].ToString();
                oObject.cd_usrtrx   = "USR MPOS";
            }

            return(oObject);
        }
Exemplo n.º 3
0
        public static xmlmpos getdatosMPOS()
        {
            xmlmpos oObject = getMPOSSession("");

            return(oObject);
        }