-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponseHandling.aspx.cs
More file actions
97 lines (70 loc) · 2.63 KB
/
ResponseHandling.aspx.cs
File metadata and controls
97 lines (70 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Security.Cryptography;
using System.Text;
public partial class ResponseHandling : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
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 (Request.Form["status"]=="success")
{
merc_hash_vars_seq = hash_seq.Split('|');
Array.Reverse(merc_hash_vars_seq);
merc_hash_string = ConfigurationManager.AppSettings["SALT"] + "|" + Request.Form["status"];
foreach (string merc_hash_var in merc_hash_vars_seq)
{
merc_hash_string += "|";
merc_hash_string = merc_hash_string + (Request.Form[merc_hash_var]!=null ? Request.Form[merc_hash_var] : "");
}
merc_hash = Generatehash512(merc_hash_string).ToLower();
if (merc_hash!=Request.Form["hash"])
{
Response.Write("Hash value did not matched");
}
else
{
order_id = Request.Form["txnid"];
Response.Write("value matched");
//Hash value did not matched
}
}
else
{
Response.Write("Hash value did not matched");
// osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment' , 'SSL', null, null,true));
}
}
catch( Exception ex)
{
Response.Write("<span style='color:red'>" + ex.Message + "</span>");
}
}
public string Generatehash512(string text)
{
byte[] message = Encoding.UTF8.GetBytes(text);
UnicodeEncoding UE = new UnicodeEncoding();
byte[] hashValue;
SHA512Managed hashString = new SHA512Managed();
string hex = "";
hashValue = hashString.ComputeHash(message);
foreach (byte x in hashValue)
{
hex += String.Format("{0:x2}", x);
}
return hex;
}
}