예제 #1
0
        private static void Main(string[] args)
        {
            // Please keep in mind that you must not use special characters (includes ä, ö, ü etc.)
            // Except " " in info.fullName, info.address_1, .._2, .._3, info.city
            // Except "@" in info.email
            // Except "+" in info.telephone

            billingInfo info = new billingInfo();

            info.creditcard  = Creditcards.VISA;
            info.fullname    = "Max Mustermann";
            info.email       = "*****@*****.**";
            info.telephone   = "+4915113371337";
            info.address_1   = "12 Muehlen Street";
            info.address_2   = "Bldg E";
            info.address_3   = "Floor 2 Apt 12";
            info.zip         = "78467";
            info.city        = "Konstanz";
            info.countryCode = "DE";
            info.ccNumber    = "4906759104921149";
            info.ccMonth     = "12";
            info.ccYear      = "2019";
            info.ccCVV       = "999";

            String keywords = "lacoste,track,jacket";
            String color    = "black";
            String size     = "Medium";


            List <String> urlList  = retrieveShopList();
            cartInfo      realInfo = retrieveSpecificUrl(urlList, Categories.All, keywords, true, color, true, size);

            if (realInfo.articleID != "article_sold_out" && realInfo.articleID != "article_not_found")
            {
                if (addToCart(realInfo))
                {
                    // Added to Cart
                    if (checkOut(info))
                    {
                        // Checked out successfully. Order placed.
                    }
                    else
                    {
                        // Error checking out
                    }
                }
                else
                {
                    // Error  adding to cart
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Checks the item finally out. Whole process is over after calling this function.
        /// </summary>
        /// <param name="info">Structure with information about the billing address</param>
        /// <returns>Returns true if order was successful, false if not. (maybe sold out)</returns>
        private static bool checkOut(billingInfo info)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://www.supremenewyork.com/checkout");

            req.Method          = "GET";
            req.CookieContainer = cookies;

            HttpWebResponse res            = (HttpWebResponse)req.GetResponse();
            StreamReader    responseReader = new StreamReader(res.GetResponseStream());
            String          finalRes       = responseReader.ReadToEnd();

            responseReader.Close();

            String authenticity_token = new Regex("<input type=\"hidden\" name=\"authenticity_token\" value=\"(.+?)\" />").Match(finalRes).Groups[1].Value;
            String postString         = generatePostString(info, authenticity_token);

            req             = (HttpWebRequest)WebRequest.Create("https://www.supremenewyork.com/checkout");
            req.Referer     = "https://www.supremenewyork.com/checkout";
            req.Method      = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            req.Headers["Upgrade-Insecure-Requests"] = "1";
            req.UserAgent       = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0";
            req.ContentLength   = postString.Length;
            req.Host            = "www.supremenewyork.com";
            req.CookieContainer = cookies;

            StreamWriter postWriter = new StreamWriter(req.GetRequestStream());

            postWriter.Write(postString);
            postWriter.Close();

            res            = (HttpWebResponse)req.GetResponse();
            responseReader = new StreamReader(res.GetResponseStream());
            finalRes       = responseReader.ReadToEnd();
            responseReader.Close();

            if (finalRes.Contains("successfully"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
        /// <summary>
        /// Helperfunction to generate the final POST-Request to buy the item.
        /// </summary>
        /// <param name="info">Structure with information about the billing address</param>
        /// <param name="authenticity_token">XRSS-Token required by Supreme.</param>
        /// <returns></returns>
        private static String generatePostString(billingInfo info, String authenticity_token)
        {
            StringBuilder postString = new StringBuilder();

            postString.Append("utf8=");
            postString.Append(billingInfo.UTF8);
            postString.Append("&authenticity_token=");
            postString.Append(Uri.EscapeDataString(authenticity_token));
            postString.Append("&order%5Bbilling_name%5D=");
            postString.Append(info.fullname.Replace(" ", "+"));
            postString.Append("&order%5Bemail%5D=");
            postString.Append(info.email.Replace("@", "%40"));
            postString.Append("&order%5Btel%5D=");
            postString.Append(info.telephone.Replace("+", "%2B"));
            postString.Append("&order%5Bbilling_address%5D=");
            postString.Append(info.address_1.Replace(" ", "+"));
            postString.Append("&order%5Bbilling_address_2%5D=");
            postString.Append(info.address_2.Replace(" ", "+"));
            postString.Append("&order%5Bbilling_address_3%5D=");
            postString.Append(info.address_3.Replace(" ", "+"));
            postString.Append("&order%5Bbilling_city%5D=");
            postString.Append(info.city.Replace(" ", "+"));
            postString.Append("&order%5Bbilling_zip%5D=");
            postString.Append(info.zip);
            postString.Append("&order%5Bbilling_country%5D=");
            postString.Append(info.countryCode);
            postString.Append("&same_as_billing_address=1&store_credit_id=");
            postString.Append("&credit_card%5Btype%5D=");
            postString.Append(info.creditcard);
            postString.Append("&credit_card%5Bcnb%5D=");
            postString.Append(info.ccNumber);
            postString.Append("&credit_card%5Bmonth%5D=");
            postString.Append(info.ccMonth);
            postString.Append("&credit_card%5Byear%5D=");
            postString.Append(info.ccYear);
            postString.Append("&credit_card%5Bvval%5D=");
            postString.Append(info.ccCVV);
            postString.Append("&order%5Bterms%5D=0&order%5Bterms%5D=1&hpcvv=");
            postString.Append("&commit=");
            postString.Append(billingInfo.en_commit);

            return(postString.ToString());
        }