mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
微信支付修复2.8.2.BETA版本引入的签名问题
This commit is contained in:
parent
65ef21b280
commit
2ab389e84f
@ -147,10 +147,8 @@ public abstract class WxPayServiceAbstractImpl implements WxPayService {
|
||||
}
|
||||
|
||||
String responseContent = this.post(url, request.toXML(), true);
|
||||
WxPaySendRedpackResult result = WxPayBaseResult.fromXML(responseContent, WxPaySendRedpackResult.class);
|
||||
//毋须校验,因为没有返回签名信息
|
||||
// this.checkResult(result);
|
||||
return result;
|
||||
//无需校验,因为没有返回签名信息
|
||||
return WxPayBaseResult.fromXML(responseContent, WxPaySendRedpackResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
|
||||
import me.chanjar.weixin.common.util.BeanUtils;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
@ -44,19 +45,13 @@ public class SignUtils {
|
||||
* @return 签名字符串
|
||||
*/
|
||||
public static String createSign(Map<String, String> params, String signKey, String signType) {
|
||||
// if (this.getConfig().useSandbox()) {
|
||||
// //使用仿真测试环境
|
||||
// //TODO 目前测试发现,以下两行代码都会出问题,所以暂不建议使用仿真测试环境
|
||||
// signKey = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456";
|
||||
// //return "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456";
|
||||
// }
|
||||
|
||||
SortedMap<String, String> sortedMap = new TreeMap<>(params);
|
||||
|
||||
StringBuilder toSign = new StringBuilder();
|
||||
for (String key : sortedMap.keySet()) {
|
||||
String value = params.get(key);
|
||||
if (!Lists.newArrayList("sign", "key", "sign_type").contains(key)) {
|
||||
if (StringUtils.isNotEmpty(value) &&
|
||||
!Lists.newArrayList("sign", "key", "sign_type").contains(key)) {
|
||||
toSign.append(key).append("=").append(value).append("&");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user