protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string strLoginName = "cn001"; string strPassword = "******"; //判断支付密码 Tz888.BLL.PayPwd payDll = new Tz888.BLL.PayPwd(); Tz888.BLL.Pay paypwdDll = new Tz888.BLL.Pay(); if (tzWeb.pay.comm.isSetPwd(strLoginName))//设置了支付密码 则使用支付验证 { DataTable dtpaypwd = payDll.valiPayPwd(strLoginName, txtPwd.Value.Trim()); if (dtpaypwd.Rows.Count > 0)//支付密码正确 { Tz888.BLL.Pay1.PayOrder bll = new Tz888.BLL.Pay1.PayOrder(); //bool b = bll.accountPaySuccess(orderNo, strLoginName, lblorderby_no.Text.ToString().Trim(), lblUser_no.Text.ToString().Trim()); bool b = true; if (b) { bll.AddLmOrder(orderNo, strLoginName, lblorderby_no.Text.ToString().Trim(), lblUser_no.Text.ToString().Trim()); Response.Write("<script>alert('结算成功!');window.location.href='../Pay/UserMoney.aspx?Money=" + lblorder_no.Text.ToString().Trim() + "&order_no=" + orderNo + "';</script>"); } else { Response.Write("<script>alert('支付失败!');</script>"); } } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('密码不正确点击确认找回密码!');location.href='getPayPwd.aspx'", true); return; } } else//按照登录密码验证 { //判断登录密码 DataTable dtLoginPwd = payDll.valiLoginPwd(strLoginName, txtPwd.Value.Trim()); if (dtLoginPwd.Rows.Count > 0) { Tz888.BLL.Pay1.PayOrder bll = new Tz888.BLL.Pay1.PayOrder(); bool b = bll.accountPaySuccess(orderNo, strLoginName, lblorderby_no.Text.ToString().Trim(), lblUser_no.Text.ToString().Trim()); if (b) { bll.AddLmOrder(orderNo, strLoginName, lblorderby_no.Text.ToString().Trim(), lblUser_no.Text.ToString().Trim()); Response.Write("<script>alert('结算成功!');window.location.href='../Pay/UserMoney.aspx?Money=" + lblorder_no.Text.ToString().Trim() + "&order_no=" + orderNo + "';</script>"); } else { Response.Write("<script>alert('支付失败!');</script>"); } } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('密码错误!您没有设置支付密码,默认为登录密码!')", true); return; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Request.ContentEncoding = System.Text.Encoding.GetEncoding(QuickPayConf.charset); String[] resArr = new String[QuickPayConf.notifyVo.Length]; for (int i = 0; i < QuickPayConf.notifyVo.Length; i++) { resArr[i] = Request.Params[QuickPayConf.notifyVo[i]]; } String signature = Request.Params[QuickPayConf.signature]; String signMethod = Request.Params[QuickPayConf.signMethod]; Response.ContentType = "text/html;charset=" + QuickPayConf.charset; Response.ContentEncoding = System.Text.Encoding.GetEncoding(QuickPayConf.charset); try { bool signatureCheck = new QuickPayUtils().checkSign(resArr, signMethod, signature); StringBuilder sb = new StringBuilder(); //sb.Append("签名是否正确:" + signatureCheck); bool success = resArr[10] == "00"; if (success) { string moneyz = resArr[13]; lab_OrderNo.Text = resArr[8]; //资源交易号 lab_Point.Text = Convert.ToString(Convert.ToInt32(moneyz) / 100); //实际支付金额 lab_aliNo.Text = resArr[9]; //外部交易号 //先充值 后消费 string loginname = this.Page.User.Identity.Name; ////业务逻辑处理 Tz888.BLL.Pay1.PayOrder bbl = new Tz888.BLL.Pay1.PayOrder(); bbl.PaySuccessQuick(resArr[8], loginname, Convert.ToString(Convert.ToInt32(6000) / 100)); bbl.AddLmOrder(resArr[8], loginname, Convert.ToString(Convert.ToInt32(resArr[13]) / 100), "1"); } else { sb.Append("<br>失败原因:" + resArr[11]); Response.Write(sb.ToString()); } Response.Write(sb.ToString()); } catch (Exception) { } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Request.ContentEncoding = System.Text.Encoding.GetEncoding(QuickPayConf.charset); String[] resArr = new String[QuickPayConf.notifyVo.Length]; for (int i = 0; i < QuickPayConf.notifyVo.Length; i++) { resArr[i] = Request.Params[QuickPayConf.notifyVo[i]]; } String signature = Request.Params[QuickPayConf.signature]; String signMethod = Request.Params[QuickPayConf.signMethod]; Response.ContentType = "text/html;charset=" + QuickPayConf.charset; Response.ContentEncoding = System.Text.Encoding.GetEncoding(QuickPayConf.charset); try { bool signatureCheck = new QuickPayUtils().checkSign(resArr, signMethod, signature); StringBuilder sb = new StringBuilder(); //sb.Append("签名是否正确:" + signatureCheck); bool success = resArr[10] == "00"; if (success) { string moneyz = resArr[13]; lab_OrderNo.Text = resArr[8]; //资源交易号 lab_Point.Text = Convert.ToString(Convert.ToInt32(moneyz) / 100); //实际支付金额 lab_aliNo.Text = resArr[9]; //外部交易号 //先充值 后消费 string loginname = this.Page.User.Identity.Name; ////业务逻辑处理 Tz888.BLL.Pay1.PayOrder bbl = new Tz888.BLL.Pay1.PayOrder(); bool quick = bbl.PaySuccessQuick(resArr[8], loginname, Convert.ToString(Convert.ToInt32(resArr[13]) / 100)); if (quick) { bool lm = bbl.AddLmOrder(resArr[8], loginname, Convert.ToString(Convert.ToInt32(resArr[13]) / 100), "1"); Tz888.BLL.Conn dal = new Tz888.BLL.Conn(); DataTable dt = new DataTable(); DataTable dttype = new DataTable(); dt = dal.GetList("ConsumeRecviw", "*", "ID", 1, 1, 0, 1, "OrderNo=" + resArr[8].ToString().Trim() + ""); if (dt.Rows.Count > 0) { lblTitle.Text = "<a target='_blank' href='" + DomainName.SiteDomain() + "/" + dt.Rows[0]["htmlfile"].ToString() + "'>" + dt.Rows[0]["SourceType"].ToString() + "</a>"; lblOrderDate.Text = dt.Rows[0]["ConsumeTime"].ToString(); lblStatus.Text = "已付款"; lblPayType.Text = Tz888.Common.Common.GetPayType(dt.Rows[0]["payType"].ToString()); } } } else { sb.Append("<br>失败原因:" + resArr[11]); Response.Write(sb.ToString()); } Response.Write(sb.ToString()); } catch (Exception) { } } }
protected void Page_Load(object sender, EventArgs e) { /// <summary> /// created by sunzhizhi 2006.5.21,[email protected]。 /// </summary> string partner = "2088501923223124"; //partner合作伙伴id(必须填写) string key = "dxuq3bnfunsdr353bigih0w5jmly0i31"; //partner 的对应交易安全校验码(必须填写) string alipayNotifyURL = "https://www.alipay.com/cooperate/gateway.do?"; alipayNotifyURL = alipayNotifyURL + "service=notify_verify" + "&partner=" + partner + "¬ify_id=" + Request.Form["notify_id"]; //获取支付宝ATN返回结果,true是正确的订单信息,false 是无效的 string responseTxt = Get_Http(alipayNotifyURL, 120000); int i; NameValueCollection coll; coll = Request.Form; //Load Form variables into NameValueCollection variable. String[] requestarr = coll.AllKeys; // Get names of all forms into a string array. string[] Sortedstr = BubbleSort(requestarr); //进行排序; //构造待md5摘要字符串 ; string prestr = ""; for (i = 0; i < Sortedstr.Length; i++) { if (Request.Form[Sortedstr[i]] != "" && Sortedstr[i] != "sign" && Sortedstr[i] != "sign_type") { if (i == Sortedstr.Length - 1) { prestr = prestr + Sortedstr[i] + "=" + Request.Form[Sortedstr[i]]; } else { prestr = prestr + Sortedstr[i] + "=" + Request.Form[Sortedstr[i]] + "&"; } } } prestr = prestr + key; string mysign = GetMD5(prestr); string sign = Request.Form["sign"]; if (mysign == sign && responseTxt == "true") //验证支付发过来的消息,签名是否正确 { //先充值 后消费 string loginname = this.Page.User.Identity.Name; //业务逻辑处理 string orderNo = Request.QueryString["out_trade_no"].ToString().Trim(); string transaction_id = Request.QueryString["trade_no"].Trim(); string total_fee = Request.QueryString["total_fee"].Trim(); Tz888.BLL.Pay1.PayOrder bbl = new Tz888.BLL.Pay1.PayOrder(); bbl.PaySuccess(orderNo, loginname, total_fee); bbl.AddLmOrder(orderNo, loginname, total_fee, "1"); //Tz888.BLL.StrikeOrder dal = new Tz888.BLL.StrikeOrder(); //bool b = dal.StrikeSuccess(orderNo, "alipay", transaction_id, loginname); //bool num = dal.StrikeSuccess(orderNo, "alipay", transaction_id, loginname); //if (b) //{ // Tz888.Common.MessageBox.Show(this.Page, "RECV_ORD_ID_" + orderNo); //} //else //{ // Tz888.Common.MessageBox.Show(this.Page, "充值未成功,请联系我们的客服!"); //} } else { Tz888.Common.MessageBox.Show(this.Page, "交易失败!"); } }
protected void Page_Load(object sender, EventArgs e) { //lblPnr.Text = Request.QueryString["out_trade_no"].Trim(); //资源交易号 //lblSys.Text = Request.QueryString["trade_no"].Trim(); //外部交易号 //lblPayPoint.Text = Request.QueryString["total_fee"].Trim(); //实际支付金额 //lblPoint.Text = bll.getTotalFee(Convert.ToInt64(lblPnr.Text)); //需要支付的点数 lab_OrderNo.Text = Request.QueryString["out_trade_no"].Trim(); //资源交易号 lab_Point.Text = Request.QueryString["total_fee"].Trim(); //实际支付金额 lab_aliNo.Text = Request.QueryString["trade_no"].Trim(); //外部交易号 order_no = Request.QueryString["out_trade_no"].Trim(); /// <summary> /// created by sunzhizhi 2006.5.21,[email protected]。 /// </summary> string partner = "2088501923223124"; //partner合作伙伴id(必须填写) string key = "dxuq3bnfunsdr353bigih0w5jmly0i31"; //partner 的对应交易安全校验码(必须填写) string alipayNotifyURL = "http://notify.alipay.com/trade/notify_query.do?"; alipayNotifyURL = alipayNotifyURL + "service=notify_verify" + "&partner=" + partner + "¬ify_id=" + Request.QueryString["notify_id"]; //获取支付宝ATN返回结果,true是正确的订单信息,false 是无效的 string responseTxt = Get_Http(alipayNotifyURL, 120000); int i; NameValueCollection coll; coll = Request.QueryString; //Load Form variables into NameValueCollection variable String[] requestarr = coll.AllKeys; // Get names of all forms into a string array. //进行排序; string[] Sortedstr = BubbleSort(requestarr); // for (i = 0; i < Sortedstr.Length; i++) // { // Response.Write("Form: " + Sortedstr[i] + "=" + Request.QueryString[Sortedstr[i]] + "<br>"); // } //构造待md5摘要字符串 ; StringBuilder prestr = new StringBuilder(); for (i = 0; i < Sortedstr.Length; i++) { if (Request.Form[Sortedstr[i]] != "" && Sortedstr[i] != "sign" && Sortedstr[i] != "sign_type") { if (i == Sortedstr.Length - 1) { prestr.Append(Sortedstr[i] + "=" + Request.QueryString[Sortedstr[i]]); } else { prestr.Append(Sortedstr[i] + "=" + Request.QueryString[Sortedstr[i]] + "&"); } } } prestr.Append(key); //生成Md5摘要; string mysign = GetMD5(prestr.ToString()); string sign = Request.QueryString["sign"]; if (mysign == sign && responseTxt == "true") //验证支付发过来的消息,签名是否正确 { //先充值 后消费 string loginname = this.Page.User.Identity.Name; //业务逻辑处理 string orderNo = Request.QueryString["out_trade_no"].ToString().Trim(); string transaction_id = Request.QueryString["trade_no"].Trim(); string total_fee = Request.QueryString["total_fee"].Trim();; Tz888.BLL.Pay1.PayOrder bbl = new Tz888.BLL.Pay1.PayOrder(); bbl.PaySuccess(orderNo, loginname, total_fee); bbl.AddLmOrder(orderNo, loginname, total_fee, "1"); Tz888.BLL.Conn dal = new Tz888.BLL.Conn(); DataTable dt = new DataTable(); DataTable dttype = new DataTable(); dt = dal.GetList("ConsumeRecviw", "*", "ID", 1, 1, 0, 1, "OrderNo=" + orderNo.ToString().Trim() + ""); if (dt.Rows.Count > 0) { lblTitle.Text = "<a target='_blank' href='" + DomainName.SiteDomain() + "/" + dt.Rows[0]["htmlfile"].ToString() + "'>" + dt.Rows[0]["SourceType"].ToString() + "</a>"; lblOrderDate.Text = dt.Rows[0]["ConsumeTime"].ToString(); lblStatus.Text = "已付款"; lblPayType.Text = Tz888.Common.Common.GetPayType(dt.Rows[0]["payType"].ToString()); } //Tz888.BLL.StrikeOrder dal = new Tz888.BLL.StrikeOrder(); //bool b = dal.StrikeSuccess(orderNo, "alipay", transaction_id, loginname); } }