Beispiel #1
0
        /// <summary>
        /// 审核通过客户订单
        /// </summary>
        /// <param name="id"></param>
        /// <param name="agentID"></param>
        /// <returns></returns>
        public JsonResult PayOrderAndAuthorizeClient(string id)
        {
            //订单支付及后台客户授权
            ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);

            if (order.Status == 0)
            {
                bool flag = ClientOrderBusiness.PayOrderAndAuthorizeClient(id, CurrentUser.UserID, -1, EnumOrderPayType.Cash);
                JsonDictionary.Add("Result", flag ? 1 : 0);

                if (flag)
                {
                    ClientBusiness.UpdateClientCache(order.ClientID);
                    ClearClientCache(order.ClientID);
                }
            }
            else
            {
                JsonDictionary.Add("Result", order.Status == 1 ? 1001 : 1002);
            }
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #2
0
        public JsonResult PayOrderAndAuthorizeClient(string id, string agentID)
        {
            //订单支付及后台客户授权
            bool flag = ClientOrderBusiness.PayOrderAndAuthorizeClient(id);

            JsonDictionary.Add("Result", flag ? 1 : 0);

            if (flag)
            {
                AgentsBusiness.UpdatetAgentCache(agentID);
            }

            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #3
0
        /// <summary>
        /// 接受支付宝扣款通知
        /// </summary>
        public void Notify()
        {
            SortedDictionary <string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]);


                if (verifyResult)//验证成功
                {
                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表

                    //商户订单号
                    string out_trade_no = Request.Form["out_trade_no"];

                    //支付宝交易号

                    string trade_no = Request.Form["trade_no"];

                    //交易状态
                    string trade_status = Request.Form["trade_status"];


                    if (Request.Form["trade_status"] == "TRADE_FINISHED")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的
                        //如果有做过处理,不执行商户的业务程序

                        //注意:
                        //退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知
                    }
                    else if (Request.Form["trade_status"] == "TRADE_SUCCESS")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的
                        //如果有做过处理,不执行商户的业务程序

                        //注意:
                        //付款完成后,支付宝系统发送该交易状态通知

                        //获取订单详情
                        ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(out_trade_no);
                        if (order != null && !string.IsNullOrEmpty(order.OrderID))
                        {
                            decimal total_fee = decimal.Parse(Request.Form["total_fee"]);
                            if (order.RealAmount == total_fee)
                            {
                                //订单支付及后台客户授权
                                bool flag = ClientOrderBusiness.PayOrderAndAuthorizeClient(order.OrderID, string.Empty, 1, IntFactoryEnum.EnumOrderPayType.AliPay);

                                if (flag)
                                {
                                    ClientBusiness.UpdateClientCache(order.ClientID);
                                    Response.Write("success");  //请不要修改或删除
                                }
                            }
                        }
                    }
                }
            }
        }