#830 修复微信支付退款通知解析代码在某些环境下可能会出现的乱码问题

This commit is contained in:
Binary Wang 2018-11-01 17:33:10 +08:00
parent b4833d1019
commit 9236f04d68

View File

@ -50,7 +50,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
if (WxPayConstants.ResultCode.FAIL.equals(result.getReturnCode())) {
return result;
}
String reqInfoString = result.getReqInfoString();
try {
final String keyMd5String = DigestUtils.md5Hex(mchKey).toLowerCase();
@ -58,7 +58,8 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, key);
result.setReqInfo(ReqInfo.fromXML(new String(cipher.doFinal(Base64.decodeBase64(reqInfoString)))));
result.setReqInfo(ReqInfo.fromXML(new String(cipher.doFinal(Base64.decodeBase64(reqInfoString)),
StandardCharsets.UTF_8)));
} catch (Exception e) {
throw new WxPayException("解密退款通知加密信息时出错", e);
}