public Ipong.Classes.XObjs.InterSwitchResponse getJsonTrasactionsData(string product_id, string transactionreference, string amount, string get_trans_hash) { //inputString = product_id + transactionreference + hash; //Get the hash value // string get_trans_hash = hash_value.GetGetSHA512String(inputString); check_trans_page = ConfigurationManager.AppSettings["pd_get_trans_json_page"]; Ipong.Classes.RemotePost rp = new Ipong.Classes.RemotePost(); rp.Add("productid", product_id); rp.Add("transactionreference", transactionreference); rp.Add("amount", amount); rp.AddHeader("Hash", get_trans_hash); string succ = rp.GetFormResponse(check_trans_page, "GET"); //0.985 isr = js.Deserialize<Ipong.Classes.XObjs.InterSwitchResponse>(succ); return isr; }
public Ipong.Classes.XObjs.InterSwitchResponse myOldRedirect(string url, string headerName, string headerValue) { // Response.Clear(); try { System.Net.WebRequest request = System.Net.WebRequest.Create(url); request.Headers.Add(headerName, headerValue); request.Method = "GET"; // request.Headers. System.Net.WebResponse response = request.GetResponse(); //if (request.Headers["Hash"] != null) //{ // Sess = request.Headers["Hash"].ToString(); //} System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.Default); string content = sr.ReadToEnd(); sr.Close(); isr = js.Deserialize<Ipong.Classes.XObjs.InterSwitchResponse>(content); } catch (Exception ex) { string err = ex.ToString(); } return isr; }
public Ipong.Classes.XObjs.InterSwitchResponse myRedirect(string url, string headerName, string headerValue) { try { HttpWebRequest request = (HttpWebRequest )WebRequest.Create(url); // request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0"; // request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,**;q=0.8"; // request.UnsafeAuthenticatedConnectionSharing = true; request.Headers.Add(headerName, headerValue); request.Method = "GET"; //request.KeepAlive = true; // request.AllowAutoRedirect = true; ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.Default); string content = sr.ReadToEnd(); sr.Close(); isr = js.Deserialize<Ipong.Classes.XObjs.InterSwitchResponse>(content); } catch (Exception ex) { string err = ex.ToString(); return isr; } return isr; }
protected void Page_Load(object sender, EventArgs e) { //if ((Session["pwalletID"] != null) && (Session["pwalletID"].ToString() != "")) //{ this.adminID = Session["pwalletID"].ToString(); } //else //{ base.Response.Redirect("../../../a_login.aspx"); } xstring = new StringBuilder(); product_id = ConfigurationManager.AppSettings["pd_product_id"]; mackey = ConfigurationManager.AppSettings["pd_mackey"]; check_trans_page = ConfigurationManager.AppSettings["pd_get_trans_json_page"]; if ((Request.Form["txnRef"] != null) && (Request.Form["txnRef"] != "")) { txnref = Request.Form["txnRef"].ToString(); Session["transID"] = txnref; } if ((Request.Form["payRef"] != null) && (Request.Form["payRef"] != "")) { payRef = Request.Form["payRef"].ToString(); } if ((Request.Form["retRef"] != null) && (Request.Form["retRef"] != "")) { retRef = Request.Form["retRef"].ToString(); } if ((Request.Form["cardNum"] != null) && (Request.Form["cardNum"] != "")) { cardNum = Request.Form["cardNum"].ToString(); } if ((Request.Form["apprAmt"] != null) && (Request.Form["apprAmt"] != "")) { apprAmt = Request.Form["apprAmt"].ToString(); } if ((Request.Form["resp"] != null) && (Request.Form["resp"] != "")) { resp = Request.Form["resp"].ToString(); } if ((Request.Form["desc"] != null) && (Request.Form["desc"] != "")) { desc = Request.Form["desc"].ToString(); } if (!IsPostBack) { isw_fields = ret.getISWtransactionByTransactionID(txnref); xstring.AppendLine("Transaction reference= " + txnref + " Payment reference= " + payRef + " Switching Bank Reference number= " + retRef + " card No= " + cardNum + " apprAmt= " + apprAmt); inputString = product_id + txnref + mackey; //Get the hash value string get_trans_hash = hash_value.GetGetSHA512String(inputString); isr = tx.myRedirect(check_trans_page + "?productid=" + product_id + "&transactionreference=" + txnref + "&amount=" + isw_fields.amount, "Hash", get_trans_hash); if ((isr.ResponseCode != "") && (isr.ResponseCode != null)) { err_desc = eh.getErrorDesc(isr.ResponseCode); if ((err_desc != "") && (err_desc != null) && (err_desc != "NA")) { isr.ResponseDescription = err_desc; } xstring.AppendLine("Sent Amount: " + isw_fields.amount + "\r\n Product ID: " + product_id + "\r\n Hash: " + get_trans_hash + "\r\n Amount: " + isr.Amount + "\r\n CardNumber: " + isr.CardNumber + "\r\n MerchantReference: " + isr.MerchantReference + "\r\n PaymentReference: " + isr.PaymentReference + "\r\n RetrievalReferenceNumber: " + isr.RetrievalReferenceNumber + "\r\n LeadBankCbnCode: " + isr.LeadBankCbnCode + "\r\n TransactionDate: " + isr.TransactionDate + "\r\n ResponseCode: " + isr.ResponseCode + "\r\n ResponseDescription: " + isr.ResponseDescription + "\r\n Json Page: " + check_trans_page + "\r\n Form Response: " + resp + "\r\n Form Description: " + desc ); //Log the info in a file if (txnref != "") { docpath = base.Server.MapPath("~/") + "InterLogs/" + txnref + ".txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } else { docpath = base.Server.MapPath("~/") + "InterLogs/xxx.txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } //Update the DB Record succ = reg.updateInterSwitchRecords(txnref, payRef, retRef, isr.ResponseCode, isr.TransactionDate, isr.MerchantReference,isr.ResponseDescription); if (isr.ResponseCode == "00") { xpay_status = "1";//Successfull } else { xpay_status = "3";//Error } reg.updateTwalletPaymentStatus(txnref, xpay_status); if (succ != 0) { sendAlert(); } } else { string rc = "None"; string rd = "None"; xstring.AppendLine("Sent Amount: " + isw_fields.amount + "\r\n Product ID: " + product_id + "\r\n Hash: " + get_trans_hash + "\r\n Amount: None\r\n CardNumber: None\r\n MerchantReference: None\r\n PaymentReference: None\r\n RetrievalReferenceNumber: None\r\n LeadBankCbnCode: None\r\n TransactionDate: None\r\n ResponseCode: " + rc + "\r\n ResponseDescription: " + rd + "\r\n Json Page: " + check_trans_page + "\r\n Form Response: " + resp + "\r\n Form Description: " + desc ); //Log the info in a file if (txnref != "") { docpath = base.Server.MapPath("~/") + "InterLogs/" + txnref + ".txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } else { docpath = base.Server.MapPath("~/") + "InterLogs/xxx.txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } xpay_status = "3";//Error reg.updateTwalletPaymentStatus(txnref, xpay_status); //No internet Connection at this time if (desc == ""){isr.ResponseDescription = "Transaction Pending"; } else { isr.ResponseDescription = desc;} if (resp == "") { isr.ResponseCode = "XXXX"; } else { isr.ResponseCode = resp; } sendAlert(); } } }
protected void gvTm_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "TmPayClick") { GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer); int rowindex = rowSelect.RowIndex; string og_transID = e.CommandArgument.ToString(); int succ = 0; isw_fields = ret.getISWtransactionByTransactionID(og_transID); //Get the hash value // string get_trans_hash = hash_value.GetGetSHA512String(inputString); isr = tx.myRedirect(check_trans_page + "?productid=" + isw_fields.product_id + "&transactionreference=" + isw_fields.txn_ref + "&amount=" + isw_fields.amount, "Hash", isw_fields.hash); string xpay_status = ""; succ = reg.updateInterSwitchRecords(isw_fields.txn_ref, isw_fields.pay_ref, isw_fields.ret_ref, isr.ResponseCode, isr.TransactionDate, isr.MerchantReference, isr.ResponseDescription); if ((isr.ResponseCode == "") || (isr.ResponseCode == null)) { xpay_status = "2";//Pending } else if (isr.ResponseCode == "00") { xpay_status = "1";//Successfull } else { xpay_status = "3";//Error } string new_local_date = DateTime.Now.ToString("dd-MMM-yy HH:MM:ss"); reg.updateInterSwitchPostFieldsDate(isw_fields.txn_ref, new_local_date); Response.Redirect("./v_bask_tmp.aspx"); if (succ != 0) { // sendAlert(); } } if (e.CommandName == "TmDeleteClick") { GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer); int rowindex = rowSelect.RowIndex; string og_transID = e.CommandArgument.ToString(); int succ = 0; succ = reg.updateInterSwitchVisibleStatus(og_transID, "0"); Response.Redirect("./v_bask_tmp.aspx"); //if (succ != 0){ sendAlert(); } } if (e.CommandName == "TmDetailsClick") { GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer); int rowindex = rowSelect.RowIndex; string tnxref = e.CommandArgument.ToString(); lt_twall = ret.getTwalletByMemberID(adminID, tnxref, Session["agentType"].ToString()); if (lt_twall.Count > 0) { string pay_status = lt_twall[0].xpay_status; lt_fdets = ret.getFee_detailsByTwalletID(lt_twall[0].xid); Session["transID"] = tnxref; Session["memberID"] = adminID; show_inv = 1; if (pay_status == "0") { pay_status = "PAYMENT UNCOMPLETED!!!"; } else if (pay_status == "1") { pay_status = "PAYMENT SUCCESSFUL!!!"; } else if (pay_status == "2") { pay_status = "PAYMENT PENDING!!!"; } else if (pay_status == "3") { pay_status = "PAYMENT UNSUCCESSFUL!!!"; } } } }
protected void gvTm_RowCommand(object sender, GridViewCommandEventArgs e) { if ((Session["tm_cnt"] != null) && (Session["tm_cnt"].ToString() != "")) { tm_cnt = Convert.ToInt32(Session["tm_cnt"]); } if ((Session["lt_ri"] != null) && (Session["lt_ri"].ToString() != "")) { lt_ri = (List<Classes.XObjs.ReportItem>)Session["lt_ri"]; } gvTm.DataSource = lt_ri; gvTm.DataBind(); if (e.CommandName == "TmPayClick") { GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer); int rowindex = rowSelect.RowIndex; string tnxref = e.CommandArgument.ToString(); xispf = ret.getISWtransactionByTransactionID(tnxref); if ((xispf.xid != null) && (xispf.xid != null)) { Session["xispf"] = xispf; Response.Redirect("../xis/pd/tx/re_payment_details.aspx"); } } if (e.CommandName == "TmReqClick") { string new_local_date = DateTime.Now.ToString("dd-MMM-yy HH:MM:ss"); GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer); int rowindex = rowSelect.RowIndex; string og_transID = e.CommandArgument.ToString(); int succ = 0; isw_fields = ret.getISWtransactionByTransactionID(og_transID); //Get the hash value string inputString = isw_fields.product_id + isw_fields.txn_ref + isw_fields.mackey; string get_trans_hash = hash_value.GetGetSHA512String(inputString); isr = tx.myRedirect(check_trans_page + "?productid=" + isw_fields.product_id + "&transactionreference=" + isw_fields.txn_ref + "&amount=" + isw_fields.amount, "Hash", get_trans_hash); ////////////////////////////////////////////////////////////////////////////////////////// if ((isr.ResponseCode != "") && (isr.ResponseCode != null) && (isr.PaymentReference != "") && (isr.PaymentReference != null) && (isr.ResponseDescription != "") && (isr.ResponseDescription != null) ) { if (isw_fields.txn_ref == null) { isw_fields.txn_ref = ""; }; if (isw_fields.pay_ref == null) { isw_fields.pay_ref = ""; }; if (isw_fields.ret_ref == null) { isw_fields.ret_ref = ""; }; if (isr.ResponseCode == null) { isr.ResponseCode = ""; }; if (isr.TransactionDate == null) { isr.TransactionDate = ""; }; if (isr.MerchantReference == null) { isr.MerchantReference = ""; }; if (isr.ResponseDescription == null) { isr.ResponseDescription = ""; }; xstring.AppendLine("Sent Amount: " + isw_fields.amount + "\r\n Product ID: " + isw_fields.product_id + "\r\n Hash: " + get_trans_hash + "\r\n Amount: " + isr.Amount + "\r\n CardNumber: " + isr.CardNumber + "\r\n MerchantReference: " + isr.MerchantReference + "\r\n PaymentReference: " + isr.PaymentReference + "\r\n RetrievalReferenceNumber: " + isr.RetrievalReferenceNumber + "\r\n LeadBankCbnCode: " + isr.LeadBankCbnCode + "\r\n TransactionDate: " + isr.TransactionDate + "\r\n ResponseCode: " + isr.ResponseCode + "\r\n ResponseDescription: " + isr.ResponseDescription + "\r\n Json Page: " + check_trans_page); //Log the info in a file if (isw_fields.txn_ref != "") { docpath = base.Server.MapPath("~/") + "LiveInterLogs/Ag/" + isw_fields.txn_ref + ".txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } else { docpath = base.Server.MapPath("~/") + "LiveInterLogs/Ag/xxx.txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } if ((isr.ResponseCode == "") || (isr.ResponseCode == null)) { xpay_status = "2";//Pending } else if (isr.ResponseCode == "00") { xpay_status = "1";//Successfull } else { xpay_status = "3";//Error } succ = reg.updateInterSwitchRecords(isw_fields.txn_ref, isw_fields.pay_ref, isw_fields.ret_ref, isr.ResponseCode, isr.TransactionDate, isr.MerchantReference, isr.ResponseDescription); reg.updateTwalletPaymentStatus(isw_fields.txn_ref, xpay_status); reg.updateInterSwitchPostFieldsDate(isw_fields.txn_ref, new_local_date); Response.Redirect("./xreport_payments.aspx"); if (succ != 0) { //sendAlert(); } } else { Response.Redirect("./xreport_payments.aspx"); } } if (e.CommandName == "TmDeleteClick") { GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer); int rowindex = rowSelect.RowIndex; string og_transID = e.CommandArgument.ToString(); int succ = 0; succ = reg.updateInterSwitchVisibleStatus(og_transID, "0"); Response.Redirect("./xreport_payments.aspx"); //if (succ != 0){ sendAlert(); } } if (e.CommandName == "TmDetailsClick") { GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer); int rowindex = rowSelect.RowIndex; string tnxref = e.CommandArgument.ToString(); lt_twall = ret.getTwalletByMemberID(adminID, tnxref, Session["agentType"].ToString()); if (lt_twall.Count > 0) { string pay_status = lt_twall[0].xpay_status; lt_fdets = ret.getFee_detailsByTwalletID(lt_twall[0].xid); Session["transID"] = tnxref; Session["memberID"] = adminID; show_inv = 1; if (pay_status == "0") { pay_status = "PAYMENT UNCOMPLETED!!!"; } else if (pay_status == "1") { pay_status = "PAYMENT SUCCESSFUL!!!"; } else if (pay_status == "2") { pay_status = "PAYMENT PENDING!!!"; } else if (pay_status == "3") { pay_status = "PAYMENT UNSUCCESSFUL!!!"; } } } }