|
@ -1,29 +1,85 @@ |
|
|
using System; |
|
|
|
|
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
|
using Swift.API; |
|
|
|
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Data; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Web; |
|
|
using System.Web; |
|
|
using System.Web.UI; |
|
|
using System.Web.UI; |
|
|
using System.Web.UI.WebControls; |
|
|
using System.Web.UI.WebControls; |
|
|
|
|
|
using UAParser; |
|
|
|
|
|
|
|
|
namespace Swift.web.Payment |
|
|
namespace Swift.web.Payment |
|
|
{ |
|
|
{ |
|
|
public partial class STPaymentCustomerRedirect : System.Web.UI.Page |
|
|
public partial class STPaymentCustomerRedirect : System.Web.UI.Page |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e) |
|
|
protected void Page_Load(object sender, EventArgs e) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (!Page.IsPostBack) |
|
|
|
|
|
{ |
|
|
|
|
|
var cn = GetStatic.ReadQueryString("cn", ""); |
|
|
|
|
|
|
|
|
sitesecuritytimestamp.Value = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
|
|
|
|
var customerid = GetStatic.ReadQueryString("cid", ""); |
|
|
|
|
|
|
|
|
|
|
|
var uniqueId = GetStatic.ReadQueryString("ref", ""); |
|
|
var uniqueId = GetStatic.ReadQueryString("ref", ""); |
|
|
var tranid = GetStatic.ReadQueryString("Id", ""); |
|
|
|
|
|
orderreference.Value = Guid.NewGuid().ToString(); |
|
|
|
|
|
|
|
|
var eid = GetStatic.ReadQueryString("Id", ""); |
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(eid)) |
|
|
|
|
|
{ |
|
|
|
|
|
string uaString = HttpContext.Current.Request.Headers["User-Agent"].ToString(); |
|
|
|
|
|
|
|
|
|
|
|
var uaParser = Parser.GetDefault(); |
|
|
|
|
|
|
|
|
|
|
|
ClientInfo c = uaParser.Parse(uaString); |
|
|
|
|
|
RemittanceLibrary _remit = new RemittanceLibrary(); |
|
|
|
|
|
SwiftLibrary sl = new SwiftLibrary(); |
|
|
|
|
|
var tranid = HttpUtility.UrlDecode(WebUtils.DecryptString(eid)); |
|
|
|
|
|
var controlNo = HttpUtility.UrlDecode(WebUtils.DecryptString(eid)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utility.LogRequest(tranid, "TRUSTPAY", "CustomerRedirect", controlNo, JsonConvert.SerializeObject(c), uniqueId); |
|
|
|
|
|
|
|
|
|
|
|
string sql = "EXEC proc_trust_payment @Flag = 'details',@type='data', @tranid = " + sl.FilterString(tranid) + ""; |
|
|
|
|
|
DataSet ds = _remit.ExecuteDataset(sql); |
|
|
|
|
|
if (ds.Tables == null || ds.Tables.Count <= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
GetStatic.AlertMessage(this, "Data Empty."); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DataTable dt = ds.Tables[0]; |
|
|
|
|
|
if (dt == null || dt.Rows.Count <= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
GetStatic.AlertMessage(this, "Data Empty."); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderreference.Value = Convert.ToString(dt.Rows[0]["ControlNo"]); |
|
|
|
|
|
sitesecuritytimestamp.Value = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
mainamount.Value = Convert.ToString(dt.Rows[0]["camt"]); |
|
|
|
|
|
|
|
|
|
|
|
billingpostcode.Value = customerpostcode.Value = Convert.ToString(dt.Rows[0]["zipcode"]); |
|
|
|
|
|
|
|
|
|
|
|
billingfirstname.Value = Convert.ToString(dt.Rows[0]["firstname"]); |
|
|
|
|
|
billinglastname.Value = Convert.ToString(dt.Rows[0]["lastname1"]); |
|
|
|
|
|
|
|
|
|
|
|
billingstreet.Value = customerstreet.Value = Convert.ToString(dt.Rows[0]["address"]); |
|
|
|
|
|
customertown.Value = billingtown.Value = Convert.ToString(dt.Rows[0]["city"]); |
|
|
|
|
|
|
|
|
|
|
|
billingtelephone.Value = customertelephone.Value = Convert.ToString(dt.Rows[0]["mobile"]); |
|
|
|
|
|
|
|
|
Form.Method = "POST"; |
|
|
Form.Method = "POST"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hash = $"GBP700.00test_subhidauk71992{sitesecuritytimestamp.Value}BEe6nRraqNeUgkpI"; |
|
|
|
|
|
|
|
|
var hash = $"GBP{ mainamount.Value}test_subhidauk71992{sitesecuritytimestamp.Value}BEe6nRraqNeUgkpI"; |
|
|
|
|
|
|
|
|
StringBuilder builder = new StringBuilder(); |
|
|
StringBuilder builder = new StringBuilder(); |
|
|
using (SHA256 sha256Hash = SHA256.Create()) |
|
|
using (SHA256 sha256Hash = SHA256.Create()) |
|
@ -40,7 +96,12 @@ namespace Swift.web.Payment |
|
|
|
|
|
|
|
|
sitesecurity.Value = $"h{builder.ToString()}"; |
|
|
sitesecurity.Value = $"h{builder.ToString()}"; |
|
|
Form.Action = "https://payments.securetrading.net/process/payments/choice"; |
|
|
Form.Action = "https://payments.securetrading.net/process/payments/choice"; |
|
|
GetStatic.CallJSFunction(this, $"CallBackPost('true','{customerid}','{uniqueId}','{tranid}')"); |
|
|
|
|
|
|
|
|
GetStatic.CallJSFunction(this, $"CallBackPost('true')"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|