• 支付宝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";
    }
    }
  • 相关阅读:
    45. 跳跃游戏 II
    BIO,AIO,NIO
    sqlyog连接阿里云mysql
    Hive的数据表HDFS的关系。
    云计算和虚拟机
    oracle入门笔记
    程序员开发协作管理工具
    IT行业的新思想来源
    docker所需的os基础
    docker源码和原理探究
  • 原文地址:https://www.cnblogs.com/xu-xiang/p/5820215.html
Copyright © 2020-2023  润新知