@Test public void testAlipayCallback() throws Exception { String content = "discount=0.00&payment_type=1&subject=测试&trade_no=2013082244524842&buyer_email=dlwdgl@gmail.com&gmt_create=2013-08-22 14:45:23&notify_type=trade_status_sync&quantity=1&out_trade_no=082215222612710&seller_id=2088501624816263&notify_time=2013-08-22 14:45:24&body=测试测试&trade_status=TRADE_SUCCESS&is_total_fee_adjust=N&total_fee=1.00&gmt_payment=2013-08-22 14:45:24&seller_email=xxx@alipay.com&price=1.00&buyer_id=2088602315385429&notify_id=64ce1b6ab92d00ede0ee56ade98fdf2f4c&use_coupon=N&sign_type=RSA&sign=1glihU9DPWee+UJ82u3+mw3Bdnr9u01at0M/xJnPsGuHh+JA5bk3zbWaoWhU6GmLab3dIM4JNdktTcEUI9/FBGhgfLO39BKX/eBCFQ3bXAmIZn4l26fiwoO613BptT44GTEtnPiQ6+tnLsGlVSrFZaLB9FVhrGfipH2SWJcnwYs="; post("/api/v1/pub/user/order/alipay/callback",content, MediaType.APPLICATION_FORM_URLENCODED); }
@ApiOperation(value = "支付成功,支付宝异步通知接口") @RequestMapping(value = "/api/v1/pub/user/order/alipay/callback",method = RequestMethod.POST) public void alipayCallback(HttpServletRequest request,HttpServletResponse response) throws Exception { Map params = request.getParameterMap(); String notify_id = (String) params.get("notify_id"); if(notify_id!="" && notify_id!=null){ String trade_status = (String) params.get("trade_status"); if(trade_status.equals("TRADE_FINISHED") || trade_status.equals("TRADE_SUCCESS")){ response.getWriter().print("success"); } else if (trade_status.equals("WAIT_BUYER_PAY")){ boolean b = aliPayService.checkAliPayOrderValidator(params); response.getWriter().print(b?"success":"fail"); } }else{ LOG.debug("订单支付失败,不是异步消息通知,notify_id等于空"); response.getWriter().print("fail"); } }
PayController extends BaseController { @ApiOperation(value = "支付成功,支付宝异步通知接口") @RequestMapping(value = "/api/v1/pub/user/order/alipay/callback",method = RequestMethod.POST) public void alipayCallback(HttpServletRequest request,HttpServletResponse response) throws Exception { Map params = request.getParameterMap(); String notify_id = (String) params.get("notify_id"); if(notify_id!="" && notify_id!=null){ String trade_status = (String) params.get("trade_status"); if(trade_status.equals("TRADE_FINISHED") || trade_status.equals("TRADE_SUCCESS")){ response.getWriter().print("success"); } else if (trade_status.equals("WAIT_BUYER_PAY")){ boolean b = aliPayService.checkAliPayOrderValidator(params); response.getWriter().print(b?"success":"fail"); } }else{ LOG.debug("订单支付失败,不是异步消息通知,notify_id等于空"); response.getWriter().print("fail"); } } }
PayController extends BaseController { @ApiOperation(value = "支付成功,支付宝异步通知接口") @RequestMapping(value = "/api/v1/pub/user/order/alipay/callback",method = RequestMethod.POST) public void alipayCallback(HttpServletRequest request,HttpServletResponse response) throws Exception { Map params = request.getParameterMap(); String notify_id = (String) params.get("notify_id"); if(notify_id!="" && notify_id!=null){ String trade_status = (String) params.get("trade_status"); if(trade_status.equals("TRADE_FINISHED") || trade_status.equals("TRADE_SUCCESS")){ response.getWriter().print("success"); } else if (trade_status.equals("WAIT_BUYER_PAY")){ boolean b = aliPayService.checkAliPayOrderValidator(params); response.getWriter().print(b?"success":"fail"); } }else{ LOG.debug("订单支付失败,不是异步消息通知,notify_id等于空"); response.getWriter().print("fail"); } }  }
PayController extends BaseController { @ApiOperation(value = "支付成功,支付宝异步通知接口") @RequestMapping(value = "/api/v1/pub/user/order/alipay/callback",method = RequestMethod.POST) public void alipayCallback(HttpServletRequest request,HttpServletResponse response) throws Exception { Map params = request.getParameterMap(); String notify_id = (String) params.get("notify_id"); if(notify_id!="" && notify_id!=null){ String trade_status = (String) params.get("trade_status"); if(trade_status.equals("TRADE_FINISHED") || trade_status.equals("TRADE_SUCCESS")){ response.getWriter().print("success"); } else if (trade_status.equals("WAIT_BUYER_PAY")){ boolean b = aliPayService.checkAliPayOrderValidator(params); response.getWriter().print(b?"success":"fail"); } }else{ LOG.debug("订单支付失败,不是异步消息通知,notify_id等于空"); response.getWriter().print("fail"); } }  @ApiOperation(value = "支付宝支付,创建订单接口") @RequestMapping(value = "/api/v1/user/order/alipay", method = RequestMethod.POST) JSONObject createOrderByAlipay(@Valid @RequestBody OrderFormData param, BindingResult br); @ApiOperation(value = "支付成功,支付宝异步通知接口") @RequestMapping(value = "/api/v1/pub/user/order/alipay/callback",method = RequestMethod.POST) void alipayCallback(HttpServletRequest request,HttpServletResponse response); @ResponseBody @ApiOperation(value = "接收支付宝返回的请求参数") @RequestMapping(value = "/api/v1/pub/orders/alipay/callbacks.do", produces = "text/html;charset=UTF-8", method = {RequestMethod.POST}) String callbacks(HttpServletRequest request); @RequestMapping(value = "/api/v1/user/order/alipay/query", method = RequestMethod.POST) void orderPayQuery(HttpServletRequest request, HttpServletResponse response, String tradeno, String orderno,
                              String callback); @RequestMapping(value = "/api/v1/user/order/wxpay/notify", method = RequestMethod.POST) void orderPayNotify(HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/api/v1/user/order/alipay/refund", method = RequestMethod.POST) void orderPayRefund(HttpServletRequest request, HttpServletResponse response, String tradeno, String orderno,
                               String callback); @RequestMapping(value = "/api/v1/user/order/alipay/refund/query", method = RequestMethod.POST) void orderPayRefundQuery(HttpServletRequest request, HttpServletResponse response, String orderno,
                                    String tradeno, String callback); }
PayController extends BaseController { @ApiOperation(value = "支付成功,支付宝异步通知接口") @RequestMapping(value = "/api/v1/pub/user/order/alipay/callback",method = RequestMethod.POST) public void alipayCallback(HttpServletRequest request,HttpServletResponse response) throws Exception { Map params = request.getParameterMap(); String notify_id = (String) params.get("notify_id"); if(notify_id!="" && notify_id!=null){ String trade_status = (String) params.get("trade_status"); if(trade_status.equals("TRADE_FINISHED") || trade_status.equals("TRADE_SUCCESS")){ response.getWriter().print("success"); } else if (trade_status.equals("WAIT_BUYER_PAY")){ boolean b = aliPayService.checkAliPayOrderValidator(params); response.getWriter().print(b?"success":"fail"); } }else{ LOG.debug("订单支付失败,不是异步消息通知,notify_id等于空"); response.getWriter().print("fail"); } }  @ApiOperation(value = "支付宝支付,创建订单接口") @RequestMapping(value = "/api/v1/user/order/alipay", method = RequestMethod.POST) JSONObject createOrderByAlipay(@Valid @RequestBody OrderFormData param, BindingResult br); @ApiOperation(value = "支付成功,支付宝异步通知接口") @RequestMapping(value = "/api/v1/pub/user/order/alipay/callback",method = RequestMethod.POST) void alipayCallback(HttpServletRequest request,HttpServletResponse response); @ResponseBody @ApiOperation(value = "接收支付宝返回的请求参数") @RequestMapping(value = "/api/v1/pub/orders/alipay/callbacks.do", produces = "text/html;charset=UTF-8", method = {RequestMethod.POST}) String callbacks(HttpServletRequest request); @RequestMapping(value = "/api/v1/user/order/alipay/query", method = RequestMethod.POST) void orderPayQuery(HttpServletRequest request, HttpServletResponse response, String tradeno, String orderno,
                              String callback); @RequestMapping(value = "/api/v1/user/order/wxpay/notify", method = RequestMethod.POST) void orderPayNotify(HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/api/v1/user/order/alipay/refund", method = RequestMethod.POST) void orderPayRefund(HttpServletRequest request, HttpServletResponse response, String tradeno, String orderno,
                               String callback); @RequestMapping(value = "/api/v1/user/order/alipay/refund/query", method = RequestMethod.POST) void orderPayRefundQuery(HttpServletRequest request, HttpServletResponse response, String orderno,
                                    String tradeno, String callback);  }