Commit d743f0d5 by chongli

微信下单回调

parent 6fecf069
...@@ -43,6 +43,32 @@ public class NotifyController { ...@@ -43,6 +43,32 @@ public class NotifyController {
return notifyResponseBean; return notifyResponseBean;
} }
/**
* 微信支付通知
*/
@RequestMapping(value = "/{orderType}/notifyForWeiXinPay", produces = "application/json;charset=UTF-8")
@ResponseBody
public String notifyForWeiXinPay(HttpServletRequest request,HttpServletResponse response,@PathVariable String orderType) throws Exception{
BufferedReader reader = null;
reader = request.getReader();
String line = "";
String xmlString = null;
StringBuffer inputString = new StringBuffer();
while ((line = reader.readLine()) != null) {
inputString.append(line);
}
xmlString = inputString.toString();
request.getReader().close();
System.out.println("----接收到的数据如下:---" + xmlString);
this.notifyService.notifyForWeiXinPay(orderType,xmlString);
response.getWriter().write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
return null;
}
/** /**
* 微信支付通知 * 微信支付通知
*/ */
......
...@@ -42,6 +42,17 @@ public class NotifyService { ...@@ -42,6 +42,17 @@ public class NotifyService {
* @param paymentResponse * @param paymentResponse
* @return * @return
*/ */
public String notifyForWeiXinPay(String orderType,String xml) {
HttpEntity<String> entity = new HttpEntity<String>(xml);
String response = restTemplate.exchange(this.getServerBaseNotifyPath()+"/"+orderType+"/notifyForWeiXinPay", HttpMethod.POST, entity, new ParameterizedTypeReference<String>() {
}).getBody();
return null;
}
/**
* @param paymentResponse
* @return
*/
public String notifyForMiniApp(String xml) { public String notifyForMiniApp(String xml) {
HttpEntity<String> entity = new HttpEntity<String>(xml); HttpEntity<String> entity = new HttpEntity<String>(xml);
String response = restTemplate.exchange(this.getServerBaseNotifyPath()+"/communeOrder/notifyForMiniApp", HttpMethod.POST, entity, new ParameterizedTypeReference<String>() { String response = restTemplate.exchange(this.getServerBaseNotifyPath()+"/communeOrder/notifyForMiniApp", HttpMethod.POST, entity, new ParameterizedTypeReference<String>() {
...@@ -49,6 +60,8 @@ public class NotifyService { ...@@ -49,6 +60,8 @@ public class NotifyService {
return response; return response;
} }
public RestTemplate getRestTemplate() { public RestTemplate getRestTemplate() {
return restTemplate; return restTemplate;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment