Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Page.Request.RequestType.ToString() != "POST")
        //{
        //    Response.Redirect("/index.htm");
        //    return;
        //}
        if (Request.QueryString["action"] != null)
        {
            action = Request.QueryString["action"].Trim();
        }
        TransType = Request.Form["TransType"]; //交易类型

        MerId = Request.Form["MerId"];         //商户号

        OrdId = Request.Form["OrdId"];         //订单号

        MerDate = Request.Form["MerDate"];     //商户日期

        TransAmt = Request.Form["TransAmt"];   //交易金额

        MerPriv = Request.Form["MerPriv"];     //商户私有域

        GateId = Request.Form["GateId"];       //网关号

        TransStat = Request.Form["TransStat"]; //交易状态

        SysDate = Request.Form["SysDate"];     //系统日期

        SysSeqId = Request.Form["SysSeqId"];   //系统流水号

        lblPnr.Text   = OrdId;
        lblSys.Text   = SysSeqId;
        lblPoint.Text = TransAmt;                                                        //实际支付金额
        ChkValue      = Request.Form["ChkValue"];                                        //签名值
        PgKeyFile     = System.Configuration.ConfigurationSettings.AppSettings["pnrPK"]; //公钥文件名
        CHINAPNRLib.NetpayClientClass ThisOrder = new CHINAPNRLib.NetpayClientClass();
        ret       = ThisOrder.VeriSignOrder0(MerId, PgKeyFile, OrdId, TransAmt, MerDate, TransType, TransStat, GateId, MerPriv, SysDate, SysSeqId, ChkValue);
        loginname = Page.User.Identity.Name;
        bool cz_success = OnlineStrike.isSuccess(OrdId);//该订单是否充值成功

        if (!Page.IsPostBack)
        {
            if (ret == "0")//本次调用成功
            {
                if (TransStat == "S")
                {
                    if (!cz_success)//订单是否被充值成功
                    {
                        bool b = dal.StrikeSuccess(OrdId, "pnr", SysSeqId, loginname);
                    }
                }
            }
            else
            {
                //Response.Write("验证失败");
            }
        }
    }
Esempio n. 2
0
    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.StrikeOrder dal = new Tz888.BLL.StrikeOrder();
                    bool b = dal.StrikeSuccess(lab_OrderNo.Text.ToString().Trim(), "alipay", resArr[9], loginname);
                }

                else
                {
                    sb.Append("<br>失败原因:" + resArr[11]);
                    Response.Write(sb.ToString());
                }
                Response.Write(sb.ToString());
            }
            catch (Exception) { }
        }
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.User.Identity.Name == null || Page.User.Identity.Name.Trim() == "")
        {
            Response.Redirect("../Login.aspx");
        }
        string loginname = Page.User.Identity.Name;

        string             key        = OnlineStrike.getTenKey();        //密钥
        PayResponseHandler resHandler = new PayResponseHandler(Context); //创建PayResponseHandler实例

        resHandler.setKey(key);

        if (resHandler.isTenpaySign())                                         //判断签名
        {
            string transaction_id = resHandler.getParameter("transaction_id"); //交易单号
            string total_fee      = resHandler.getParameter("total_fee");      //金额金额,以分为单位
            total_fee = Convert.ToString(Convert.ToInt32(total_fee) / 100);
            string pay_result = resHandler.getParameter("pay_result");         //支付结果
            string orderNo    = transaction_id.Substring(17, 10).Trim();

            lab_OrderNo.Text = orderNo;
            lab_Point.Text   = total_fee.Trim();
            lab_TenNo.Text   = transaction_id.Trim();

            if ("0".Equals(pay_result))
            {
                //开始处理业务
                Tz888.BLL.StrikeOrder dal = new Tz888.BLL.StrikeOrder();
                bool b = dal.StrikeSuccess(orderNo, "tenpay", transaction_id, loginname);

                //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面.
                resHandler.doShow("http://member.topfo.com/PayManage/show.aspx");
            }
            else
            {
                Response.Write("支付失败");         //当做不成功处理
            }
        }
        else
        {
            Response.Write("认证签名失败");
            //string debugInfo = resHandler.getDebugInfo();
            //Response.Write("<br/>debugInfo:" + debugInfo);
        }
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        wt("接受参数");
        try
        {
            string icpData = new SOFTFAMILYLib.PayClass().Decode(Request.Params["Data"]);
            wt(icpData);
            if (icpData.Length > 8)
            {
                //Get the parameters from a string
                pCode       = icpData.Substring(0, 8);    //产品编号
                dateTime    = icpData.Substring(8, 14);
                caller_id   = icpData.Substring(22, 16);  //付费电话号码
                loginname   = icpData.Substring(38, 20);  //充值帐户
                charge      = icpData.Substring(58, 9);   //金额
                demand_data = icpData.Substring(67, 40);  //订单号
                index_no    = icpData.Substring(107, 16); //eBilling服务器认证的付费序号
                string str        = icpData.Substring(23 - 1, 16) + icpData.Substring(59 - 1, 9) + icpData.Substring(108 - 1, 16);
                bool   cz_success = OnlineStrike.isSuccess(demand_data);
                if (!cz_success)//
                {
                    //开始充值
                    bool b = dal.StrikeSuccess(demand_data, "ebilling", index_no, loginname);
                    Response.Write((new SOFTFAMILYLib.PayClass()).Encode(str));
                    wt((new SOFTFAMILYLib.PayClass()).Encode(str));
                }
            }
            else
            {
                Response.Write("Error!");
            }
        }
        catch (Exception ex)
        {
            //Response.Write(ex.Message);
            wt(ex.Message);
        }

        //写入日志
    }
Esempio n. 5
0
    protected void btnStatus_Click(object sender, EventArgs e)
    {
        string LoginName = bp.LoginName;

        if (txtLoginName.Text.Trim() != "")
        {
            MemberInfoBLL memberBll = new MemberInfoBLL();
            int           result    = memberBll.ValideNameUseable(txtLoginName.Text.Trim());
            if (result > 0)
            {       //不可用
                Tz888.Model.StrikeOrder model = new Tz888.Model.StrikeOrder();
                Tz888.BLL.StrikeOrder   dal   = new Tz888.BLL.StrikeOrder();

                model.PayTypeCode     = "bank";
                model.LoginName       = LoginName;                //充值人
                model.StrikeLoginName = txtLoginName.Text.Trim(); //充值帐户
                model.TotalCount      = Convert.ToDouble(txtMoney.Text.Trim());
                model.BuyType         = "Pre-Paid";               //购买类型
                if (txtBank.Text.ToString().Trim() == "")
                {
                    model.remark = txtLoginName.Text.Trim() + "使用银行汇款充值" + txtMoney.Text.Trim() + "元" + " 操作人 " + LoginName;    //备注
                }
                else
                {
                    model.remark = txtBank.Text.ToString().Trim();
                }
                model.OperationMan = LoginName;

                int orderno = dal.CreateStrikeOrder(model);
                if (orderno > 0)
                {
                    Tz888.BLL.StrikeOrder dall = new Tz888.BLL.StrikeOrder();
                    bool b = dall.StrikeSuccess(Convert.ToString(orderno), "bank", "", LoginName);
                    if (b)
                    {
                        Tz888.BLL.Order.BusStrikeRecBLL    RecBLL   = new Tz888.BLL.Order.BusStrikeRecBLL();
                        Tz888.Model.Orders.BusStrikeRecTab BusModel = new Tz888.Model.Orders.BusStrikeRecTab();
                        BusModel.CardNo     = Convert.ToInt64(orderno);
                        BusModel.ChangeBy   = LoginName;
                        BusModel.ChangeTime = System.DateTime.Now;
                        BusModel.Email      = txtEmail.Text.ToString().Trim();
                        BusModel.Tel        = txtTelCountry.Value.ToString().Trim() + txtTelZoneCode.Value.ToString().Trim() + txtTelNumber.Value.ToString().Trim();
                        BusModel.PointCount = Convert.ToDecimal(txtMoney.Text.ToString().Trim());
                        if (txtBank.Text.ToString().Trim() == "")
                        {
                            model.remark = txtLoginName.Text.Trim() + "使用银行汇款充值" + txtMoney.Text.Trim() + "元" + " 操作人 " + LoginName;    //备注
                        }
                        else
                        {
                            model.remark = txtBank.Text.ToString().Trim();
                        }
                        BusModel.StrikeType = "bank";
                        BusModel.Mobile     = txtMobile.Value.ToString().Trim();
                        BusModel.LoginName  = txtLoginName.Text.ToString().Trim();
                        BusModel.Free       = Convert.ToInt32(sType.Value.Trim());
                        int num = RecBLL.Add(BusModel);
                        if (num > 0)
                        {
                            Tz888.Common.MessageBox.Show(this.Page, "充值成功!");
                        }
                    }
                }
                else
                {
                    Tz888.Common.MessageBox.Show(this.Page, "订单提交失败!请重试!");
                }
            }
            else
            {
                Tz888.Common.MessageBox.Show(this.Page, "充值帐号不正确请重新输入!");
            }
        }

        else
        {
            Tz888.Common.MessageBox.Show(this.Page, "帐号不为空或者帐号不正确!");
            return;
        }
    }
Esempio n. 6
0
 protected void Button2_Click1(object sender, EventArgs e)
 {
     Tz888.BLL.StrikeOrder dal = new Tz888.BLL.StrikeOrder();
     bool b = dal.StrikeSuccess("1000000338", "pnr", "2005", "huanglelou");
 }
    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.StrikeOrder dal = new Tz888.BLL.StrikeOrder();
            bool b = 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, "交易失败!");
        }
    }
Esempio n. 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Page.Request.RequestType.ToString() != "POST")
        //{
        //    Response.Redirect("/index.htm");
        //    return;
        //}
        if (Request.QueryString["action"] != null)
        {
            action = Request.QueryString["action"].Trim();
        }
        TransType = Request.Form["TransType"]; //交易类型

        MerId = Request.Form["MerId"];         //商户号


        OrdId = Request.Form["OrdId"];//订单号


        MerDate = Request.Form["MerDate"];   //商户日期

        TransAmt = Request.Form["TransAmt"]; //交易金额

        MerPriv = Request.Form["MerPriv"];   //商户私有域


        GateId = Request.Form["GateId"];//网关号


        TransStat = Request.Form["TransStat"];//交易状态


        SysDate = Request.Form["SysDate"];   //系统日期

        SysSeqId = Request.Form["SysSeqId"]; //系统流水号


        //lblPnr.Text = OrdId;
        //lblSys.Text = SysSeqId;
        //lblPayPoint.Text = TransAmt;//实际支付金额
        //lblPoint.Text = tzWeb.pay.comm.getOrderPoint(Convert.ToInt64(OrdId));//需要支付的点数

        ChkValue = Request.Form["ChkValue"];                                         //签名值

        PgKeyFile = System.Configuration.ConfigurationSettings.AppSettings["pnrPK"]; //公钥文件名

        CHINAPNRLib.NetpayClientClass ThisOrder = new CHINAPNRLib.NetpayClientClass();
        ret = ThisOrder.VeriSignOrder0(MerId, PgKeyFile, OrdId, TransAmt, MerDate, TransType, TransStat, GateId, MerPriv, SysDate, SysSeqId, ChkValue);
        //loginname = tzWeb.LoginInfo.GetLoginUserName(0);
        bool cs_success = OnlineStrike.isSuccess(OrdId);//该订单是否充值成功

        if (!Page.IsPostBack)
        {
            if (ret == "0")//本次调用成功
            {
                if (TransStat == "S")
                {
                    if (!cs_success)//
                    {
                        //开始充值

                        //bool b = dal.StrikeSuccess(OrdId, "huanglelou");
                        bool b = dal.StrikeSuccess(OrdId, "pnr", SysSeqId, Page.User.Identity.Name);
                        if (b)
                        {
                            Response.Write("RECV_ORD_ID" + OrdId);
                        }
                        else
                        {
                            Response.Write("充值未成功,请联系我们的客服!");
                        }
                    }
                }
            }
            else
            {
                Response.Write("验证失败");
            }
        }
    }
    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.StrikeOrder dal = new Tz888.BLL.StrikeOrder();
            bool b = dal.StrikeSuccess(orderNo, "alipay", transaction_id, loginname);
        }
    }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Page.Request.RequestType.ToString() != "POST")
        //{
        //    Response.Redirect("/index.htm");//
        //    return;

        //}
        bussinessid   = Request.Params["bussinessid"];                                     //商户ID
        orderid       = Request.Params["orderid"];                                         //订单号
        cardsn        = Request.Params["cardsn"];                                          //用户的充值卡序列号
        truemoney     = Request.Params["true_money"];                                      //充值金额
        creattime     = Request.Params["creattime"];                                       //'订单日期 不少于21位
        sucflag       = Request.Params["suc_flag"];                                        //是否成功 1成功 0失败
        userid        = Request.Params["userid"];                                          //用户id
        username      = Request.Params["username"];                                        //姓名
        email         = Request.Params["email"];                                           //邮件
        tel           = Request.Params["tel"];                                             //电话
        post          = Request.Params["post"];                                            //邮编
        address       = Request.Params["address"];                                         //地主
        note          = Request.Params["note"];                                            //留言
        verifymd5     = Request.Params["verifymd5"];                                       //返回的加密字段
        digitalstr    = Request.Params["digitalstr"];                                      //返回的签名
        mybussinessid = "945104";                                                          //
        md5Key        = "tz888";                                                           //商户通过神州行管理平台设置的MD5密钥
        certFile      = System.Configuration.ConfigurationSettings.AppSettings["szxcert"]; //神州行证书文件
        string myverifymd5 = GetKey(bussinessid, orderid, sucflag, truemoney, md5Key);     //返回验证
        bool   cz_success  = OnlineStrike.isSuccess(orderid);                              //该订单是否充值成功

        lblPnr.Text   = orderid;
        lblSys.Text   = cardsn;
        lblPoint.Text = truemoney;//实际支付金额
        string loginname = Page.User.Identity.Name;

        if (bussinessid == mybussinessid)
        {
            SIGN32Lib.SignVerifyClass sign32 = new SIGN32Lib.SignVerifyClass();
            bool b = sign32.Verify(certFile, verifymd5, digitalstr);//证书  MD5验证码 二级签名数据
            if (verifymd5 == myverifymd5)
            {
                if (b)//数字验证通过 POST 方式访问(神州行支付网站订单交易结果)
                {
                    //int money=Convert.ToInt32(truemoney)*100+0.5/100;
                    if (sucflag == "1" && Convert.ToInt32(truemoney) > 0) //交易成功
                    {
                        if (!cz_success)                                  //
                        {
                            bool ResultFlag = dal.StrikeSuccess(orderid, "szx", cardsn, loginname);
                            if (!ResultFlag)
                            {
                                Response.AddHeader("Data-Received", "1");//添加headed
                            }
                            else //订单更新失败 继续发送返回结果
                            {
                                Response.AddHeader("Data-Received", "0");
                            }
                        }
                    }
                    else//交易失败
                    {
                        //Response.Write("支付失败");
                    }
                }
            }
            else
            {
                //Response.Write("二级签名验证错误");
            }
        }
        else
        {
            //Response.Write("无效的参数");
        }
        //写入日志
    }