Skip to content

Instantly share code, notes, and snippets.

@razarahil
Last active February 17, 2016 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razarahil/28897e91ca6aed7ce3b3 to your computer and use it in GitHub Desktop.
Save razarahil/28897e91ca6aed7ce3b3 to your computer and use it in GitHub Desktop.
[AllowAnonymous]
public ActionResult Return(FormCollection form=null)
{
try
{
string[] merc_hash_vars_seq;
string merc_hash_string = string.Empty;
string merc_hash = string.Empty;
string order_id = string.Empty;
string hash_seq = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10";
if (form["status"].ToString() == "success")
{
merc_hash_vars_seq = hash_seq.Split('|');
Array.Reverse(merc_hash_vars_seq);
merc_hash_string = ConfigurationManager.AppSettings["SALT"] + "|" + form["status"].ToString();
foreach (string merc_hash_var in merc_hash_vars_seq)
{
merc_hash_string += "|";
merc_hash_string = merc_hash_string + (form[merc_hash_var] != null ? form[merc_hash_var] : "");
}
Response.Write(merc_hash_string);
merc_hash = Generatehash512(merc_hash_string).ToLower();
//if (merc_hash != form["hash"])
//{
//    Response.Write("Hash value did not matched");
//}
//else
//{
order_id = Request.Form["txnid"];
//ViewData["Message"] = "Status is successful. Hash value is matched";
//Response.Write("<br/>Hash value matched");
//Hash value did not matched
//    }
}
else
{
tokenContext.setPaymentMessageSession("Payment Fails! Order Pending to save.");
//Response.Write("Hash value did not matched");
// osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment' , 'SSL', null, null,true));
}
}
catch (Exception ex)
{
ViewData["PaymentMessage"] = "Payment Fails! Order Pending to save.";
//Response.Write("<span style='color:red'>" + ex.Message + "</span>");
}
return RedirectToAction("PrescriptionDashBoard");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment