标签:puts src out log res 接口 while 文档 ade
小程序支付的简易流程图,直接参考官网的文档和Domo就可以做出来,这里简单说明一下,支付总的来说分为两步,第一步:调用统一下单接口,获取prepay_id等参数,签名后返回给小程序;第二步: 由小程序去调用支付接口;
需要注意的一点是,在第一步中生成签名的写法,下图中红框标注的地方
@ApiOperation(value = "接收微信回调消息") @PostMapping(value = "receive_notify") @ResponseBody public void receiveNotify(HttpServletRequest request, HttpServletResponse response) throws Exception { String line = null; String xmlString = null; BufferedReader reader = request.getReader(); StringBuffer inputString = new StringBuffer(); while ((line = reader.readLine()) != null) { inputString.append(line); } xmlString = inputString.toString(); request.getReader().close(); log.info("----接收到的数据如下:---" + xmlString); String returnXml = payService.receiveNotify(xmlString,(BatteryPay pay)->{ orderService.paySucc(pay); }); // 处理业务完毕 BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); out.write(returnXml.getBytes()); out.flush(); out.close(); }
标签:puts src out log res 接口 while 文档 ade
原文地址:https://www.cnblogs.com/wjf0/p/9275519.html