Browse Source

#888 修复微信支付部分接口请求中签名方法不统一的问题

master
Binary Wang 6 years ago
parent
commit
ac944d46ed
2 changed files with 6 additions and 6 deletions
  1. +5
    -5
      weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
  2. +1
    -1
      weixin-java-pay/src/main/java/com/github/binarywang/wxpay/util/SignUtils.java

+ 5
- 5
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java View File

@@ -342,7 +342,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
configMap.put("appid", appId); configMap.put("appid", appId);


final WxPayAppOrderResult result = WxPayAppOrderResult.builder() final WxPayAppOrderResult result = WxPayAppOrderResult.builder()
.sign(SignUtils.createSign(configMap, null, this.getConfig().getMchKey(), null))
.sign(SignUtils.createSign(configMap, request.getSignType(), this.getConfig().getMchKey(), null))
.prepayId(prepayId) .prepayId(prepayId)
.partnerId(partnerId) .partnerId(partnerId)
.appId(appId) .appId(appId)
@@ -419,7 +419,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
configMap.put("noncestr", nonceStr); configMap.put("noncestr", nonceStr);
configMap.put("appid", appId); configMap.put("appid", appId);
// 此map用于客户端与微信服务器交互 // 此map用于客户端与微信服务器交互
payInfo.put("sign", SignUtils.createSign(configMap, null, this.getConfig().getMchKey(), null));
payInfo.put("sign", SignUtils.createSign(configMap, request.getSignType(), this.getConfig().getMchKey(), null));
payInfo.put("prepayId", prepayId); payInfo.put("prepayId", prepayId);
payInfo.put("partnerId", partnerId); payInfo.put("partnerId", partnerId);
payInfo.put("appId", appId); payInfo.put("appId", appId);
@@ -432,8 +432,8 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
payInfo.put("timeStamp", timestamp); payInfo.put("timeStamp", timestamp);
payInfo.put("nonceStr", nonceStr); payInfo.put("nonceStr", nonceStr);
payInfo.put("package", "prepay_id=" + prepayId); payInfo.put("package", "prepay_id=" + prepayId);
payInfo.put("signType", SignType.MD5);
payInfo.put("paySign", SignUtils.createSign(payInfo, null, this.getConfig().getMchKey(), null));
payInfo.put("signType", request.getSignType());
payInfo.put("paySign", SignUtils.createSign(payInfo, request.getSignType(), this.getConfig().getMchKey(), null));
} }


return payInfo; return payInfo;
@@ -457,7 +457,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
params.put("time_stamp", String.valueOf(System.currentTimeMillis() / 1000)); params.put("time_stamp", String.valueOf(System.currentTimeMillis() / 1000));
params.put("nonce_str", String.valueOf(System.currentTimeMillis())); params.put("nonce_str", String.valueOf(System.currentTimeMillis()));


String sign = SignUtils.createSign(params, null, this.getConfig().getMchKey(), null);
String sign = SignUtils.createSign(params, SignType.MD5, this.getConfig().getMchKey(), null);
params.put("sign", sign); params.put("sign", sign);


for (String key : params.keySet()) { for (String key : params.keySet()) {


+ 1
- 1
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/util/SignUtils.java View File

@@ -52,7 +52,7 @@ public class SignUtils {
*/ */
@Deprecated @Deprecated
public static String createSign(Map<String, String> params, String signKey) { public static String createSign(Map<String, String> params, String signKey) {
return createSign(params, null, signKey, new String[0]);
return createSign(params, SignType.MD5, signKey, new String[0]);
} }


/** /**


Loading…
Cancel
Save