优化非核心类代码以及V3版本JSAPI接口支付签名错误bug

This commit is contained in:
jy.hu
2014-12-15 00:11:00 +08:00
parent 746697a358
commit 641d6c62ac
32 changed files with 266 additions and 263 deletions
+7 -2
View File
@@ -1,10 +1,11 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.foxinmy</groupId>
<artifactId>weixin4j-mp</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</parent>
<artifactId>weixin4j-mp-server</artifactId>
<name>weixin4j-mp-server</name>
@@ -53,6 +54,10 @@
<artifactId>logback-core</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@@ -236,15 +236,17 @@ public class PayAction {
"商品描述", "系统内部订单号", 1d, "IP地址", TradeType.NATIVE);
payPackage.setProduct_id(payNotify.getProductId());
if (!sign.equals(valid_sign)) {
NativePayResponseV3 payReponse = new NativePayResponseV3(
payPackage, "签名失败", null);
// 校验失败
NativePayResponseV3 payReponse = new NativePayResponseV3("签名失败",
null);
payReponse.setSign(PayUtil.paysignMd5(payReponse,
weixinAccount.getPaySignKey()));
return XStream.to(payReponse);
}
// 成功返回
NativePayResponseV3 payReponse = new NativePayResponseV3(payPackage,
null, null);
weixinAccount.getPaySignKey());
payReponse.setSign(PayUtil.paysignMd5(payReponse,
weixinAccount.getPaySignKey()));
return XStream.to(payReponse);
@@ -298,7 +300,8 @@ public class PayAction {
obj.put("openid", feedback.getOpenId());
obj.put("appid", feedback.getAppId());
obj.put("timestamp", feedback.getTimeStamp());
String sign = PayUtil.paysignSha(obj, weixinAccount.getPaySignKey());
obj.put("appkey", weixinAccount.getPaySignKey());
String sign = PayUtil.paysignSha(obj);
log.info("微信签名----->sign={},vaild_sign={}", sign, feedback.getPaySign());
return "success";
}