Beispiel #1
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);
        }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //创建PayResponseHandler实例
        PayResponseHandler resHandler = new PayResponseHandler(Context);

        resHandler.setKey(TenpayUtil.tenpay_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");

            if ("0".Equals(pay_result))
            {
                //------------------------------
                //处理业务开始
                //------------------------------

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

                //------------------------------
                //处理业务完毕
                //------------------------------

                //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面.
                resHandler.doShow(TenpayUtil.tenpay_show);
            }
            else
            {
                //当做不成功处理
                Response.Write("支付失败");
            }
        }
        else
        {
            Response.Write("认证签名失败");
            //string debugInfo = resHandler.getDebugInfo();
            //Response.Write("<br/>debugInfo:" + debugInfo);
        }
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.User.Identity.Name == null || Page.User.Identity.Name.Trim() == "")
        {
            Response.Redirect("../Login.aspx");
        }
        string loginname = Page.User.Identity.Name;

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

        resHandler.setKey(key);

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

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

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

                //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面.
                resHandler.doShow("http://member.topfo.com/PayManage/show.aspx");
            }
            else
            {
                Response.Write("支付失败");         //当做不成功处理
            }
        }
        else
        {
            Response.Write("认证签名失败");
            //string debugInfo = resHandler.getDebugInfo();
            //Response.Write("<br/>debugInfo:" + debugInfo);
        }
    }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //密钥
            string key = TenpayParameters.Key;

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

            resHandler.setKey(key);

            //判断签名
            if (resHandler.isTenpaySign())
            {
                //交易单号
                string trade_no = resHandler.getParameter("transaction_id");
                //金额金额,以分为单位
                decimal total_fee = Convert.ToDecimal(resHandler.getParameter("total_fee")) / 100;
                //支付结果
                string pay_result = resHandler.getParameter("pay_result");
                //订单号
                string order_no = resHandler.getParameter("sp_billno");
                //支付账号
                string buyer_email = "";
                EyouSoft.IBLL.TicketStructure.ITicketOrder orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance();
                string sWord = "Notify_URL:trade_no=" + trade_no + "\n total_fee:sign=" + total_fee + "&order_no=" + order_no + "";

                IList <EyouSoft.Model.TicketStructure.TicketPay> payList = orderBll.GetPayList("", EyouSoft.Model.TicketStructure.ItemType.供应商付款到平台_购买运价, order_no, "");
                if ("0".Equals(pay_result))
                {
                    //为了保证不被重复调用,或重复执行数据库更新程序,请判断该笔交易状态是否是订单未处理状态
                    //string order_no="201011080010";
                    //string trade_no="2010110861004313";
                    //string total_fee="0.01";
                    //string buyer_email="*****@*****.**";
                    //string seller_mailer="*****@*****.**";
                    if (payList != null && payList.Count > 0)
                    {
                        if (payList[0].PayState != EyouSoft.Model.TicketStructure.PayState.交易完成)
                        {
                            EyouSoft.BLL.TicketStructure.FreightBuyLog.CreateInstance().PayAfter(trade_no, total_fee, EyouSoft.Model.TicketStructure.PayState.交易完成, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, "", order_no, DateTime.Now, "");
                            //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示show.aspx页面.

                            // AlipayFunction.log_result(Server.MapPath("../log/运价购买 " + order_no + "-" + DateTime.Now.ToString().Replace(":", "")) + ".txt", sWord + "||支付完成,修改状态完成");
                            resHandler.doShow(string.Format(Domain.UserBackCenter + "/TicketsCenter/tenpay/Show.aspx?logId={0}", payList[0].ItemId));
                        }
                        if (payList[0].PayState != EyouSoft.Model.TicketStructure.PayState.交易完成)
                        {
                            // AlipayFunction.log_result(Server.MapPath("../log/运价购买 " + order_no + "-" + DateTime.Now.ToString().Replace(":", "")) + ".txt", sWord + "||支付完成,修改状态未完成!");
                            resHandler.doShow(string.Format(Domain.UserBackCenter + "/TicketsCenter/tenpay/Show.aspx?logId={0}", payList[0].ItemId));
                        }
                    }
                    else
                    {
                        // AlipayFunction.log_result(Server.MapPath("../log/运价购买 " + order_no + "-" + DateTime.Now.ToString().Replace(":", "")) + ".txt", sWord + "||payList count 为0!");
                        Response.Write("未找到相关订单!");
                        //Response.Write("trade_status=" + Request.QueryString["trade_status"]);
                    }
                }
                else
                {
                    // AlipayFunction.log_result(Server.MapPath("../log/运价购买 " + order_no + "-" + DateTime.Now.ToString().Replace(":", "")) + ".txt", sWord + "||交易失败");
                    Response.Write("交易失败");
                    Response.Write("trade_status=" + Request.QueryString["trade_status"]);
                }
            }

            //获取debug信息,建议把debug信息写入日志,方便定位问题

            else
            {
                Response.Write("认证签名失败");
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //密钥
            string key = TenpayParameters.Key;

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

            resHandler.setKey(key);

            //判断签名
            if (resHandler.isTenpaySign())
            {
                //交易单号
                string trade_no = resHandler.getParameter("transaction_id");
                //金额金额,以分为单位
                decimal total_fee = decimal.Parse(resHandler.getParameter("total_fee")) / 100;
                //支付结果
                string pay_result = resHandler.getParameter("pay_result");
                //订单号
                string order_no = resHandler.getParameter("sp_billno");
                //支付账号
                string buyer_email = "";


                EyouSoft.IBLL.TicketStructure.ITicketOrder orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance();
                EyouSoft.Model.TicketStructure.OrderInfo   info     = orderBll.GetOrderInfoByNo(order_no);
                if (info.OrderState == EyouSoft.Model.TicketStructure.OrderState.审核通过)
                {
                    IList <EyouSoft.Model.TicketStructure.TicketCompanyAccount> list = EyouSoft.BLL.TicketStructure.TicketCompanyAccount.CreateInstance().GetTicketCompanyAccountList(info.SupplierCId); //获取供应商所有账户
                    string sellAccount = "";                                                                                                                                                             //供应商账户
                    EyouSoft.Model.TicketStructure.TicketCompanyAccount accountModel = list.FirstOrDefault(i => i.InterfaceType == EyouSoft.Model.TicketStructure.TicketAccountType.财付通);                //获取供应商账户实体
                    if (accountModel != null)
                    {
                        sellAccount = accountModel.AccountNumber;//赋值供应商账户
                    }
                    string  batchNo   = "";
                    decimal IntoRatio = decimal.Parse(TenpayParameters.TongyeFee);
                    IList <EyouSoft.Model.TicketStructure.TicketPay> payList = orderBll.GetPayList(info.OrderId, EyouSoft.Model.TicketStructure.ItemType.采购商付款到平台_订单, order_no, null);
                    if ("0".Equals(pay_result))
                    {
                        if (payList != null && payList.Count > 0)
                        {
                            orderBll.PayAfterCallBack(trade_no, total_fee, EyouSoft.Model.TicketStructure.PayState.交易完成, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, buyer_email, "", order_no, DateTime.Now, "");
                        }
                        else
                        {
                            orderBll.PayBefore(info.OrderId, order_no, sellAccount, IntoRatio, info.BuyerUId, info.BuyerCId, total_fee, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, info.SupplierCId, "", out batchNo);
                            orderBll.PayAfterCallBack(trade_no, total_fee, EyouSoft.Model.TicketStructure.PayState.交易完成, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, buyer_email, "", order_no, DateTime.Now, "");
                        }

                        //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示show.aspx页面.
                        resHandler.doShow(string.Format("/AirTickets/tenpay/directpay/Show.aspx?order_no={0}&total_fee={1}&result={2}", order_no, total_fee, "1"));
                    }
                    else
                    {
                        //当做不成功处理
                        if (payList != null && payList.Count > 0)
                        {
                            orderBll.PayAfterCallBack(trade_no, total_fee, EyouSoft.Model.TicketStructure.PayState.交易失败, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, buyer_email, "", order_no, DateTime.Now, "");
                        }
                        else
                        {
                            orderBll.PayBefore(info.OrderId, order_no, sellAccount, IntoRatio, info.BuyerUId, info.BuyerCId, total_fee, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, info.SupplierCId, "", out batchNo);
                            orderBll.PayAfterCallBack(trade_no, total_fee, EyouSoft.Model.TicketStructure.PayState.交易失败, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, buyer_email, "", order_no, DateTime.Now, "");
                        }
                        resHandler.doShow(string.Format("/AirTickets/tenpay/directpay/Show.aspx?order_no={0}&total_fee={1}&result={2}", order_no, total_fee, "0"));
                        //Response.Write("支付失败");
                    }
                }

                //获取debug信息,建议把debug信息写入日志,方便定位问题
                //string debuginfo = resHandler.getDebugInfo();
                //Response.Write("<br/>debuginfo:" + debuginfo + "<br/>");
            }
            else
            {
                Response.Write("认证签名失败");
            }
        }
Beispiel #6
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);
        }