Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string billno = Utility.Common.GetStringOfUrl("billno");                 //订单编号

            string mercode = Utility.Common.GetStringOfUrl("mercode");               //商户编号

            string amount = Utility.Common.GetStringOfUrl("amount");                 //订单金额

            string date = Utility.Common.GetStringOfUrl("date");                     //订单日期

            string succ = Utility.Common.GetStringOfUrl("succ");                     //成功标志

            string ipsbillno = Utility.Common.GetStringOfUrl("ipsbillno");           //IPS订单编号

            string currency_Type = Utility.Common.GetStringOfUrl("Currency_type");   //币种

            string signature = Utility.Common.GetStringOfUrl("signature").ToLower(); //MD5签名

            string msg = Utility.Common.GetStringOfUrl("msg");                       //ips返回订单信息

            string attach = Utility.Common.GetStringOfUrl("attach");                 //商户数据包

            string retencodetype = Utility.Common.GetStringOfUrl("retencodetype");   //数字签名方式

            string ipsbanktime = Utility.Common.GetStringOfUrl("ipsbanktime");       //银行返回时间

            string signatureVal = Utility.Common.md5("billno" + billno + "currencytype" + currency_Type + "amount" + amount + "date" + date + "succ" + succ + "ipsbillno" + ipsbillno + "retencodetype" + retencodetype + UiCommon.StringConfig.IPS_Letter).ToLower();

            if (succ == "Y")
            {
                if (signature.Equals(signatureVal.ToLower()))
                {
                    BLL.Member mem = new BLL.Member();
                    bool       fl  = mem.IsPaySuccess(billno);
                    if (fl)
                    {
                        Response.Write("ipscheckok");
                        Response.End();
                    }
                    else
                    {
                        mem.Update3PayOrder((int)(float.Parse(amount)), billno);
                        Response.Write("ipscheckok");
                        Response.End();
                    }
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string billno = Utility.Common.GetStringOfUrl("billno"); //订单编号

              string mercode = Utility.Common.GetStringOfUrl("mercode");//商户编号

              string amount = Utility.Common.GetStringOfUrl("amount");  //订单金额

              string date = Utility.Common.GetStringOfUrl("date"); //订单日期

              string succ = Utility.Common.GetStringOfUrl("succ"); //成功标志

              string ipsbillno = Utility.Common.GetStringOfUrl("ipsbillno"); //IPS订单编号

              string currency_Type = Utility.Common.GetStringOfUrl("Currency_type");  //币种

              string signature = Utility.Common.GetStringOfUrl("signature").ToLower(); //MD5签名

              string msg = Utility.Common.GetStringOfUrl("msg");//ips返回订单信息

              string attach = Utility.Common.GetStringOfUrl("attach");//商户数据包

              string retencodetype = Utility.Common.GetStringOfUrl("retencodetype");//数字签名方式

              string ipsbanktime = Utility.Common.GetStringOfUrl("ipsbanktime");//银行返回时间

              string signatureVal = Utility.Common.md5("billno" + billno + "currencytype" + currency_Type + "amount" + amount + "date" + date + "succ" + succ + "ipsbillno" + ipsbillno + "retencodetype" + retencodetype + UiCommon.StringConfig.IPS_Letter).ToLower();
              if (succ == "Y")
              {
              if (signature.Equals(signatureVal.ToLower()))
              {
                  BLL.Member mem = new BLL.Member();
                  bool fl = mem.IsPaySuccess(billno);
                  if (fl)
                  {
                      Response.Write("ipscheckok");
                      Response.End();
                  }
                  else
                  {
                      mem.Update3PayOrder((int)(float.Parse(amount)), billno);
                      Response.Write("ipscheckok");
                      Response.End();
                  }
              }
              }
        }
Example #3
0
        private void UpdateDB(BuyCallbackResult result)
        {
            if (result == null)
            {
                return;
            }

            //订单流水号
            string Orderid = result.R6_Order;
            //支付金额
            string payAmount = result.R3_Amt;

            BLL.Member member = new BLL.Member();
            //金币充值
            if (result.R8_MP == "0")
            {
                if (!member.IsPaySuccess(Orderid)) //防止重复刷新页面而带来的问题
                {
                    //更新订单信息为完成状态

                    if (Orderid.ToLower().Contains("ka"))
                    {
                        member.Update3PayOrder2((int)(float.Parse(payAmount)), Orderid);
                    }
                    else
                    {
                        member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
                    }
                }
            }
            else//积分充值
            {
                if (!member.IsPaySuccess2(Orderid)) //防止重复刷新页面而带来的问题
                {
                    //更新订单信息为完成状态
                    if (Orderid.ToLower().Contains("ka"))//点卡
                    {
                        member.UpdatePayPointOrder((int)(float.Parse(payAmount)), Orderid, 1);
                    }
                    else
                    {
                        member.UpdatePayPointOrder((int)(float.Parse(payAmount)), Orderid, 0);
                    }
                }
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Pay15173 pays = new Pay15173();

            //商户ID
            pays.Bargainor_id = UiCommon.StringConfig.Pay15173ID;

            //商户密钥
            pays.Key = UiCommon.StringConfig.Pay15173Key;

            string errmsg = string.Empty;

            if (!pays.GetPayValueFromUrl(Request.QueryString, out errmsg))      //返回的参数不合法
            {
                PayResult  = "支付失败,";
                PayResult += errmsg;                                                    //返回参数不合法的错误信息
                return;
            }
            else
            {
                string orderid   = pays.Sp_billno.ToString();
                string payAmount = pays.Total_fee.ToString();
                PayResult = pays.PayResultStr;                                  //返回支付状态
                if (pays.PayResult == Pay15173.PAYERROR)
                {
                    PayResult += pays.PayErrMsg;                                //支付失败时返回的错误信息
                    PayOrderID = orderid;
                    PayMoney   = payAmount + " 元";
                    return;
                }
                if (pays.PayResult == Pay15173.PAYOK)                           //支付成功,更新订单
                {
                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(orderid)) //防止重复刷新页面而带来的问题
                    {
                        //更新订单状态为完成
                        //member.Update3PayOrder( string.Empty, (int)( float.Parse( payAmount ) ), Orderid );
                        member.Update3PayOrder((int)(float.Parse(payAmount)), orderid);
                    }
                    PayResult  = "恭喜您,支付成功!";
                    PayOrderID = orderid;
                    PayMoney   = payAmount + " 元";
                }
            }
        }
Example #5
0
        private void UpdateDB(BuyCallbackResult result)
        {
            if (result == null)
            {
                return;
            }

            //订单流水号
            string Orderid = result.R6_Order;
            //支付金额
            string payAmount = result.R3_Amt;

            BLL.Member member = new BLL.Member();
            if (!member.IsPaySuccess(Orderid)) //防止重复刷新页面而带来的问题
            {
                //更新订单信息为完成状态
                member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
            }
        }
Example #6
0
        private void UpdateDB(BuyCallbackResult result)
        {
            if (result == null)
                return;

            //������ˮ��
            string Orderid = result.R6_Order;
            //֧�����
            string payAmount = result.R3_Amt;

            BLL.Member member = new BLL.Member();
            if (!member.IsPaySuccess(Orderid)) //��ֹ�ظ�ˢ��ҳ�������������
            {
                //���¶�����ϢΪ���״̬
                member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
            }
        }
Example #7
0
        /// <summary>
        /// created by sunzhizhi 2006.5.21,[email protected]。
        /// </summary>


        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// created by sunzhizhi 2006.5.21,[email protected]。
            /// </summary>
            string alipayNotifyURL = UiCommon.StringConfig.AlipayNotifyURL;
            //partner合作伙伴id(必须填写)
            string partner = UiCommon.StringConfig.AlipayPartnerID;
            //partner 的对应交易安全校验码(必须填写)
            string key = UiCommon.StringConfig.AlipayKey;

            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;

            //Load Form variables into NameValueCollection variable.
            coll = Request.Form;

            // Get names of all forms into a string array.
            String[] requestarr = coll.AllKeys;



            //进行排序;
            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")                                                                 //验证支付发过来的消息,签名是否正确
            {
                if (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS") // WAIT_SELLER_SEND_GOODS  判断支付状态(文档中有枚举表可以参考)
                {
                    //更新自己数据库的订单语句,请自己填写一下*************************************


                    //订单流水号
                    string Orderid = Request.Form["out_trade_no"].ToString().Trim();
                    //支付金额
                    string payAmount = Request.Form["total_fee"].ToString().Trim();

                    //Lab_msg.Text = "恭喜您,充值成功!";

                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(Orderid)) //防止重复刷新页面而带来的问题
                    {
                        //更新订单信息为完成状态
                        //member.Update3PayOrder( string.Empty, (int)( float.Parse( payAmount ) ), Orderid );
                        member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
                    }

                    #region [add] jeffery

                    //string allBody = Request.Form["body"].ToString().Trim();
                    //int pos = allBody.IndexOf("!@#");

                    //string ourBody = allBody.Substring(pos + 1);
                    //pos = ourBody.IndexOf("!@#");

                    //string username = ourBody.Substring(0, pos);
                    //int couponNum = Convert.ToInt32(
                    //    ourBody.Substring(pos+1)
                    //    );

                    //string strsql =
                    //            "select UserID from TUsers where UserName=@username";
                    //DataTable dt =
                    //    SqlHelper.ExecuteDataset(CommandType.Text,
                    //    strsql,
                    //    new SqlParameter[]
                    //            {
                    //                new SqlParameter("@username",username)
                    //            }
                    //    ).Tables[0];
                    //int userid = Convert.ToInt32(dt.Rows[0]["UserID"]);

                    //strsql = "insert into TCoupon(UserID,CouponNum,RechargeType,CreateTime)values(@userid,@coupon,@rechargeType,@createTime)";
                    //int num =
                    //    SqlHelper.ExecuteNonQuery
                    //    (CommandType.Text,
                    //    strsql,
                    //    new SqlParameter[]
                    //            {
                    //                new SqlParameter("@userid",userid),
                    //                new SqlParameter("@coupon",couponNum),
                    //                new SqlParameter("@rechargeType",4),
                    //                new SqlParameter("@createTime",DateTime.Now)
                    //            });

                    //if (num != 1)
                    //{
                    //    Response.Write("<script>alert('充值成功,但赠送奖劵失败!')</script>");
                    //}
                    #endregion

                    //返回给支付宝消息,成功
                    Response.Write("success");
                }

                else
                {
                    Response.Write("fail");
                }
            }
        }
Example #8
0
        /// <summary>
        /// created by sunzhizhi 2006.5.21,[email protected]��
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// created by sunzhizhi 2006.5.21,[email protected]��
            /// </summary>
            string alipayNotifyURL = UiCommon.StringConfig.AlipayNotifyURL;
            //partner�������id���������
            string partner = UiCommon.StringConfig.AlipayPartnerID;
            //partner �Ķ�Ӧ���װ�ȫУ���루������д��
            string key = UiCommon.StringConfig.AlipayKey;

            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;
            //Load Form variables into NameValueCollection variable.
            coll = Request.Form;

            // Get names of all forms into a string array.
            String[] requestarr = coll.AllKeys;

            //��������
            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")   //��֤֧������������Ϣ��ǩ���Ƿ���ȷ
            {
                if( Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS" )// WAIT_SELLER_SEND_GOODS  �ж�֧��״̬���ĵ�����ö�ٱ���Բο���
                {
                    //�����Լ����ݿ�Ķ�����䣬���Լ���дһ��*************************************

                    //������ˮ��
                    string Orderid = Request.Form["out_trade_no"].ToString().Trim();
                    //֧�����
                    string payAmount = Request.Form["total_fee"].ToString().Trim();

                    //Lab_msg.Text = "��ϲ������ֵ�ɹ���";

                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(Orderid)) //��ֹ�ظ�ˢ��ҳ�������������
                    {
                        //���¶�����ϢΪ���״̬
                        //member.Update3PayOrder( string.Empty, (int)( float.Parse( payAmount ) ), Orderid );
                        member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
                    }

                    #region [add] jeffery

                    //string allBody = Request.Form["body"].ToString().Trim();
                    //int pos = allBody.IndexOf("!@#");

                    //string ourBody = allBody.Substring(pos + 1);
                    //pos = ourBody.IndexOf("!@#");

                    //string username = ourBody.Substring(0, pos);
                    //int couponNum = Convert.ToInt32(
                    //    ourBody.Substring(pos+1)
                    //    );

                    //string strsql =
                    //            "select UserID from TUsers where UserName=@username";
                    //DataTable dt =
                    //    SqlHelper.ExecuteDataset(CommandType.Text,
                    //    strsql,
                    //    new SqlParameter[]
                    //            {
                    //                new SqlParameter("@username",username)
                    //            }
                    //    ).Tables[0];
                    //int userid = Convert.ToInt32(dt.Rows[0]["UserID"]);

                    //strsql = "insert into TCoupon(UserID,CouponNum,RechargeType,CreateTime)values(@userid,@coupon,@rechargeType,@createTime)";
                    //int num =
                    //    SqlHelper.ExecuteNonQuery
                    //    (CommandType.Text,
                    //    strsql,
                    //    new SqlParameter[]
                    //            {
                    //                new SqlParameter("@userid",userid),
                    //                new SqlParameter("@coupon",couponNum),
                    //                new SqlParameter("@rechargeType",4),
                    //                new SqlParameter("@createTime",DateTime.Now)
                    //            });

                    //if (num != 1)
                    //{
                    //    Response.Write("<script>alert('��ֵ�ɹ��������ͽ���ʧ�ܣ�')</script>");
                    //}
                    #endregion

                    //���ظ�֧������Ϣ���ɹ�
                    Response.Write("success");

                }

                else
                {
                    Response.Write("fail");
                }
            }
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //处理支付结果的页面地址
            string showUrl = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/99bill/PhonePay/Show.aspx";



            //获取神州行网关账户号
            String merchantAcctId = Request["merchantAcctId"].ToString().Trim();

            //设置神州行网关密钥
            ///区分大小写
            String key = UiCommon.StringConfig.JJbill_SZX_Key; //"84YB4FXGFKZ85975";


            //获取网关版本.固定值
            ///本代码版本号固定为v2.0
            String version = Request["version"].ToString().Trim();

            //获取语言种类.固定选择值。
            ///只能选择1、2
            ///1代表中文;2代表英文
            String language = Request["language"].ToString().Trim();

            //获取支付方式
            ///可选择00、41、42、52
            ///00 代表快钱默认支付方式,目前为神州行卡密支付和快钱账户支付;41 代表快钱账户支付;42 代表神州行卡密支付和快钱账户支付;52 代表神州行卡密支付
            String payType = Request["payType"].ToString().Trim();

            //神州行卡序号
            ///如果通过神州行卡直接支付时返回
            String cardNumber = Request["cardNumber"].ToString().Trim();

            //获取神州行卡密码
            ///如果通过神州行卡直接支付时返回
            String cardPwd = Request["cardPwd"].ToString().Trim();

            //获取商户订单号
            String orderId = Request["orderId"].ToString().Trim();


            //获取原始订单金额
            ///订单提交到快钱时的金额,单位为分。
            ///比方2 ,代表0.02元
            String orderAmount = Request["orderAmount"].ToString().Trim();

            //获取快钱交易号
            ///获取该交易在快钱的交易号
            String dealId = Request["dealId"].ToString().Trim();


            //获取商户提交订单时的时间
            ///14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
            ///如:20080101010101
            String orderTime = Request["orderTime"].ToString().Trim();

            //获取扩展字段1
            ///与商户提交订单时的扩展字段1保持一致
            String ext1 = Request["ext1"].ToString().Trim();

            //获取扩展字段2
            ///与商户提交订单时的扩展字段2保持一致
            String ext2 = Request["ext2"].ToString().Trim();

            //获取实际支付金额
            ///单位为分
            ///比方 2 ,代表0.02元
            String payAmount = Request["payAmount"].ToString().Trim();

            //获取快钱处理时间
            String billOrderTime = Request["billOrderTime"].ToString().Trim();

            //获取处理结果
            ///10代表支付成功; 11代表支付失败
            String payResult = Request["payResult"].ToString().Trim();

            //获取签名类型
            ///1代表MD5签名
            ///当前版本固定为1
            String signType = Request["signType"].ToString().Trim();

            //获取加密签名串
            String signMsg = Request["signMsg"].ToString().Trim();



            //生成加密串。必须保持如下顺序。
            String merchantSignMsgVal = "";

            merchantSignMsgVal = appendParam(merchantSignMsgVal, "merchantAcctId", merchantAcctId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "version", version);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "language", language);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payType", payType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "cardNumber", cardNumber);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "cardPwd", cardPwd);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderId", orderId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderAmount", orderAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "dealId", dealId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderTime", orderTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext1", ext1);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext2", ext2);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payAmount", payAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "billOrderTime", billOrderTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payResult", payResult);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "signType", signType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "key", key);

            String merchantSignMsg = GetMD5(merchantSignMsgVal, "utf-8");



            //商家进行数据处理,并跳转会商家显示支付结果的页面
            ///首先进行签名字符串验证
            if (signMsg.ToUpper() == merchantSignMsg.ToUpper())
            {
                switch (payResult)
                {
                case "10":
                    /*
                     * // 商户网站逻辑处理,比方更新订单支付状态为成功
                     * // 特别注意:只有signMsg.ToUpper() == merchantSignMsg.ToUpper(),且payResult=10,才表示支付成功!
                     */

                    //更新订单为完成状态
                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(orderId))
                    {
                        int bMoney = Convert.ToInt32(payAmount) / 100;
                        member.Update3PayOrder(string.Empty, bMoney, orderId);
                    }

                    //报告给快钱处理结果,并提供将要重定向的地址。
                    rtnOk = 1;
                    //rtnUrl = "http://www.yoursite.com/show.aspx?msg=success";
                    rtnUrl = showUrl + "?msg=success";
                    break;

                default:

                    rtnOk = 1;
                    //rtnUrl = "http://www.yoursite.com/show.aspx?msg=false";
                    rtnUrl = showUrl + "?msg=false";
                    break;
                }
            }
            else
            {
                rtnOk  = 1;
                rtnUrl = showUrl + "?msg=error";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// created by sunzhizhi 2006.5.21,[email protected]。
            /// </summary>
            string alipayNotifyURL = UiCommon.StringConfig.AlipayNotifyURL;
            //partner合作伙伴id(必须填写)
            string partner = UiCommon.StringConfig.AlipayPartnerID;
            //partner 的对应交易安全校验码(必须填写)
            string key = UiCommon.StringConfig.AlipayKey;

            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;

            //Load Form variables into NameValueCollection variable.
            coll = Request.Form;

            // Get names of all forms into a string array.
            String[] requestarr = coll.AllKeys;



            //进行排序;
            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")              //验证支付发过来的消息,签名是否正确
            {
                if (Request.Form["trade_status"] == "TRADE_FINISHED") // WAIT_SELLER_SEND_GOODS  判断支付状态(文档中有枚举表可以参考)
                {
                    //更新自己数据库的订单语句,请自己填写一下*************************************


                    //订单流水号
                    string Orderid = Request.Form["out_trade_no"].ToString().Trim();
                    //支付金额
                    string payAmount = Request.Form["total_fee"].ToString().Trim();

                    //Lab_msg.Text = "恭喜您,充值成功!";

                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(Orderid)) //防止重复刷新页面而带来的问题
                    {
                        //更新订单信息为完成状态
                        //member.Update3PayOrder( string.Empty, (int)( float.Parse( payAmount ) ), Orderid );
                        member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
                    }

                    //返回给支付宝消息,成功
                    Response.Write("success");
                }

                else
                {
                    Response.Write("fail");
                }
            }
        }
Example #11
0
        private void UpdateDB(BuyCallbackResult result)
        {
            if (result == null)
                return;

            //订单流水号
            string Orderid = result.R6_Order;
            //支付金额
            string payAmount = result.R3_Amt;

            BLL.Member member = new BLL.Member();
            //金币充值
            if (result.R8_MP == "0")
            {
                if (!member.IsPaySuccess(Orderid)) //防止重复刷新页面而带来的问题
                {
                    //更新订单信息为完成状态

                    if (Orderid.ToLower().Contains("ka"))
                        member.Update3PayOrder2((int)(float.Parse(payAmount)), Orderid);
                    else
                        member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);

                }
            }
            else//积分充值
            {
                if (!member.IsPaySuccess2(Orderid)) //防止重复刷新页面而带来的问题
                {
                    //更新订单信息为完成状态
                    if (Orderid.ToLower().Contains("ka"))//点卡
                    {
                         member.UpdatePayPointOrder((int)(float.Parse(payAmount)), Orderid, 1);
                    }
                    else
                    {
                        member.UpdatePayPointOrder((int)(float.Parse(payAmount)), Orderid, 0);
                    }
                }
            }
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string MerchantID = Request.Params["MerchantID"];//商户号
            string TransID = Request.Params["TransID"];//商户流水号
            string Result = Request.Params["Result"];//支付结果(1:成功,0:失败)
            string resultDesc = Request.Params["resultDesc"];//支付结果描述
            string factMoney = Request.Params["factMoney"];//实际成交金额
            string additionalInfo = Request.Params["additionalInfo"];//订单附加消息
            string SuccTime = Request.Params["SuccTime"];//交易成功时间
            string Md5Sign = Request.Params["Md5Sign"].ToLower();//md5签名

            string _Md5Key = ConfigurationManager.AppSettings["baofoo_key"];
            string _WaitSign = MerchantID + TransID + Result + resultDesc + factMoney + additionalInfo + SuccTime + _Md5Key;
            if (Result == "1")
            {
                if (Md5Sign.ToLower() == Helper.Md5Encrypt(_WaitSign).ToLower())
                {
                    //开始下面的操作,处理订单
                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(TransID)) //防止重复刷新页面而带来的问题
                    {

                        //更新订单信息为完成状态
                        if (TransID.ToLower().Contains("ka"))
                            member.Update3PayOrder2((int)(float.Parse(factMoney)) / 100, TransID);
                        else
                            member.Update3PayOrder((int)(float.Parse(factMoney)) / 100, TransID);
                    }

                    #region [add] jeffery

                    //int pos = additionalInfo.IndexOf("!@#");
                    //string username = additionalInfo.Substring(0, pos);
                    //int couponNum =
                    //    Convert.ToInt32(
                    //    additionalInfo.Substring(pos + 1)
                    //    );
                    //string strsql =
                    //    "select UserID from TUsers where UserName=@username";

                    //DataTable dt =
                    //    SqlHelper.ExecuteDataset(CommandType.Text,
                    //    strsql,
                    //    new SqlParameter[]
                    //            {
                    //                new SqlParameter("@username",username)
                    //            }
                    //    ).Tables[0];

                    //int userid = Convert.ToInt32(dt.Rows[0]["UserID"]);

                    //strsql = "insert into TCoupon(UserID,CouponNum,RechargeType,CreateTime)values(@userid,@coupon,@rechargeType,@createTime)";
                    //int num =
                    //    SqlHelper.ExecuteNonQuery
                    //    (CommandType.Text,
                    //    strsql,
                    //    new SqlParameter[]
                    //            {
                    //                new SqlParameter("@userid",userid),
                    //                new SqlParameter("@coupon",couponNum),
                    //                new SqlParameter("@rechargeType",5),
                    //                new SqlParameter("@createTime",DateTime.Now)
                    //            });

                    //if (num != 1)
                    //{
                    //    Response.Write("<script>alert('充值成功,但赠送奖劵失败!')</script>");
                    //}

                    #endregion

                    //md5校验成功,输出OK
                    Response.Write("OK");
                }
            }
            else
            {
                Response.Write("Md5CheckFail");
            }
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Pay15173 pays = new Pay15173();
            //商户ID
            pays.Bargainor_id = UiCommon.StringConfig.Pay15173ID;

            //商户密钥
            pays.Key = UiCommon.StringConfig.Pay15173Key;

            string errmsg = string.Empty;
            if (!pays.GetPayValueFromUrl(Request.QueryString, out errmsg))	//返回的参数不合法
            {
                PayResult = "支付失败,";
                PayResult += errmsg;							//返回参数不合法的错误信息
                return;
            }
            else
            {
                string orderid = pays.Sp_billno.ToString();
                string payAmount = pays.Total_fee.ToString();
                PayResult = pays.PayResultStr;					//返回支付状态
                if (pays.PayResult == Pay15173.PAYERROR)
                {
                    PayResult += pays.PayErrMsg;				//支付失败时返回的错误信息
                    PayOrderID = orderid;
                    PayMoney = payAmount + " 元";
                    return;
                }
                if (pays.PayResult == Pay15173.PAYOK)				//支付成功,更新订单
                {
                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(orderid)) //防止重复刷新页面而带来的问题
                    {
                        //更新订单状态为完成
                        //member.Update3PayOrder( string.Empty, (int)( float.Parse( payAmount ) ), Orderid );
                        member.Update3PayOrder((int)(float.Parse(payAmount)), orderid);
                    }
                    PayResult = "恭喜您,支付成功!";
                    PayOrderID = orderid;
                    PayMoney = payAmount + " 元";

                }
            }
        }
Example #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //����֧�������ҳ���ַ
            string showUrl = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/99bill/PhonePay/Show.aspx";

            //��ȡ�����������˻���
            String merchantAcctId = Request["merchantAcctId"].ToString().Trim();

            //����������������Կ
            ///���ִ�Сд
            String key = UiCommon.StringConfig.JJbill_SZX_Key; //"84YB4FXGFKZ85975";

            //��ȡ���ذ汾.�̶�ֵ
            ///������汾�Ź̶�Ϊv2.0
            String version = Request["version"].ToString().Trim();

            //��ȡ��������.�̶�ѡ��ֵ��
            ///ֻ��ѡ��1��2
            ///1�������ģ�2����Ӣ��
            String language = Request["language"].ToString().Trim();

            //��ȡ֧����ʽ
            ///��ѡ��00��41��42��52
            ///00 �����ǮĬ��֧����ʽ��ĿǰΪ�����п���֧���Ϳ�Ǯ�˻�֧����41 �����Ǯ�˻�֧����42 ���������п���֧���Ϳ�Ǯ�˻�֧����52 ���������п���֧��
            String payType = Request["payType"].ToString().Trim();

            //��������
            ///���ͨ�������п�ֱ��֧��ʱ����
            String cardNumber = Request["cardNumber"].ToString().Trim();

            //��ȡ�����п�����
            ///���ͨ�������п�ֱ��֧��ʱ����
            String cardPwd = Request["cardPwd"].ToString().Trim();

            //��ȡ�̻�������
            String orderId = Request["orderId"].ToString().Trim();

            //��ȡԭʼ�������
            ///�����ύ����Ǯʱ�Ľ���λΪ�֡�
            ///�ȷ�2 ������0.02Ԫ
            String orderAmount = Request["orderAmount"].ToString().Trim();

            //��ȡ��Ǯ���׺�
            ///��ȡ�ý����ڿ�Ǯ�Ľ��׺�
            String dealId = Request["dealId"].ToString().Trim();

            //��ȡ�̻��ύ����ʱ��ʱ��
            ///14λ���֡���[4λ]��[2λ]��[2λ]ʱ[2λ]��[2λ]��[2λ]
            ///�磺20080101010101
            String orderTime = Request["orderTime"].ToString().Trim();

            //��ȡ��չ�ֶ�1
            ///���̻��ύ����ʱ����չ�ֶ�1����һ��
            String ext1 = Request["ext1"].ToString().Trim();

            //��ȡ��չ�ֶ�2
            ///���̻��ύ����ʱ����չ�ֶ�2����һ��
            String ext2 = Request["ext2"].ToString().Trim();

            //��ȡʵ��֧�����
            ///��λΪ��
            ///�ȷ� 2 ������0.02Ԫ
            String payAmount = Request["payAmount"].ToString().Trim();

            //��ȡ��Ǯ����ʱ��
            String billOrderTime = Request["billOrderTime"].ToString().Trim();

            //��ȡ������
            ///10����֧���ɹ��� 11����֧��ʧ��
            String payResult = Request["payResult"].ToString().Trim();

            //��ȡǩ������
            ///1����MD5ǩ��
            ///��ǰ�汾�̶�Ϊ1
            String signType = Request["signType"].ToString().Trim();

            //��ȡ����ǩ����
            String signMsg = Request["signMsg"].ToString().Trim();

            //���ɼ��ܴ������뱣������˳��
            String merchantSignMsgVal = "";
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "merchantAcctId", merchantAcctId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "version", version);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "language", language);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payType", payType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "cardNumber", cardNumber);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "cardPwd", cardPwd);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderId", orderId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderAmount", orderAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "dealId", dealId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderTime", orderTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext1", ext1);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext2", ext2);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payAmount", payAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "billOrderTime", billOrderTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payResult", payResult);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "signType", signType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "key", key);

            String merchantSignMsg = GetMD5(merchantSignMsgVal, "utf-8");

            //�̼ҽ������ݴ��������ת���̼���ʾ֧�������ҳ��
            ///���Ƚ���ǩ���ַ�����֤
            if (signMsg.ToUpper() == merchantSignMsg.ToUpper())
            {

                switch (payResult)
                {

                    case "10":
                        /*
                         // �̻���վ�߼�������ȷ����¶���֧��״̬Ϊ�ɹ�
                        // �ر�ע�⣺ֻ��signMsg.ToUpper() == merchantSignMsg.ToUpper()����payResult=10���ű�ʾ֧���ɹ���
                        */

                        //���¶���Ϊ���״̬
                        BLL.Member member = new BLL.Member();
                        if (!member.IsPaySuccess(orderId))
                        {
                            int bMoney = Convert.ToInt32(payAmount) / 100;
                            member.Update3PayOrder(string.Empty, bMoney, orderId);
                        }

                        //�������Ǯ�����������ṩ��Ҫ�ض���ĵ�ַ��
                        rtnOk = 1;
                        //rtnUrl = "http://www.yoursite.com/show.aspx?msg=success";
                        rtnUrl = showUrl + "?msg=success";
                        break;

                    default:

                        rtnOk = 1;
                        //rtnUrl = "http://www.yoursite.com/show.aspx?msg=false";
                        rtnUrl = showUrl + "?msg=false";
                        break;
                }

            }
            else
            {
                rtnOk = 1;
                rtnUrl = showUrl + "?msg=error";

            }
        }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //***************************************************************
            string alipayNotifyURL = UiCommon.StringConfig.AlipayNotifyURL;
            //partner 的对应交易安全校验码(必须填写)
            string key            = UiCommon.StringConfig.AlipayKey;
            string _input_charset = "utf-8";
            //partner合作伙伴id(必须填写)
            string partner = UiCommon.StringConfig.AlipayPartnerID;

            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;

            //Load Form variables into NameValueCollection variable.
            coll = Request.QueryString;

            // Get names of all forms into a string array.
            String[] requestarr = coll.AllKeys;


            //进行排序;
            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(), _input_charset);
            string mysign       = GetMD5(prestr.ToString(), _input_charset);
            string sign         = Request.QueryString["sign"];
            string trade_status = Request.QueryString["trade_status"];

            //Response.Write(prestr.ToString());  //打印返回通知消息,接收到的


            //订单流水号
            string Orderid = Request.QueryString["out_trade_no"].Trim();
            //支付金额
            string payAmount = Request.QueryString["total_fee"].Trim();

            if (mysign == sign && responseTxt == "true")   //验证支付发过来的消息,签名是否正确
            {
                //更新自己数据库的订单语句,请自己填写一下**************************************************


                BLL.Member member = new BLL.Member();
                if (!member.IsPaySuccess(Orderid)) //防止重复刷新页面而带来的问题
                {
                    //更新订单状态为完成
                    //member.Update3PayOrder( string.Empty, (int)( float.Parse( payAmount ) ), Orderid );
                    member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
                }
                PayResult  = "恭喜您,支付成功!";
                PayOrderID = Orderid;
                PayMoney   = payAmount + " 元";

                //Lab_msg.Text = "恭喜您,充值成功,订单号为" + Orderid + ",充值金额为" + payAmount + "元!<br>";

                Response.Write("success");     //返回给支付宝消息,成功(不用返回给支付宝)
                //**************************************************************************
                //打印出接收通知。计算结果
                //Response.Write("------------------------------------------");
                //Response.Write("<br>Result:responseTxt=" + responseTxt);
                //Response.Write("<br>Result:mysign=" + mysign);
                //Response.Write("<br>Result:sign=" + sign);
            }
            else
            {
                PayResult  = "抱歉,支付失败!";
                PayOrderID = Orderid;
                PayMoney   = payAmount + " 元,如果您确认钱已支付,请及时向我们反馈此问题!";
                // Lab_msg.Text = "对不起,充值失败,订单号为" + Orderid + ",充值金额为" + payAmount + "元,如果您确认钱已支付,请及时向我们反馈此问题!<br>";

                //**************************************************************************
                //打印出接收通知。计算结果
                //Response.Write("------------------------------------------");
                //Response.Write("<br>Result:responseTxt=" + responseTxt);
                //Response.Write("<br>Result:mysign=" + mysign);
                //Response.Write("<br>Result:sign=" + sign);
            }
        }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// created by sunzhizhi 2006.5.21,[email protected]。
            /// </summary>
            string alipayNotifyURL = UiCommon.StringConfig.AlipayNotifyURL;
            //partner合作伙伴id(必须填写)
            string partner = UiCommon.StringConfig.AlipayPartnerID;
            //partner 的对应交易安全校验码(必须填写)
            string key = UiCommon.StringConfig.AlipayKey;

            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;
            //Load Form variables into NameValueCollection variable.
            coll = Request.Form;

            // Get names of all forms into a string array.
            String[] requestarr = coll.AllKeys;

            //进行排序;
            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")   //验证支付发过来的消息,签名是否正确
            {
                if (Request.Form["trade_status"] == "TRADE_FINISHED")// WAIT_SELLER_SEND_GOODS  判断支付状态(文档中有枚举表可以参考)
                {

                    //更新自己数据库的订单语句,请自己填写一下*************************************

                    //订单流水号
                    string Orderid = Request.Form["out_trade_no"].ToString().Trim();
                    //支付金额
                    string payAmount = Request.Form["total_fee"].ToString().Trim();

                    //Lab_msg.Text = "恭喜您,充值成功!";

                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(Orderid)) //防止重复刷新页面而带来的问题
                    {
                        //更新订单信息为完成状态
                        //member.Update3PayOrder( string.Empty, (int)( float.Parse( payAmount ) ), Orderid );
                        member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
                    }

                    //返回给支付宝消息,成功
                    Response.Write("success");
                }

                else
                {
                    Response.Write("fail");
                }

            }
        }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //***************************************************************
            string alipayNotifyURL = UiCommon.StringConfig.AlipayNotifyURL;
            //partner �Ķ�Ӧ���װ�ȫУ���루������д��
            string key = UiCommon.StringConfig.AlipayKey;
            string _input_charset = "utf-8";
            //partner�������id���������
            string partner = UiCommon.StringConfig.AlipayPartnerID;

            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;
            //Load Form variables into NameValueCollection variable.
            coll = Request.QueryString;

            // Get names of all forms into a string array.
            String[] requestarr = coll.AllKeys;

            //��������
            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(), _input_charset);
            string mysign = GetMD5(prestr.ToString(), _input_charset);
            string sign = Request.QueryString["sign"];
            string trade_status = Request.QueryString["trade_status"];

            //Response.Write(prestr.ToString());  //��ӡ����֪ͨ��Ϣ�����յ���

            //������ˮ��
            string Orderid = Request.QueryString["out_trade_no"].Trim();
            //֧�����
            string payAmount = Request.QueryString["total_fee"].Trim();

            if (mysign == sign && responseTxt == "true")   //��֤֧������������Ϣ��ǩ���Ƿ���ȷ
            {

                //�����Լ����ݿ�Ķ�����䣬���Լ���дһ��**************************************************

                BLL.Member member = new BLL.Member();
                if (!member.IsPaySuccess(Orderid)) //��ֹ�ظ�ˢ��ҳ�������������
                {
                    //���¶���״̬Ϊ���
                    //member.Update3PayOrder( string.Empty, (int)( float.Parse( payAmount ) ), Orderid );
                    member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
                }
                PayResult = "��ϲ����֧���ɹ���";
                PayOrderID = Orderid;
                PayMoney = payAmount + " Ԫ";

                //Lab_msg.Text = "��ϲ������ֵ�ɹ���������Ϊ" + Orderid + "����ֵ���Ϊ" + payAmount + "Ԫ��<br>";

                Response.Write("success");     //���ظ�֧������Ϣ���ɹ������÷��ظ�֧������
                //**************************************************************************
                //��ӡ������֪ͨ��������
                //Response.Write("------------------------------------------");
                //Response.Write("<br>Result:responseTxt=" + responseTxt);
                //Response.Write("<br>Result:mysign=" + mysign);
                //Response.Write("<br>Result:sign=" + sign);

            }
            else
            {
                PayResult = "��Ǹ��֧��ʧ�ܣ�";
                PayOrderID = Orderid;
                PayMoney = payAmount + " Ԫ�������ȷ��Ǯ��֧�����뼰ʱ�����Ƿ��������⣡";
                // Lab_msg.Text = "�Բ��𣬳�ֵʧ�ܣ�������Ϊ" + Orderid + "����ֵ���Ϊ" + payAmount + "Ԫ�������ȷ��Ǯ��֧�����뼰ʱ�����Ƿ��������⣡<br>";

                //**************************************************************************
                //��ӡ������֪ͨ��������
                //Response.Write("------------------------------------------");
                //Response.Write("<br>Result:responseTxt=" + responseTxt);
                //Response.Write("<br>Result:mysign=" + mysign);
                //Response.Write("<br>Result:sign=" + sign);
            }
        }
Example #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string MerchantID     = Request.Params["MerchantID"];        //商户号
            string TransID        = Request.Params["TransID"];           //商户流水号
            string Result         = Request.Params["Result"];            //支付结果(1:成功,0:失败)
            string resultDesc     = Request.Params["resultDesc"];        //支付结果描述
            string factMoney      = Request.Params["factMoney"];         //实际成交金额
            string additionalInfo = Request.Params["additionalInfo"];    //订单附加消息
            string SuccTime       = Request.Params["SuccTime"];          //交易成功时间
            string Md5Sign        = Request.Params["Md5Sign"].ToLower(); //md5签名

            string _Md5Key   = ConfigurationManager.AppSettings["baofoo_key"];
            string _WaitSign = MerchantID + TransID + Result + resultDesc + factMoney + additionalInfo + SuccTime + _Md5Key;

            if (Result == "1")
            {
                if (Md5Sign.ToLower() == Helper.Md5Encrypt(_WaitSign).ToLower())
                {
                    //开始下面的操作,处理订单
                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(TransID)) //防止重复刷新页面而带来的问题
                    {
                        //更新订单信息为完成状态
                        if (TransID.ToLower().Contains("ka"))
                        {
                            member.Update3PayOrder2((int)(float.Parse(factMoney)) / 100, TransID);
                        }
                        else
                        {
                            member.Update3PayOrder((int)(float.Parse(factMoney)) / 100, TransID);
                        }
                    }

                    #region [add] jeffery

                    //int pos = additionalInfo.IndexOf("!@#");
                    //string username = additionalInfo.Substring(0, pos);
                    //int couponNum =
                    //    Convert.ToInt32(
                    //    additionalInfo.Substring(pos + 1)
                    //    );
                    //string strsql =
                    //    "select UserID from TUsers where UserName=@username";

                    //DataTable dt =
                    //    SqlHelper.ExecuteDataset(CommandType.Text,
                    //    strsql,
                    //    new SqlParameter[]
                    //            {
                    //                new SqlParameter("@username",username)
                    //            }
                    //    ).Tables[0];

                    //int userid = Convert.ToInt32(dt.Rows[0]["UserID"]);

                    //strsql = "insert into TCoupon(UserID,CouponNum,RechargeType,CreateTime)values(@userid,@coupon,@rechargeType,@createTime)";
                    //int num =
                    //    SqlHelper.ExecuteNonQuery
                    //    (CommandType.Text,
                    //    strsql,
                    //    new SqlParameter[]
                    //            {
                    //                new SqlParameter("@userid",userid),
                    //                new SqlParameter("@coupon",couponNum),
                    //                new SqlParameter("@rechargeType",5),
                    //                new SqlParameter("@createTime",DateTime.Now)
                    //            });


                    //if (num != 1)
                    //{
                    //    Response.Write("<script>alert('充值成功,但赠送奖劵失败!')</script>");
                    //}


                    #endregion

                    //md5校验成功,输出OK
                    Response.Write("OK");
                }
            }
            else
            {
                Response.Write("Md5CheckFail");
            }
        }
Example #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //����֧�������ҳ���ַ
            string showUrl = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/99bill/NetBank/Show.aspx";

            //��ȡ����������˻���
            String merchantAcctId = Request["merchantAcctId"].ToString().Trim();

            //���������������Կ
            ///���ִ�Сд
            String key = UiCommon.StringConfig.JJbill_NetBank_Key; //"K65XTCHC2N72M4MS";

            //��ȡ���ذ汾.�̶�ֵ
            ///��Ǯ����ݰ汾�������ö�Ӧ�Ľӿڴ������
            ///������汾�Ź̶�Ϊv2.0
            String version = Request["version"].ToString().Trim();

            //��ȡ��������.�̶�ѡ��ֵ��
            ///ֻ��ѡ��1��2��3
            ///1�������ģ�2����Ӣ��
            ///Ĭ��ֵΪ1
            String language = Request["language"].ToString().Trim();

            //ǩ������.�̶�ֵ
            ///1����MD5ǩ��
            ///��ǰ�汾�̶�Ϊ1
            String signType = Request["signType"].ToString().Trim();

            //��ȡ֧����ʽ
            ///ֵΪ��10��11��12��13��14
            ///00�����֧��������֧��ҳ����ʾ��Ǯ֧�ֵĸ���֧����ʽ���Ƽ�ʹ�ã�10�����п�֧��������֧��ҳ��ֻ��ʾ���п�֧����.11���绰����֧��������֧��ҳ��ֻ��ʾ�绰֧����.12����Ǯ�˻�֧��������֧��ҳ��ֻ��ʾ��Ǯ�˻�֧����.13������֧��������֧��ҳ��ֻ��ʾ����֧����ʽ��.14��B2B֧��������֧��ҳ��ֻ��ʾB2B֧��������Ҫ���Ǯ���뿪ͨ����ʹ�ã�
            String payType = Request["payType"].ToString().Trim();

            //a
            ///�μ����д����б�
            String bankId = Request["bankId"].ToString().Trim();

            //��ȡ�̻�������
            String orderId = Request["orderId"].ToString().Trim();

            //��ȡ�����ύʱ��
            ///��ȡ�̻��ύ����ʱ��ʱ��.14λ���֡���[4λ]��[2λ]��[2λ]ʱ[2λ]��[2λ]��[2λ]
            ///�磺20080101010101
            String orderTime = Request["orderTime"].ToString().Trim();

            //��ȡԭʼ�������
            ///�����ύ����Ǯʱ�Ľ���λΪ�֡�
            ///�ȷ�2 ������0.02Ԫ
            String orderAmount = Request["orderAmount"].ToString().Trim();

            //��ȡ��Ǯ���׺�
            ///��ȡ�ý����ڿ�Ǯ�Ľ��׺�
            String dealId = Request["dealId"].ToString().Trim();

            //��ȡ���н��׺�
            ///���ʹ�����п�֧��ʱ�������еĽ��׺š��粻��ͨ������֧������Ϊ��
            String bankDealId = Request["bankDealId"].ToString().Trim();

            //��ȡ�ڿ�Ǯ����ʱ��
            ///14λ���֡���[4λ]��[2λ]��[2λ]ʱ[2λ]��[2λ]��[2λ]
            ///�磻20080101010101
            String dealTime = Request["dealTime"].ToString().Trim();

            //��ȡʵ��֧�����
            ///��λΪ��
            ///�ȷ� 2 ������0.02Ԫ
            String payAmount = Request["payAmount"].ToString().Trim();

            //��ȡ����������
            ///��λΪ��
            ///�ȷ� 2 ������0.02Ԫ
            String fee = Request["fee"].ToString().Trim();

            //��ȡ��չ�ֶ�1
            String ext1 = Request["ext1"].ToString().Trim();

            //��ȡ��չ�ֶ�2
            String ext2 = Request["ext2"].ToString().Trim();

            //��ȡ������
            ///10���� �ɹ�; 11���� ʧ��
            ///00���� �¶����ɹ������Ե绰����֧���������أ�;01���� �¶���ʧ�ܣ����Ե绰����֧���������أ�
            String payResult = Request["payResult"].ToString().Trim();

            //��ȡ�������
            ///��ϸ���ĵ���������б�
            String errCode = Request["errCode"].ToString().Trim();

            //��ȡ����ǩ����
            String signMsg = Request["signMsg"].ToString().Trim();

            //���ɼ��ܴ������뱣������˳��
            String merchantSignMsgVal = "";
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "merchantAcctId", merchantAcctId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "version", version);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "language", language);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "signType", signType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payType", payType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "bankId", bankId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderId", orderId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderTime", orderTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderAmount", orderAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "dealId", dealId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "bankDealId", bankDealId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "dealTime", dealTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payAmount", payAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "fee", fee);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext1", ext1);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext2", ext2);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payResult", payResult);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "errCode", errCode);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "key", key);

            String merchantSignMsg = FormsAuthentication.HashPasswordForStoringInConfigFile(merchantSignMsgVal, "MD5");

            //�̼ҽ������ݴ��������ת���̼���ʾ֧�������ҳ��
            ///���Ƚ���ǩ���ַ�����֤
            if (signMsg.ToUpper() == merchantSignMsg.ToUpper())
            {

                switch (payResult)
                {

                    case "10":
                        /*
                         ' �̻���վ�߼�������ȷ����¶���֧��״̬Ϊ�ɹ�
                        ' �ر�ע�⣺ֻ��signMsg.ToUpper() == merchantSignMsg.ToUpper()����payResult=10���ű�ʾ֧���ɹ���
                        */

                        //���¶���Ϊ���״̬
                        BLL.Member member = new BLL.Member();
                        if (!member.IsPaySuccess(orderId))
                        {
                            int bMoney = Convert.ToInt32(payAmount) / 100;
                            member.Update3PayOrder(string.Empty, bMoney, orderId);
                        }

                        //�������Ǯ�����������ṩ��Ҫ�ض���ĵ�ַ��
                        rtnOk = 1;
                        //rtnUrl = "http://www.yoursite.com/show.aspx?msg=success";
                        rtnUrl = showUrl + "?msg=success";
                        break;

                    default:

                        rtnOk = 1;
                        //rtnUrl = "http://www.yoursite.com/show.aspx?msg=false";
                        rtnUrl = showUrl + "?msg=false";
                        break;
                }

            }
            else
            {
                rtnOk = 1;
                rtnUrl = showUrl + "?msg=error";

            }
        }
Example #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //***************************************************************
            string alipayNotifyURL = UiCommon.StringConfig.AlipayNotifyURL;
            //partner 的对应交易安全校验码(必须填写)
            string key = UiCommon.StringConfig.AlipayKey;
            string _input_charset = "utf-8";
            //partner合作伙伴id(必须填写)
            string partner = UiCommon.StringConfig.AlipayPartnerID;

            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;
            //Load Form variables into NameValueCollection variable.
            coll = Request.QueryString;

            // Get names of all forms into a string array.
            String[] requestarr = coll.AllKeys;

            //进行排序;
            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(), _input_charset);
            string mysign = GetMD5(prestr.ToString(), _input_charset);
            string sign = Request.QueryString["sign"];
            string trade_status = Request.QueryString["trade_status"];

            //Response.Write(prestr.ToString());  //打印返回通知消息,接收到的

            //订单流水号
            string Orderid = Request.QueryString["out_trade_no"].Trim();
            //支付金额
            string payAmount = Request.QueryString["total_fee"].Trim();

            if (mysign == sign && responseTxt == "true")   //验证支付发过来的消息,签名是否正确
            {

                //更新自己数据库的订单语句,请自己填写一下**************************************************

                BLL.Member member = new BLL.Member();
                if (!member.IsPaySuccess(Orderid)) //防止重复刷新页面而带来的问题
                {
                    //更新订单状态为完成
                    //member.Update3PayOrder( string.Empty, (int)( float.Parse( payAmount ) ), Orderid );
                    member.Update3PayOrder((int)(float.Parse(payAmount)), Orderid);
                }
                PayResult = "恭喜您,支付成功!";
                PayOrderID = Orderid;
                PayMoney = payAmount + " 元";

                //Lab_msg.Text = "恭喜您,充值成功,订单号为" + Orderid + ",充值金额为" + payAmount + "元!<br>";

                Response.Write("success");     //返回给支付宝消息,成功(不用返回给支付宝)
                //**************************************************************************
                //打印出接收通知。计算结果
                //Response.Write("------------------------------------------");
                //Response.Write("<br>Result:responseTxt=" + responseTxt);
                //Response.Write("<br>Result:mysign=" + mysign);
                //Response.Write("<br>Result:sign=" + sign);

            }
            else
            {
                PayResult = "抱歉,支付失败!";
                PayOrderID = Orderid;
                PayMoney = payAmount + " 元,如果您确认钱已支付,请及时向我们反馈此问题!";
                // Lab_msg.Text = "对不起,充值失败,订单号为" + Orderid + ",充值金额为" + payAmount + "元,如果您确认钱已支付,请及时向我们反馈此问题!<br>";

                //**************************************************************************
                //打印出接收通知。计算结果
                //Response.Write("------------------------------------------");
                //Response.Write("<br>Result:responseTxt=" + responseTxt);
                //Response.Write("<br>Result:mysign=" + mysign);
                //Response.Write("<br>Result:sign=" + sign);
            }
        }
Example #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //处理支付结果的页面地址
            string showUrl = UiCommon.StringConfig.WebSiteName + "/Manage/Pay/99bill/NetBank/Show.aspx";



            //获取人民币网关账户号
            String merchantAcctId = Request["merchantAcctId"].ToString().Trim();

            //设置人民币网关密钥
            ///区分大小写
            String key = UiCommon.StringConfig.JJbill_NetBank_Key; //"K65XTCHC2N72M4MS";

            //获取网关版本.固定值
            ///快钱会根据版本号来调用对应的接口处理程序。
            ///本代码版本号固定为v2.0
            String version = Request["version"].ToString().Trim();

            //获取语言种类.固定选择值。
            ///只能选择1、2、3
            ///1代表中文;2代表英文
            ///默认值为1
            String language = Request["language"].ToString().Trim();

            //签名类型.固定值
            ///1代表MD5签名
            ///当前版本固定为1
            String signType = Request["signType"].ToString().Trim();

            //获取支付方式
            ///值为:10、11、12、13、14
            ///00:组合支付(网关支付页面显示快钱支持的各种支付方式,推荐使用)10:银行卡支付(网关支付页面只显示银行卡支付).11:电话银行支付(网关支付页面只显示电话支付).12:快钱账户支付(网关支付页面只显示快钱账户支付).13:线下支付(网关支付页面只显示线下支付方式).14:B2B支付(网关支付页面只显示B2B支付,但需要向快钱申请开通才能使用)
            String payType = Request["payType"].ToString().Trim();

            //a
            ///参见银行代码列表
            String bankId = Request["bankId"].ToString().Trim();

            //获取商户订单号
            String orderId = Request["orderId"].ToString().Trim();

            //获取订单提交时间
            ///获取商户提交订单时的时间.14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
            ///如:20080101010101
            String orderTime = Request["orderTime"].ToString().Trim();

            //获取原始订单金额
            ///订单提交到快钱时的金额,单位为分。
            ///比方2 ,代表0.02元
            String orderAmount = Request["orderAmount"].ToString().Trim();

            //获取快钱交易号
            ///获取该交易在快钱的交易号
            String dealId = Request["dealId"].ToString().Trim();

            //获取银行交易号
            ///如果使用银行卡支付时,在银行的交易号。如不是通过银行支付,则为空
            String bankDealId = Request["bankDealId"].ToString().Trim();

            //获取在快钱交易时间
            ///14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
            ///如;20080101010101
            String dealTime = Request["dealTime"].ToString().Trim();

            //获取实际支付金额
            ///单位为分
            ///比方 2 ,代表0.02元
            String payAmount = Request["payAmount"].ToString().Trim();

            //获取交易手续费
            ///单位为分
            ///比方 2 ,代表0.02元
            String fee = Request["fee"].ToString().Trim();

            //获取扩展字段1
            String ext1 = Request["ext1"].ToString().Trim();

            //获取扩展字段2
            String ext2 = Request["ext2"].ToString().Trim();

            //获取处理结果
            ///10代表 成功; 11代表 失败
            ///00代表 下订单成功(仅对电话银行支付订单返回);01代表 下订单失败(仅对电话银行支付订单返回)
            String payResult = Request["payResult"].ToString().Trim();

            //获取错误代码
            ///详细见文档错误代码列表
            String errCode = Request["errCode"].ToString().Trim();

            //获取加密签名串
            String signMsg = Request["signMsg"].ToString().Trim();



            //生成加密串。必须保持如下顺序。
            String merchantSignMsgVal = "";

            merchantSignMsgVal = appendParam(merchantSignMsgVal, "merchantAcctId", merchantAcctId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "version", version);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "language", language);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "signType", signType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payType", payType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "bankId", bankId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderId", orderId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderTime", orderTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderAmount", orderAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "dealId", dealId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "bankDealId", bankDealId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "dealTime", dealTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payAmount", payAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "fee", fee);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext1", ext1);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext2", ext2);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payResult", payResult);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "errCode", errCode);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "key", key);

            String merchantSignMsg = FormsAuthentication.HashPasswordForStoringInConfigFile(merchantSignMsgVal, "MD5");



            //商家进行数据处理,并跳转会商家显示支付结果的页面
            ///首先进行签名字符串验证
            if (signMsg.ToUpper() == merchantSignMsg.ToUpper())
            {
                switch (payResult)
                {
                case "10":
                    /*
                     * ' 商户网站逻辑处理,比方更新订单支付状态为成功
                     * ' 特别注意:只有signMsg.ToUpper() == merchantSignMsg.ToUpper(),且payResult=10,才表示支付成功!
                     */

                    //更新订单为完成状态
                    BLL.Member member = new BLL.Member();
                    if (!member.IsPaySuccess(orderId))
                    {
                        int bMoney = Convert.ToInt32(payAmount) / 100;
                        member.Update3PayOrder(string.Empty, bMoney, orderId);
                    }

                    //报告给快钱处理结果,并提供将要重定向的地址。
                    rtnOk = 1;
                    //rtnUrl = "http://www.yoursite.com/show.aspx?msg=success";
                    rtnUrl = showUrl + "?msg=success";
                    break;

                default:

                    rtnOk = 1;
                    //rtnUrl = "http://www.yoursite.com/show.aspx?msg=false";
                    rtnUrl = showUrl + "?msg=false";
                    break;
                }
            }
            else
            {
                rtnOk  = 1;
                rtnUrl = showUrl + "?msg=error";
            }
        }