protected void Page_Load(object sender, EventArgs e) { kkx = null; if ((Session["pwalletID"] != null) && (Session["pwalletID"].ToString() != "")) { adminID = Session["pwalletID"].ToString(); } else { Response.Redirect(ConfigurationManager.AppSettings["agent_home"]); } if (Session["fullname"] != null) { fullname = Session["fullname"].ToString(); } if (Session["email"] != null) { email = Session["email"].ToString(); } if (Session["mobile"] != null) { mobile = Session["mobile"].ToString(); } if (Session["cust_id"] != null) { cust_id = Session["cust_id"].ToString(); } 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) { Session["vitem_code"] = null; c_twall = ret.getTwalletByTransIDAdminID(txnref, adminID); c_app = ret.getApplicantByID(c_twall.applicantID); isw_fields = ret.getISWtransactionByTransactionID(txnref.Trim()); if (c_twall.xid != null) { Session["c_twall"] = c_twall; lt_fdets = ret.getFee_detailsByTwalletID(c_twall.xid); if (lt_fdets.Count > 0) { Session["lt_fdets"] = lt_fdets; } lt_hwall = ret.getHwalletByTransID(txnref); int num = 1; int num2 = 0; XObjs.Registration c_reg2 = (XObjs.Registration)Session["c_reg"]; vid = c_reg2.xid; foreach (XObjs.Hwallet hwallet in lt_hwall) { XObjs.PaymentReciept item = new XObjs.PaymentReciept(); XObjs.Fee_list _list = new XObjs.Fee_list(); XObjs.Fee_details _details = new XObjs.Fee_details(); _details = ret.getFee_detailsByID(hwallet.fee_detailsID); _list = ret.getFee_listByID(_details.fee_listID); item.sn = num.ToString(); item.item_code = _list.item_code; if (item.item_code == "AA1") { Session["vitem_code"] = "AA1"; } item.item_desc = _list.xdesc; item.init_amt = string.Format("{0:n}", Convert.ToInt32(_details.init_amt)); item.tech_amt = string.Format("{0:n}", Convert.ToInt32(_details.tech_amt)); item.qty = string.Format("{0:n}", 1); int num3 = Convert.ToInt32(_details.init_amt) + Convert.ToInt32(_details.tech_amt); item.tot_amount = string.Format("{0:n}", num3); item.transID = hwallet.transID + "-" + hwallet.fee_detailsID + "-" + hwallet.xid; num2 += num3; Session["amt"] = num2; total_amt = string.Format("{0:n}", num2 + Math.Round(Convert.ToDouble(isw_fields.isw_conv_fee), 2)); Session["total_amt"] = total_amt; lt_pr.Add(item); num++; } } xstring.AppendLine("Transaction reference= " + txnref + " Payment reference= " + payRef + " Switching Bank Reference number= " + retRef + " card No= " + cardNum + " apprAmt= " + apprAmt); inputString = product_id.Trim() + txnref.Trim() + mackey.Trim(); string headerValue = hash_value.GetGetSHA512String(inputString); isr = tx.myRedirect(check_trans_page.Trim() + "?productid=" + product_id.Trim() + "&transactionreference=" + txnref.Trim() + "&amount=" + isw_fields.amount.Trim(), "Hash", headerValue.Trim()); if (((isr.ResponseCode != "") && (isr.ResponseCode != null)) && (isr.ResponseCode == "00")) { 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: " + headerValue + "\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); if (txnref != "") { if (Directory.Exists(Server.MapPath("~/") + "InterLogs/")) { docpath = Server.MapPath("~/") + "InterLogs/" + txnref + ".txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } } else { if (Directory.Exists(Server.MapPath("~/") + "InterLogs/")) { docpath = Server.MapPath("~/") + "InterLogs/xxx.txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } } succ = reg.updateInterSwitchRecords(txnref, payRef, retRef, isr.ResponseCode, isr.TransactionDate, isr.MerchantReference, isr.ResponseDescription,isr.PaymentReference); if (isr.ResponseCode == "00" && (isr.PaymentReference!=null ||isr.PaymentReference!="") ) { xpay_status = "1"; } else { xpay_status = "3"; } reg.updateTwalletPaymentStatus(txnref.Trim(), xpay_status.Trim()); if (succ != 0) { if (Session["vitem_code"] != null) { vitem_code = Convert.ToString(Session["vitem_code"]); Retriever kp = new Retriever(); // int vmax = kp.getMaxSysId(); // vmax=vmax+1; // String vsys_id = "CLD/RA/0" + vmax; Registration dd = new Registration(); // dd.updateRegistrationSysID(vid, vsys_id); dd.updateRegistrationSysID2(vid, "Paid"); XObjs.Registration ds=kp.getRegistrationByID(vid); sendemail(ds); // Session["cust_id"] = vsys_id; if (Session["cust_id"] != null) { cust_id = Session["cust_id"].ToString(); } } if (Session["onlineid"] != null) { Registration dd = new Registration(); string dpp = Convert.ToString(Session["onlineid"]); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(dpp); dd.updateTransID2(dpp.Trim(), txnref.Trim()); dd.updateHwallet2(txnref.Trim(), "Used"); } if (Session["onlineid2"] != null) { Registration dd = new Registration(); string dpp = Convert.ToString(Session["onlineid2"]); dd.updateTransID3(dpp, txnref.Trim()); dd.updateHwallet2(txnref.Trim(), "Used"); } if (Session["onlineid3"] != null) { Registration dd = new Registration(); xname.Value = "Success"; xname2.Value = Convert.ToString(Session["onlineid3"]); vamount.Value = isr.Amount; vtransactionid.Value = isr.MerchantReference; vtype.Value = "Name"; //Registration dd = new Registration(); //string dpp = Convert.ToString(Session["onlineid2"]); //dd.updateTransID3(dpp, txnref.Trim()); dd.updateHwallet2(txnref.Trim(), "Used"); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(xname2.Value); } if (Session["onlineid4"] != null) { Registration dd = new Registration(); xname.Value = "Success"; xname2.Value = Convert.ToString(Session["onlineid4"]); vamount.Value = isr.Amount; vtransactionid.Value = isr.MerchantReference; vtype.Value = "Address"; dd.updateHwallet2(txnref.Trim(), "Used"); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(xname2.Value); //Registration dd = new Registration(); //string dpp = Convert.ToString(Session["onlineid2"]); //dd.updateTransID3(dpp, txnref.Trim()); } if (Session["onlineid5"] != null) { Registration dd = new Registration(); xname.Value = "Success"; xname2.Value = Convert.ToString(Session["onlineid5"]); vamount.Value = isr.Amount; vtransactionid.Value = isr.MerchantReference; vtype.Value = "Agent"; dd.updateHwallet2(txnref.Trim(), "Used"); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(xname2.Value); //Registration dd = new Registration(); //string dpp = Convert.ToString(Session["onlineid2"]); //dd.updateTransID3(dpp, txnref.Trim()); } if (Session["onlineid6"] != null) { Registration dd = new Registration(); xname.Value = "Success"; xname2.Value = Convert.ToString(Session["onlineid6"]); vamount.Value = isr.Amount; vtransactionid.Value = isr.MerchantReference; vtype.Value = "Rectification"; dd.updateHwallet2(txnref.Trim(), "Used"); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(xname2.Value); //Registration dd = new Registration(); //string dpp = Convert.ToString(Session["onlineid2"]); //dd.updateTransID3(dpp, txnref.Trim()); } if (Session["onlineid7"] != null) { Registration dd = new Registration(); xname.Value = "Success"; xname2.Value = Convert.ToString(Session["onlineid7"]); vamount.Value = isr.Amount; vtransactionid.Value = isr.MerchantReference; vtype.Value = "Assignment"; dd.updateHwallet2(txnref.Trim(), "Used"); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(xname2.Value); //Registration dd = new Registration(); //string dpp = Convert.ToString(Session["onlineid2"]); //dd.updateTransID3(dpp, txnref.Trim()); } if (Session["onlineid8"] != null) { Registration dd = new Registration(); xname.Value = "Success"; xname2.Value = Convert.ToString(Session["onlineid8"]); vamount.Value = isr.Amount; vtransactionid.Value = isr.MerchantReference; vtype.Value = "Assignment2"; dd.updateHwallet2(txnref.Trim(), "Used"); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(xname2.Value); //Registration dd = new Registration(); //string dpp = Convert.ToString(Session["onlineid2"]); //dd.updateTransID3(dpp, txnref.Trim()); } if (Session["onlineid9"] != null) { Registration dd = new Registration(); xname.Value = "Success"; xname2.Value = Convert.ToString(Session["onlineid9"]); vamount.Value = isr.Amount; vtransactionid.Value = isr.MerchantReference; vtype.Value = "Renewal"; dd.updateHwallet2(txnref.Trim(), "Used"); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(xname2.Value); //Registration dd = new Registration(); //string dpp = Convert.ToString(Session["onlineid2"]); //dd.updateTransID3(dpp, txnref.Trim()); } if (Session["onlineid10"] != null) { Registration dd = new Registration(); xname.Value = "Success"; xname2.Value = Convert.ToString(Session["onlineid10"]); vamount.Value = isr.Amount; vtransactionid.Value = isr.MerchantReference; vtype.Value = "TradeMarkAmendment"; dd.updateHwallet2(txnref.Trim(), "Used"); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(xname2.Value); //Registration dd = new Registration(); //string dpp = Convert.ToString(Session["onlineid2"]); //dd.updateTransID3(dpp, txnref.Trim()); } if (Session["onlineid12"] != null) { Registration dd = new Registration(); xname.Value = "Success"; xname2.Value = Convert.ToString(Session["onlineid12"]); vamount.Value = isr.Amount; vtransactionid.Value = isr.MerchantReference; vtype.Value = "RegisteredUser"; dd.updateHwallet2(txnref.Trim(), "Used"); Retriever dp = new Retriever(); kkx = dp.getMarkInfo(xname2.Value); //Registration dd = new Registration(); //string dpp = Convert.ToString(Session["onlineid2"]); //dd.updateTransID3(dpp, txnref.Trim()); } sendAlertHtml(); } } else if (((isr.ResponseCode != "") && (isr.ResponseCode != null)) && (isr.ResponseCode != "00")) { 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: " + headerValue + "\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); if (txnref != "") { docpath = Server.MapPath("~/") + "InterLogs/" + txnref + ".txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } else { docpath = Server.MapPath("~/") + "InterLogs/xxx.txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } succ = reg.updateInterSwitchRecords(txnref, payRef, retRef, isr.ResponseCode, isr.TransactionDate, isr.MerchantReference, isr.ResponseDescription,isr.PaymentReference); if (isr.ResponseCode == "00" && (isr.PaymentReference != null || isr.PaymentReference != "")) { xpay_status = "1"; } else { xpay_status = "3"; } reg.updateTwalletPaymentStatus(txnref.Trim(), xpay_status.Trim()); if (succ != 0) { sendUnsuccAlertHtml(); } } else if ((isr.ResponseCode == "") || (isr.ResponseCode == null)) { string str2 = "None"; string str3 = "None"; xstring.AppendLine("Sent Amount: " + isw_fields.amount + "\r\n Product ID: " + product_id + "\r\n Hash: " + headerValue + "\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: " + str2 + "\r\n ResponseDescription: " + str3 + "\r\n Json Page: " + check_trans_page + "\r\n Form Response: " + resp + "\r\n Form Description: " + desc); if (txnref != "") { docpath = Server.MapPath("~/") + "InterLogs/" + txnref + ".txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } else { docpath = Server.MapPath("~/") + "InterLogs/xxx.txt"; succ = x.WriteToFile(xstring.ToString(), docpath); } xpay_status = "3"; reg.updateTwalletPaymentStatus(txnref, xpay_status); if (desc == "") { isr.ResponseDescription = "Transaction Pending"; } else { isr.ResponseDescription = desc; } if (resp == "") { isr.ResponseCode = "XXXX"; } else { isr.ResponseCode = resp; } sendUnsuccAlertHtml(); } } }
protected void Page_Load(object sender, EventArgs e) { if ((Session["pwalletID"] != null) && (Session["pwalletID"].ToString() != "")) { adminID =Session["pwalletID"].ToString(); } else { base.Response.Redirect(ConfigurationManager.AppSettings["agent_home"]); } if (base.IsPostBack) { if (rblOptions.SelectedValue == "isw") { if (Session["xispf"] != null) { xispf = (XObjs.InterSwitchPostFields)Session["xispf"]; if ((Session["AgentType"] != null) && (Session["AgentType"].ToString() != "")) { agentType =Session["AgentType"].ToString(); if (agentType == "Agent") { c_reg = (XObjs.Registration)Session["c_reg"]; xispf.cust_id =c_reg.Sys_ID; Session["cust_id"] =c_reg.Sys_ID; xispf.cust_id_desc = "Portal Agent"; } else { c_sub = (XObjs.Subagent)Session["c_sub"]; xispf.cust_id =c_sub.Sys_ID; Session["cust_id"] =c_sub.Sys_ID; xispf.cust_id_desc = "Portal Sub-Agent"; } } int tw_cnt = 0; Retriever ret = new Retriever(); tw_cnt = ret.getTransIDCnt(xispf.txn_ref.Trim()); // if(tw_cnt==0) // { Retriever dd = new Retriever(); int vcount3 = dd.getCountTrans(xispf.txn_ref.Trim()); if (vcount3 > 0) { return; } addIsw_succ =reg.addInterSwitchRecords(xispf); if (addIsw_succ > 0) { update_twallxgt_succ =reg.updateTwalletXgt(xispf.txn_ref, "xpay_isw",adminID); if (update_twallxgt_succ > 0) { base.Response.Redirect("./payment_detailsx.aspx"); } } // } } else { base.Response.Redirect("../../../A/m_payx.aspx"); } } else if ((rblOptions.SelectedValue == "bank") && (Session["xispf"] != null)) { xispf = (XObjs.InterSwitchPostFields)Session["xispf"]; update_twallxgt_succ =reg.updateTwalletXgtBanker(xispf.txn_ref, "xpay_bk",adminID); if (update_twallxgt_succ > 0) { base.Response.Redirect("../../../A/m_invoice_bank.aspx?tx=" +xispf.txn_ref); } } } }