private static String checkOut(Product product, BillingInformation billingInfo, CreditcardDetails ccInfo) { SupremeRequest sr = new SupremeRequest(new Uri("https://www.supremenewyork.com/checkout"), ref product.getCookieReference()); String checkOutPageSrc = sr.GET(true); String authenticity_token = ExHelper.getAuthenticity_token(checkOutPageSrc); String postString = SupremeRequest.generatePostString(authenticity_token, billingInfo, ccInfo); sr = new SupremeRequest(new Uri("https://www.supremenewyork.com/checkout"), ref product.getCookieReference()); String successPageSrc = sr.POST(postString, true, true, true, "https://www.supremenewyork.com/checkout"); return(successPageSrc); }
private static bool addToCart(Product product) { SupremeRequest sr = new SupremeRequest(new Uri("http://www.supremenewyork.com/shop/" + product.getInnerProduct().getArticleID() + "/add"), ref product.getCookieReference()); String postString = "utf8=" + Constants.UTF8 + "&style=" + product.getInnerProduct().getStyleID() + "&size=" + product.getInnerProduct().getSizeID() + "&commit=" + Constants.en_commit; String tmpRes = sr.POST(postString, true, false, true, product.getInnerProduct().getReferer()); sr = new SupremeRequest(new Uri("http://www.supremenewyork.com/shop/cart"), ref product.getCookieReference()); tmpRes = sr.GET(); if (tmpRes.Contains("1 item")) { return(true); } else { return(false); } }
public void initialize() { int keyLength = _keywords.Length; String tmpSize = ""; List <String> shopList = SupremeRequest.getShopList(); foreach (String s in shopList) { if (_category.Value != Category.All.Value && s.StartsWith(_category.Value) || _category.Value == Category.All.Value) { SupremeRequest sr = new SupremeRequest(new Uri("http://www.supremenewyork.com/shop/" + s), ref _cookiereference); String resString = sr.GET(); int tempCtr = 0; foreach (String k in _keywords) { if (resString.ToLower().Contains(k.ToLower())) { tempCtr++; } } if (tempCtr == keyLength) { if (_colorRelevant) { if (ExHelper.IsRightColor(resString, _color)) { } else { continue; } } if (ExHelper.IsSoldOut(resString) == null) { IsCorrectlyInitialized = false; throw (new ArticleSoldOutException()); } else { if (_sizeRelevant) { if (ExHelper.IsCorrectSize(resString, _size) != null) { tmpSize = ExHelper.IsCorrectSize(resString, _size); } else { continue; } } else { tmpSize = ExHelper.IsCorrectSize(resString, _size); } String tmpStyle = ExHelper.getStyleID(resString); String tmpMatch = ExHelper.IsSoldOut(resString); innerProduct = new Product(); innerProduct._initialize(tmpMatch, tmpStyle, tmpSize, ("http://supremenewyork.com/shop/" + s)); IsCorrectlyInitialized = true; } } else { tempCtr = 0; continue; } } else { } } }