// GET: Robobank public ActionResult Pay() { RobobankViewModel VM = new RobobankViewModel(); VM.Amount = 50; VM.OrderID = DateTime.Now.Ticks.ToString(); return(View(VM)); }
public ActionResult Pay(RobobankViewModel model) { if (ModelState.IsValid) { string data = String.Format("merchantId={0}", MerchantId) + String.Format("|orderId={0}", model.OrderID) + String.Format("|amount={0}", model.Amount) + String.Format("|customerLanguage={0}", LanguageCode) + String.Format("|keyVersion={0}", SecurityKeyVersion) + String.Format("|currencyCode={0}", CurrencyCode) // + String.Format("|PaymentMeanBrandList={0}", "IDEAL") + String.Format("|normalReturnUrl={0}", "http://www." + Request.Url.Host + "/Robobank/RedirectResponse") + String.Format("|automaticResponseUrl={0}", "http://www." + Request.Url.Host + "/Robobank/RedirectResponse") + String.Format("|transactionReference={0}", model.OrderID + "x" + DateTime.Now.ToString("hhmmss")); // Seal-veld berekenen SHA256 sha256 = SHA256.Create(); byte[] hashValue = sha256.ComputeHash(new UTF8Encoding().GetBytes(data + SecurityKey)); // POST data samenstellen NameValueCollection postData = new NameValueCollection(); postData.Add("Data", data); postData.Add("Seal", ByteArrayToHexString(hashValue)); postData.Add("InterfaceVersion", "HP_1.0"); // Posten van data byte[] response; using (WebClient client = new WebClient()) response = client.UploadValues(PostUrl, postData); TempData["Response"] = Encoding.UTF8.GetString(response); return(RedirectToAction("Confirm", "Robobank")); } return(View(model)); }