Skip to content

Commit 5326c5b

Browse files
authored
🐛 #2216 【微信支付】修复APP统一下单v3接口缺少sign参数的问题
1 parent 60c9df4 commit 5326c5b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxPayUnifiedOrderV3Result.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ public static class AppResult implements Serializable {
9898
private String packageValue;
9999
private String noncestr;
100100
private String timestamp;
101+
private String sign;
101102

103+
private String getSignStr() {
104+
return String.format("%s\n%s\n%s\n%s\n", appid, timestamp, noncestr, prepayid);
105+
}
102106
}
103107

104108
public <T> T getPayInfo(TradeTypeEnum tradeType, String appId, String mchId, PrivateKey privateKey) {
@@ -119,7 +123,8 @@ public <T> T getPayInfo(TradeTypeEnum tradeType, String appId, String mchId, Pri
119123
appResult.setAppid(appId).setPrepayId(this.prepayId).setPartnerId(mchId)
120124
.setNoncestr(nonceStr).setTimestamp(timestamp)
121125
//暂填写固定值Sign=WXPay
122-
.setPackageValue("Sign=WXPay");
126+
.setPackageValue("Sign=WXPay")
127+
.setSign(SignUtils.sign(appResult.getSignStr(), privateKey));
123128
return (T) appResult;
124129
case NATIVE:
125130
return (T) this.codeUrl;

0 commit comments

Comments
 (0)