Ejemplo n.º 1
0
        public static PDTHolder Success(string tx)
        {
            VishnuworldEntities ocmde = new VishnuworldEntities();

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            authToken = ocmde.Settings.Find(14).Value;
            txToken   = tx;
            query     = string.Format("cmd=_notify-synch&tx={0}&at={1}", txToken, authToken);
            var            payPalSubmitUrl = ocmde.Settings.Find(11).Value;
            string         url             = payPalSubmitUrl;
            HttpWebRequest req             = (HttpWebRequest)WebRequest.Create(url);

            req.Method        = "POST";
            req.ContentType   = "application/x-www-form-urlencoded";
            req.ContentLength = query.Length;
            StreamWriter stOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);

            stOut.Write(query);
            stOut.Close();
            StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());

            strResponse = stIn.ReadToEnd();
            stIn.Close();
            if (strResponse.StartsWith("SUCCESS"))
            {
                return(PDTHolder.Parse(strResponse));
            }
            return(null);
        }