Esempio n. 1
0
 /// <summary>
 /// 订单退款
 /// </summary>
 /// <returns></returns>
 public ActionResult RefundOrder(RefundDTO dto)
 {
     try
     {
         IF2FTradeService service = new AliPayTradeService();
         if (Session["CurrentAlipayAuthToken"] != null && !string.IsNullOrEmpty(Session["CurrentAlipayAuthToken"].ToString()))
         {
             service.SetAuthToken(Session["CurrentAlipayAuthToken"].ToString());
         }
         var result = service.Refund(dto);
         return(Content(string.Format("传参值:{0}<br/>请求结果:{1}<br/>CurrentAlipayAuthToken:{2}", new JavaScriptSerializer().Serialize(dto), result.ResponseBody, Session["CurrentAlipayAuthToken"])));
     }
     catch (Exception e)
     {
         return(Content(string.Format("发生异常:{0}", e.Message)));
     }
 }
Esempio n. 2
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));
        }