コード例 #1
0
        /// <summary>
        /// 选定支付方式后更新平台信息
        /// </summary>
        public bool UpdatePlat(int id, M_PayPlat.Plat plat, string platInfo = "")
        {
            M_PayPlat           platMod = new B_PayPlat().SelModelByClass(plat);
            List <SqlParameter> sp      = new List <SqlParameter>()
            {
                new SqlParameter("platInfo", platInfo)
            };

            DBCenter.UpdateSQL(TbName, "PayPlatID=" + platMod.PayPlatID + ",PlatFormInfo=@platInfo", PK + "=" + id, sp);
            return(true);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sArrary = GetRequestGet();

            ///////////////////////以下参数是需要设置的相关配置参数,设置后不会更改的//////////////////////
            ZoomLa.BLL.B_PayPlat payBLL = new ZoomLa.BLL.B_PayPlat();
            DataTable            pay    = payBLL.GetPayPlatByClassid(12);

            ZoomLa.Model.M_Alipay_config con = new ZoomLa.Model.M_Alipay_config();
            if (pay == null || pay.Rows.Count < 1)
            {
                function.WriteErrMsg("请先配置支付平台信息!![系统设置-->支付平台-->在线支付平台]");
            }
            string partner       = pay.Rows[0]["AccountID"].ToString();
            string key           = pay.Rows[0]["MD5Key"].ToString();
            string input_charset = con.Input_charset;
            string sign_type     = con.Sign_type;
            string transport     = con.Transport;

            //////////////////////////////////////////////////////////////////////////////////////////////

            if (sArrary.Count > 0)//判断是否有带返回参数
            {
                B_Alipay_notify aliNotify = new B_Alipay_notify(sArrary, Request.QueryString["notify_id"], partner, key, input_charset, sign_type, transport);
                //AlipayNotify aliNotify = new AlipayNotify(sArrary, Request.QueryString["notify_id"], partner, key, input_charset, sign_type, transport);
                string responseTxt = aliNotify.ResponseTxt;       //获取远程服务器ATN结果,验证是否是支付宝服务器发来的请求
                string sign        = Request.QueryString["sign"]; //获取支付宝反馈回来的sign结果
                string mysign      = aliNotify.Mysign;            //获取通知返回后计算后(验证)的签名结果

                //写日志记录(若要调试,请取消下面两行注释)
                //string sWord = "responseTxt=" + responseTxt + "\n return_url_log:sign=" + Request.QueryString["sign"] + "&mysign=" + mysign + "\n return回来的参数:" + aliNotify.PreSignStr;
                //AlipayFunction.log_result(Server.MapPath("log/" + DateTime.Now.ToString().Replace(":", "")) + ".txt",sWord);

                //判断responsetTxt是否为ture,生成的签名结果mysign与获得的签名结果sign是否一致
                //responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
                //mysign与sign不等,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
                if (responseTxt == "true" && sign == mysign)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码

                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
                    string trade_no    = Request.QueryString["trade_no"];           //支付宝交易号
                    string order_no    = Request.QueryString["out_trade_no"];       //获取订单号
                    string total_fee   = Request.QueryString["total_fee"];          //获取总金额
                    string subject     = Request.QueryString["subject"];            //商品名称、订单名称
                    string body        = Request.QueryString["body"];               //商品描述、订单备注、描述
                    string buyer_email = Request.QueryString["buyer_email"];        //买家支付宝账号
                                                                                    //string receive_name = Request["receive_name"];      //收货人姓名
                                                                                    //string receive_address = Request["receive_address"];//收货人地址
                                                                                    //string receive_zip = Request["receive_zip"];        //收货人邮编
                                                                                    //string receive_phone = Request["receive_phone"];    //收货人电话
                                                                                    //string receive_mobile = Request["receive_mobile"];  //收货人手机
                    string trade_status = Request.QueryString["trade_status"];      //交易状态

                    //打印页面
                    lbTrade_no.Text     = trade_no;
                    lbOut_trade_no.Text = order_no;
                    lbTotal_fee.Text    = total_fee;
                    lbSubject.Text      = subject;
                    lbBody.Text         = body;
                    lbBuyer_email.Text  = buyer_email;
                    lbTrade_status.Text = trade_status;
                    lbVerify.Text       = "验证成功";

                    if (Request.QueryString["trade_status"] == "WAIT_SELLER_SEND_GOODS" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")//买家已经付款,等待卖家发货
                    {
                        M_Payment   payMod = payBll.SelModelByPayNo(order_no);
                        M_OrderList omod   = orderBll.SelModelByOrderNo(payMod.PaymentNum.Split(',')[0]);
                        LbName.Text    = omod.Receiver;
                        LbAddress.Text = omod.Jiedao;
                        LbZip.Text     = omod.ZipCode;
                        LbPhone.Text   = omod.Phone;
                        LbMobile.Text  = omod.Mobile.ToString();
                        FinalStep(omod);
                    }
                    else if (Request.QueryString["trade_status"] == "TRADE_FINISHED")//交易成功结束
                    {
                        lbVerify.Text = "该交易已经成功结束!";
                    }
                    else
                    {
                        Response.Write("trade_status=" + Request.QueryString["trade_status"]);
                    }
                }
                else//验证失败
                {
                    lbVerify.Text = "验证失败";
                }
            }
            else
            {
                lbVerify.Text = "无返回参数";
            }
        }
コード例 #3
0
        //-----------------------------Tools
        public string GetPayPlatName(M_Payment payMod)
        {
            if (payMod == null)
            {
                return("无支付信息");
            }
            string plat = "";

            if (payMod.PayPlatID == (int)M_PayPlat.Plat.Offline)
            {
                plat = "现金支付";
            }
            else if (payMod.PayPlatID == (int)M_PayPlat.Plat.CashOnDelivery)
            {
                plat = "货到付款";
            }
            else if (payMod.PayPlatID < 1)
            {
                plat = "虚拟币";
                switch (payMod.PlatformInfo.ToLower())
                {
                case "purse":
                    plat += "[余额]";
                    break;

                case "point":
                    plat += "[积分]";
                    break;

                case "sicon":
                case "silvercoin":
                    plat += "[银币]";
                    break;

                default:
                    plat += "[" + payMod.PlatformInfo + "]";
                    break;
                }
            }
            else
            {
                B_PayPlat platBll = new B_PayPlat();
                if (payMod.PayPlatID < 1)
                {
                    plat = "平台不存在";
                }
                else
                {
                    M_PayPlat platMod = null;
                    //兼容之前的错误(微信存了PayClass)
                    if (payMod.PayPlatID == (int)M_PayPlat.Plat.WXPay)
                    {
                        platMod = platBll.SelModelByClass((M_PayPlat.Plat)payMod.PayPlatID);
                    }
                    else
                    {
                        platMod = platBll.SelReturnModel(payMod.PayPlatID);
                    }
                    plat = (platMod == null ? "平台[" + payMod.PayPlatID + "]不存在" : platMod.PayPlatName);
                }
            }
            return(plat);
        }