Ejemplo n.º 1
0
        public static string VPayVal()
        {
            string sRes = string.Empty;
            //'接受服务器url get参数
            string        rtmd5    = CYRequest.GetString("v1");  //   '服务器MD5
            string        trka     = CYRequest.GetString("v2");  //  'V币号码15位
            string        rtmi     = CYRequest.GetString("v3");  //   '密码'V币密码6位 (可能为空 老V币没有密码)
            string        rtmz     = CYRequest.GetString("v4");  //  '面值1-999 整数
            string        rtlx     = CYRequest.GetString("v5");  //  '卡的类型  1 2 3
            string        rtoid    = CYRequest.GetString("v6");  // '网盈一号通服务器端订单
            string        rtcoid   = CYRequest.GetString("v7");  //  '商户自己订单
            string        rtuserid = CYRequest.GetString("v8");  // '商户的用户ID
            string        rtcustom = CYRequest.GetString("v9");  //'商户自己定义数据
            string        rtflag   = CYRequest.GetString("v10"); // '返回状态. 1正常发送 2补单发送
            StringBuilder sbText   = new StringBuilder();

            sbText.Append(trka);
            sbText.Append(rtmi);
            sbText.Append(rtoid);
            sbText.Append(spid);
            sbText.Append(sppwd);
            sbText.Append(rtcoid);
            sbText.Append(rtflag);
            sbText.Append(rtmz);
            string  get_key     = sbText.ToString();                    //string get_key = trka + rtmi + rtoid + spid + sppwd + rtcoid + rtflag + rtmz;
            string  md5password = ProvideCommon.MD5(get_key).ToUpper(); //  '先MD5 32 然后转大写
            string  sAccount    = rtuserid;                             //获取充值人账户
            decimal dPrice      = 0;

            decimal.TryParse(rtmz, out dPrice);
            if (rtflag == "1" || rtflag == "2")
            {
                if (md5password == rtmd5)
                {
                    string sTranID = string.Format("{0}{1}", rtcoid, rtcustom.Split('|')[0]);
                    int    j       = TransPBLL.PointSalesCommit(sTranID, sAccount, dPrice); //确认返回信息无误后提交此定单
                    sRes = j.ToString();
                }
                else
                {
                    sRes = string.Format("{0}|{1}", md5password, rtmd5);
                }
            }
            else
            {
                sRes = string.Format("rtflag:{0}", rtflag);
            }
            return(sRes);
        }
Ejemplo n.º 2
0
        public static string TenPaySubmit(HttpContext Context)
        {
            string sRes = string.Empty;

            //创建PayResponseHandler实例
            PayResponseHandler resHandler = new PayResponseHandler(Context);

            resHandler.setKey(key);

            //判断签名
            if (resHandler.isTenpaySign())
            {
                //交易单号
                string transaction_id = resHandler.getParameter("transaction_id");

                //金额,以分为单位
                string total_fee = resHandler.getParameter("total_fee");

                //支付结果
                string pay_result = resHandler.getParameter("pay_result");

                string sp_billno = resHandler.getParameter("sp_billno");

                string attach = resHandler.getParameter("attach");
                if ("0".Equals(pay_result))
                {
                    //注意交易单不要重复处理
                    //注意判断返回金额
                    string  sTranID  = string.Format("{0}{1}", sp_billno, attach.Split('|')[0]);
                    decimal dPrice   = decimal.Parse(total_fee) / 100;
                    string  sAccount = attach.Split('|')[1];
                    int     j        = TransPBLL.PointSalesCommit(sTranID, sAccount, dPrice); //确认返回信息无误后提交此定单
                    if (0 == j)
                    {
                        resHandler.doShow(string.Format("PayPSucc.aspx?TranID={0}", sTranID));
                    }
                    sRes = j.ToString();
                }
                else
                {
                    sRes = "-1";
                }
            }
            else
            {
                sRes = "-2";
            }
            return(sRes);
        }
Ejemplo n.º 3
0
        public static string QuickYeePaySubmit()
        {
            string sRes = string.Empty;
            // 校验返回数据包
            BuyCallbackResult result = Buy.VerifyCallback(p1_MerId, keyValue, Buy.GetQueryString("r0_Cmd"), Buy.GetQueryString("r1_Code"), Buy.GetQueryString("r2_TrxId"),
                                                          Buy.GetQueryString("r3_Amt"), Buy.GetQueryString("r4_Cur"), Buy.GetQueryString("r5_Pid"), Buy.GetQueryString("r6_Order"), Buy.GetQueryString("r7_Uid"),
                                                          Buy.GetQueryString("r8_MP"), Buy.GetQueryString("r9_BType"), Buy.GetQueryString("rp_PayDate"), Buy.GetQueryString("hmac"));

            if (string.IsNullOrEmpty(result.ErrMsg))    //校验返回数据包成功
            {
                StringBuilder sbText = new StringBuilder();
                if (result.R1_Code == "1")  //返回充值成功的标识
                {
                    decimal dPrice   = decimal.Parse(result.R3_Amt);
                    int     iPrice   = Convert.ToInt32(dPrice);
                    string  sChannel = string.Empty;
                    switch (Buy.GetQueryString("rb_BankId"))
                    {
                    case "SZX-NET":
                        sChannel = "yp-szx";
                        break;

                    case "TELECOM-NET":
                        sChannel = "yp-dx";
                        break;

                    case "UNICOM-NET":
                        sChannel = "yp-lt";
                        break;

                    case "ZHENGTU-NET":
                        sChannel = "yp-zt";
                        break;

                    case "SNDACARD-NET":
                        sChannel = "yp-sd";
                        break;

                    case "JUNNET-NET":
                        sChannel = "yp-jcard";
                        break;

                    default:
                        sChannel = "";
                        break;
                    }
                    if (sChannel != "")
                    {
                        dPrice = dPrice * ChannelBLL.FeeScaleSel(sChannel);
                    }
                    if (result.R9_BType == "1")  //返回方式1:浏览器重定向方式
                    {
                        string sPTranID = result.R6_Order;
                        string sAccount = result.R8_MP.Split('|')[0];
                        string sGame    = result.R8_MP.Split('|')[1];
                        int    iResNum  = TransPBLL.PointSalesCommit(sPTranID, sAccount, iPrice);
                        string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sPTranID);
                        if (0 == iResNum)
                        {
                            TranQuickBLL.TranQuickUpdateP(sPTranID);
                            string sGTRes = string.Empty;
                            if (sGame.IndexOf("sq") == -1)
                            {
                                sGTRes = PayAll.GameQuickPay(sGame, sAccount, dPrice, sGTranID);
                            }
                            else
                            {
                                string sRoleID = result.R8_MP.Split('|')[2];
                                sGTRes = PayAll.sqQuickPay(sGame, sAccount, dPrice, sGTranID, sRoleID);
                            }
                            if (sGTRes == "0")
                            {
                                TranQuickBLL.TranQuickUpdateG(sGTranID);
                                sbText.Append("1|");
                            }
                            else
                            {
                                //游戏冲值失败
                                sbText.Append("3|");
                            }
                            sbText.Append(sGTranID);
                            sbText.AppendFormat("|{0}", sGame);
                            sRes = sbText.ToString();
                        }
                        else
                        {
                            string sQuickState = TranQuickBLL.TransQuickStateSelByP(sPTranID);
                            if (sQuickState == "2")
                            {
                                //游戏充值成功
                                sbText.Append("1|");
                                sbText.Append(sGTranID);
                                sbText.AppendFormat("|{0}", sGame);
                                sRes = sbText.ToString();
                            }
                            else if (sQuickState == "1")
                            {
                                string sGTRes = string.Empty;
                                if (sGame.IndexOf("sq") == -1)
                                {
                                    sGTRes = PayAll.GameQuickPay(sGame, sAccount, dPrice, sGTranID);
                                }
                                else
                                {
                                    string sRoleID = result.R8_MP.Split('|')[2];
                                    sGTRes = PayAll.sqQuickPay(sGame, sAccount, dPrice, sGTranID, sRoleID);
                                }
                                if (sGTRes == "0") //游戏兑换成功
                                {
                                    TranQuickBLL.TranQuickUpdateG(sGTranID);
                                    //游戏充值成功
                                    sbText.Append("1|");
                                }
                                else
                                {
                                    //游戏冲值失败
                                    sbText.Append("3|");
                                }
                                sbText.Append(sGTranID);
                                sbText.AppendFormat("|{0}", sGame);
                                sRes = sbText.ToString();
                            }
                            else
                            {
                                sbText.Append("2|");
                                sbText.Append(sPTranID);
                                sRes = sbText.ToString();
                            }
                        }
                    }
                    else if (result.R9_BType == "2")
                    {
                        string sAccount = result.R8_MP.Split('|')[0];
                        string sGame    = result.R8_MP.Split('|')[1];
                        string sPTranID = result.R6_Order;
                        int    iRes     = TransPBLL.PointSalesCommit(sPTranID, sAccount, iPrice);
                        string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sPTranID);
                        if (iRes == 0)
                        {
                            TranQuickBLL.TranQuickUpdateP(sPTranID);
                            string sGTRes = string.Empty;
                            if (sGame.IndexOf("sq") == -1)
                            {
                                sGTRes = PayAll.GameQuickPay(sGame, sAccount, dPrice, sGTranID);
                            }
                            else
                            {
                                string sRoleID = result.R8_MP.Split('|')[2];
                                sGTRes = PayAll.sqQuickPay(sGame, sAccount, dPrice, sGTranID, sRoleID);
                            }
                            if (sGTRes == "0")
                            {
                                TranQuickBLL.TranQuickUpdateG(sGTranID);
                            }
                        }
                        sRes = "4";
                    }
                    else if (result.R9_BType == "3")
                    {
                        sRes = "4";
                    }
                }
                else
                {
                    sbText.Append("0|");
                    sbText.Append(result.R1_Code);
                    sRes = sbText.ToString();
                }
            }
            else
            {
                sRes = "0|valerr";
            }
            return(sRes);
        }
Ejemplo n.º 4
0
        public static string QuickTenPaySubmit(HttpContext Context)
        {
            string sRes = string.Empty;

            //创建PayResponseHandler实例
            PayResponseHandler resHandler = new PayResponseHandler(Context);

            resHandler.setKey(key);

            //判断签名
            if (resHandler.isTenpaySign())
            {
                //交易单号
                string transaction_id = resHandler.getParameter("transaction_id");

                //金额金额,以分为单位
                string total_fee = resHandler.getParameter("total_fee");

                //支付结果
                string pay_result = resHandler.getParameter("pay_result");

                string sp_billno = resHandler.getParameter("sp_billno");

                string attach = resHandler.getParameter("attach");
                if ("0".Equals(pay_result))
                {
                    //------------------------------
                    //处理业务开始
                    //------------------------------

                    //注意交易单不要重复处理
                    //注意判断返回金额

                    //------------------------------
                    //处理业务完毕
                    //------------------------------
                    string  sTranID    = string.Format("{0}{1}", sp_billno, attach.Split('|')[0]);
                    decimal dPrice     = decimal.Parse(total_fee) / 100;
                    string  sAccount   = attach.Split('|')[1];
                    string  sGameAbbre = attach.Split('|')[2];

                    string sTranIP  = ProvideCommon.GetRealIP();
                    string sFromUrl = Context.Request.Url.ToString();
                    LastOfPayPointBLL.Add(sTranIP, ' ', sFromUrl, sTranID);

                    int j = TransPBLL.PointSalesCommit(sTranID, sAccount, dPrice);
                    if (0 == j)
                    {
                        string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sTranID);
                        TranQuickBLL.TranQuickUpdateP(sTranID);
                        string sGTRes = string.Empty;
                        if (sGameAbbre.IndexOf("sq") == -1)
                        {
                            sGTRes = PayAll.GameQuickPay(sGameAbbre, sAccount, dPrice, sGTranID);
                        }
                        else
                        {
                            string sRoleID = attach.Split('|')[3];
                            sGTRes = PayAll.sqQuickPay(sGameAbbre, sAccount, dPrice, sGTranID, sRoleID);
                        }

                        string sUrl = string.Empty;
                        if (sGTRes == "0")
                        {
                            TranQuickBLL.TranQuickUpdateG(sGTranID);
                            sUrl = string.Format("PayGSucc.aspx?TranID={0}&gn={1}&type=q", sGTranID, sGameAbbre);
                            //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面.
                            resHandler.doShow(sUrl);
                        }
                        sRes = sGTRes;
                    }
                    else if (j == 6)
                    {
                        string sQuickState = TranQuickBLL.TransQuickStateSelByP(sTranID);
                        string sGTranID    = TranQuickBLL.TranQuickGTranIDSel(sTranID);
                        if (sQuickState == "2")
                        {
                            string sUrl = string.Format("PayGSucc.aspx?TranID={0}&gn={1}&type=q", sGTranID, sGameAbbre);
                            //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面.
                            resHandler.doShow(sUrl);
                            sRes = "0";
                        }
                        else if (sQuickState == "1")
                        {
                            string sGTRes = string.Empty;
                            if (sGameAbbre.IndexOf("sq") == -1)
                            {
                                sGTRes = PayAll.GameQuickPay(sGameAbbre, sAccount, dPrice, sGTranID);
                            }
                            else
                            {
                                string sRoleID = attach.Split('|')[3];
                                sGTRes = PayAll.sqQuickPay(sGameAbbre, sAccount, dPrice, sGTranID, sRoleID);
                            }

                            if (sGTRes == "0") //游戏兑换成功
                            {
                                TranQuickBLL.TranQuickUpdateG(sGTranID);
                                string sUrl = string.Format("PayGSucc.aspx?TranID={0}&gn={1}&type=q", sGTranID, sGameAbbre);
                                //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面.
                                resHandler.doShow(sUrl);
                                sRes = "0";
                            }
                            else
                            {
                                //sMsg = "<script>alert('充值武林币成功!游戏兑换失败!如有问题请与客服联系!');</script>";
                                sRes = "-3";
                            }
                        }
                    }
                    else
                    {
                        sRes = "-4";
                    }
                }
                else
                {
                    //当做不成功处理
                    sRes = "-1";
                }
            }
            else
            {
                sRes = "-2";
            }
            return(sRes);
        }
Ejemplo n.º 5
0
        public static string YeePaySubmit()
        {
            string sRes = string.Empty;
            // 校验返回数据包
            BuyCallbackResult result = Buy.VerifyCallback(p1_MerId, keyValue, Buy.GetQueryString("r0_Cmd"), Buy.GetQueryString("r1_Code"), Buy.GetQueryString("r2_TrxId"),
                                                          Buy.GetQueryString("r3_Amt"), Buy.GetQueryString("r4_Cur"), Buy.GetQueryString("r5_Pid"), Buy.GetQueryString("r6_Order"), Buy.GetQueryString("r7_Uid"),
                                                          Buy.GetQueryString("r8_MP"), Buy.GetQueryString("r9_BType"), Buy.GetQueryString("rp_PayDate"), Buy.GetQueryString("hmac"));

            if (string.IsNullOrEmpty(result.ErrMsg))    //校验返回数据包成功
            {
                StringBuilder sbText = new StringBuilder();
                if (result.R1_Code == "1")      //返回充值成功的标识
                {
                    if (result.R9_BType == "1") //返回方式1:浏览器重定向方式
                    {
                        string  sTranID  = result.R6_Order;
                        decimal dPrice   = decimal.Parse(result.R3_Amt);
                        string  sAccount = result.R8_MP;
                        int     iResNum  = TransPBLL.PointSalesCommit(sTranID, sAccount, dPrice);
                        if (0 == iResNum)
                        {
                            sbText.Append("1|");
                            sbText.Append(result.R6_Order);
                            sRes = sbText.ToString();
                        }
                        else
                        {
                            if (6 == iResNum)
                            {
                                sbText.Append("1|");
                                sbText.Append(result.R6_Order);
                                sRes = sbText.ToString();
                            }
                            else
                            {
                                sbText.Append("2|");
                                sbText.Append(result.R6_Order);
                                sRes = sbText.ToString();
                            }
                        }
                    }
                    else if (result.R9_BType == "2")
                    {
                        int iRes = TransPBLL.PointSalesCommit(result.R6_Order, result.R8_MP, decimal.Parse(result.R3_Amt));
                        sRes = "4";
                    }
                    else if (result.R9_BType == "3")
                    {
                        sRes = "4";
                    }
                }
                else
                {
                    sbText.Append("0|");
                    sbText.Append(result.R1_Code);
                    sRes = sbText.ToString();
                }
            }
            else
            {
                sRes = "0|valerr";
            }
            return(sRes);
        }