zoukankan      html  css  js  c++  java
  • 支付宝APP支付Java回调具体步骤

    /**
    * 支付宝异步请求通知
    *
    * @param request
    * @return
    */
    @RequestMapping(value = "async", method = RequestMethod.POST)
    @ResponseBody
    @Transactional(readOnly = false)
    public String async(HttpServletRequest request) {
    Map<String, String> params = new HashMap<String, String>();
    Map requestParams = request.getParameterMap();
    for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
    String name = (String) iter.next();
    String[] values = (String[]) requestParams.get(name);
    String valueStr = "";
    for (int i = 0; i < values.length; i++) {
    valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";
    }
    System.out.println(">>>>>参数" + name + ":" + valueStr);
    params.put(name, valueStr);
    }
    requestParams.get("trade_status");
    String tradeNo = request.getParameter("out_trade_no");
    String tradeStatus = request.getParameter("trade_status");
    if (AlipayNotify.verify(params)) {//验证成功
    if (tradeStatus.equals("TRADE_FINISHED") || tradeStatus.equals("TRADE_SUCCESS")) {
    System.out.println(">>>>>状态要更新了");
        //商品交易成功之后的业务逻辑代码

    System.out.println(">>>>>下单成功" + tradeNo);
    }
    return "success";
    } else {//验证失败
    System.out.println(">>>>>验签失败" + tradeNo);
    System.out.println(">>>>>交易被关闭了");
    MemberOrder order = this.memberOrderService.get(tradeNo);
    this.memberOrderService.updateActualPayAndSurplusPay("0.00", order.getActualPay().toString(), tradeNo);
    return "fail";
    }
    }
  • 相关阅读:
    052-141
    052-140
    052-139
    052-138
    需要做笔记的页面
    日期总是显示1900/01/01 0:00:00
    延迟加载的树控件
    (简单)关于summary的注释
    江南检测
    fineui动态添加用户控件
  • 原文地址:https://www.cnblogs.com/xu-xiang/p/5820215.html
Copyright © 2011-2022 走看看