浏览代码

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

master
Binary Wang 6 年前
父节点
当前提交
9236f04d68
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. +3
    -2
      weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResult.java

+ 3
- 2
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResult.java 查看文件

@@ -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);
}


正在加载...
取消
保存