Пример #1
0
    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) { }
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string loginname = Page.User.Identity.Name;
            string dict      = Request.QueryString["dict"].ToString().Trim();  //获取有效期
            string price     = Request.QueryString["price"].ToString().Trim(); //获取价格
            string Valdate   = Request.QueryString["Vdate"].ToString().Trim(); //获取是就个月1代表3个月,2代表6个月,3代表一年
            if (dict != "" || price != "")
            {
                double userpoint = Convert.ToDouble(tzWeb.pay.comm.getUserPoint(loginname)); //用户余额
                #region 生成订单号
                //生成订单 返回订单号
                Tz888.BLL.Pay1.PayOrder dal = new Tz888.BLL.Pay1.PayOrder();
                try
                {
                    int    ErrorID  = 0;
                    string ErrorMsg = "";

                    int orderno = dal.CreateVipInfoOrder(loginname, price, Valdate, ref ErrorID, ref ErrorMsg);  //订单号

                    if (orderno != 0)
                    {
                        decimal orderpoint = (Convert.ToDecimal(price));   //订单金额

                        Response.Redirect("orderBuy_item.aspx?order_no=" + tzWeb.pay.comm.JiaMi(orderno.ToString()) + "&dict=" + dict.ToString() + "&Valdate=" + Valdate.ToString(), false);
                    }
                    else
                    {
                        Tz888.Common.Common.ShowMessage(this.Page, "出现异常请稍后再试!", "VipManage.aspx");
                    }
                }
                catch (Exception)
                {
                    Tz888.Common.Common.ShowMessage(this.Page, "出现异常请稍后再试!", "VipManage.aspx");
                }


                #endregion
            }
            else
            {
                Tz888.Common.Common.ShowMessage(this.Page, "出现异常请稍后再试!", "VipManage.aspx");
            }
        }
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            infoID = Request.QueryString["InfoID"];
            string loginname          = Page.User.Identity.Name; //tzWeb.LoginInfo.GetLoginUserName(0);
            int    num                = bbl.CheckDate(Convert.ToInt64(infoID), "1");
            Tz888.BLL.GetDataList bll = new Tz888.BLL.GetDataList();
            dt = bll.GetList("MainInfoTab", "HtmlFile", "InfoID", 1, 1, 0, 1, "InfoId=" + infoID);
            if (num == 1)
            {
                string Money = bbl.OrderByMoney(Convert.ToInt64(infoID), loginname);
                if (Money == "")
                {
                    double userpoint = Convert.ToDouble(tzWeb.pay.comm.getUserPoint(loginname));  //用户余额
                    #region 生成订单号
                    if (infoID != "" && infoID != null)
                    {
                        //生成订单 返回订单号
                        Tz888.BLL.Pay1.PayOrder dal = new Tz888.BLL.Pay1.PayOrder();
                        try
                        {
                            int    ErrorID  = 0;
                            string ErrorMsg = "";

                            int orderno = dal.CreateInfoOrder(Convert.ToInt64(infoID), loginname, ref ErrorID, ref ErrorMsg);  //订单号

                            if (orderno != 0)
                            {
                                AdSystem.Logic loc = new AdSystem.Logic();
                                loc.AdOrder_Add(Convert.ToInt64(orderno));



                                double orderpoint = Convert.ToDouble(tzWeb.pay.comm.getOrderPoint(Convert.ToInt64(orderno)));   //订单金额

                                Response.Redirect("orderBuy_item.aspx?order_no=" + tzWeb.pay.comm.JiaMi(orderno.ToString()) + "&user_on?=" + userpoint.ToString(), false);
                            }
                            else
                            {
                                Tz888.Common.Common.ShowMessage(this.Page, "此信息已不需要付费!", "trade_info_wait.aspx");
                            }
                        }
                        catch
                        {
                            Tz888.Common.Common.ShowMessage(this.Page, "此信息已不需要付费!", "trade_info_wait.aspx");
                        }
                    }
                    #endregion
                }
                else
                {
                    Tz888.Common.Common.ShowMessage(this.Page, "此信息已经购买!", "trade_info_wait.aspx");
                }
            }
            else
            {
                Tz888.Common.Common.ShowMessage(this.Page, "此信息已经过期!", "trade_info_wait.aspx");
            }
        }
    }
Пример #5
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        string ValliDate = Request.QueryString["Validate"].ToString().Trim();
        string vadate    = Request.QueryString["vadate"].ToString().Trim();

        if (ValliDate != "")
        {
            string strLoginName = Page.User.Identity.Name;
            string strPassword  = txtPwd.Value.Trim();
            //判断支付密码
            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.VipaccountPaySuccess(orderNo, strLoginName, lblorderby_no.Text.ToString().Trim(), lblUser_no.Text.ToString().Trim(), ValliDate, vadate.ToString().Trim());
                    if (b)
                    {
                        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.VipaccountPaySuccess(orderNo, strLoginName, lblorderby_no.Text.ToString().Trim(), lblUser_no.Text.ToString().Trim(), ValliDate, vadate.ToString().Trim());
                    if (b)
                    {
                        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;
                }
            }
        }
        else
        {
            Response.Write("<script>alert('出现异常请稍后再试!');window.location.href='VipManage.aspx';</script>");
        }
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        /// <summary>
        /// created by sunzhizhi 2006.5.21,[email protected]。
        /// </summary>
        string partner         = "2088001390620672";                 //partner合作伙伴id(必须填写)
        string key             = "kf69mv76m23a9vp34nkz6s16aux29h29"; //partner 的对应交易安全校验码(必须填写)
        string alipayNotifyURL = "https://www.alipay.com/cooperate/gateway.do?";

        alipayNotifyURL = alipayNotifyURL + "service=notify_verify" + "&partner=" + partner + "&notify_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.PayVipSuccess(orderNo, loginname, total_fee);
            //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)
    {
        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) { }
        }
    }
Пример #8
0
    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 + "&notify_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);
        }
    }
 private void Page_Load(object sender, System.EventArgs e)
 {
     //if (tzWeb.LoginInfo.GetLoginUserName(0) == "")
     //{
     //    Response.Redirect(tzWeb.pay.comm.LoginPage + "?ReturnURL=" + Request.Url.ToString());
     //    return;
     //}
     if (Page.User.Identity.Name == null || Page.User.Identity.Name.Trim() == "")
     {
         Response.Redirect("../Login.aspx");
     }
     if (Request.QueryString["pay_type"] != null)
     {
         pay_type = Request.QueryString["pay_type"].Trim();
     }
     if (Request.QueryString["smscount"] != null)
     {
         smscount = Convert.ToInt32(Request.QueryString["smscount"]);
     }
     if (Request.QueryString["price"] != null)
     {
         price = Convert.ToInt32(Request.QueryString["price"]);
     }
     if (Request.QueryString["Id"] != null)
     {
         sId = Convert.ToInt32(Request.QueryString["Id"]);
     }
     if (!IsPostBack)
     {
         //smscount = 2;
         //price = 2;
         //sId = 58;
         //string loginname = tzWeb.LoginInfo.GetLoginUserName(0);
         string loginname = Page.User.Identity.Name;
         //loginname = "hellocindy";
         double userpoint = Convert.ToDouble(tzWeb.pay.comm.getUserPoint(loginname));
         if (loginname != "")
         {
             //生成订单 返回订单号
             Tz888.BLL.Pay1.PayOrder dal = new Tz888.BLL.Pay1.PayOrder();
             try
             {
                 int    ErrorID  = 0;
                 string ErrorMsg = "";
                 int    orderno  = dal.CreatePromotionOrder1(loginname, smscount, sId, price, ref ErrorID, ref ErrorMsg);
                 if (orderno != 0)
                 {
                     string order      = tzWeb.pay.comm.JiaMi(orderno.ToString());
                     string par        = order.ToString().Replace(" ", "+");
                     string orderNo1   = tzWeb.pay.comm.JieMi(par);
                     double orderpoint = Convert.ToDouble(tzWeb.pay.comm.getOrderPoint(Convert.ToInt64(orderno)));
                     if (userpoint < orderpoint)
                     {
                         Response.Redirect("http://pay.topfo.com/otherpay.aspx?order_no=" + order, true);
                     }
                     else
                     {
                         Response.Redirect("http://pay.topfo.com/account/accountpay.aspx?order_no=" + order, true);
                     }
                 }
                 else
                 {
                     Response.Write("<script>alert('订单创建失败')</script>");
                 }
             }
             catch (Exception ae)
             {
                 Response.Write(ae.ToString());
             }
         }
         else
         {
             Response.Redirect("http://pay.topfo.com/paylogin.aspx");
         }
     }
 }
Пример #10
0
    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         = "2088001390620672";                 //***partner合作伙伴id(必须填写)
        string key             = "kf69mv76m23a9vp34nkz6s16aux29h29"; //**partner 的对应交易安全校验码(必须填写)
        string alipayNotifyURL = "http://notify.alipay.com/trade/notify_query.do?";

        alipayNotifyURL = alipayNotifyURL + "service=notify_verify" + "&partner=" + partner + "&notify_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.PayVipSuccess(orderNo, loginname, total_fee);
            //Tz888.BLL.StrikeOrder dal = new Tz888.BLL.StrikeOrder();
            //bool b = dal.StrikeSuccess(orderNo, "alipay", transaction_id, loginname);
        }
    }