|
|
|
@@ -1,5 +1,7 @@ |
|
|
|
package com.iformall.controller; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.iformall.interceptor.BodyReaderHttpServletRequestWrapper; |
|
|
|
import com.iformall.utils.sign.SignUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
@@ -34,14 +36,18 @@ public class TtOrderCallbackController extends BaseController { |
|
|
|
@PostMapping(value = "/orderPay") |
|
|
|
@ResponseBody |
|
|
|
public Map<String,Object> createOrder( HttpServletRequest request){ |
|
|
|
|
|
|
|
Map<String,Object> resultMap = new HashMap<>(); |
|
|
|
|
|
|
|
String timestamp = request.getParameter("timestamp"); |
|
|
|
String nonce = request.getParameter("nonce"); |
|
|
|
String msg = request.getParameter("msg"); |
|
|
|
String type = request.getParameter("type"); |
|
|
|
String msgSignature = request.getParameter("msg_signature"); |
|
|
|
String body = ((BodyReaderHttpServletRequestWrapper) request).getBody(); |
|
|
|
|
|
|
|
Map<String, Object> parameterMap = JSONObject.parseObject(body, Map.class); |
|
|
|
|
|
|
|
|
|
|
|
String timestamp = parameterMap.get("timestamp").toString(); |
|
|
|
String nonce = parameterMap.get("nonce").toString(); |
|
|
|
String msg = parameterMap.get("msg").toString(); |
|
|
|
String type = parameterMap.get("type").toString(); |
|
|
|
String msgSignature = parameterMap.get("msg_signature").toString(); |
|
|
|
logger.info("timestamp:"+timestamp+",nonce:"+nonce+",msg:"+msg+",type:"+type+",msgSignature:"+msgSignature); |
|
|
|
|
|
|
|
Map<String,Object> paramMap = new HashMap<>(); |
|
|
|
@@ -49,7 +55,7 @@ public class TtOrderCallbackController extends BaseController { |
|
|
|
paramMap.put("timestamp",timestamp); |
|
|
|
paramMap.put("nonce",nonce); |
|
|
|
paramMap.put("msg",msg); |
|
|
|
String sha = SignUtils.getSign(null, paramMap, "SHA"); |
|
|
|
String sha = SignUtils.getSign(null, paramMap, "SHA1"); |
|
|
|
logger.info("sha----"+sha); |
|
|
|
if(msgSignature.equals(sha)){ |
|
|
|
logger.info("true"); |
|
|
|
|