Exemplo n.º 1
0
        /// <summary>
        /// 页面跳转同步通知页面
        /// </summary>
        /// <returns>返回页面</returns>
        public ActionResult RecvPayStatusSync()
        {
            string mainDomain = System.Configuration.ConfigurationManager.AppSettings["MainDomain"];
            SortedDictionary<string, string> sPara = GetRequestGet();
            //判断是否有带返回参数
            if (sPara.Count > 0)
            {
                Notify aliNotify = new Notify();
                bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);
                //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
                //商户订单号
                string out_trade_no = Request.QueryString["out_trade_no"];
                //支付宝交易号
                string trade_no = Request.QueryString["trade_no"];
                //交易状态
                string trade_status = Request.QueryString["trade_status"];
                //验证成功
                if (verifyResult)
                {
                    if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
                    {

                    }
                    else
                    {
                        //充值失败&错误
                    }
                }
                else
                {
                    //充值失败&错误
                    return Redirect(mainDomain + "/pay/error?order_id=" + out_trade_no + "&error_type=verifyerror");
                }
            }
            else
            {
                //充值失败&错误
                return Redirect(mainDomain + "/pay/error?error_type=exerror");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 退款通知
        /// </summary>
        public void RefundNotify()
        {
            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 batch_no = Request.Form["batch_no"];
                    //批量退款数据中转账成功的笔数
                    string success_num = Request.Form["success_num"];
                    //批量退款数据中的详细信息
                    string result_details = Request.Form["result_details"];

                    Response.Write("success");  //请不要修改或删除
                }
                else//验证失败
                {
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("无通知参数");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 服务器异步通知
 /// </summary>
 public void RecvPayStatus()
 {
     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"]);
         //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
         //商户订单号
         string out_trade_no = Request.Form["out_trade_no"];
         //支付宝交易号
         string trade_no = Request.Form["trade_no"];
         //交易状态
         string trade_status = Request.Form["trade_status"];
         //验证成功
         if (verifyResult)
         {
             if (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS")
             {
                 Response.Write("success");
             }
         }
         //验证失败
         else
         {
             Response.Write("fail");
         }
     }
     else
     {
         Response.Write("无通知参数");
     }
 }