Esempio n. 1
0
        public ActionResult OrderPay(OrderPayDTO model)
        {
            IF2FTradeService service = new AliPayTradeService();

            try
            {
                if (Session["CurrentAlipayAuthToken"] != null && !string.IsNullOrEmpty(Session["CurrentAlipayAuthToken"].ToString()))
                {
                    service.SetAuthToken(Session["CurrentAlipayAuthToken"].ToString());
                }
                var result = service.OrderPay(model);

                ViewData["resultMsg"] = string.Format("http路径:{0}<br/>http请求内容:{1}<br/>响应结果为:{2}<br/>CurrentAlipayAuthToken:{3}", result.RequestUrl, result.RequestContent, result.ResponseBody, Session["CurrentAlipayAuthToken"]);

                ViewData["OnlineTradeNo"] = result.OnlineTradeNo;
            }
            catch (F2FPayException e)
            {
                ViewData["resultMsg"] = string.Format("发生异常为:{0}", e);
            }
            return(View(model));
        }