예제 #1
0
    //支付成功时执行的操作
    private void PayOrder_Success(WxPayData result)
    {
        ZLLog.L(ZLEnum.Log.pay, PayPlat + " 支付单:" + result.GetValue("out_trade_no") + " 金额:" + result.GetValue("total_fee"));
        try
        {
            M_Order_PayLog paylogMod = new M_Order_PayLog();
            M_Payment      pinfo     = payBll.SelModelByPayNo(result.GetValue("out_trade_no").ToString());
            if (pinfo == null)
            {
                throw new Exception("支付单不存在");
            }                                                    //支付单检测合为一个方法
            if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
            {
                throw new Exception("支付单状态不为未支付");
            }
            pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
            pinfo.PlatformInfo = PayPlat;
            pinfo.SuccessTime  = DateTime.Now;
            pinfo.PayTime      = DateTime.Now;
            pinfo.CStatus      = true;
            //1=100,
            double tradeAmt = Convert.ToDouble(result.GetValue("total_fee")) / 100;
            pinfo.MoneyTrue = tradeAmt;
            payBll.Update(pinfo);
            DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
            foreach (DataRow dr in orderDT.Rows)
            {
                M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                //if (orderMod.Ordertype == (int)M_OrderList.OrderEnum.Purse)
                //{

                //    M_UserInfo mu = buser.SelReturnModel(orderMod.Userid);
                //    new B_Shop_MoneyRegular().AddMoneyByMin(mu, orderMod.Ordersamount, ",订单号[" + orderMod.OrderNo + "]");
                //}
                orderCom.SendMessage(orderMod, paylogMod, "payed");
                //orderCom.SaveSnapShot(orderMod);
                //发送微信消息
                B_UserAPP  userappBll = new B_UserAPP();
                M_UserAPP  userappMod = new M_UserAPP();
                M_UserInfo mu         = buser.GetUserByUserID(orderMod.Userid);
                userappMod = userappBll.SelModelByUid(mu.UserID, "wechat");
                if (userappMod != null)
                {
                    WxAPI  wxapi = WxAPI.Code_Get(1);
                    string json  = "{\"first\":{\"value\":\"您已成功支付" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#000\"},\"DateTime\":{\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"PayAmount\":{\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"您的订单已成功付款!订单号:" + orderMod.OrderNo + "\",\"color\":\"#173177\"}}";
                    wxapi.Tlp_SendTlpMsg(userappMod.OpenID, "jAP4eGIOPvCdg33KBVDcClxRGYNNgcUpmHlVdO_FRV0", SiteConfig.SiteInfo.SiteUrl + "/User/Order/OrderProList?OrderNo=" + orderMod.OrderNo, json);
                }
            }
            ZLLog.L(ZLEnum.Log.pay, PayPlat + "成功!支付单:" + result.GetValue("out_trade_no").ToString());
        }
        catch (Exception ex)
        {
            ZLLog.L(ZLEnum.Log.pay, new M_Log()
            {
                Action  = "支付回调报错",
                Message = PayPlat + ",支付单:" + result.GetValue("out_trade_no").ToString() + ",原因:" + ex.Message
            });
        }
    }
예제 #2
0
        //修改合计金额(单店铺)
        protected void ChangeMoney_Btn_Click(object sender, EventArgs e)
        {
            orderinfo              = oll.GetOrderListByid(Mid);
            orderinfo.Freight      = DataConverter.CDouble(PI_OrderExpMoney_T.Text);
            orderinfo.Ordersamount = DataConverter.CDouble(PI_OrdersMoney_T.Text) + orderinfo.Freight;
            M_Payment payMod = GetPayment(orderinfo);

            if (payMod != null)
            {
                if (payMod.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    function.WriteErrMsg("该订单已支付过,不可修改金额");
                }
                payMod.MoneyReal = orderinfo.Ordersamount;
                payMod.MoneyPay  = orderinfo.Ordersamount;
                payBll.Update(payMod);
            }
            if (orderinfo.Freight < 0 || orderinfo.Ordersamount < 0)
            {
                function.WriteErrMsg("指定的金额不正确");
            }
            M_Order_OPLog logMod = logBll.NewLog(Mid, "修改金额", orderinfo.Ordersamount.ToString());

            oll.Update(orderinfo); logBll.Insert(logMod);
            Response.Redirect(Request.RawUrl);
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            M_PayPlat platmod  = platBll.SelModelByClass(M_PayPlat.Plat.ECPSS);
            string    md5key   = platmod.MD5Key;
            string    billno   = Request["BillNo"];
            string    amount   = Request["Amount"];
            string    result   = Request["Result"];
            string    Succeed  = Request["Succeed"];
            string    signinfo = Request["SignMD5info"];
            string    md5src   = billno + "&" + amount + "&" + Succeed + "&" + md5key;

            if (signinfo.Equals(FormsAuthentication.HashPasswordForStoringInConfigFile(md5src, "MD5")))
            {
                ZLLog.L(ZLEnum.Log.pay, "汇潮支付 交易状态:" + result + " 支付单:" + billno + " 金额:" + amount);
                if (!Succeed.Equals("88"))
                {
                    ZLLog.L(ZLEnum.Log.pay, "贝付交易失败!支付单:" + billno); return;
                }
                try
                {
                    M_Payment pinfo = payBll.SelModelByPayNo(billno);
                    if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                    {
                        return;
                    }
                    pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
                    pinfo.PlatformInfo = "汇潮支付";       //平台反馈信息
                    pinfo.SuccessTime  = DateTime.Now; //交易成功时间
                    pinfo.CStatus      = true;         //处理状态
                    pinfo.MoneyTrue    = Convert.ToDouble(amount);
                    payBll.Update(pinfo);
                    DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                    foreach (DataRow dr in orderDT.Rows)
                    {
                        M_Order_PayLog paylogMod = new M_Order_PayLog();
                        M_OrderList    orderMod  = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                        OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                    }
                    Response.Write("ok");
                    ZLLog.L(ZLEnum.Log.pay, "汇潮平台支付成功!支付单:" + billno);
                }
                catch (Exception ex)
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action  = "支付回调报错",
                        Message = "平台:汇潮,支付单:" + billno + ",原因:" + ex.Message
                    });
                    Response.Write("erro");
                }
            }
            else
            {
                ZLLog.L(ZLEnum.Log.safe, "汇潮验证失败!支付单:" + billno);
                Response.Write("erro");
            }
        }
        //强制成功
        protected void ForceSucc_B_Click(object sender, EventArgs e)
        {
            M_AdminInfo adminMod = B_Admin.GetLogin();
            M_Payment   payMod   = payBll.SelReturnModel(Mid);
            M_OrderList orderMod = orderBll.SelModelByOrderNo(payMod.PaymentNum);

            payMod.Status  = (int)M_Payment.PayStatus.HasPayed;
            payMod.CStatus = true;
            payMod.Remark += "(" + "管理员确认支付,ID:" + adminMod.AdminId + ",登录名:" + adminMod.AdminName + ",真实姓名:" + adminMod.AdminTrueName + ")";
            payBll.Update(payMod);
            OrderHelper.FinalStep(payMod, orderMod, new M_Order_PayLog());
            Response.Redirect(Request.RawUrl);
        }
예제 #5
0
        //支付成功时执行的操作
        private void PayOrder_Success(M_Payment pinfo, WxPayData result)
        {
            ZLLog.L(ZLEnum.Log.pay, PayPlat + " 支付单:" + result.GetValue("out_trade_no") + " 金额:" + result.GetValue("total_fee"));
            try
            {
                M_Order_PayLog paylogMod = new M_Order_PayLog();
                if (pinfo == null)
                {
                    throw new Exception("支付单不存在");
                }                                                    //支付单检测合为一个方法
                if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    throw new Exception("支付单状态不为未支付");
                }
                pinfo.Status        = (int)M_Payment.PayStatus.HasPayed;
                pinfo.PlatformInfo += PayPlat;
                pinfo.SuccessTime   = DateTime.Now;
                pinfo.PayTime       = DateTime.Now;
                pinfo.CStatus       = true;
                //1=100,
                double tradeAmt = Convert.ToDouble(result.GetValue("total_fee")) / 100;
                pinfo.MoneyTrue = tradeAmt;
                payBll.Update(pinfo);
                DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                foreach (DataRow dr in orderDT.Rows)
                {
                    M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                    OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                    //if (orderMod.Ordertype == (int)M_OrderList.OrderEnum.Purse)
                    //{

                    //    M_UserInfo mu = buser.SelReturnModel(orderMod.Userid);
                    //    new B_Shop_MoneyRegular().AddMoneyByMin(mu, orderMod.Ordersamount, ",订单号[" + orderMod.OrderNo + "]");
                    //}
                    orderCom.SendMessage(orderMod, paylogMod, "payed");
                    //orderCom.SaveSnapShot(orderMod);
                }
                ZLLog.L(ZLEnum.Log.pay, PayPlat + "成功!支付单:" + result.GetValue("out_trade_no").ToString());
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付回调报错",
                    Message = PayPlat + ",支付单:" + result.GetValue("out_trade_no").ToString() + ",原因:" + ex.Message
                });
            }
        }
예제 #6
0
 //支付成功时执行的操作
 private void PayOrder_Success(WxPayData result)
 {
     ZLLog.L(ZLEnum.Log.pay, PayPlat + " 支付单:" + result.GetValue("out_trade_no") + " 金额:" + result.GetValue("total_fee"));
     try
     {
         M_Order_PayLog paylogMod = new M_Order_PayLog();
         M_Payment      pinfo     = payBll.SelModelByPayNo(result.GetValue("out_trade_no").ToString());
         if (pinfo == null)
         {
             throw new Exception("支付单不存在");
         }                                                    //支付单检测合为一个方法
         if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
         {
             throw new Exception("支付单状态不为未支付");
         }
         pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
         pinfo.PlatformInfo = PayPlat;
         pinfo.SuccessTime  = DateTime.Now;
         pinfo.PayTime      = DateTime.Now;
         pinfo.CStatus      = true;
         //1=100,
         double tradeAmt = Convert.ToDouble(result.GetValue("total_fee")) / 100;
         pinfo.MoneyTrue = tradeAmt;
         payBll.Update(pinfo);
         DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
         foreach (DataRow dr in orderDT.Rows)
         {
             M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
             OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
             orderCom.SendMessage(orderMod, paylogMod, "payed");
             //orderCom.SaveSnapShot(orderMod);
         }
         ZLLog.L(ZLEnum.Log.pay, PayPlat + "支付成功,支付单:" + result.GetValue("out_trade_no").ToString());
     }
     catch (Exception ex)
     {
         ZLLog.L(ZLEnum.Log.pay, new M_Log()
         {
             Action  = "支付回调报错",
             Message = PayPlat + ",支付单:" + result.GetValue("out_trade_no").ToString() + ",原因:" + ex.Message
         });
     }
 }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ZLLog.L(ZLEnum.Log.pay, "进入双乾支付页");
        string MerNo     = Request.Params["MerNo"].ToString();
        string BillNo    = Request.Params["BillNo"].ToString();
        string Amount    = Request.Params["Amount"].ToString();
        string Succeed   = Request.Params["Succeed"].ToString();
        string Result    = Request.Params["Result"].ToString();
        string MD5info   = Request.Params["MD5info"].ToString();
        string MerRemark = Request.Params["MerRemark"].ToString();

        M_Payment payMod  = payBll.SelModelByPayNo(BillNo);
        M_PayPlat platMod = new M_PayPlat();

        platMod = platBll.SelReturnModel(payMod.PayPlatID);
        if (platMod.PayClass != (int)M_PayPlat.Plat.EPay95)
        {
            ZLLog.L(ZLEnum.Log.safe, "回调页面错误" + Request.RawUrl);
        }
        string MD5key = platMod.MD5Key;//Md5加密私钥[注册时产生]
        string md5md5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(MD5key, "MD5").ToUpper();
        string md5src = "Amount=" + Amount + "&BillNo=" + BillNo + "&MerNo=" + MerNo + "&Succeed=" + Succeed + "&" + md5md5;
        string md5str = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5src, "MD5").ToUpper();

        try { ZLLog.L(ZLEnum.Log.labelex, "双乾详情:" + md5src); }
        catch (Exception ex) { ZLLog.L(ZLEnum.Log.labelex, "双乾未完成记录" + ex.Message); }
        if (MD5info.Equals(md5str))
        {
            if (!Succeed.Equals("88"))
            {
                ZLLog.L(ZLEnum.Log.pay, "支付单:" + BillNo + ", 支付状态非成功,取消处理!" + md5src); return;
            }
            try
            {
                M_Payment pinfo = payBll.SelModelByPayNo(BillNo);
                if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    return;
                }
                pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
                pinfo.PlatformInfo = "双乾坤支付";      //平台反馈信息
                pinfo.SuccessTime  = DateTime.Now; //交易成功时间
                pinfo.CStatus      = true;         //处理状态
                pinfo.MoneyTrue    = Convert.ToDecimal(Amount);
                payBll.Update(pinfo);

                //-------支付成功处理,发送邮件
                M_OrderList orderMod1 = orderBll.SelModelByOrderNo(pinfo.PaymentNum);
                B_User      userBll   = new B_User();
                M_UserInfo  info      = userBll.GetSelect(pinfo.UserID);
                MailInfo    mailInfo  = new MailInfo();
                mailInfo.IsBodyHtml = true;
                mailInfo.FromName   = SiteConfig.SiteInfo.SiteName;
                MailAddress address = new MailAddress(info.Email);
                mailInfo.ToAddress = address;
                mailInfo.MailBody  = "尊敬的" + info.UserName + ",您的入金订单" + orderMod1.OrderNo + "购买生效<br/>金额:" + String.Format("{0:N2}", orderMod1.Ordersamount) + "<br/>您可进入<a href='" + SiteConfig.SiteInfo.SiteUrl + "/User/Info/ConsumeDetail.aspx?SType=1'>会员中心</a>查看充值记录<br/>如有任何问题请访问我们网站<a href='" + SiteConfig.SiteInfo.SiteUrl + "'>" + SiteConfig.SiteInfo.SiteUrl + "</a>,联系我们!";
                mailInfo.Subject   = SiteConfig.SiteInfo.SiteName + "网站会员入金提醒";
                SendMail.Send(mailInfo);

                DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                foreach (DataRow dr in orderDT.Rows)
                {
                    M_Order_PayLog paylogMod = new M_Order_PayLog();
                    M_OrderList    orderMod  = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                    FinalStep(pinfo, orderMod, paylogMod);
                    //orderCom.SendMessage(orderMod, paylogMod, "payed");
                    //orderCom.SaveSnapShot(orderMod);
                }
                //Response.Write("OK");
                ZLLog.L(ZLEnum.Log.pay, "完成支付" + BillNo);
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付回调报错",
                    Message = "平台:双乾,支付单:" + BillNo + ",原因:" + ex.Message
                });
            }
        }
        else
        {
            ZLLog.L(ZLEnum.Log.pay, "双乾验证失败!支付单:" + BillNo);
        }
    }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string spliteFlag  = "&signMsg=";
                string requestStr  = Request.Form.ToString();
                string srcStr      = requestStr.Substring(0, requestStr.IndexOf(spliteFlag));
                string signStr     = requestStr.Substring(requestStr.IndexOf(spliteFlag) + spliteFlag.Length);
                string spliteFlag2 = "&notifyType=";//0为页面通知,1为异步通知
                int    pos         = signStr.IndexOf(spliteFlag2);
                if (pos > 0)
                {
                    signStr = signStr.Substring(0, pos);
                }
                else
                {
                    pos = srcStr.IndexOf(spliteFlag2);
                    if (pos > 0)
                    {
                        srcStr = srcStr.Substring(0, pos);
                    }
                }
                signStr = System.Web.HttpUtility.UrlDecode(signStr);
                bool verifyResult = Mobo360SignUtil.Instance.verifyData(signStr, srcStr);
                //NotifyType 1:异步,0:同步
                //apiName=PAY_RESULT_NOTIFY&notifyTime=20150327093653&tradeAmt=0.01&merchNo=210001110003583&merchParam=&orderNo=PD12&tradeDate=20150327&accNo=761003&accDate=20150327&orderStatus=1&signMsg=YIfQ7JGp4MIe5hu19lEmWF22aM9xcaL5LqMKlddEv4L7V2vv36qtPKwdS40HOLX1aaVHXgCnwoXnHacrXghRxvM3B1yFuKcCC2q5HnRBnN3Pxg%2bmBUt5WKMJwOC6VbJgqAQvW4UYaubVl7V4TGbAoYGjWuuIFWRthAacPdpK%2bH4%3d&notifyType=1
                //apiName=PAY_RESULT_NOTIFY&notifyTime=20150327094538&tradeAmt=0.01&merchNo=210001110003583&merchParam=&orderNo=PD13&tradeDate=20150327&accNo=761140&accDate=20150327&orderStatus=1&notifyType=0&signMsg=dIUoegWS2HgtHlHwz1i62oYPfGyqgNi5HW%2bew734APG0O9xKLHXbR9atFDxwZpXtovQ7wjPuYgqtwD0R0VsNIr5ceA8dlRETepKo0D8Gi1Z4iGtW3UZ%2f92T8ILMRXEw3fUOMTMxyxk265A0VlAla9pCqMMd8QC5pxNoPWOwKFfo%3d
                #region 校验并更改状态
                //if (verifyResult)//其无法通过自己校验
                //{

                //}
                //else { B_Site_Log.Insert("MO宝校验失败", requestStr); }
                string     orderNo    = Request.Form["orderNo"];//订单号
                string     notifyType = Request.Form["notifyType"];
                double     tradeAmt   = DataConverter.CDouble(Request.Form["tradeAmt"]);
                M_UserInfo mu         = buser.GetLogin(false);
                try
                {
                    if (notifyType.Equals("0"))
                    {
                        function.WriteErrMsg("支付成功"); return;
                    }
                    if (notifyType.Equals("1"))
                    {
                        M_Payment pinfo = payBll.SelModelByPayNo(orderNo);
                        if (pinfo.Status == 3)
                        {
                            return;
                        }
                        pinfo.Status       = 3;
                        pinfo.PlatformInfo = "MO宝在线付款";
                        pinfo.SuccessTime  = DateTime.Now;
                        pinfo.PayTime      = DateTime.Now;
                        pinfo.CStatus      = true;
                        pinfo.MoneyTrue    = tradeAmt;
                        payBll.Update(pinfo);
                        DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                        foreach (DataRow dr in orderDT.Rows)
                        {
                            M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                            if (orderMod.OrderStatus >= 99)
                            {
                                return;                            //订单已处理,避免重复
                            }
                            else
                            {
                                orderBll.UpOrderinfo("Paymentstatus=1,Receivablesamount=" + tradeAmt, orderMod.id);
                            }
                            orderCom.SendMessage(orderMod, paylogMod, "payed");
                            paylogMod.Remind += "订单" + orderMod.OrderNo + "购买生效";
                            FinalStep(orderMod);
                            //-------支付成功处理,并写入日志
                            paylogMod.OrderID   = orderMod.id;
                            paylogMod.UserID    = mu.UserID;
                            paylogMod.PayMethod = (int)M_Order_PayLog.PayMethodEnum.Other;
                            paylogMod.PayMoney  = orderMod.Ordersamount;
                            paylogMod.PayPlatID = 16;
                            paylogBll.insert(paylogMod);
                            Response.Write("SUCCESS"); // 验证签名通过后,商户系统回写“SUCCESS”以表明商户收到了通知
                            B_Site_Log.Insert(pinfo.PaymentNum + ":MO宝处理成功", "状态:" + requestStr);
                        }
                    }
                }
                catch (Exception ex) { B_Site_Log.Insert(orderNo + ":MO宝支付处理失败", "原因:" + ex.Message + ":" + requestStr); }
                #endregion
            }
        }
예제 #9
0
    //支付成功时执行的操作
    private void PayOrder_Success(WxPayData result)
    {
        ZLLog.L(ZLEnum.Log.pay, "微信:微信支付 支付单:" + result.GetValue("out_trade_no") + " 金额:" + result.GetValue("total_fee"));
        try
        {
            M_Order_PayLog paylogMod = new M_Order_PayLog();
            M_Payment      pinfo     = payBll.SelModelByPayNo(result.GetValue("out_trade_no").ToString());
            if (pinfo == null)
            {
                throw new Exception("支付单不存在");
            }                                                    //支付单检测合为一个方法
            if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
            {
                throw new Exception("支付单状态不为未支付");
            }
            pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
            pinfo.PlatformInfo = "微信扫码|公众号支付";
            pinfo.SuccessTime  = DateTime.Now;
            pinfo.PayTime      = DateTime.Now;
            pinfo.CStatus      = true;
            //1=100,
            double tradeAmt = Convert.ToDouble(result.GetValue("total_fee")) / 100;
            pinfo.MoneyTrue = tradeAmt;
            payBll.Update(pinfo);
            DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
            foreach (DataRow dr in orderDT.Rows)
            {
                M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                if (orderMod.Ordertype == (int)M_OrderList.OrderEnum.Purse)
                {
                    M_UserInfo mu = buser.SelReturnModel(orderMod.Userid);
                    new B_Shop_MoneyRegular().AddMoneyByMin(mu, orderMod.Ordersamount, ",订单号[" + orderMod.OrderNo + "]");
                }
                orderCom.SendMessage(orderMod, paylogMod, "payed");
                //orderCom.SaveSnapShot(orderMod);

                if (orderMod.Ordertype != 6)
                {
                    buser.ChangeVirtualMoney(orderMod.Userid, new M_UserExpHis()
                    {
                        score     = orderMod.Ordersamount,
                        ScoreType = 3,
                        detail    = "在线消费赠送积分:" + orderMod.Ordersamount
                    });
                }
                //订单返利
                OrderRebates(orderMod.Userid, orderMod.Ordersamount);
                //订单打印
                int orderID  = DataConvert.CLng(dr["ID"].ToString());
                int StoreID  = DataConvert.CLng(dr["StoreID"].ToString());
                int devID    = GetPrintDevice(StoreID);  //设备ID
                int tlpID    = GetPrintModelID(StoreID); //模板ID
                int printnum = GetPrintNum(StoreID);
                //------------------------------
                DataTable          orderDT1 = DBCenter.Sel("ZL_OrderInfo", "ID=" + orderID);
                M_Shop_PrintTlp    tlpMod   = tlpBll.SelReturnModel(tlpID);
                M_Shop_PrintDevice devMod   = devBll.SelReturnModel(devID);
                string             msg      = orderCOM.TlpDeal(tlpMod.Content, orderDT1);
                ZLLog.L(ZLEnum.Log.pay, msg);
                msgBll.Insert(msg, tlpMod.ID, devMod, printnum);
                //function.WriteSuccessMsg("信息已发送", "MessageList.aspx");

                //发送微信通知
                try
                {
                    userappMod = userappBll.SelModelByUid(DataConvert.CLng(dr["UserID"]), "wechat");
                    if (userappMod != null)
                    {
                        WxAPI wxapi = WxAPI.Code_Get(1);
                        if (dr["Ordertype"].ToString() == "6")
                        {
                            M_UserInfo userMod = buser.GetUserByUserID(DataConvert.CLng(dr["UserID"]));
                            wxapi.Tlp_SendTlpMsg(userappMod.OpenID, "vRUiDj-k6EGjwQC2GO4oU1G37CJjiu2fZ-ePBj1jJ60", "http://v.wodian8.com/User/Order/OrderList1.aspx", "{\"first\": {\"value\":\"您好,您已经充值成功。\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + DataConvert.CDouble(dr["Ordersamount"]).ToString("0.00") + "\",\"color\":\"#173177\"},\"keyword2\": {\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + userMod.Purse.ToString("0.00") + "\",\"color\":\"#173177\"},\"remark\":{\"value\":\"感谢您对我们的信任,我们将为您提供更优质的服务。\",\"color\":\"#173177\"}}");
                        }
                        else
                        {
                            wxapi.Tlp_SendTlpMsg(userappMod.OpenID, "E-yWv8GVKeJHymtTB0zOGKnEv6LXodjr-M6tj1sLzfM", "http://v.wodian8.com/User/Order/OrderList1.aspx", "{\"first\": {\"value\":\"您的订单支付成功!\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + dr["OrderNo"].ToString() + "\",\"color\":\"#173177\"},\"keyword2\": {\"value\":\"" + GetProname(DataConvert.CLng(dr["ID"])) + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + DataConvert.CDouble(dr["Ordersamount"]).ToString("0.00") + "\",\"color\":\"#173177\"},\"keyword4\": {\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"remark\":{\"value\":\"点击查看订单详情!\",\"color\":\"#173177\"}}");
                        }
                    }
                }
                catch (Exception ex)
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action  = "发送微信通知报错",
                        Message = "原因:" + ex.Message
                    });
                    throw;
                }
            }
            ZLLog.L(ZLEnum.Log.pay, "微信支付成功!支付单:" + result.GetValue("out_trade_no").ToString());
        }
        catch (Exception ex)
        {
            ZLLog.L(ZLEnum.Log.pay, new M_Log()
            {
                Action  = "支付回调报错",
                Message = "平台:微信,支付单:" + result.GetValue("out_trade_no").ToString() + ",原因:" + ex.Message
            });
        }
    }
예제 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string    MemberID       = Request.Params["MemberID"];          //商户号
            string    TerminalID     = Request.Params["TerminalID"];        //商户终端号
            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签名
            M_Payment payMod         = payBll.SelModelByPayNo(TransID);
            M_PayPlat platMod        = new M_PayPlat();

            platMod = platBll.SelReturnModel(payMod.PayPlatID);
            if (platMod.PayClass != (int)M_PayPlat.Plat.BaoFo)
            {
                function.WriteErrMsg("回调页面错误");
            }
            String mark      = "~|~";//分隔符
            string _WaitSign = "MemberID=" + MemberID + mark + "TerminalID=" + TerminalID + mark + "TransID=" + TransID + mark + "Result=" + Result + mark + "ResultDesc=" + ResultDesc + mark
                               + "FactMoney=" + FactMoney + mark + "AdditionalInfo=" + AdditionalInfo + mark + "SuccTime=" + SuccTime
                               + mark + "Md5Sign=" + platMod.MD5Key;

            if (Md5Sign.ToLower() == StringHelper.MD5(_WaitSign).ToLower())
            {
                ZLLog.L(ZLEnum.Log.pay, "宝付:" + ResultDesc + " 支付结果:" + Result + " 支付单:" + TransID + " 金额:" + FactMoney);
                try
                {
                    M_Payment pinfo = payBll.SelModelByPayNo(TransID);
                    if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                    {
                        return;
                    }
                    pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
                    pinfo.PlatformInfo = "宝付在线付款";                            //平台反馈信息
                    pinfo.SuccessTime  = DateTime.Now;                        //交易成功时间
                    pinfo.CStatus      = true;                                //处理状态
                    pinfo.MoneyTrue    = (Convert.ToDouble(FactMoney) / 100); //其以分为单位
                    payBll.Update(pinfo);
                    DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                    foreach (DataRow dr in orderDT.Rows)
                    {
                        M_Order_PayLog paylogMod = new M_Order_PayLog();
                        M_OrderList    orderMod  = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                        OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                        orderCom.SendMessage(orderMod, paylogMod, "payed");
                        //orderCom.SaveSnapShot(orderMod);
                    }
                    Response.Write("OK");
                    ZLLog.L(ZLEnum.Log.pay, "宝付平台支付成功!支付单:" + TransID);
                }
                catch (Exception ex)
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action  = "支付回调报错",
                        Message = "平台:宝付,支付单:" + TransID + ",原因:" + ex.Message
                    });
                }
            }
            else
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付验证失败",
                    Message = "平台:宝付,支付单:" + TransID
                });
                Response.Write("Md5CheckFail");
            }
        }
예제 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string md5sign      = Request.Params["sign"];
            string notify_id    = Request.Params["notify_id"];
            string out_trade_no = Request.Params["out_trade_no"];
            string subject      = Request.Params["subject"];
            string payment_type = Request.Params["payment_type"];
            string trade_status = Request.Params["trade_status"];//交易状态,TRADE_FINISHED 表示成功
            string total_fee    = Request.Params["total_fee"];
            string seller_id    = Request.Params["seller_id"];

            string[] paramkeys = new string[Request.QueryString.AllKeys.Length];
            Request.QueryString.AllKeys.CopyTo(paramkeys, 0);
            Array.Sort(paramkeys);
            string paramstr = "";

            foreach (string item in paramkeys)
            {
                if (!item.Equals("sign"))
                {
                    paramstr += string.Format("{0}={1}&", item, Request.QueryString[item]);
                }
            }
            M_Payment payMod  = payBll.SelModelByPayNo(out_trade_no);
            M_PayPlat platMod = new M_PayPlat();

            platMod = platBll.SelReturnModel(payMod.PayPlatID);
            if (platMod.PayClass != (int)M_PayPlat.Plat.Ebatong)
            {
                ZLLog.L(ZLEnum.Log.safe, "回调页面错误" + Request.RawUrl);
            }
            string sign = new CommonHelper().md5("UTF-8", paramstr.Trim('&') + platMod.MD5Key).ToLower();

            if (sign.Equals(md5sign))
            {
                ZLLog.L(ZLEnum.Log.pay, "贝付:" + subject + " 交易状态:" + trade_status + " 支付单:" + out_trade_no + " 金额:" + total_fee);

                if (!trade_status.Equals("TRADE_FINISHED"))
                {
                    ZLLog.L(ZLEnum.Log.pay, "贝付交易失败!支付单:" + out_trade_no);
                }
                try
                {
                    M_Payment pinfo = payBll.SelModelByPayNo(out_trade_no);
                    if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                    {
                        return;
                    }
                    pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
                    pinfo.PlatformInfo = "贝付通";        //平台反馈信息
                    pinfo.SuccessTime  = DateTime.Now; //交易成功时间
                    pinfo.CStatus      = true;         //处理状态
                    pinfo.MoneyTrue    = Convert.ToDouble(total_fee);
                    payBll.Update(pinfo);
                    DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                    foreach (DataRow dr in orderDT.Rows)
                    {
                        M_Order_PayLog paylogMod = new M_Order_PayLog();
                        M_OrderList    orderMod  = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                        OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                        //orderCom.SendMessage(orderMod, paylogMod, "payed");
                        //orderCom.SaveSnapShot(orderMod);
                    }
                    Response.Write(notify_id);
                    ZLLog.L(ZLEnum.Log.pay, "贝付平台支付成功!支付单:" + out_trade_no);
                }
                catch (Exception ex)
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action  = "支付回调报错",
                        Message = "平台:贝付,支付单:" + out_trade_no + ",原因:" + ex.Message
                    });
                }
            }
            else
            {
                ZLLog.L(ZLEnum.Log.safe, "贝付通验证失败!支付单:" + out_trade_no);
            }
        }
예제 #12
0
        //支付成功时执行的操作
        private void PayOrder_Success(M_Payment pinfo, WxPayData result)
        {
            ZLLog.L(ZLEnum.Log.pay, PayPlat + " 支付单:" + result.GetValue("out_trade_no") + " 金额:" + result.GetValue("total_fee"));
            try
            {
                M_Order_PayLog paylogMod = new M_Order_PayLog();
                if (pinfo == null)
                {
                    throw new Exception("支付单不存在");
                }                                                    //支付单检测合为一个方法
                if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    throw new Exception("支付单状态不为未支付");
                }
                pinfo.Status        = (int)M_Payment.PayStatus.HasPayed;
                pinfo.PlatformInfo += PayPlat;
                pinfo.SuccessTime   = DateTime.Now;
                pinfo.PayTime       = DateTime.Now;
                pinfo.CStatus       = true;
                //1=100,
                double tradeAmt = Convert.ToDouble(result.GetValue("total_fee")) / 100;
                pinfo.MoneyTrue = tradeAmt;
                payBll.Update(pinfo);
                DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                foreach (DataRow dr in orderDT.Rows)
                {
                    M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                    OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                    //if (orderMod.Ordertype == (int)M_OrderList.OrderEnum.Purse)
                    //{

                    //    M_UserInfo mu = buser.SelReturnModel(orderMod.Userid);
                    //    new B_Shop_MoneyRegular().AddMoneyByMin(mu, orderMod.Ordersamount, ",订单号[" + orderMod.OrderNo + "]");
                    //}
                    orderCom.SendMessage(orderMod, paylogMod, "payed");
                    //orderCom.SaveSnapShot(orderMod);
                    M_UserInfo mu   = buser.GetUserByUserID(orderMod.Userid);
                    M_UserInfo pmu1 = buser.SelReturnModel(DataConvert.CLng(mu.ParentUserID));
                    M_UserInfo pmu2 = buser.SelReturnModel(DataConvert.CLng(pmu1.ParentUserID));
                    M_UserInfo pmu3 = buser.SelReturnModel(DataConvert.CLng(pmu2.ParentUserID));

                    //消息推送
                    B_User_Notify notifyBll = new B_User_Notify();
                    M_User_Notify notifyMod = new M_User_Notify();
                    notifyMod.CDate = DateTime.Now;

                    if (!pmu1.IsNull)
                    {
                        B_User_Notify.Add("订单购买消息", "您的初级乐享会员[会员ID:" + mu.UserID + ",微信名:" + mu.TrueName + "]下单成功,订单号为:" + orderMod.OrderNo, pmu1.UserID.ToString());
                    }
                    if (!pmu2.IsNull)
                    {
                        B_User_Notify.Add("订单购买消息", "您的中级乐享会员[会员ID:" + mu.UserID + ",微信名:" + mu.TrueName + "]下单成功,订单号为:" + orderMod.OrderNo, pmu1.UserID.ToString());
                    }
                    if (!pmu3.IsNull)
                    {
                        B_User_Notify.Add("订单购买消息", "您的高级乐享会员[会员ID:" + mu.UserID + ",微信名:" + mu.TrueName + "]下单成功,订单号为:" + orderMod.OrderNo, pmu1.UserID.ToString());
                    }
                    //订单返利
                    //M_UserInfo mu = buser.GetUserByUserID(orderMod.Userid);
                    //M_UserInfo pmu1 = buser.SelReturnModel(DataConvert.CLng(mu.ParentUserID));
                    //M_UserInfo pmu2 = buser.SelReturnModel(DataConvert.CLng(pmu1.ParentUserID));
                    //M_UserInfo pmu3 = buser.SelReturnModel(DataConvert.CLng(pmu2.ParentUserID));
                    //if (!pmu1.IsNull) { OrderRebates(pmu1.UserID, orderMod, mu); }
                    //if (!pmu2.IsNull) { OrderRebates(pmu2.UserID, orderMod, mu); }
                    //if (!pmu3.IsNull) { OrderRebates(pmu3.UserID, orderMod, mu); }
                }
                ZLLog.L(ZLEnum.Log.pay, PayPlat + "成功!支付单:" + result.GetValue("out_trade_no").ToString());
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付回调报错",
                    Message = PayPlat + ",支付单:" + result.GetValue("out_trade_no").ToString() + ",原因:" + ex.Message
                });
            }
        }
예제 #13
0
        //确定,生成信息写入ZL_Payment
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            int         platid   = DataConverter.CLng(Request.Form["payplat_rad"]);
            M_UserInfo  mu       = buser.GetLogin(false);
            M_Payment   pinfo    = new M_Payment();
            M_OrderList orderMod = new M_OrderList();

            if (!string.IsNullOrEmpty(PayNo))//支付单付款
            {
                pinfo = payBll.SelModelByPayNo(PayNo);
                if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    function.WriteErrMsg("该支付单已付款,请勿重复支付"); return;
                }
            }
            else
            {
                DataTable orderDT = orderBll.GetOrderbyOrderNo(OrderNo);
                GetTotal(orderDT, ref price, ref fare, ref allamount);
                if (allamount < 0.01)
                {
                    function.WriteErrMsg("每次划款金额不能低于0.01元");
                }
                if (orderDT != null && orderDT.Rows.Count > 0)
                {
                    orderMod = orderBll.GetOrderListByid(DataConverter.CLng(orderDT.Rows[0]["id"]));
                    orderBll.Update(orderMod);
                }
                pinfo.PaymentNum = OrderNo;
                pinfo.MoneyPay   = allamount;
                DataTable cartDT = new DataTable();
                if (orderMod.id > 0)
                {
                    cartDT       = bcart.GetCartProOrderID(orderMod.id);
                    pinfo.Remark = cartDT.Rows.Count > 1 ? "[" + cartDT.Rows[0]["ProName"] as string + "]等" : cartDT.Rows[0]["ProName"] as string;
                }
                else
                {
                    pinfo.Remark = "没有对应订单";
                }
            }
            pinfo.UserID    = mu.UserID;
            pinfo.PayPlatID = platid;
            pinfo.MoneyID   = 0;
            pinfo.MoneyReal = pinfo.MoneyPay;
            //用于支付宝网银
            pinfo.PlatformInfo = Request.Form["payplat_rad"];
            if (!string.IsNullOrEmpty(PayNo))
            {
                payBll.Update(pinfo);
            }
            else
            {
                pinfo.Status = (int)M_Payment.PayStatus.NoPay;
                pinfo.PayNo  = payBll.CreatePayNo();
                payBll.Add(pinfo);
            }
            string url = "PayOnline.aspx?PayNo=" + pinfo.PayNo + "&StoreID=" + StoreID;

            if (pinfo.PayPlatID == 0)
            {
                url += "&method=" + Request.Form["payplat_rad"];
            }
            Response.Redirect(url);
        }
예제 #14
0
        /*
         * 仅支持支付单
         */
        protected void Page_Load(object sender, EventArgs e)
        {
            B_User.CheckIsLogged(Request.RawUrl);
            M_UserInfo mu = buser.GetLogin(false);

            if (string.IsNullOrEmpty(SiteConfig.SiteInfo.SiteUrl))
            {
                function.WriteErrMsg("错误,管理员未定义网站地址,SiteUrl");
            }
            string siteurl = (SiteConfig.SiteInfo.SiteUrl.TrimEnd('/') + "/PayOnline/");

            if (string.IsNullOrEmpty(PayNo))
            {
                function.WriteErrMsg("请传入支付单号");
            }
            pinfo = paymentBll.SelModelByPayNo(PayNo);
            if (pinfo == null || pinfo.PaymentID < 1)
            {
                function.WriteErrMsg("支付单不存在");
            }
            M_PayPlat payPlat = payPlatBll.SelReturnModel(pinfo.PayPlatID);

            if (!IsPostBack)
            {
                #region 母版页中信息
                logged_div.Visible = true;
                #endregion
                if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    function.WriteErrMsg("支付单不能重复付款");
                }
                Rurl_Href.NavigateUrl = "/Extend/order.aspx";//返回我的订单
                if (pinfo.PaymentNum.Contains("IDC"))
                {
                    Rurl_Href.NavigateUrl = "/Plugins/Domain/ViewHave.aspx";
                }
                string url = Request.CurrentExecutionFilePath;
                urlReq1 = Request.Url.AbsoluteUri.ToString().Substring(0, Request.Url.AbsoluteUri.ToString().LastIndexOf('/'));
                double vmoney   = pinfo.MoneyReal;                //支付金额
                string v_amount = pinfo.MoneyReal.ToString("f2"); //实际支付金额
                if (string.IsNullOrEmpty(PayMethod))
                {
                    #region 现金支付
                    DataTable orderDB1  = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);//订单表,ZL_OrderInfo
                    int       orderType = 0;
                    if (orderDB1.Rows.Count > 0)
                    {
                        orderType = DataConvert.CLng(orderDB1.Rows[0]["OrderType"]);
                    }
                    DataTable ordertable = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                    if (pinfo.PayPlatID == 0 && !string.IsNullOrEmpty(pinfo.PlatformInfo))//支付宝网银支付
                    {
                        payPlat = payPlatBll.SelModelByClass(M_PayPlat.Plat.Alipay_Bank);
                        alipayBank(pinfo.PlatformInfo);
                    }
                    if (payPlat.PayClass == 99)//线下支付
                    {
                        function.WriteSuccessMsg("信息已记录,请等待商家联系完成线下付款", Rurl_Href.NavigateUrl);
                    }
                    if (payPlat == null || payPlat.PayPlatID < 1)
                    {
                        function.WriteErrMsg("没有找到对应的支付平台信息!");
                    }
                    if (payPlat.PayClass == 100)//货到付款
                    {
                        payinfo_div.Visible = false;
                        AfterPay_Tb.Visible = true;
                        Title = "下单成功!";
                    }
                    else
                    {
                        payinfo_div.Visible = true;
                        AfterPay_Tb.Visible = false;
                    }
                    switch ((M_PayPlat.Plat)payPlat.PayClass)//现仅开通 12:支付宝即时到账和支付宝网银服务,15支付宝网银服务(上方代码中处理),银币与余额服务
                    {
                        #region 各种支付方式
                    case M_PayPlat.Plat.UnionPay:
                        #region 银联在线
                        //gateway = "https://pay3.chinabank.com.cn/PayGate?encoding=UTF-8";
                        //必要的交易信息
                        string wv_amount    = v_amount;                              // 订单金额
                        string wv_moneytype = "CNY";                                 // 币种
                        string wv_md5info;                                           // 对拼凑串MD5私钥加密后的值
                        string wv_mid = payPlat.AccountID;                           // 商户号
                        //v_urlBuilder.Append("http://localhost:86/PayOnline/PayReceive.aspx?PayID=" +payid);
                        string wv_url = urlReq1 + "/PayReceive.aspx?PayNo=" + PayNo; // 返回页地址
                        string wv_oid = pinfo.PayNo;                                 // 推荐订单号构成格式为 年月日-商户号-小时分钟秒
                        //两个备注

                        // wv_mid = "1001";				 商户号,这里为测试商户号20000400,替换为自己的商户号即可
                        // wv_url = "http://localhost/chinabank/Receive.aspx";  商户自定义返回接收支付结果的页面
                        // MD5密钥要跟订单提交页相同,如Send.asp里的 key = "test" ,修改""号内 test 为您的密钥
                        string wkey = payPlat.MD5Key;                                    // 如果您还没有设置MD5密钥请登录我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/
                        // 登录后在上面的导航栏里可能找到“B2C”,在二级导航栏里有“MD5密钥设置”
                        // 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了
                        wv_amount    = v_amount;    // 订单金额
                        wv_moneytype = "CNY";       // 币种
                        //对拼凑串MD5私钥加密后的值
                        wv_mid = payPlat.AccountID; // 商户号
                        wv_oid = pinfo.PayNo;       // 推荐订单号构成格式为 年月日-商户号-小时分钟秒

                        if (wv_oid == null || wv_oid.Equals(""))
                        {
                            DateTime dt       = DateTime.Now;
                            string   wv_ymd   = dt.ToString("yyyyMMdd"); // yyyyMMdd
                            string   wtimeStr = dt.ToString("HHmmss");   // HHmmss
                            wv_oid = wv_ymd + wv_mid + wtimeStr;
                        }
                        string text = wv_amount + wv_moneytype + wv_oid + wv_mid + wv_url + wkey;     // 拼凑加密串
                        wv_md5info = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(text, "md5").ToUpper();
                        //strHiddenField.Append("<input type='hidden' name='v_md5info' value='" + wv_md5info + "'>\n");
                        //strHiddenField.Append("<input type='hidden' name='v_mid' value='" + wv_mid + "'>\n");
                        //strHiddenField.Append("<input type='hidden' name='v_oid' value='" + wv_oid + "'>\n");
                        //strHiddenField.Append("<input type='hidden' name='v_amount' value='" + wv_amount + "' >\n");
                        //strHiddenField.Append("<input type='hidden' name='v_moneytype' value='" + wv_moneytype + "'>\n");
                        //strHiddenField.Append("<input type='hidden' name='v_url' value='" + wv_url + "'>\n");
                        //    //以下几项只是用来记录客户信息,可以不用,不影响支付
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvname' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvaddr' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvtel' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvpost' value='" + "" + "' >\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvemail' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvmobile' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_ordername' value='" + "" + "' >\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_orderaddr' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_ordertel' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_orderpost' value='" + "" + "' >\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_orderemail' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_ordermobile' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='Package' value='" + Request.QueryString["Package"] + "'>\n");
                        #endregion
                        break;

                    case M_PayPlat.Plat.ChinaUnionPay:
                    {
                        #region 中国银联
                        Dictionary <string, string> param = new Dictionary <string, string>();

                        //以下信息非特殊情况不需要改动
                        param["version"]      = "5.0.0";                                      //版本号
                        param["encoding"]     = "UTF-8";                                      //编码方式
                        param["txnType"]      = "01";                                         //交易类型
                        param["txnSubType"]   = "01";                                         //交易子类
                        param["bizType"]      = "000201";                                     //业务类型
                        param["signMethod"]   = "01";                                         //签名方法
                        param["channelType"]  = "08";                                         //渠道类型
                        param["accessType"]   = "0";                                          //接入类型
                        param["frontUrl"]     = siteurl + "/Return/ChinaUnionPay.aspx";       //前台通知地址
                        param["backUrl"]      = siteurl + "/Return/ChinaUnionPayNotify.aspx"; //后台通知地址
                        param["currencyCode"] = "156";                                        //交易币种

                        //TODO 以下信息需要填写
                        param["merId"]           = payPlat.AccountID;                         //商户号,请改自己的测试商户号,此处默认取demo演示页面传递的参数
                        param["orderId"]         = pinfo.PayNo;                               //商户订单号,8-32位数字字母,不能含“-”或“_”,此处默认取demo演示页面传递的参数,可以自行定制规则
                        param["txnTime"]         = DateTime.Now.ToString("yyyyMMddHHmmss");   //订单发送时间,格式为YYYYMMDDhhmmss,取北京时间,此处默认取demo演示页面传递的参数,参考取法: DateTime.Now.ToString("yyyyMMddHHmmss")
                        param["txnAmt"]          = ((int)(pinfo.MoneyReal * 100)).ToString(); //交易金额,单位分,此处默认取demo演示页面传递的参数
                        LblHiddenValue.InnerHtml = PayHelper.BuildForm("https://101.231.204.80:5000/gateway/api/frontTransReq.do", param);
                        Alipay_Btn.Visible       = true;
                        #endregion
                    }
                    break;

                    case M_PayPlat.Plat.Alipay_Instant:
                        #region 支付宝[即时到帐]
                        string input_charset1 = "utf-8";
                        string notify_url1    = urlReq1 + "/Return/AlipayNotify.aspx"; //付完款后服务器AJAX通知的页面 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
                        string return_url1    = urlReq1 + "/Return/AlipayReturn.aspx"; //付完款后跳转的页面 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
                        string show_url1      = "";
                        string sign_type1     = "MD5";
                        ///////////////////////以下参数是需要通过下单时的订单数据传入进来获得////////////////////////////////
                        //必填参数
                        string price1             = pinfo.MoneyReal.ToString("f2");  //订单总金额,显示在支付宝收银台里的“商品单价”里
                        string logistics_fee1     = "0.00";                          //物流费用,即运费。
                        string logistics_type1    = "POST";                          //物流类型,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
                        string logistics_payment1 = "SELLER_PAY";                    //物流支付方式,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
                        string out_trade_no1      = pinfo.PayNo;                     //请与贵网站订单系统中的唯一订单号匹配
                        string subject1           = pinfo.Remark;                    //订单名称,显示在支付宝收银台里的“商品名称”里,显示在支付宝的交易管理的“商品名称”的列表里。
                        string body1            = pinfo.Remark;                      //订单描述、订单详细、订单备注,显示在支付宝收银台里的“商品描述”里
                        string quantity1        = "1";                               //商品数量,建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品。
                        string receive_name1    = "";                                //收货人姓名,如:张三
                        string receive_address1 = "";                                //收货人地址,如:XX省XXX市XXX区XXX路XXX小区XXX栋XXX单元XXX号
                        string receive_zip1     = "";                                //收货人邮编,如:123456
                        string receive_phone1   = "";                                //收货人电话号码,如:0571-81234567
                        string receive_mobile1  = "";                                //收货人手机号码,如:13312341234
                        //---------------------
                        string receive_name    = orderDB1.Rows[0]["Reuser"] + "";    //收货人姓名,如:张三
                        string receive_address = orderDB1.Rows[0]["Jiedao"] + "";    //收货人地址,如:XX省XXX市XXX区XXX路XXX小区XXX栋XXX单元XXX号
                        string receive_zip     = orderDB1.Rows[0]["ZipCode"] + "";   //收货人邮编,如:123456
                        string receive_phone   = orderDB1.Rows[0]["Phone"] + "";     //收货人电话号码,如:0571-81234567
                        string receive_mobile  = orderDB1.Rows[0]["MobileNum"] + ""; //收货人手机号码,如:13312341234
                        //扩展参数——第二组物流方式
                        //物流方式是三个为一组成组出现。若要使用,三个参数都需要填上数据;若不使用,三个参数都需要为空
                        //有了第一组物流方式,才能有第二组物流方式,且不能与第一个物流方式中的物流类型相同,
                        //即logistics_type="EXPRESS",那么logistics_type_1就必须在剩下的两个值(POST、EMS)中选择
                        string logistics_fee_3     = "";                                                    //物流费用,即运费。
                        string logistics_type_3    = "";                                                    //物流类型,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
                        string logistics_payment_3 = "";                                                    //物流支付方式,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)

                        //扩展参数——第三组物流方式
                        //物流方式是三个为一组成组出现。若要使用,三个参数都需要填上数据;若不使用,三个参数都需要为空
                        //有了第一组物流方式和第二组物流方式,才能有第三组物流方式,且不能与第一组物流方式和第二组物流方式中的物流类型相同,
                        //即logistics_type="EXPRESS"、logistics_type_1="EMS",那么logistics_type_2就只能选择"POST"
                        string logistics_fee_4     = "";                                                        //物流费用,即运费。
                        string logistics_type_4    = "";                                                        //物流类型,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
                        string logistics_payment_4 = "";                                                        //物流支付方式,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
                        //扩展功能参数——其他
                        string buyer_email1 = "";                                                               //默认买家支付宝账号
                        string discount1    = "";                                                               //折扣,是具体的金额,而不是百分比。若要使用打折,请使用负数,并保证小数点最多两位数
                        /////////////////////////////////////////////////////////////////////////////////////////////////////
                        //构造请求函数,无需修改
                        B_AliPay_trades_Services aliService1 = new B_AliPay_trades_Services(
                            payPlat.AccountID,
                            payPlat.SellerEmail,
                            return_url1,
                            notify_url1,
                            show_url1,
                            out_trade_no1,
                            subject1,
                            body1,
                            price1,
                            logistics_fee1,
                            logistics_type1,
                            logistics_payment1,
                            quantity1,
                            receive_name1,
                            receive_address1,
                            receive_zip1,
                            receive_phone1,
                            receive_mobile1,
                            logistics_fee_3,
                            logistics_type_3,
                            logistics_payment_3,
                            logistics_fee_4,
                            logistics_type_4,
                            logistics_payment_4,
                            buyer_email1,
                            discount1,
                            payPlat.MD5Key,
                            input_charset1,
                            sign_type1);
                        Alipay_Btn.Visible       = true;
                        LblHiddenValue.InnerHtml = aliService1.Build_Form();
                        #endregion
                        break;

                    case M_PayPlat.Plat.Alipay_H5:
                    {
                        Response.Redirect("/API/Pay/Alipay_H5.aspx?Payno=" + PayNo);
                    }
                    break;

                    case M_PayPlat.Plat.Alipay_Bank:    //支付宝网银,已上方处理
                        break;

                    case M_PayPlat.Plat.Bill:
                        #region 快钱支付
                    {
                        //人民币网关账户号
                        ///请登录快钱系统获取用户编号,用户编号后加01即为人民币网关账户号。
                        string merchantAcctId = payPlat.AccountID;
                        //人民币网关密钥
                        ///区分大小写.请与快钱联系索取
                        String key = payPlat.MD5Key;
                        //字符集.固定选择值。可为空。
                        ///只能选择1、2、3.
                        ///1代表UTF-8; 2代表GBK; 3代表gb2312
                        ///默认值为1
                        string inputCharset = "1";
                        //接受支付结果的页面地址.与[bgUrl]不能同时为空。必须是绝对地址。
                        ///如果[bgUrl]为空,快钱将支付结果Post到[pageUrl]对应的地址。
                        ///如果[bgUrl]不为空,并且[bgUrl]页面指定的<redirecturl>地址不为空,则转向到<redirecturl>对应的地址
                        ///
                        ///快钱通过服务器连接的方式将交易结果发送到[bgUrl]对应的页面地址,在商户处理完成后输出的<result>如果为1,页面会转向到<redirecturl>对应的地址。
                        ///如果快钱未接收到<redirecturl>对应的地址,快钱将把支付结果post到[pageUrl]对应的页面。
                        string bgUrl = "PayOnline/PayResultAlipayInstant.aspx?";
                        //网关版本.固定值
                        ///快钱会根据版本号来调用对应的接口处理程序。
                        ///本代码版本号固定为v2.0
                        string version = "v2.0";
                        //语言种类.固定选择值。
                        ///只能选择1、2、3
                        ///1代表中文;2代表英文
                        ///默认值为1
                        string language = "1";
                        //签名类型.固定值
                        ///1代表MD5签名
                        ///当前版本固定为1
                        string signType = "1";
                        //支付人姓名
                        ///可为中文或英文字符
                        string payerName = "payerName";
                        //支付人联系方式类型.固定选择值
                        ///只能选择1
                        ///1代表Email
                        string payerContactType = "1";
                        //支付人联系方式
                        ///只能选择Email或手机号
                        string payerContact = "";
                        //商户订单号
                        ///由字母、数字、或[-][_]组成
                        string orderId = pinfo.PayNo;        // DateTime.Now.ToString("yyyyMMddHHmmss");
                                                             //订单金额
                        ///以分为单位,必须是整型数字
                        ///比方2,代表0.02元
                        double moneys = DataConverter.CDouble(v_amount);
                        moneys = moneys * 100;
                        string orderAmount = DataConverter.CLng(moneys).ToString();

                        //订单提交时间
                        ///14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
                        ///如;20080101010101
                        string orderTime = DateTime.Now.ToString("yyyyMMddHHmmss");
                        //商品名称
                        ///可为中文或英文字符
                        string productName = "product";
                        //商品数量
                        ///可为空,非空时必须为数字
                        string productNum = "1";
                        //商品代码
                        ///可为字符或者数字
                        string productId = "1";
                        //商品描述
                        string productDesc = pinfo.Remark;
                        //扩展字段1
                        ///在支付结束后原样返回给商户
                        string ext1 = "";
                        //扩展字段2
                        ///在支付结束后原样返回给商户
                        string ext2 = "";
                        //支付方式.固定选择值
                        ///只能选择00、10、11、12、13、14
                        ///00:组合支付(网关支付页面显示快钱支持的各种支付方式,推荐使用)10:银行卡支付(网关支付页面只显示银行卡支付).11:电话银行支付(网关支付页面只显示电话支付).12:快钱账户支付(网关支付页面只显示快钱账户支付).13:线下支付(网关支付页面只显示线下支付方式).14:B2B支付(网关支付页面只显示B2B支付,但需要向快钱申请开通才能使用)
                        string payType = "00";

                        //银行代码
                        ///实现直接跳转到银行页面去支付,只在payType=10时才需设置参数
                        ///具体代码参见 接口文档银行代码列表
                        string bankId = "";

                        //同一订单禁止重复提交标志
                        ///固定选择值: 1、0
                        ///1代表同一订单号只允许提交1次;0表示同一订单号在没有支付成功的前提下可重复提交多次。默认为0建议实物购物车结算类商户采用0;虚拟产品类商户采用1
                        string redoFlag = "0";

                        //快钱的合作伙伴的账户号
                        ///如未和快钱签订代理合作协议,不需要填写本参数
                        string pid = "";
                        //生成加密签名串
                        ///请务必按照如下顺序和规则组成加密串!
                        String signMsgVal = "";
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "inputCharset", inputCharset);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "pageUrl", siteurl + "Return/Bill99Notify.aspx");
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "bgUrl", bgUrl);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "version", version);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "language", language);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "signType", signType);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "merchantAcctId", merchantAcctId);        //merchantAcctId
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "payerName", payerName);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "payerContactType", payerContactType);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "payerContact", payerContact);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "orderId", orderId);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "orderAmount", orderAmount);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "orderTime", orderTime);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "productName", productName);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "productNum", productNum);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "productId", productId);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "productDesc", productDesc);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "ext1", ext1);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "ext2", ext2);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "payType", payType);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "bankId", bankId);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "redoFlag", redoFlag);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "pid", pid);
                        signMsgVal = Bill99Helper.appendParam(signMsgVal, "key", key);
                        string signMsg = StringHelper.MD5(signMsgVal).ToUpper();

                        Dictionary <string, string> payform_dics = new Dictionary <string, string>();
                        payform_dics.Add("inputCharset", inputCharset);
                        payform_dics.Add("bgUrl", bgUrl);
                        payform_dics.Add("pageUrl", siteurl + "Return/Bill99Notify.aspx");        //服务器接受支付结果的后台地址.与[pageUrl]不能同时为空。必须是绝对地址。
                        payform_dics.Add("version", version);
                        payform_dics.Add("language", language);
                        payform_dics.Add("signType", signType);
                        payform_dics.Add("signMsg", signMsg);
                        payform_dics.Add("merchantAcctId", merchantAcctId);
                        payform_dics.Add("payerName", payerName);
                        payform_dics.Add("payerContactType", payerContactType);
                        payform_dics.Add("orderId", orderId);
                        payform_dics.Add("orderAmount", orderAmount);
                        payform_dics.Add("orderTime", orderTime);
                        payform_dics.Add("productName", productName);
                        payform_dics.Add("productNum", productNum);
                        payform_dics.Add("productId", productId);
                        payform_dics.Add("productDesc", productDesc);
                        payform_dics.Add("ext1", ext1);
                        payform_dics.Add("ext2", ext2);
                        payform_dics.Add("payType", payType);
                        payform_dics.Add("bankId", bankId);
                        payform_dics.Add("redoFlag", redoFlag);
                        payform_dics.Add("pid", pid);
                        payform_dics.Add("Package", Request.QueryString["Package"]);
                        LblHiddenValue.InnerHtml = PayHelper.BuildForm("https://www.99bill.com/gateway/recvMerchantInfoAction.htm", payform_dics);
                        Alipay_Btn.Visible       = true;
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.WXPay:
                        #region 微信扫码支付
                    {
                        if (DeviceHelper.GetBrower() == DeviceHelper.Brower.Micro)
                        {
                            Response.Redirect("/PayOnline/wxpay_mp.aspx?payno=" + pinfo.PayNo);
                            return;
                        }
                        pinfo.PlatformInfo = "0";
                        paymentBll.Update(pinfo);
                        WxPayData wxdata = new WxPayData();
                        wxdata.SetValue("out_trade_no", pinfo.PayNo);
                        wxdata.SetValue("body", string.IsNullOrEmpty(pinfo.Remark) ? "微信支付" : pinfo.Remark);
                        wxdata.SetValue("total_fee", Convert.ToInt32(pinfo.MoneyReal * 100));
                        wxdata.SetValue("trade_type", "NATIVE");
                        wxdata.SetValue("notify_url", urlReq1 + "/Return/WxPayReturn.aspx");
                        wxdata.SetValue("product_id", "1");
                        WxPayData result = WxPayApi.UnifiedOrder(wxdata, WxPayApi.Pay_GetByID());
                        if (result.GetValue("return_code").ToString().Equals("FAIL"))
                        {
                            function.WriteErrMsg("商户" + result.GetValue("return_msg"));
                        }
                        Response.Redirect("/PayOnline/WxCodePay.aspx?PayNo=" + pinfo.PayNo + "&wxcode=" + result.GetValue("code_url"));
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.Ebatong:
                        #region Ebatong
                    {
                        Dictionary <string, string> ebatong_dics = new Dictionary <string, string>();
                        ebatong_dics.Add("sign_type", "MD5");
                        ebatong_dics.Add("service", "create_direct_pay_by_user");
                        ebatong_dics.Add("partner", payPlat.AccountID);
                        ebatong_dics.Add("input_charset", "UTF-8");
                        ebatong_dics.Add("notify_url", siteurl + "Return/EbatongNotify.aspx");        //服务器异步通知页面路径
                        ebatong_dics.Add("return_url", siteurl + "Return/EbatongReturn.aspx");        //服务器跳转页面
                        ebatong_dics.Add("out_trade_no", pinfo.PayNo);
                        ebatong_dics.Add("subject", pinfo.Remark);
                        ebatong_dics.Add("exter_invoke_ip", Request.UserHostAddress);
                        ebatong_dics.Add("payment_type", "1");
                        ebatong_dics.Add("seller_id", payPlat.AccountID);
                        ebatong_dics.Add("total_fee", pinfo.MoneyReal.ToString("f2"));
                        ebatong_dics.Add("error_notify_url", "");
                        ebatong_dics.Add("anti_phishing_key", new ZoomLa.BLL.Ebatong.AskForTimestamp().askFor(payPlat.AccountID, payPlat.MD5Key));
                        ebatong_dics.Add("seller_email", "");
                        ebatong_dics.Add("buyer_email", "");
                        ebatong_dics.Add("buyer_id", "");
                        ebatong_dics.Add("price", "");
                        ebatong_dics.Add("quantity", "");
                        ebatong_dics.Add("body", "");
                        ebatong_dics.Add("show_url", "");
                        ebatong_dics.Add("pay_method", "bankPay");
                        ebatong_dics.Add("extra_common_para", "");
                        ebatong_dics.Add("extend_param", "");
                        ebatong_dics.Add("it_b_pay", "");
                        ebatong_dics.Add("royalty_type", "");
                        ebatong_dics.Add("royalty_parameters", "");
                        ebatong_dics.Add("default_bank", "");
                        string[] paramts = new string[ebatong_dics.Keys.Count]; //参数排序数组
                        ebatong_dics.Keys.CopyTo(paramts, 0);
                        Array.Sort(paramts);                                    //参数排序操作
                        string paramstr = "";
                        foreach (string item in paramts)
                        {
                            paramstr += string.Format("{0}={1}&", item, ebatong_dics[item]);
                        }
                        //throw new Exception(paramstr.Trim('&'));
                        string md5md5 = new ZoomLa.BLL.Ebatong.CommonHelper().md5("UTF-8", paramstr.Trim('&') + payPlat.MD5Key).ToLower();
                        ebatong_dics.Add("sign", md5md5);
                        LblHiddenValue.InnerHtml = PayHelper.BuildForm("https://www.ebatong.com/direct/gateway.htm", ebatong_dics);
                        Alipay_Btn.Visible       = true;
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.CCB:
                        #region 江西建行
                    {
                        Dictionary <string, string> ccb_dics = new Dictionary <string, string>();
                        ccb_dics.Add("MERCHANTID", payPlat.AccountID);    //商户代码
                        ccb_dics.Add("POSID", payPlat.PrivateKey);        //柜台代码
                        ccb_dics.Add("BRANCHID", payPlat.PublicKey);      //分行代码
                        ccb_dics.Add("ORDERID", pinfo.PayNo);
                        ccb_dics.Add("PAYMENT", pinfo.MoneyReal.ToString("f2"));
                        ccb_dics.Add("CURCODE", "01");
                        ccb_dics.Add("REMARK1", "");        //备注信息1(具体信息待测试)
                        ccb_dics.Add("REMARK2", "");        //备注信息2
                        ccb_dics.Add("TXCODE", "520100");
                        string ccb_paramstr = "";
                        foreach (String item in ccb_dics.Keys)
                        {
                            ccb_paramstr += string.Format("{0}={1}&", item, ccb_dics[item]);
                        }
                        string md5str = new ZoomLa.BLL.Ebatong.CommonHelper().md5("UTF-8", ccb_paramstr.Trim('&')).ToLower();
                        ccb_dics.Add("MAC", md5str);
                        LblHiddenValue.InnerHtml = PayHelper.BuildForm("https://ibsbjstar.ccb.com.cn/app/ccbMain", ccb_dics);
                        Alipay_Btn.Visible       = true;
                        //Response.Redirect("https://ibsbjstar.ccb.com.cn/app/ccbMain?" + ccb_paramstr + "MAC=" + md5str);
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.ECPSS:
                        #region 汇潮支付
                    {
                        Dictionary <string, string> payData = new Dictionary <string, string>();
                        payData.Add("OrderDesc", "test");                              //订单描述
                        payData.Add("Remark", "汇潮支付");                                 //备注
                        payData.Add("AdviceURL", siteurl + "Return/ECPSSNotfy.aspx");  //回调通知地址
                        payData.Add("ReturnURL", siteurl + "Return/ECPSSResult.aspx"); //返回地址
                        payData.Add("BillNo", pinfo.PayNo);                            //订单号
                        payData.Add("MerNo", payPlat.AccountID);                       //商户号
                        payData.Add("Amount", pinfo.MoneyReal.ToString("f2"));         //交易价格
                        string md5key = payPlat.MD5Key;
                        string md5str = payData["MerNo"] + "&" + payData["BillNo"] + "&" + payData["Amount"] + "&" + payData["ReturnURL"] + "&" + md5key;
                        payData.Add("SignInfo", System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5str, "MD5")); //签名
                        payData.Add("defaultBankNumber", "");                                                                               //银行代码(选填)
                        payData.Add("orderTime", DateTime.Now.ToString("yyyyMMddHHmmss"));                                                  //交易时间yyyyMMddHHmmss
                        payData.Add("products", pinfo.Remark);                                                                              //物品信息
                        LblHiddenValue.InnerHtml = PayHelper.BuildForm("https://pay.ecpss.com/sslpayment", payData);
                        Alipay_Btn.Visible       = true;
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.ICBC_NC:
                        #region 南昌工行
                    {
                        function.WriteErrMsg("工行支付组件未注册,请联系管理员");
                        //ICBCHelper icbc = new ICBCHelper();
                        //infosecapiLib.infosecClass obj = new infosecapiLib.infosecClass();
                        //Dictionary<string, string> dics = new Dictionary<string, string>();
                        //string posturl = "https://B2C.icbc.com.cn/servlet/ICBCINBSEBusinessServlet";
                        //---Debug
                        //payPlat.AccountID = "1502EC24392836";
                        //payPlat.SellerEmail = "1502201009004747554";
                        //payPlat.PrivateKey = "/Cert/cs.key";
                        //payPlat.PublicKey = "/Cert/cs.cer";
                        //posturl = "https://myipad.dccnet.com.cn/servlet/NewB2cMerPayReqServlet";
                        //throw new Exception(payPlat.PrivateKey + ":" + payPlat.PublicKey + ":" + payPlat.AccountID + ":" + payPlat.SellerEmail);
                        //Debug End
                        //*.z01.com根据需要更改如*.hx008.com
                        //string data = icbc.SpliceTranData(pinfo, payPlat.AccountID.Trim(), payPlat.SellerEmail.Trim(), "*.z01.com", siteurl + "ICBCNotify.aspx");
                        //string sign = obj.sign(data, Server.MapPath(payPlat.PrivateKey), payPlat.MD5Key.Trim());//私钥虚拟路径与私钥密钥
                        //dics.Add("interfaceName", "ICBC_PERBANK_B2C");
                        //dics.Add("interfaceVersion", "1.0.0.11");
                        //dics.Add("tranData", obj.base64enc(data));
                        //dics.Add("merSignMsg", sign);
                        //dics.Add("merCert", icbc.ReadCertToBase64(payPlat.PublicKey));//公钥路径
                        //LblHiddenValue.InnerHtml = new Pay_BaoFa().BuildForm(posturl, dics);
                        //Alipay_Btn.Visible = true;
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.CashOnDelivery:
                        #region 货到付款
                        zfpt.Text      = payPlat.PayPlatName;
                        ddh.Text       = pinfo.PaymentNum;
                        PayNum_L2.Text = Convert.ToDecimal(vmoney).ToString("F2") + " 元";
                        sxf.Text       = payPlat.Rate.ToString() + " %";
                        sjhbje.Text    = v_amount + " 元";
                        #endregion
                        break;

                    case M_PayPlat.Plat.PayPal:
                    {
                        Response.Redirect("PP/Pay.aspx?Payno=" + pinfo.PayNo);
                    }
                    break;

                    default:
                        throw new Exception("错误:支付方式不存在:" + payPlat.PayClass);
                        #endregion
                    }
                    VMoneyPayed_L.Text = payPlat.PayPlatName;
                    OrderNo_L.Text     = pinfo.PaymentNum;
                    LblRate.Text       = payPlat.Rate.ToString() + " %";
                    #endregion
                }
                else//非现金支付,给用户显示确认支付页,实际支付行为在Confirm_Click
                {
                    spwd_div.Visible    = (!string.IsNullOrEmpty(mu.PayPassWord));
                    nospwd_div.Visible  = string.IsNullOrEmpty(mu.PayPassWord);//如未设定,则不需要输入二级密码
                    payinfo_div.Visible = true;
                    AfterPay_Tb.Visible = false;
                    OrderNo_L.Text      = pinfo.PaymentNum;
                    DataTable ordertable = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                    if (ordertable != null && ordertable.Rows.Count > 0)
                    {
                        switch (PayMethod)
                        {
                        case "Purse":
                            //Titles.Text = "余额支付操作(确认支付款项)";
                            Fee.Text           = "帐户余额:";
                            LblRate.Text       = mu.Purse + " 元";
                            VMoneyPayed_L.Text = "帐户余额";
                            break;

                        case "SilverCoin":
                            //Titles.Text = "银币支付操作(确认支付款项)";
                            Fee.Text           = "帐户银币:";
                            LblRate.Text       = mu.SilverCoin + " 个";
                            VMoneyPayed_L.Text = "账户银币";
                            break;

                        case "Score":
                            //Titles.Text = "积分支付操作(确认支付款项)";
                            Fee.Text           = "帐户积分:";
                            LblRate.Text       = mu.UserExp + " 分";
                            VMoneyPayed_L.Text = "账户积分";
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        payinfo_div.Visible = false;
                        AfterPay_Tb.Visible = false;
                        function.WriteErrMsg("订单不存在");
                    }
                }
                //显示金额信息
                LblPayMoney.Text = pinfo.MoneyReal.ToString("F2") + " 元";//应付金额
            }
            //------------------检测End;
        }
예제 #15
0
        //支付成功时执行的操作
        private void PayOrder_Success(M_Payment pinfo, WxPayData result)
        {
            ZLLog.L(ZLEnum.Log.pay, PayPlat + " 支付单:" + result.GetValue("out_trade_no") + " 金额:" + result.GetValue("total_fee"));
            try
            {
                M_Order_PayLog paylogMod = new M_Order_PayLog();
                if (pinfo == null)
                {
                    throw new Exception("支付单不存在");
                }                                                    //支付单检测合为一个方法
                if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    throw new Exception("支付单状态不为未支付");
                }
                pinfo.Status        = (int)M_Payment.PayStatus.HasPayed;
                pinfo.PlatformInfo += PayPlat;
                pinfo.SuccessTime   = DateTime.Now;
                pinfo.PayTime       = DateTime.Now;
                pinfo.CStatus       = true;
                //1=100,
                double tradeAmt = Convert.ToDouble(result.GetValue("total_fee")) / 100;
                pinfo.MoneyTrue = tradeAmt;
                payBll.Update(pinfo);
                DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                foreach (DataRow dr in orderDT.Rows)
                {
                    M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                    OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                    //发送微信消息
                    ZoomLa.BLL.WxAPI wxapi = ZoomLa.BLL.WxAPI.Code_Get();
                    ZoomLa.BLL.User.Addon.B_UserAPP appBll = new ZoomLa.BLL.User.Addon.B_UserAPP();
                    ZoomLa.Model.User.M_UserAPP     appMod = appBll.SelModelByUid(orderMod.Userid, "wechat");
                    switch (orderMod.Ordertype)
                    {
                    case (int)M_OrderList.OrderEnum.Score://押金
                    {
                        if (appMod != null && !string.IsNullOrEmpty(appMod.OpenID))
                        {
                            //发送模板消息通知用户
                            string json = "{\"first\": {\"value\":\"订单支付成功\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + orderMod.OrderNo + "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"您的押金已成功支付!\",\"color\":\"#173177\"}}";
                            wxapi.Tlp_SendTlpMsg(appMod.OpenID, "dlAIEAkV0lgDfc7-RYsdLVFMyP9UF7gHi_9kjPblVAU", ZoomLa.Components.SiteConfig.SiteInfo.SiteUrl + "/BU/UE/MyLend.aspx", json);
                        }
                    }
                    break;

                    case (int)M_OrderList.OrderEnum.Purse://充值
                    {
                        if (appMod != null && !string.IsNullOrEmpty(appMod.OpenID))
                        {
                            //发送模板消息通知用户
                            string json = "{\"first\": {\"value\":\"订单支付成功\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + orderMod.OrderNo + "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"你已成功充值!\",\"color\":\"#173177\"}}";
                            wxapi.Tlp_SendTlpMsg(appMod.OpenID, "dlAIEAkV0lgDfc7-RYsdLVFMyP9UF7gHi_9kjPblVAU", ZoomLa.Components.SiteConfig.SiteInfo.SiteUrl + "/BU/UE/MyLend.aspx", json);
                        }
                    }
                    break;

                    case (int)M_OrderList.OrderEnum.Fast://借伞|转借
                        //{
                        //    //转借订单不需要还
                        //    if (orderMod.Promoter == 0) { break; }
                        //    ZoomLa.BLL.Shop.B_Store_Info storeBll = new ZoomLa.BLL.Shop.B_Store_Info();
                        //    ZoomLa.Model.Shop.M_Store_Info storeMod = storeBll.SelReturnModel(orderMod.StoreID);
                        //    if (storeMod != null && storeMod.UserID > 0)
                        //    {
                        //        appMod = appBll.SelModelByUid(storeMod.UserID,"wechat");
                        //        if (appMod != null && !string.IsNullOrEmpty(appMod.OpenID))
                        //        {
                        //            string json = "{\"first\": {\"value\":\"订单支付成功\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + orderMod.OrderNo + "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"用户押金已成功支付!\",\"color\":\"#173177\"}}";
                        //            wxapi.Tlp_SendTlpMsg(appMod.OpenID, "dlAIEAkV0lgDfc7-RYsdLVFMyP9UF7gHi_9kjPblVAU", ZoomLa.Components.SiteConfig.SiteInfo.SiteUrl + "/Class_2/NodePage.aspx", json);
                        //        }
                        //    }
                        //}
                        break;
                    }



                    /*
                     * B_UserAPP userappBll = new B_UserAPP();
                     * M_UserAPP userappMod = new M_UserAPP();
                     *
                     * M_UserInfo mu = buser.SeachByID(orderMod.Userid);
                     * userappMod = userappBll.SelModelByUid(mu.UserID, "wechat");
                     * if (userappMod != null)
                     * {
                     * WxAPI wxapi = WxAPI.Code_Get(1);
                     * string json = "{\"first\": {\"value\":\"订单支付成功\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + orderMod.OrderNo + "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"您的押金已成功支付!\",\"color\":\"#173177\"}}";
                     * wxapi.Tlp_SendTlpMsg(userappMod.OpenID, "dlAIEAkV0lgDfc7-RYsdLVFMyP9UF7gHi_9kjPblVAU", SiteConfig.SiteInfo.SiteUrl + "/BU/UE/MyLend.aspx", json);
                     * }
                     */
                    //发送消息给店主和送货员

                    /*
                     * if (orderMod.StoreID > 0)
                     * {
                     * B_Content contBll = new B_Content();
                     * M_CommonData CData = contBll.SelReturnModel(orderMod.StoreID);
                     * if (CData != null)
                     * {
                     * //店主
                     * M_UserInfo smu = buser.GetUserIDByUserName(CData.Inputer);
                     *              userappMod = userappBll.SelModelByUid(smu.UserID, "wechat");
                     * if (smu != null && smu.UserID > 0)
                     * {
                     * string json = "{\"first\": {\"value\":\"订单支付成功\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + orderMod.OrderNo + "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"用户押金已成功支付!\",\"color\":\"#173177\"}}";
                     *                      wxapi.Tlp_SendTlpMsg(userappMod.OpenID, "dlAIEAkV0lgDfc7-RYsdLVFMyP9UF7gHi_9kjPblVAU", SiteConfig.SiteInfo.SiteUrl + "/Class_2/NodePage.aspx", json);
                     * }
                     * }
                     * }
                     */
                    //if (orderMod.Ordertype == (int)M_OrderList.OrderEnum.Purse)
                    //{

                    //    M_UserInfo mu = buser.SelReturnModel(orderMod.Userid);
                    //    new B_Shop_MoneyRegular().AddMoneyByMin(mu, orderMod.Ordersamount, ",订单号[" + orderMod.OrderNo + "]");
                    //}
                    //orderCom.SendMessage(orderMod, paylogMod, "payed");
                    //orderCom.SaveSnapShot(orderMod);
                }
                ZLLog.L(ZLEnum.Log.pay, PayPlat + "成功!支付单:" + result.GetValue("out_trade_no").ToString());
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付回调报错",
                    Message = PayPlat + ",支付单:" + result.GetValue("out_trade_no").ToString() + ",原因:" + ex.Message
                });
            }
        }
예제 #16
0
        //确定,生成信息写入ZL_Payment
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            int         platid   = DataConverter.CLng(Request.Form["payplat_rad"]);
            M_UserInfo  mu       = buser.GetLogin(false);
            M_Payment   pinfo    = new M_Payment();
            M_OrderList orderMod = new M_OrderList();

            if (!string.IsNullOrEmpty(PayNo))//支付单付款
            {
                pinfo = payBll.SelModelByPayNo(PayNo);
                if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    function.WriteErrMsg("该支付单已付款,请勿重复支付"); return;
                }
            }
            else
            {
                //传入订单,或直接充值
                if (Money > 0)//直接充值
                {
                    orderMod.OrderNo      = B_OrderList.CreateOrderNo(M_OrderList.OrderEnum.Purse);
                    orderMod.Ordertype    = (int)M_OrderList.OrderEnum.Purse;//Purse等充值
                    orderMod.Userid       = mu.UserID;
                    orderMod.Rename       = mu.UserName;
                    orderMod.AddUser      = mu.UserName;
                    orderMod.Ordersamount = Money;
                    if (orderMod.Ordersamount < 0.01)
                    {
                        function.WriteErrMsg("错误,金额过小");
                    }
                    orderBll.Add(orderMod);
                    pinfo.PaymentNum = orderMod.OrderNo;
                    pinfo.MoneyPay   = orderMod.Ordersamount;
                    pinfo.Remark     = "用户充值";
                }
                else
                {
                    DataTable orderDT = orderBll.GetOrderbyOrderNo(OrderNo);
                    GetTotal(orderDT, ref price, ref fare, ref allamount);
                    if (allamount < 0.01)
                    {
                        function.WriteErrMsg("每次划款金额不能低于0.01元");
                    }
                    if (orderDT != null && orderDT.Rows.Count > 0)
                    {
                        orderMod         = orderBll.GetOrderListByid(DataConverter.CLng(orderDT.Rows[0]["id"]));
                        orderMod.Payment = platid;
                        orderBll.Update(orderMod);
                    }
                    pinfo.PaymentNum = OrderNo;
                    pinfo.MoneyPay   = allamount;
                    DataTable cartDT = new DataTable();
                    //cartDT = bcart.GetSelectTableBySql("select * From ZL_CartPro Where OrderListID = " + orderMod.id, null);
                    //pinfo.Remark = cartDT.Rows.Count > 1 ? "[" + cartDT.Rows[0]["ProName"] as string + "]等" : cartDT.Rows[0]["ProName"] as string;
                }
            }
            pinfo.UserID    = mu.UserID;
            pinfo.PayPlatID = platid;
            pinfo.MoneyID   = 0;
            pinfo.MoneyReal = pinfo.MoneyPay;
            //用于支付宝网银
            pinfo.PlatformInfo = Request.Form["payplat_rad"];
            if (!string.IsNullOrEmpty(PayNo))
            {
                payBll.Update(pinfo);
            }
            else
            {
                pinfo.Status = (int)M_Payment.PayStatus.NoPay;
                pinfo.PayNo  = payBll.CreatePayNo();
                payBll.Add(pinfo);
            }
            string url = "PayOnline.aspx?PayNo=" + pinfo.PayNo;

            if (pinfo.PayPlatID == 0)
            {
                url += "&method=" + Request.Form["payplat_rad"];
            }
            Response.Redirect(url);
        }
예제 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string posid    = Request.Params["POSID"];    //商户柜台代码
            string branchid = Request.Params["BRANCHID"]; //分行代码
            string orderid  = Request.Params["ORDERID"];  //定单号
            string payment  = Request.Params["PAYMENT"];  //付款金额
            string curcode  = Request.Params["CURCODE"];  //币种
            string remark1  = Request.Params["REMARK1"];  //备注1
            string remark2  = Request.Params["REMARK2"];  //备注2
            string acc_type = Request.Params["ACC_TYPE"]; //账户类型
            string success  = Request.Params["SUCCESS"];
            string sign     = Request.Params["SIGN"];     //数字签名

            M_Payment payMod  = payBll.SelModelByPayNo(branchid);
            M_PayPlat platMod = new M_PayPlat();

            platMod = platBll.SelReturnModel(payMod.PayPlatID);
            if (platMod.PayClass != (int)M_PayPlat.Plat.CCB)
            {
                ZLLog.L(ZLEnum.Log.pay, "回调页面错误" + Request.RawUrl);
            }
            string md5key = string.Format("POSID={0}&BRANCHID={1}&ORDERID={2}&PAYMENT={3}&CURCODE={4}&REMARK1={5}&REMARK2={6}&SUCCESS={7}", posid, branchid, orderid, payment, curcode, remark1, remark2, success);//ACC_TYPE参数(待测试)
            string md5md5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5key, "MD5").ToLower();

            if (md5md5.Equals(sign))
            {
                if (!success.Equals("Y"))
                {
                    ZLLog.L(ZLEnum.Log.pay, "建行交易失败!支付单:" + orderid);
                }
                ZLLog.L(ZLEnum.Log.pay, "建行:" + remark1 + " 支付单:" + orderid + " 金额:" + payment);
                try
                {
                    M_Payment pinfo = payBll.SelModelByPayNo(orderid);
                    if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                    {
                        return;
                    }
                    pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
                    pinfo.PlatformInfo = "建行支付";       //平台反馈信息
                    pinfo.SuccessTime  = DateTime.Now; //交易成功时间
                    pinfo.CStatus      = true;         //处理状态
                    pinfo.MoneyTrue    = Convert.ToDouble(payment);
                    payBll.Update(pinfo);
                    DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                    foreach (DataRow dr in orderDT.Rows)
                    {
                        M_Order_PayLog paylogMod = new M_Order_PayLog();
                        M_OrderList    orderMod  = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                        OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                        //orderCom.SendMessage(orderMod, paylogMod, "payed");
                        //orderCom.SaveSnapShot(orderMod);
                    }
                    Response.Write("OK");
                    ZLLog.L(ZLEnum.Log.pay, "建行支付成功!支付单:" + orderid);
                }
                catch (Exception ex)
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action  = "支付回调报错",
                        Message = "平台:建行,支付单:" + orderid + ",原因:" + ex.Message
                    });
                }
            }
            else
            {
                ZLLog.L(ZLEnum.Log.pay, "建行验证失败!支付单:" + orderid);
            }
        }
예제 #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //DataTable pay = payPlatBll.GetPayPlatByClassid(12);
            M_PayPlat platMod = payPlatBll.SelModelByClass(M_PayPlat.Plat.Alipay_Instant);
            SortedDictionary <string, string> sArrary = GetRequestPost();

            ///////////////////////以下参数是需要设置的相关配置参数,设置后不会更改的//////////////////////
            ZoomLa.Model.M_Alipay_config con = new ZoomLa.Model.M_Alipay_config();
            string partner       = platMod.AccountID;
            string key           = platMod.MD5Key;
            string input_charset = con.Input_charset;
            string sign_type     = con.Sign_type;
            string transport     = con.Transport;

            //////////////////////////////////////////////////////////////////////////////////////////////
            if (sArrary.Count > 0)//判断是否有带返回参数
            {
                ZoomLa.BLL.B_Alipay_notify aliNotify = new ZoomLa.BLL.B_Alipay_notify(sArrary, Request.Form["notify_id"], partner, key, input_charset, sign_type, transport);
                string responseTxt = aliNotify.ResponseTxt;     //获取远程服务器ATN结果,验证是否是支付宝服务器发来的请求
                string sign        = Request.Form["sign"];
                string mysign      = aliNotify.Mysign;          //获取通知返回后计算后(验证)的签名结果
                                                                //判断responsetTxt是否为ture,生成的签名结果mysign与获得的签名结果sign是否一致
                                                                //responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
                                                                //mysign与sign不等,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
                string order_no = Request.Form["out_trade_no"]; //获取订单号
                ZLLog.L(ZLEnum.Log.pay, PayPlat + aliNotify.ResponseTxt + ":" + order_no + ":" + Request.Form["buyer_email"] + ":" + Request.Form["trade_status"] + ":" + Request.Form["price"] + ":" + Request.Form["subject"]);
                if (responseTxt == "true" && sign == mysign)    //验证成功
                {
                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取通知返回参数,可参考技术文档中服务器异步通知参数列表
                    string trade_no     = Request.Form["trade_no"];       //交易号
                    string total_fee    = Request.Form["price"];          //获取总金额
                    string subject      = Request.Form["subject"];        //商品名称、
                    string body         = Request.Form["body"];           //商品描述、订单备注、描述
                    string buyer_email  = Request.Form["buyer_email"];    //买家账号
                    string trade_status = Request.Form["trade_status"];   //交易状态
                    if (Request.Form["trade_status"] == "WAIT_BUYER_PAY") //没有付款
                    {
                    }
                    else if (trade_status.Equals("WAIT_SELLER_SEND_GOODS"))//付款成功,但是卖家没有发货
                    {
                    }
                    else if (trade_status.Equals("TRADE_SUCCESS"))//付款成功
                    {
                        try
                        {
                            M_Payment pinfo = payBll.SelModelByPayNo(order_no);
                            if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                            {
                                return;
                            }
                            pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
                            pinfo.PlatformInfo = PayPlat;      //平台反馈信息
                            pinfo.SuccessTime  = DateTime.Now; //交易成功时间
                            pinfo.CStatus      = true;         //处理状态
                            pinfo.AlipayNO     = trade_no;     //保存支付宝交易号
                            pinfo.MoneyTrue    = Convert.ToDouble(total_fee);
                            payBll.Update(pinfo);
                            DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                            foreach (DataRow dr in orderDT.Rows)
                            {
                                M_Order_PayLog paylogMod = new M_Order_PayLog();
                                M_OrderList    orderMod  = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                                OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                                orderCOM.SendMessage(orderMod, paylogMod, "payed");
                            }
                            Response.Write("success");
                            ZLLog.L(ZLEnum.Log.pay, PayPlat + "成功!支付单:" + order_no);
                        }
                        catch (Exception ex)
                        {
                            ZLLog.L(ZLEnum.Log.pay, new M_Log()
                            {
                                Action  = "支付回调报错",
                                Message = PayPlat + ",支付单:" + order_no + ",原因:" + ex.Message
                            });
                        }
                    }
                    else if (Request.Form["trade_status"] == "WAIT_BUYER_CONFIRM_GOODS")//卖家已经发货,等待买家确认
                    {
                    }
                    else if (Request.Form["trade_status"] == "TRADE_FINISHED")
                    {
                    }
                    else//其他状态判断。普通即时到帐中,其他状态不用判断,直接打印success。
                    {
                        ZLLog.L(PayPlat + "付款未成功截获,单号:[" + trade_status + "]");
                    }
                }
                else//验证失败
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action  = "支付验证失败",
                        Message = PayPlat + ",支付单:" + order_no
                    });
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("success");
            }
        }
예제 #19
0
        /*
         * 仅支持支付单
         */
        protected void Page_Load(object sender, EventArgs e)
        {
            B_User.CheckIsLogged(Request.RawUrl);
            M_UserInfo mu = buser.GetLogin(false);

            if (string.IsNullOrEmpty(SiteConfig.SiteInfo.SiteUrl))
            {
                function.WriteErrMsg("错误,管理员未定义网站地址,SiteUrl");
            }
            string siteurl = (SiteConfig.SiteInfo.SiteUrl.TrimEnd('/') + "/PayOnline/");

            if (string.IsNullOrEmpty(PayNo))
            {
                function.WriteErrMsg("请传入支付单号");
            }
            pinfo = paymentBll.SelModelByPayNo(PayNo);
            if (pinfo == null || pinfo.PaymentID < 1)
            {
                function.WriteErrMsg("支付单不存在");
            }
            M_PayPlat payPlat = payPlatBll.GetPayPlatByid(pinfo.PayPlatID);

            if (!IsPostBack)
            {
                #region 母版页中信息
                logged_div.Visible = true;
                #endregion
                if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    function.WriteErrMsg("支付单不能重复付款");
                }
                Rurl_Href.NavigateUrl = "/User/Order/OrderList";//返回我的订单
                if (pinfo.PaymentNum.Contains("IDC"))
                {
                    Rurl_Href.NavigateUrl = "/Plugins/Domain/ViewHave.aspx";
                }
                string url = Request.CurrentExecutionFilePath;
                urlReq1 = Request.Url.AbsoluteUri.ToString().Substring(0, Request.Url.AbsoluteUri.ToString().LastIndexOf('/'));
                double vmoney   = pinfo.MoneyReal;                //支付金额
                string v_amount = pinfo.MoneyReal.ToString("f2"); //实际支付金额
                if (string.IsNullOrEmpty(PayMethod))
                {
                    #region 现金支付
                    DataTable orderDB1  = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);//订单表,ZL_OrderInfo
                    int       orderType = 0;
                    if (orderDB1.Rows.Count > 0)
                    {
                        orderType = DataConvert.CLng(orderDB1.Rows[0]["OrderType"]);
                    }
                    if (orderType == 8)//有需要检测库存的订单类型,放此
                    {
                        if (!cartBll.CheckStock(Convert.ToInt32(orderDB1.Rows[0]["OrderType"])))
                        {
                            function.WriteErrMsg("商品库存数量不足,请重新购买");
                        }
                    }
                    DataTable ordertable = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                    int       DeliveryID = 0; //送货方式ID
                    if (ordertable != null && ordertable.Rows.Count > 0)
                    {
                        DeliveryID = DataConverter.CLng(ordertable.Rows[0]["Delivery"]);
                    }
                    if (pinfo.PayPlatID == 0 && !string.IsNullOrEmpty(pinfo.PlatformInfo))//支付宝网银支付
                    {
                        payPlat = payPlatBll.GetPayPlatByClassID("15");
                        alipayBank(pinfo.PlatformInfo);
                    }
                    if (payPlat.PayClass == 99)//线下支付
                    {
                        function.WriteSuccessMsg("信息已记录,请等待商家联系完成线下付款", Rurl_Href.NavigateUrl);
                    }
                    if (payPlat == null || payPlat.PayPlatID < 1)
                    {
                        function.WriteErrMsg("没有找到对应的支付平台信息!");
                    }
                    //StringBuilder v_urlBuilder = new StringBuilder();    //构造返回URL
                    //StringBuilder strHiddenField = new StringBuilder();
                    //string applicationName = paymentBll.GetApplicationName();
                    //if (!applicationName.EndsWith("/"))
                    //{
                    //    applicationName = applicationName + "/";
                    //}
                    //v_urlBuilder.Append("http://");
                    //v_urlBuilder.Append(applicationName);
                    //string v_ShowResultUrl = v_urlBuilder.ToString() + "PayOnline/ShowReturn.aspx?";
                    if (payPlat.PayClass == 100)//货到付款
                    {
                        payinfo_div.Visible = false;
                        AfterPay_Tb.Visible = true;
                        Title = "下单成功!";
                    }
                    else
                    {
                        payinfo_div.Visible = true;
                        AfterPay_Tb.Visible = false;
                    }
                    switch ((M_PayPlat.Plat)payPlat.PayClass)//现仅开通 12:支付宝即时到账和支付宝网银服务,15支付宝网银服务(上方代码中处理),银币与余额服务
                    {
                        #region 各种支付方式
                    case M_PayPlat.Plat.UnionPay:
                        #region 银联在线
                        //gateway = "https://pay3.chinabank.com.cn/PayGate?encoding=UTF-8";
                        //必要的交易信息
                        string wv_amount    = v_amount;                              // 订单金额
                        string wv_moneytype = "CNY";                                 // 币种
                        string wv_md5info;                                           // 对拼凑串MD5私钥加密后的值
                        string wv_mid = payPlat.AccountID;                           // 商户号
                        //v_urlBuilder.Append("http://localhost:86/PayOnline/PayReceive.aspx?PayID=" +payid);
                        string wv_url = urlReq1 + "/PayReceive.aspx?PayNo=" + PayNo; // 返回页地址
                        string wv_oid = pinfo.PayNo;                                 // 推荐订单号构成格式为 年月日-商户号-小时分钟秒
                        //两个备注

                        // wv_mid = "1001";				 商户号,这里为测试商户号20000400,替换为自己的商户号即可
                        // wv_url = "http://localhost/chinabank/Receive.aspx";  商户自定义返回接收支付结果的页面
                        // MD5密钥要跟订单提交页相同,如Send.asp里的 key = "test" ,修改""号内 test 为您的密钥
                        string wkey = payPlat.MD5Key;                                    // 如果您还没有设置MD5密钥请登录我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/
                        // 登录后在上面的导航栏里可能找到“B2C”,在二级导航栏里有“MD5密钥设置”
                        // 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了
                        wv_amount    = v_amount;    // 订单金额
                        wv_moneytype = "CNY";       // 币种
                        //对拼凑串MD5私钥加密后的值
                        wv_mid = payPlat.AccountID; // 商户号
                        wv_oid = pinfo.PayNo;       // 推荐订单号构成格式为 年月日-商户号-小时分钟秒

                        if (wv_oid == null || wv_oid.Equals(""))
                        {
                            DateTime dt       = DateTime.Now;
                            string   wv_ymd   = dt.ToString("yyyyMMdd"); // yyyyMMdd
                            string   wtimeStr = dt.ToString("HHmmss");   // HHmmss
                            wv_oid = wv_ymd + wv_mid + wtimeStr;
                        }
                        string text = wv_amount + wv_moneytype + wv_oid + wv_mid + wv_url + wkey;     // 拼凑加密串
                        wv_md5info = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(text, "md5").ToUpper();
                        //strHiddenField.Append("<input type='hidden' name='v_md5info' value='" + wv_md5info + "'>\n");
                        //strHiddenField.Append("<input type='hidden' name='v_mid' value='" + wv_mid + "'>\n");
                        //strHiddenField.Append("<input type='hidden' name='v_oid' value='" + wv_oid + "'>\n");
                        //strHiddenField.Append("<input type='hidden' name='v_amount' value='" + wv_amount + "' >\n");
                        //strHiddenField.Append("<input type='hidden' name='v_moneytype' value='" + wv_moneytype + "'>\n");
                        //strHiddenField.Append("<input type='hidden' name='v_url' value='" + wv_url + "'>\n");
                        //    //以下几项只是用来记录客户信息,可以不用,不影响支付
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvname' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvaddr' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvtel' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvpost' value='" + "" + "' >\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvemail' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_rcvmobile' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_ordername' value='" + "" + "' >\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_orderaddr' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_ordertel' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_orderpost' value='" + "" + "' >\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_orderemail' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='v_ordermobile' value='" + "" + "'>\n");
                        //    strHiddenField.Append("<input type='hidden' name='Package' value='" + Request.QueryString["Package"] + "'>\n");
                        #endregion
                        break;

                    case M_PayPlat.Plat.Alipay_Instant:
                        #region 支付宝[即时到帐]
                        string input_charset1 = "utf-8";
                        string notify_url1    = urlReq1 + "/Return/AlipayNotify.aspx"; //付完款后服务器AJAX通知的页面 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
                        string return_url1    = urlReq1 + "/Return/AlipayReturn.aspx"; //付完款后跳转的页面 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
                        string show_url1      = "";
                        string sign_type1     = "MD5";
                        ///////////////////////以下参数是需要通过下单时的订单数据传入进来获得////////////////////////////////
                        //必填参数
                        string price1             = pinfo.MoneyReal.ToString("f2");  //订单总金额,显示在支付宝收银台里的“商品单价”里
                        string logistics_fee1     = "0.00";                          //物流费用,即运费。
                        string logistics_type1    = "POST";                          //物流类型,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
                        string logistics_payment1 = "SELLER_PAY";                    //物流支付方式,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
                        string out_trade_no1      = pinfo.PayNo;                     //请与贵网站订单系统中的唯一订单号匹配
                        string subject1           = pinfo.Remark;                    //订单名称,显示在支付宝收银台里的“商品名称”里,显示在支付宝的交易管理的“商品名称”的列表里。
                        string body1            = pinfo.Remark;                      //订单描述、订单详细、订单备注,显示在支付宝收银台里的“商品描述”里
                        string quantity1        = "1";                               //商品数量,建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品。
                        string receive_name1    = "";                                //收货人姓名,如:张三
                        string receive_address1 = "";                                //收货人地址,如:XX省XXX市XXX区XXX路XXX小区XXX栋XXX单元XXX号
                        string receive_zip1     = "";                                //收货人邮编,如:123456
                        string receive_phone1   = "";                                //收货人电话号码,如:0571-81234567
                        string receive_mobile1  = "";                                //收货人手机号码,如:13312341234
                        //---------------------
                        string receive_name    = orderDB1.Rows[0]["Reuser"] + "";    //收货人姓名,如:张三
                        string receive_address = orderDB1.Rows[0]["Jiedao"] + "";    //收货人地址,如:XX省XXX市XXX区XXX路XXX小区XXX栋XXX单元XXX号
                        string receive_zip     = orderDB1.Rows[0]["ZipCode"] + "";   //收货人邮编,如:123456
                        string receive_phone   = orderDB1.Rows[0]["Phone"] + "";     //收货人电话号码,如:0571-81234567
                        string receive_mobile  = orderDB1.Rows[0]["MobileNum"] + ""; //收货人手机号码,如:13312341234
                        //扩展参数——第二组物流方式
                        //物流方式是三个为一组成组出现。若要使用,三个参数都需要填上数据;若不使用,三个参数都需要为空
                        //有了第一组物流方式,才能有第二组物流方式,且不能与第一个物流方式中的物流类型相同,
                        //即logistics_type="EXPRESS",那么logistics_type_1就必须在剩下的两个值(POST、EMS)中选择
                        string logistics_fee_3     = "";                                                    //物流费用,即运费。
                        string logistics_type_3    = "";                                                    //物流类型,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
                        string logistics_payment_3 = "";                                                    //物流支付方式,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)

                        //扩展参数——第三组物流方式
                        //物流方式是三个为一组成组出现。若要使用,三个参数都需要填上数据;若不使用,三个参数都需要为空
                        //有了第一组物流方式和第二组物流方式,才能有第三组物流方式,且不能与第一组物流方式和第二组物流方式中的物流类型相同,
                        //即logistics_type="EXPRESS"、logistics_type_1="EMS",那么logistics_type_2就只能选择"POST"
                        string logistics_fee_4     = "";                                                        //物流费用,即运费。
                        string logistics_type_4    = "";                                                        //物流类型,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
                        string logistics_payment_4 = "";                                                        //物流支付方式,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
                        //扩展功能参数——其他
                        string buyer_email1 = "";                                                               //默认买家支付宝账号
                        string discount1    = "";                                                               //折扣,是具体的金额,而不是百分比。若要使用打折,请使用负数,并保证小数点最多两位数
                        /////////////////////////////////////////////////////////////////////////////////////////////////////
                        //构造请求函数,无需修改
                        B_AliPay_trades_Services aliService1 = new B_AliPay_trades_Services(
                            payPlat.AccountID,
                            payPlat.SellerEmail,
                            return_url1,
                            notify_url1,
                            show_url1,
                            out_trade_no1,
                            subject1,
                            body1,
                            price1,
                            logistics_fee1,
                            logistics_type1,
                            logistics_payment1,
                            quantity1,
                            receive_name1,
                            receive_address1,
                            receive_zip1,
                            receive_phone1,
                            receive_mobile1,
                            logistics_fee_3,
                            logistics_type_3,
                            logistics_payment_3,
                            logistics_fee_4,
                            logistics_type_4,
                            logistics_payment_4,
                            buyer_email1,
                            discount1,
                            payPlat.MD5Key,
                            input_charset1,
                            sign_type1);
                        Alipay_Btn.Visible       = true;
                        LblHiddenValue.InnerHtml = aliService1.Build_Form();
                        #endregion
                        break;

                    case M_PayPlat.Plat.Alipay_Bank:    //支付宝网银,已上方处理
                        break;

                    case M_PayPlat.Plat.Mobo:
                        #region 成都MO宝支付
                    {
                        string pfxFilePath = Server.MapPath("/muzi.pfx");
                        string cerFilePath = Server.MapPath("/mobaopay.cer");
                        string passwd      = payPlat.MD5Key;
                        if (!File.Exists(pfxFilePath) || !File.Exists(cerFilePath))
                        {
                            function.WriteErrMsg("证书文件不存在");
                        }
                        Mobo360SignUtil.Instance.init(pfxFilePath, cerFilePath, passwd);
                        //--------------------------------------------------------------------
                        Dictionary <string, string> payData = new Dictionary <string, string>();
                        payData.Add("apiName", "WEB_PAY_B2C");
                        payData.Add("apiVersion", "1.0.0.0");
                        payData.Add("platformID", payPlat.PayPlatinfo); //平台ID,商户号
                        payData.Add("merchNo", payPlat.AccountID);
                        payData.Add("orderNo", pinfo.PayNo);            //订单号,
                        payData.Add("tradeDate", DateTime.Now.ToString("yyyyMMdd"));
                        payData.Add("amt", pinfo.MoneyReal.ToString("f2"));
                        payData.Add("merchUrl", urlReq1 + "/Return/MoBaoReturn.aspx");
                        payData.Add("merchParam", "");
                        payData.Add("tradeSummary", pinfo.Remark);
                        payData.Add("signMsg", Mobo360SignUtil.Instance.sign(payData));
                        string payReqUrl = Mobo360Merchant.Instance.generatePayUrl(payData, "https://trade.mobaopay.com/cgi-bin/netpayment/pay_gate.cgi");
                        Response.ContentEncoding = System.Text.Encoding.UTF8;
                        Alipay_Btn.Visible       = true;
                        LblHiddenValue.InnerHtml = new Pay_BaoFa().BuildForm(payReqUrl, null);
                        //Response.Redirect(payReqUrl);// 重定向客户端到收银台
                        //Confirm_VMoney_Btn.Visible = true;
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.WXPay:
                        #region 微信扫码支付
                    {
                        pinfo.PlatformInfo = "0";
                        paymentBll.Update(pinfo);
                        WxPayData wxdata = new WxPayData();
                        wxdata.SetValue("out_trade_no", pinfo.PayNo);
                        wxdata.SetValue("body", string.IsNullOrEmpty(pinfo.Remark) ? "微信支付" : pinfo.Remark);
                        wxdata.SetValue("total_fee", Convert.ToInt32(pinfo.MoneyReal * 100));
                        wxdata.SetValue("trade_type", "NATIVE");
                        wxdata.SetValue("notify_url", urlReq1 + "/Return/WxPayReturn.aspx");
                        wxdata.SetValue("product_id", "1");
                        WxPayData result = WxPayApi.UnifiedOrder(wxdata, WxPayApi.Pay_GetByID());
                        if (result.GetValue("return_code").ToString().Equals("FAIL"))
                        {
                            function.WriteErrMsg("商户" + result.GetValue("return_msg"));
                        }
                        Response.Redirect("/PayOnline/WxCodePay.aspx?PayNo=" + pinfo.PayNo + "&wxcode=" + result.GetValue("code_url"));
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.BaoFo:
                        #region 宝付
                    {
                        Pay_BaoFa baofaBll = new Pay_BaoFa();
                        //测试使用
                        payPlat.AccountID   = "100000178";
                        payPlat.MD5Key      = "abcdefg";
                        payPlat.PayPlatinfo = "10000001";
                        Dictionary <string, string> dics = new Dictionary <string, string>();
                        dics.Add("MemberID", payPlat.AccountID);        //"100000178",
                        dics.Add("PayID", "");
                        dics.Add("TradeDate", DateTime.Now.ToString("yyyyMMddHHmmss"));
                        dics.Add("TerminalID", payPlat.PayPlatinfo);        //19534
                        dics.Add("InterfaceVersion", "4.0");
                        dics.Add("KeyType", "1");
                        dics.Add("TransID", pinfo.PayNo);
                        dics.Add("OrderMoney", (pinfo.MoneyReal * 100).ToString("f0"));        //金额必须相等,否则会报签名失败
                        dics.Add("ProductName", pinfo.Remark);
                        dics.Add("Amount", pinfo.MoneyReal.ToString("f2"));
                        dics.Add("Username", mu.UserName);
                        dics.Add("AdditionalInfo", "");                               //可填sessionid等
                        dics.Add("PageUrl", siteurl + "/Return/BaoFaoShow.aspx");
                        dics.Add("ReturnUrl", siteurl + "/Return/BaoFaoNotify.aspx"); //是否必须正式才会有回调
                        dics.Add("NoticeType", "1");
                        string signature = baofaBll.GetMd5Sign(dics["MemberID"], dics["PayID"], dics["TradeDate"]
                                                               , dics["TransID"], dics["OrderMoney"]
                                                               , dics["PageUrl"], dics["ReturnUrl"], dics["NoticeType"], payPlat.MD5Key);
                        dics.Add("Signature", signature);
                        Alipay_Btn.Visible       = true;  //测试URL:http://tgw.bfopay.com/payindex   //正式:http://gw.bfopay.com/payindex
                        LblHiddenValue.InnerHtml = baofaBll.BuildForm("http://tgw.bfopay.com/payindex", dics);
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.EPay95:
                        #region 双乾
                    {
                        Dictionary <string, string> epay_dics = new Dictionary <string, string>();
                        epay_dics.Add("MerNo", payPlat.AccountID);
                        epay_dics.Add("BillNo", pinfo.PayNo);
                        epay_dics.Add("Amount", pinfo.MoneyReal.ToString("f2"));
                        epay_dics.Add("ReturnURL", siteurl + "Return/EPay95Result.aspx");
                        epay_dics.Add("NotifyURL", siteurl + "Return/EPay95Notify.aspx");
                        string EpayMD5Key = payPlat.MD5Key;
                        string md5md5     = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(EpayMD5Key, "MD5").ToUpper();
                        //注意这里和示例不同,其示例是错误的.
                        string md5src = StringHelper.MD5("Amount=" + pinfo.MoneyReal.ToString("f2") + "&BillNo=" + pinfo.PayNo + "&MerNo=" + payPlat.AccountID + "&ReturnURL=" + siteurl + "EPay95Result.aspx" + "&" + md5md5).ToUpper();
                        epay_dics.Add("MD5info", md5src);
                        epay_dics.Add("PayType", "CSPAY");
                        epay_dics.Add("MerRemark", "双乾支付");
                        epay_dics.Add("products", pinfo.Remark);
                        LblHiddenValue.InnerHtml = new Pay_BaoFa().BuildForm("https://www.95epay.cn/sslpayment", epay_dics);
                        Alipay_Btn.Visible       = true;
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.Ebatong:
                        #region Ebatong
                    {
                        Dictionary <string, string> ebatong_dics = new Dictionary <string, string>();
                        ebatong_dics.Add("sign_type", "MD5");
                        ebatong_dics.Add("service", "create_direct_pay_by_user");
                        ebatong_dics.Add("partner", payPlat.AccountID);
                        ebatong_dics.Add("input_charset", "UTF-8");
                        ebatong_dics.Add("notify_url", siteurl + "Return/EbatongNotify.aspx");        //服务器异步通知页面路径
                        ebatong_dics.Add("return_url", siteurl + "Return/EbatongReturn.aspx");        //服务器跳转页面
                        ebatong_dics.Add("out_trade_no", pinfo.PayNo);
                        ebatong_dics.Add("subject", pinfo.Remark);
                        ebatong_dics.Add("exter_invoke_ip", Request.UserHostAddress);
                        ebatong_dics.Add("payment_type", "1");
                        ebatong_dics.Add("seller_id", payPlat.AccountID);
                        ebatong_dics.Add("total_fee", pinfo.MoneyReal.ToString("f2"));
                        ebatong_dics.Add("error_notify_url", "");
                        ebatong_dics.Add("anti_phishing_key", new ZoomLa.BLL.Ebatong.AskForTimestamp().askFor(payPlat.AccountID, payPlat.MD5Key));
                        ebatong_dics.Add("seller_email", "");
                        ebatong_dics.Add("buyer_email", "");
                        ebatong_dics.Add("buyer_id", "");
                        ebatong_dics.Add("price", "");
                        ebatong_dics.Add("quantity", "");
                        ebatong_dics.Add("body", "");
                        ebatong_dics.Add("show_url", "");
                        ebatong_dics.Add("pay_method", "bankPay");
                        ebatong_dics.Add("extra_common_para", "");
                        ebatong_dics.Add("extend_param", "");
                        ebatong_dics.Add("it_b_pay", "");
                        ebatong_dics.Add("royalty_type", "");
                        ebatong_dics.Add("royalty_parameters", "");
                        ebatong_dics.Add("default_bank", "");
                        string[] paramts = new string[ebatong_dics.Keys.Count]; //参数排序数组
                        ebatong_dics.Keys.CopyTo(paramts, 0);
                        Array.Sort(paramts);                                    //参数排序操作
                        string paramstr = "";
                        foreach (string item in paramts)
                        {
                            paramstr += string.Format("{0}={1}&", item, ebatong_dics[item]);
                        }
                        //throw new Exception(paramstr.Trim('&'));
                        string md5md5 = new ZoomLa.BLL.Ebatong.CommonHelper().md5("UTF-8", paramstr.Trim('&') + payPlat.MD5Key).ToLower();
                        ebatong_dics.Add("sign", md5md5);
                        LblHiddenValue.InnerHtml = new Pay_BaoFa().BuildForm("https://www.ebatong.com/direct/gateway.htm", ebatong_dics);
                        Alipay_Btn.Visible       = true;
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.CCB:
                        #region 江西建行
                    {
                        Dictionary <string, string> ccb_dics = new Dictionary <string, string>();
                        ccb_dics.Add("MERCHANTID", payPlat.AccountID);    //商户代码
                        ccb_dics.Add("POSID", payPlat.PrivateKey);        //柜台代码
                        ccb_dics.Add("BRANCHID", payPlat.PublicKey);      //分行代码
                        ccb_dics.Add("ORDERID", pinfo.PayNo);
                        ccb_dics.Add("PAYMENT", pinfo.MoneyReal.ToString("f2"));
                        ccb_dics.Add("CURCODE", "01");
                        ccb_dics.Add("REMARK1", "");        //备注信息1(具体信息待测试)
                        ccb_dics.Add("REMARK2", "");        //备注信息2
                        ccb_dics.Add("TXCODE", "520100");
                        string ccb_paramstr = "";
                        foreach (String item in ccb_dics.Keys)
                        {
                            ccb_paramstr += string.Format("{0}={1}&", item, ccb_dics[item]);
                        }
                        string md5str = new ZoomLa.BLL.Ebatong.CommonHelper().md5("UTF-8", ccb_paramstr.Trim('&')).ToLower();
                        ccb_dics.Add("MAC", md5str);
                        LblHiddenValue.InnerHtml = new Pay_BaoFa().BuildForm("https://ibsbjstar.ccb.com.cn/app/ccbMain", ccb_dics);
                        Alipay_Btn.Visible       = true;
                        //Response.Redirect("https://ibsbjstar.ccb.com.cn/app/ccbMain?" + ccb_paramstr + "MAC=" + md5str);
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.ECPSS:
                        #region 汇潮支付
                    {
                        Dictionary <string, string> payData = new Dictionary <string, string>();
                        payData.Add("OrderDesc", "test");                              //订单描述
                        payData.Add("Remark", "汇潮支付");                                 //备注
                        payData.Add("AdviceURL", siteurl + "Return/ECPSSNotfy.aspx");  //回调通知地址
                        payData.Add("ReturnURL", siteurl + "Return/ECPSSResult.aspx"); //返回地址
                        payData.Add("BillNo", pinfo.PayNo);                            //订单号
                        payData.Add("MerNo", payPlat.AccountID);                       //商户号
                        payData.Add("Amount", pinfo.MoneyReal.ToString("f2"));         //交易价格
                        string md5key = payPlat.MD5Key;
                        string md5str = payData["MerNo"] + "&" + payData["BillNo"] + "&" + payData["Amount"] + "&" + payData["ReturnURL"] + "&" + md5key;
                        payData.Add("SignInfo", System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5str, "MD5")); //签名
                        payData.Add("defaultBankNumber", "");                                                                               //银行代码(选填)
                        payData.Add("orderTime", DateTime.Now.ToString("yyyyMMddHHmmss"));                                                  //交易时间yyyyMMddHHmmss
                        payData.Add("products", pinfo.Remark);                                                                              //物品信息
                        LblHiddenValue.InnerHtml = new Pay_BaoFa().BuildForm("https://pay.ecpss.com/sslpayment", payData);
                        Alipay_Btn.Visible       = true;
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.ICBC_NC:
                        #region 南昌工行
                    {
                        function.WriteErrMsg("工行支付组件未注册,请联系管理员");
                        //ICBCHelper icbc = new ICBCHelper();
                        //infosecapiLib.infosecClass obj = new infosecapiLib.infosecClass();
                        //Dictionary<string, string> dics = new Dictionary<string, string>();
                        //string posturl = "https://B2C.icbc.com.cn/servlet/ICBCINBSEBusinessServlet";
                        //---Debug
                        //payPlat.AccountID = "1502EC24392836";
                        //payPlat.SellerEmail = "1502201009004747554";
                        //payPlat.PrivateKey = "/Cert/cs.key";
                        //payPlat.PublicKey = "/Cert/cs.cer";
                        //posturl = "https://myipad.dccnet.com.cn/servlet/NewB2cMerPayReqServlet";
                        //throw new Exception(payPlat.PrivateKey + ":" + payPlat.PublicKey + ":" + payPlat.AccountID + ":" + payPlat.SellerEmail);
                        //Debug End
                        //*.z01.com根据需要更改如*.hx008.com
                        //string data = icbc.SpliceTranData(pinfo, payPlat.AccountID.Trim(), payPlat.SellerEmail.Trim(), "*.z01.com", siteurl + "ICBCNotify.aspx");
                        //string sign = obj.sign(data, Server.MapPath(payPlat.PrivateKey), payPlat.MD5Key.Trim());//私钥虚拟路径与私钥密钥
                        //dics.Add("interfaceName", "ICBC_PERBANK_B2C");
                        //dics.Add("interfaceVersion", "1.0.0.11");
                        //dics.Add("tranData", obj.base64enc(data));
                        //dics.Add("merSignMsg", sign);
                        //dics.Add("merCert", icbc.ReadCertToBase64(payPlat.PublicKey));//公钥路径
                        //LblHiddenValue.InnerHtml = new Pay_BaoFa().BuildForm(posturl, dics);
                        //Alipay_Btn.Visible = true;
                    }
                        #endregion
                        break;

                    case M_PayPlat.Plat.CashOnDelivery:
                        #region 货到付款
                        zfpt.Text      = payPlat.PayPlatName;
                        ddh.Text       = pinfo.PaymentNum;
                        PayNum_L2.Text = Convert.ToDecimal(vmoney).ToString("F2") + " 元";
                        sxf.Text       = payPlat.Rate.ToString() + " %";
                        sjhbje.Text    = v_amount + " 元";
                        #endregion
                        break;

                    default:
                        throw new Exception("错误:支付方式不存在");
                        #endregion
                    }
                    VMoneyPayed_L.Text = payPlat.PayPlatName;
                    OrderNo_L.Text     = pinfo.PaymentNum;
                    LblRate.Text       = payPlat.Rate.ToString() + " %";
                    #endregion
                }
                else//非现金支付,给用户显示确认支付页,实际支付行为在Confirm_Click
                {
                    Confirm_VMoney_Btn.Visible = true;
                    payinfo_div.Visible        = true;
                    AfterPay_Tb.Visible        = false;
                    OrderNo_L.Text             = pinfo.PaymentNum;
                    DataTable ordertable = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                    if (ordertable != null && ordertable.Rows.Count > 0)
                    {
                        switch (PayMethod)
                        {
                        case "Purse":
                            //Titles.Text = "余额支付操作(确认支付款项)";
                            Fee.Text           = "帐户余额:";
                            LblRate.Text       = mu.Purse + " 元";
                            VMoneyPayed_L.Text = "帐户余额";
                            break;

                        case "SilverCoin":
                            //Titles.Text = "银币支付操作(确认支付款项)";
                            Fee.Text           = "帐户银币:";
                            LblRate.Text       = mu.SilverCoin + " 个";
                            VMoneyPayed_L.Text = "账户银币";
                            break;

                        case "Score":
                            //Titles.Text = "积分支付操作(确认支付款项)";
                            Fee.Text           = "帐户积分:";
                            LblRate.Text       = mu.UserExp + " 分";
                            VMoneyPayed_L.Text = "账户积分";
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        payinfo_div.Visible = false;
                        AfterPay_Tb.Visible = false;
                        function.WriteErrMsg("订单不存在");
                    }
                }
                //显示金额信息
                LblPayMoney.Text = pinfo.MoneyReal.ToString("F2") + " 元";//应付金额
                //string priceJson = orderCom.GetTotalJson(ordertable);//多虚拟币支付,暂取消
                //M_LinPrice priceMod = JsonConvert.DeserializeObject<M_LinPrice>(priceJson);
                //if (orderCom.HasPrice(priceJson))
                //{
                //    if (priceMod.Purse > 0)
                //    {
                //        LblPayMoney.Text += " 余额:" + priceMod.Purse.ToString("f2");
                //    }
                //    if (priceMod.Sicon > 0)
                //    { LblPayMoney.Text += " 银币:" + priceMod.Sicon.ToString("f2"); }
                //    if (priceMod.Point > 0)
                //    {
                //        LblPayMoney.Text += " 积分:" + priceMod.Point.ToString("f2");
                //    }
                //}
            }
            //------------------检测End;
        }