public static string Compute3DHash(Sale3DOOSPayRequest request, Settings3D settings3D) { SHA1 sha = new SHA1CryptoServiceProvider(); var temp = settings3D.Password + request.terminalid.PadLeft(9, '0'); var hashedPassword = sha.ComputeHash(Encoding.UTF8.GetBytes(temp)); StringBuilder sb = new StringBuilder(); for (int i = 0; i < hashedPassword.Length; i++) { sb.Append(hashedPassword[i].ToString("X2")); } temp = request.terminalid + request.orderid + request.txnamount + request.successurl + request.errorurl + request.txntype + request.txninstallmentcount + request.storekey + sb.ToString(); var hashData = sha.ComputeHash(Encoding.UTF8.GetBytes(temp)); sb = new StringBuilder(); for (int i = 0; i < hashData.Length; i++) { sb.Append(hashData[i].ToString("X2")); } return(sb.ToString()); }
public static string Execute(Sale3DOOSPayRequest request, Settings3D settings3D) { request.secure3dhash = Compute3DHash(request, settings3D); NameValueCollection Data = new NameValueCollection(); Data.Add("mode", request.mode); Data.Add("secure3dsecuritylevel", request.secure3dsecuritylevel); Data.Add("apiversion", request.apiversion); Data.Add("terminalprovuserid", request.terminalprovuserid); Data.Add("terminaluserid", request.terminaluserid); Data.Add("terminalmerchantid", request.terminalmerchantid); Data.Add("terminalid", request.terminalid); Data.Add("txntype", request.txntype); Data.Add("txnamount", request.txnamount); Data.Add("txncurrencycode", request.txncurrencycode); Data.Add("txninstallmentcount", request.txninstallmentcount); Data.Add("orderid", request.orderid); Data.Add("successurl", request.successurl); Data.Add("errorurl", request.errorurl); Data.Add("customeremailaddress", request.customeremailaddress); Data.Add("customeripaddress", request.customeripaddress); Data.Add("secure3dhash", request.secure3dhash); Data.Add("lang", request.lang); Data.Add("refreshtime", request.refreshtime); Data.Add("txntimestamp", request.txntimestamp); Data.Add("companyname", request.companyname); return(Helper.PreparePOSTForm(settings3D.BaseUrl, Data)); }