Skip to content

Commit c68f2d2

Browse files
authored
🐛 #2734 【微信支付】商家批量转账参数加密异常修复
1 parent 27bccb3 commit c68f2d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/TransferServiceImpl.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import com.google.gson.GsonBuilder;
1010
import lombok.RequiredArgsConstructor;
1111

12+
import java.security.cert.X509Certificate;
13+
import java.util.List;
14+
1215
/**
1316
* 商家转账到零钱
1417
*
@@ -24,7 +27,11 @@ public class TransferServiceImpl implements TransferService {
2427
@Override
2528
public TransferBatchesResult transferBatches(TransferBatchesRequest request) throws WxPayException {
2629
String url = String.format("%s/v3/transfer/batches", this.payService.getPayBaseUrl());
27-
RsaCryptoUtil.encryptFields(request, this.payService.getConfig().getVerifier().getValidCertificate());
30+
List<TransferBatchesRequest.TransferDetail> transferDetailList = request.getTransferDetailList();
31+
X509Certificate validCertificate = this.payService.getConfig().getVerifier().getValidCertificate();
32+
for (TransferBatchesRequest.TransferDetail detail : transferDetailList) {
33+
RsaCryptoUtil.encryptFields(detail, validCertificate);
34+
}
2835
String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request));
2936
return GSON.fromJson(result, TransferBatchesResult.class);
3037
}

0 commit comments

Comments
 (0)