コード例 #1
0
ファイル: IPS_Server.cs プロジェクト: lincoln56/robinerp
        protected void Page_Load(object sender, EventArgs e)
        {
            string billno = Utility.Common.GetStringOfUrl("billno"); //订单编号

            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 retencodetype = Utility.Common.GetStringOfUrl("retencodetype");//交易返回签名方式

            if (string.IsNullOrEmpty(billno) || string.IsNullOrEmpty(amount) || string.IsNullOrEmpty(date) ||
                string.IsNullOrEmpty(succ) || string.IsNullOrEmpty(ipsbillno) || string.IsNullOrEmpty(currency_Type) || string.IsNullOrEmpty(signature))
            {
                Server.Transfer("Default.aspx");
            }

            if (succ.Equals("Y"))
            {
                //交易成功

                if (currency_Type == null || currency_Type == "")
                {
                    currency_Type = "RMB";
                }
                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 (signature.Equals(signatureVal.ToLower()))
                {
                    Member mem = new Member();
                    if (!mem.IsPaySuccess(billno))
                    {
                        mem.Update3PayOrder((int)(float.Parse(amount)), billno);

                    }
                }
                else
                {

                }

            }
            else
            {
                //交易失败
                //  lblMsg.Text = "充值失败,请稍后再试!";
            }
        }
コード例 #2
0
ファイル: Receive.cs プロジェクト: lincoln56/robinerp
        protected void Page_Load(object sender, EventArgs e)
        {
            String key = UiCommon.StringConfig.JFTpay_MemberKey; //配置文件密钥

            //返回参数
            String orderid = Request.QueryString["orderid"];//返回订单号
            String opstate = Request.QueryString["opstate"];//返回处理结果
            String ovalue = Request.QueryString["ovalue"];//返回充值金额
            String sign = Request.QueryString["sign"];//返回加密标记
            String Reply = Request.QueryString["Reply"];//同步发送:1代表同步发送,2代表异步发送
            String kaorderID = Request.QueryString["ekaorderid"];
            String time = Request.QueryString["ekatime"];//亿卡处理时间。

            //组织参数
            String param = String.Format("orderid={0}&opstate={1}&ovalue={2}{3}", orderid, opstate, ovalue, key);

            //比对参数是否有效
            if (sign.Equals(FormsAuthentication.HashPasswordForStoringInConfigFile(param, "MD5").ToLower()))
            {
                //执行操作方法
                if (opstate.Equals("0"))
                {
                    #region [add] jeffery

                    //if (Session["CouponInfo"] != null)
                    //{
                    //    string strCouponInfo = Session["CouponInfo"].ToString();
                    //    Session["CouponInfo"] = ""; // 用完后销毁
                    //    if (strCouponInfo != "")
                    //    {
                    //        int pos = strCouponInfo.IndexOf("!@#");
                    //        string username = strCouponInfo.Substring(0, pos);
                    //        int couponNum = Convert.ToInt32(
                    //            strCouponInfo.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];

                    //        if (dt.Rows.Count > 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",6),
                    //                                    new SqlParameter("@createTime",DateTime.Now)
                    //                                });

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

                    //    }
                    //}
                    #endregion

                    Member mem = new Member();

                    if (Reply == "1")
                    {
                        Response.Write("opstate=0");

                        //操作流程成功的情况
                        //注:不能打印其他的字符,否则不会同步
                        if (!mem.IsPaySuccess(orderid)) //防止重复刷新页面而带来的问题
                        {

                            //更新订单信息为完成状态
                            if (orderid.ToLower().Contains("ka"))
                                mem.Update3PayOrder2((int)(float.Parse(ovalue)), orderid);
                            else
                                mem.Update3PayOrder((int)(float.Parse(ovalue)), orderid);

                        }

                    }
                    else if (Reply == "2")
                    {

                        //防止重复刷新页面而带来的问题
                        if (!mem.IsPaySuccess(orderid))
                        {
                            if (orderid.ToLower().Contains("ka"))
                                mem.Update3PayOrder2((int)(float.Parse(ovalue)), orderid);
                            else
                                mem.Update3PayOrder((int)(float.Parse(ovalue)), orderid);

                        }
                        //返回到成功页面
                        Response.Redirect("NotityReceive.aspx?orderid=" + orderid + "&opstate=" + opstate);

                    }

                }
                if (opstate.Equals("-1"))
                {
                    //请求参数无效
                    Response.Write("请求参数无效");
                }
                if (opstate.Equals("-2"))
                {
                    //交易签名无效
                    Response.Write("签名错误");
                }
            }
        }
コード例 #3
0
ファイル: Result.cs プロジェクト: lincoln56/robinerp
        protected void Page_Load(object sender, EventArgs e)
        {
            string UserId =Utility.Common.GetStringOfUrl( Request["P_UserId"]);
            string OrderId = Utility.Common.GetStringOfUrl(Request["P_OrderId"]);
            string CardId = Utility.Common.GetStringOfUrl(Request["P_CardId"]);
            string CardPass = Utility.Common.GetStringOfUrl(Request["P_CardPass"]);
            string FaceValue = Utility.Common.GetStringOfUrl(Request["P_FaceValue"]);
            string ChannelId = Utility.Common.GetStringOfUrl(Request["P_ChannelId"]);

            string subject = Utility.Common.GetStringOfUrl(Request["P_Subject"]);
            string description = Utility.Common.GetStringOfUrl(Request["P_Description"]);
            string price = Utility.Common.GetStringOfUrl(Request["P_Price"]);
            string quantity = Utility.Common.GetStringOfUrl(Request["P_Quantity"]);
            string notic = Utility.Common.GetStringOfUrl(Request["P_Notic"]);
            string ErrCode = Utility.Common.GetStringOfUrl(Request["P_ErrCode"]);
            string PostKey = Utility.Common.GetStringOfUrl(Request["P_PostKey"]);
            string payMoney = Utility.Common.GetStringOfUrl(Request["P_PayMoney"]);

            string SalfStr =UiCommon.StringConfig.KFPayKey;
            string preEncodeStr = UserId + "|" + OrderId + "|" + CardId + "|" + CardPass + "|" + FaceValue + "|" + ChannelId + "|" + SalfStr;

            string encodeStr = Utility.Common.md5(preEncodeStr);

              //   Response.Write(preEncodeStr + "<br>" + encodeStr+"<br>");//调试语句

             Response.Write("errCode=0");
             //string FilePath = Server.MapPath("/test/weather.txt");
             //if (!File.Exists(FilePath))
             //{
             //    FileStream fs = File.Create(FilePath);
             //    fs.Close();
             //}
             ////写入文本
             //StreamWriter sr = new StreamWriter(Server.MapPath("/test/weather.txt"), false, System.Text.Encoding.Default);
             //try
             //{
             //    string str = "P_UserId:" + UserId + "P_OrderId:" + OrderId + "P_CardId:"
             //        + CardId + "P_CardPass:"******"P_FaceValue:" + FaceValue
             //        + "P_ChannelId:" + ChannelId + "P_Subject:" + subject
             //        + "P_Description:" + description + "P_Price:" + price
             //        + "P_ErrCode:" + ErrCode + "P_PostKey:" + PostKey
             //        + "P_PayMoney:" + payMoney;
             //    sr.Write(str+"<br/>"+preEncodeStr + "<br/>" + encodeStr + "<br/>");
             //    sr.Close();

             //}
             //catch
             //{

             //}
            if (PostKey.ToUpper().CompareTo(encodeStr.ToUpper()) == 0)//表示数据合法
            {

                if (int.Parse(ErrCode) == 0)//说明是充值成功了的
                {
                    //这里进行订单更新
                    Member mem = new Member();
                    if (!mem.IsPaySuccess(OrderId))
                    {
                        mem.Update3PayOrder((int)(float.Parse(FaceValue)), OrderId);
                    }

                }
                else
                {
                 //   Response.Write("-Err");
                }
            }
            else
            {

               // Response.Write("-数据不合法");
            }
        }
コード例 #4
0
ファイル: OrderReturn.cs プロジェクト: lincoln56/robinerp
        protected void Page_Load(object sender, EventArgs e)
        {
            string billno = Utility.Common.GetStringOfUrl("billno"); //订单编号

            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 retencodetype = Utility.Common.GetStringOfUrl("retencodetype");//交易返回签名方式

            // [add] jeffery
            //string strAttach = Utility.Common.GetStringOfUrl("attach");
            // ---end

            if (string.IsNullOrEmpty(billno) || string.IsNullOrEmpty(amount) || string.IsNullOrEmpty(date) ||
                string.IsNullOrEmpty(succ) || string.IsNullOrEmpty(ipsbillno) || string.IsNullOrEmpty(currency_Type) || string.IsNullOrEmpty(signature))
            {
                Server.Transfer("Default.aspx");
            }

            PayOrderID = billno;

            PayMoney = amount;

            if (succ.Equals("Y"))
            {
                //交易成功
                PayResult = "恭喜您,充值成功!";
                if (currency_Type == null || currency_Type == "")
                {
                    currency_Type = "RMB";
                }
                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 (signature.Equals(signatureVal.ToLower()))
                {
                    Member mem = new Member();
                    if (!mem.IsPaySuccess(billno))
                    {
                        mem.Update3PayOrder((int)(float.Parse(PayMoney)), PayOrderID);
                    }

                    #region [add] jeffery

                    //int pos = strAttach.IndexOf("!@#");
                    //string username = strAttach.Substring(0, pos);
                    //int couponNum =
                    //    Convert.ToInt32(
                    //    strAttach.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",2),
                    //                new SqlParameter("@createTime",DateTime.Now)
                    //            });

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

                    #endregion
                }
                else
                {
                    PayResult = "充值失败,请不要恶意删改数据";
                }

            }
            else
            {
                //交易失败
                PayResult = "充值失败,请稍后再试!";
            }
        }
コード例 #5
0
ファイル: return_url.cs プロジェクト: lincoln56/robinerp
        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;

            //MerchantID=SDF&TransID=234&Result=212&resultDesc=1&factMoney=20&additionalInfo=sdsfd&Md5Sign=323423

            lblBillon.Text = TransID;
            lblAmount.Text = (Convert.ToInt32(factMoney) / 100).ToString();

            if (Result == "1")
            {
                if (Md5Sign.ToLower() == Helper.Md5Encrypt(_WaitSign).ToLower())
                {

                    //交易成功
                    lblMsg.Text = "恭喜您,充值成功!";
                    //更新订单
                    Member mem = new Member();
                    if (!mem.IsPaySuccess(TransID))
                    {
                        //更新订单信息为完成状态
                        if (TransID.ToLower().Contains("ka"))
                            mem.Update3PayOrder2((int)(float.Parse(factMoney))/100, TransID);
                        else
                            mem.Update3PayOrder((int)(float.Parse(factMoney))/100, TransID);

                    }
                }
                else
                {
                    lblMsg.Text = "充值失败,请稍后再试!";
                }
            }
            else
            {
                //交易失败
                lblMsg.Text = "充值失败,原因:" + resultDesc + "。请稍后再试!";
            }
        }
コード例 #6
0
ファイル: Return.cs プロジェクト: lincoln56/robinerp
        protected void Page_Load(object sender, EventArgs e)
        {
            string UserId =Utility.Common.GetStringOfUrl( Request["P_UserId"]);
            string OrderId = Utility.Common.GetStringOfUrl(Request["P_OrderId"]);
            string CardId = Utility.Common.GetStringOfUrl(Request["P_CardId"]);
            string CardPass = Utility.Common.GetStringOfUrl(Request["P_CardPass"]);
            string FaceValue = Utility.Common.GetStringOfUrl(Request["P_FaceValue"]);
            string ChannelId = Utility.Common.GetStringOfUrl(Request["P_ChannelId"]);

            string subject = Utility.Common.GetStringOfUrl(Request["P_Subject"]);
            string description = Utility.Common.GetStringOfUrl(Request["P_Description"]);
            string price = Utility.Common.GetStringOfUrl(Request["P_Price"]);
            string quantity = Utility.Common.GetStringOfUrl(Request["P_Quantity"]);
            string notic = Utility.Common.GetStringOfUrl(Request["P_Notic"]);
            string ErrCode = Utility.Common.GetStringOfUrl(Request["P_ErrCode"]);
            string PostKey = Utility.Common.GetStringOfUrl(Request["P_PostKey"]);
            string payMoney = Utility.Common.GetStringOfUrl(Request["P_PayMoney"]);

            string SalfStr = UiCommon.StringConfig.KFPayKey;
            string preEncodeStr = UserId + "|" + OrderId + "|" + CardId + "|" + CardPass + "|" + FaceValue + "|" + ChannelId + "|" + SalfStr;

            string encodeStr = Utility.Common.md5(preEncodeStr);

               //  Response.Write(preEncodeStr + "<br>" + encodeStr+"<br>");//调试语句
            PayOrderID = OrderId;

            PayMoney = FaceValue;
            //string FilePath = Server.MapPath("/test/weather.txt");
            //if (!File.Exists(FilePath))
            //{
            //    FileStream fs = File.Create(FilePath);
            //    fs.Close();
            //}
            ////写入文本
            //StreamWriter sr = new StreamWriter(Server.MapPath("/test/weather1.txt"), false, System.Text.Encoding.Default);
            //try
            //{
            //    string str = "P_UserId:" + UserId + "P_OrderId:" + OrderId + "P_CardId:"
            //        + CardId + "P_CardPass:"******"P_FaceValue:" + FaceValue
            //        + "P_ChannelId:" + ChannelId + "P_Subject:" + subject
            //        + "P_Description:" + description + "P_Price:" + price
            //        + "P_ErrCode:" + ErrCode + "P_PostKey:" + PostKey
            //        + "P_PayMoney:" + payMoney;
            //    sr.Write(str + "<br/>" + preEncodeStr + "<br/>" + encodeStr + "<br/>");
            //    sr.Close();

            //}
            //catch
            //{

            //}
            if (PostKey.ToUpper().CompareTo(encodeStr.ToUpper()) == 0)
            {
              //  Response.Write("errCode=0");//表示数据合法
                if (int.Parse(ErrCode) == 0)//说明是充值成功了的
                {
                    //这里进行订单更新

                    PayResult = "恭喜您,充值成功!";
                    Member mem = new Member();
                    if (!mem.IsPaySuccess(OrderId))
                    {
                        mem.Update3PayOrder((int)(float.Parse(PayMoney)), PayOrderID);
                    }
                }
                else
                {
                    PayResult = "充值失败,请不要恶意删改数据";
                }
            }
            else
            {
                //交易失败
                switch(encodeStr){
                    case "101": PayResult = "商户ID为空"; break;
                    case "102": PayResult = "卡号不合法"; break;
                    case "103": PayResult = "卡密不合法"; break;
                    case "104": PayResult = "卡号太长"; break;
                    case "105": PayResult = "卡密太长"; break;
                    case "106": PayResult = "面值数据不合法"; break;
                    case "107": PayResult = "充值类型错误"; break;
                    case "108": PayResult = "游戏用户名过长"; break;
                    case "109": PayResult = "用户不存在"; break;
                    case "110": PayResult = "加密串postKey错误"; break;
                    case "111": PayResult = "该卡号已经被使用过"; break;
                    case "112": PayResult = "卡号类型不存在"; break;
                    case "113": PayResult = "未开通此通道或者业务"; break;
                    case "114": PayResult = "系统配置错误"; break;
                    case "115": PayResult = "卡号卡密或者面值不相符合"; break;
                    case "116": PayResult = "未知错误"; break;
                    case "117": PayResult = "未知错误"; break;
                    case "118": PayResult = "商户订单号为空"; break;
                    case "119": PayResult = "商户订单号太长"; break;
                    case "120": PayResult = "充值金额不合法"; break;
                    case "121": PayResult = "产品名称太长"; break;
                    case "122": PayResult = "产品描述文字太多"; break;
                    case "123": PayResult = "产品单价不是数字"; break;
                    case "124": PayResult = "用户自定义信息文字太多"; break;
                    case "125": PayResult = "notify_url太长"; break;
                    case "126": PayResult = "result_url太长"; break;
                    default: PayResult = "未知错误"; break;
                }
            }
        }