Skip to content

Commit 9236f04

Browse files
committed
#830 修复微信支付退款通知解析代码在某些环境下可能会出现的乱码问题
1 parent b4833d1 commit 9236f04

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResult.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ public static WxPayRefundNotifyResult fromXML(String xmlString, String mchKey) t
5050
if (WxPayConstants.ResultCode.FAIL.equals(result.getReturnCode())) {
5151
return result;
5252
}
53-
53+
5454
String reqInfoString = result.getReqInfoString();
5555
try {
5656
final String keyMd5String = DigestUtils.md5Hex(mchKey).toLowerCase();
5757
SecretKeySpec key = new SecretKeySpec(keyMd5String.getBytes(StandardCharsets.UTF_8), "AES");
5858

5959
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
6060
cipher.init(Cipher.DECRYPT_MODE, key);
61-
result.setReqInfo(ReqInfo.fromXML(new String(cipher.doFinal(Base64.decodeBase64(reqInfoString)))));
61+
result.setReqInfo(ReqInfo.fromXML(new String(cipher.doFinal(Base64.decodeBase64(reqInfoString)),
62+
StandardCharsets.UTF_8)));
6263
} catch (Exception e) {
6364
throw new WxPayException("解密退款通知加密信息时出错", e);
6465
}

0 commit comments

Comments
 (0)