mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-19 06:36:28 +08:00
#752 修复微信支付拉取支付评价的接口(limit不参与签名)
This commit is contained in:
@@ -1,19 +1,46 @@
|
||||
package com.github.binarywang.wxpay.service;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.WxPayApiData;
|
||||
import com.github.binarywang.wxpay.bean.coupon.*;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxScanPayNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.request.*;
|
||||
import com.github.binarywang.wxpay.bean.result.*;
|
||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.WxPayApiData;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponInfoQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponInfoQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendRequest;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendResult;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponStockQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponStockQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxScanPayNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayAuthcode2OpenidRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayDownloadBillRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayDownloadFundFlowRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayMicropayRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayOrderCloseRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayOrderQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayOrderReverseRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayRefundQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayReportRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPaySendRedpackRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayShorturlRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayBillResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayFundFlowResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayMicropayResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayOrderCloseResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayOrderReverseResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRedpackQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPaySendRedpackResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult;
|
||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 微信支付相关接口.
|
||||
@@ -530,7 +557,7 @@ public interface WxPayService {
|
||||
* @param beginDate 开始时间
|
||||
* @param endDate 结束时间
|
||||
* @param offset 位移
|
||||
* @param limit 条数
|
||||
* @param limit 条数,建议填null,否则接口会报签名错误
|
||||
*/
|
||||
String queryComment(Date beginDate, Date endDate, Integer offset, Integer limit) throws WxPayException;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,29 @@
|
||||
package com.github.binarywang.wxpay.service.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.github.binarywang.utils.qrcode.QrcodeUtils;
|
||||
import com.github.binarywang.wxpay.bean.WxPayApiData;
|
||||
import com.github.binarywang.wxpay.bean.coupon.*;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponInfoQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponInfoQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendRequest;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendResult;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponStockQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponStockQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxScanPayNotifyResult;
|
||||
@@ -10,8 +31,40 @@ import com.github.binarywang.wxpay.bean.order.WxPayAppOrderResult;
|
||||
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
||||
import com.github.binarywang.wxpay.bean.order.WxPayMwebOrderResult;
|
||||
import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult;
|
||||
import com.github.binarywang.wxpay.bean.request.*;
|
||||
import com.github.binarywang.wxpay.bean.result.*;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayAuthcode2OpenidRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayDefaultRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayDownloadBillRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayDownloadFundFlowRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayMicropayRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayOrderCloseRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayOrderQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayOrderReverseRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayQueryCommentRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayRedpackQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayRefundQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayReportRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPaySendRedpackRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayShorturlRequest;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
||||
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayAuthcode2OpenidResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayBillBaseResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayBillResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayCommonResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayFundFlowBaseResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayFundFlowResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayMicropayResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayOrderCloseResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayOrderReverseResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRedpackQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPaySandboxSignKeyResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPaySendRedpackResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayShorturlResult;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult;
|
||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||
import com.github.binarywang.wxpay.constant.WxPayConstants.BillType;
|
||||
import com.github.binarywang.wxpay.constant.WxPayConstants.SignType;
|
||||
@@ -23,17 +76,6 @@ import com.github.binarywang.wxpay.util.SignUtils;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.Maps;
|
||||
import jodd.io.ZipUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.zip.ZipException;
|
||||
|
||||
import static com.github.binarywang.wxpay.constant.WxPayConstants.QUERY_COMMENT_DATE_FORMAT;
|
||||
import static com.github.binarywang.wxpay.constant.WxPayConstants.TarType;
|
||||
@@ -291,7 +333,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
|
||||
configMap.put("appid", appId);
|
||||
|
||||
final WxPayAppOrderResult result = WxPayAppOrderResult.builder()
|
||||
.sign(SignUtils.createSign(configMap, null, this.getConfig().getMchKey(), false))
|
||||
.sign(SignUtils.createSign(configMap, null, this.getConfig().getMchKey(), null))
|
||||
.prepayId(prepayId)
|
||||
.partnerId(partnerId)
|
||||
.appId(appId)
|
||||
@@ -317,7 +359,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
|
||||
.signType(signType)
|
||||
.build();
|
||||
|
||||
payResult.setPaySign(SignUtils.createSign(payResult, signType, this.getConfig().getMchKey(), false));
|
||||
payResult.setPaySign(SignUtils.createSign(payResult, signType, this.getConfig().getMchKey(), null));
|
||||
return (T) payResult;
|
||||
}
|
||||
|
||||
@@ -368,7 +410,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
|
||||
configMap.put("noncestr", nonceStr);
|
||||
configMap.put("appid", appId);
|
||||
// 此map用于客户端与微信服务器交互
|
||||
payInfo.put("sign", SignUtils.createSign(configMap, null, this.getConfig().getMchKey(), false));
|
||||
payInfo.put("sign", SignUtils.createSign(configMap, null, this.getConfig().getMchKey(), null));
|
||||
payInfo.put("prepayId", prepayId);
|
||||
payInfo.put("partnerId", partnerId);
|
||||
payInfo.put("appId", appId);
|
||||
@@ -382,7 +424,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
|
||||
payInfo.put("nonceStr", nonceStr);
|
||||
payInfo.put("package", "prepay_id=" + prepayId);
|
||||
payInfo.put("signType", SignType.MD5);
|
||||
payInfo.put("paySign", SignUtils.createSign(payInfo, null, this.getConfig().getMchKey(), false));
|
||||
payInfo.put("paySign", SignUtils.createSign(payInfo, null, this.getConfig().getMchKey(), null));
|
||||
}
|
||||
|
||||
return payInfo;
|
||||
@@ -406,7 +448,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
|
||||
params.put("time_stamp", String.valueOf(System.currentTimeMillis() / 1000));
|
||||
params.put("nonce_str", String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
String sign = SignUtils.createSign(params, null, this.getConfig().getMchKey(), false);
|
||||
String sign = SignUtils.createSign(params, null, this.getConfig().getMchKey(), null);
|
||||
params.put("sign", sign);
|
||||
|
||||
for (String key : params.keySet()) {
|
||||
@@ -632,7 +674,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
|
||||
}
|
||||
} catch (WxPayException wxPayException) {
|
||||
throw wxPayException;
|
||||
} catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
this.log.error("解析对账单文件时出错", e);
|
||||
throw new WxPayException("解压zip文件出错");
|
||||
}
|
||||
|
||||
@@ -1,19 +1,5 @@
|
||||
package com.github.binarywang.wxpay.service.impl;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.entpay.*;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayDefaultRequest;
|
||||
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.EntPayService;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.github.binarywang.wxpay.util.SignUtils;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.openssl.PEMParser;
|
||||
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
@@ -21,6 +7,28 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Security;
|
||||
import javax.crypto.Cipher;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.openssl.PEMParser;
|
||||
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayBankQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayBankQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayBankRequest;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayBankResult;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
|
||||
import com.github.binarywang.wxpay.bean.entpay.GetPublicKeyResult;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayDefaultRequest;
|
||||
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.EntPayService;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -65,8 +73,8 @@ public class EntPayServiceImpl implements EntPayService {
|
||||
WxPayDefaultRequest request = new WxPayDefaultRequest();
|
||||
request.setMchId(this.payService.getConfig().getMchId());
|
||||
request.setNonceStr(String.valueOf(System.currentTimeMillis()));
|
||||
request.setSign(SignUtils.createSign(request, null, this.payService.getConfig().getMchKey(),
|
||||
true));
|
||||
|
||||
request.checkAndSign(this.payService.getConfig());
|
||||
|
||||
String url = "https://fraud.mch.weixin.qq.com/risk/getpublickey";
|
||||
String responseContent = this.payService.post(url, request.toXML(), true);
|
||||
|
||||
Reference in New Issue
Block a user