提交 bb2a2bd7 authored 作者: zhouzhigang's avatar zhouzhigang

--no commit message

上级 b20f6c4b
...@@ -67,9 +67,6 @@ public class WeChatPayImpl extends PayTypeAdapter{ ...@@ -67,9 +67,6 @@ public class WeChatPayImpl extends PayTypeAdapter{
// 扫码回调地址 // 扫码回调地址
@Value("${pay.wechatpay.notify_url}") @Value("${pay.wechatpay.notify_url}")
private String notify_url; private String notify_url;
// H5支付场景信息
@Value("${scene_info}")
private String scene_info;
@Override @Override
public List<PayTypeEnum> getEnums() { public List<PayTypeEnum> getEnums() {
...@@ -109,9 +106,9 @@ public class WeChatPayImpl extends PayTypeAdapter{ ...@@ -109,9 +106,9 @@ public class WeChatPayImpl extends PayTypeAdapter{
// 元换算为 分 // 元换算为 分
String realData = wechartPrice(tempData); String realData = wechartPrice(tempData);
// 计算订单的交易起始时间和结束时间 // 计算订单的交易起始时间和结束时间
Date start = orderPayVo.getCreateTime(); //Date start = orderPayVo.getCreateTime();
// 结束时间为订单创建时间的一小时后 // 结束时间为订单创建时间的一小时后
Date end = DateUtils.addDateHour(start, 24); //Date end = DateUtils.addDateHour(start, 24);
//String startStr = DateUtils.dateTimeToStr(start, DateUtils.DATE_TIME_FORMAT_YYYYMMDDHHMISS); //String startStr = DateUtils.dateTimeToStr(start, DateUtils.DATE_TIME_FORMAT_YYYYMMDDHHMISS);
//String endStr = DateUtils.dateTimeToStr(end, DateUtils.DATE_TIME_FORMAT_YYYYMMDDHHMISS); //String endStr = DateUtils.dateTimeToStr(end, DateUtils.DATE_TIME_FORMAT_YYYYMMDDHHMISS);
...@@ -120,8 +117,8 @@ public class WeChatPayImpl extends PayTypeAdapter{ ...@@ -120,8 +117,8 @@ public class WeChatPayImpl extends PayTypeAdapter{
data.put("device_info", device_info); data.put("device_info", device_info);
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
HttpServletRequest request = servletRequestAttributes.getRequest(); HttpServletRequest request = servletRequestAttributes.getRequest();
//data.put("spbill_create_ip", WXPayUtil.getIpAddr(request)); data.put("spbill_create_ip", WXPayUtil.getIpAddr(request));
data.put("spbill_create_ip", spbill_create_ip); //data.put("spbill_create_ip", spbill_create_ip);
data.put("notify_url", notify_url); data.put("notify_url", notify_url);
//data.put("time_start", startStr); //data.put("time_start", startStr);
...@@ -133,9 +130,6 @@ public class WeChatPayImpl extends PayTypeAdapter{ ...@@ -133,9 +130,6 @@ public class WeChatPayImpl extends PayTypeAdapter{
if(WeChartType.JSAPI.getCode().equals(toPayForm.getTrade_type())){ if(WeChartType.JSAPI.getCode().equals(toPayForm.getTrade_type())){
data.put("openid", toPayForm.getOpenid()); data.put("openid", toPayForm.getOpenid());
} }
if(WeChartType.H5.getCode().equals(toPayForm.getTrade_type())){
data.put("scene_info", scene_info);
}
Map<String, String> resp = wxpay.unifiedOrder(data); Map<String, String> resp = wxpay.unifiedOrder(data);
if (resp == null) if (resp == null)
return null; return null;
...@@ -160,42 +154,22 @@ public class WeChatPayImpl extends PayTypeAdapter{ ...@@ -160,42 +154,22 @@ public class WeChatPayImpl extends PayTypeAdapter{
Map<String,String> map =new HashMap<String,String>(); Map<String,String> map =new HashMap<String,String>();
String timestamp = String.valueOf(new Date().getTime()/1000); String timestamp = String.valueOf(new Date().getTime()/1000);
map.put("appId", wecartPayReturn.getAppid()); map.put("appId", wecartPayReturn.getAppid());
map.put("timeStamp", timestamp);
map.put("nonceStr", wecartPayReturn.getNonce_str()); map.put("nonceStr", wecartPayReturn.getNonce_str());
map.put("package", "prepay_id="+resp.get("prepay_id")); map.put("package", "prepay_id="+resp.get("prepay_id"));
map.put("signType", "MD5"); map.put("signType", "MD5");
map.put("totalFee", realData); map.put("timeStamp", timestamp);
//签名生成 //签名生成
String prepay_id= resp.get("prepay_id"); String prepay_id= resp.get("prepay_id");
//String timestamp = String.valueOf(new Date().getTime()/1000);
//String stringA =""+"appId="+config.getAppID()+"&nonceStr="+resp.get("nonce_str") +"&package=prepay_id="+prepay_id+"&signType=MD5"+"&timeStamp=" + timestamp + "&key="+config.getKey();
String stringA =""+"appId="+config.getAppID()+"&nonceStr="+resp.get("nonce_str") +"&package="+"prepay_id="+prepay_id+"&signType=MD5"+"&timeStamp=" + timestamp + "&key="+config.getKey(); String stringA =""+"appId="+config.getAppID()+"&nonceStr="+resp.get("nonce_str") +"&package="+"prepay_id="+prepay_id+"&signType=MD5"+"&timeStamp=" + timestamp + "&key="+config.getKey();
String paySign=WXPayUtil.MD5(stringA).toUpperCase(); String paySign=WXPayUtil.MD5(stringA).toUpperCase();
//String paySign = WXPayUtil.generateSignature(map, config.getKey(),SignType.MD5);
wecartPayReturn.setSign(paySign);
wecartPayReturn.setTimestamp(timestamp);
/* /*
* //拼装参数 Map<String,String> map =new HashMap<String,String>(); String timestamp * String paySign = WXPayUtil.generateSignature(map,
* = String.valueOf(new Date().getTime()/1000); map.put("appId", * config.getKey(),SignType.MD5); wecartPayReturn.setSign(paySign);
* wecartPayReturn.getAppid()); map.put("nonceStr", * wecartPayReturn.setTimestamp(timestamp);
* wecartPayReturn.getNonce_str()); map.put("package",
* "prepay_id="+wecartPayReturn.getPrepay_id()); map.put("signType", "MD5");
* map.put("timeStamp", timestamp);
*
* //签名生成 //String prepay_id= resp.get("prepay_id");
*
* // String stringA
* =""+"appId="+config.getAppID()+"&nonceStr="+resp.get("nonce_str")
* +"&package=prepay_id="+prepay_id+"&signType=MD5"+"&timeStamp=" + timestamp +
* "&key="+config.getKey(); //String
* paySign=WXPayUtil.MD5(stringA).toUpperCase(); //String paySign =
* WXPayUtil.generateSignature(data, config.getKey(),SignType.MD5); String
* paySign = WXPayUtil.generateSignature(map, config.getKey(), SignType.MD5);
* wecartPayReturn.setSign(paySign); wecartPayReturn.setTimestamp(timestamp);
* map.put("paySign", paySign);
*/ */
map.put("sign", paySign); map.put("sign", paySign);
logger.info("wwwwwwwwwwwwwwwwwwwwJSAPI订单:" + toPayForm.getOut_trade_no() + "完成获取微信链接wwwwwwwwwwwwwwwwwwww"); logger.info("wwwwwwwwwwwwwwwwwwwwJSAPI订单:" + toPayForm.getOut_trade_no() + "完成获取微信链接wwwwwwwwwwwwwwwwwwww");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论