Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信支付的异步通知 签名类型 的选择 #1483

Closed
dute7liang opened this issue Apr 2, 2020 · 5 comments
Closed

微信支付的异步通知 签名类型 的选择 #1483

dute7liang opened this issue Apr 2, 2020 · 5 comments

Comments

@dute7liang
Copy link

我在参考该项目给自己的项目写一份阉割且独立的微信支付

我在参考其代码的时候发现,在异步通知的处理过程中,也就是BaseWxPayServiceImpl.parseOrderNotifyResult的方法中。在签名校验的过程中有一些歧义的问题。 具体可以见下面的代码说明!

  @Override
  public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException {
    try {
      log.debug("微信支付异步通知请求参数:{}", xmlData);
      WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData);
      log.debug("微信支付异步通知请求解析后的对象:{}", result);
      // 这里的signType 不是应该取 微信传过来的signType么?
      result.checkResult(this, this.getConfig().getSignType(), false);
      return result;
    } catch (WxPayException e) {
      throw e;
    } catch (Exception e) {
      throw new WxPayException("发生异常!", e);
    }
  }

由于我暂时还没有拿到微信支付所有需要的环境。所以无法测试。以上仅仅是个人通过代码和微信文档的假设。

有条件我会测试一下我的问题! 如果你觉得这个问题确实存在。希望能够回复我!

  • WxJava 模块名: weixin-java-pay
  • WxJava 版本号: master
@binarywang
Copy link
Member

这个地方确实是问题,稍后修复下

@binarywang
Copy link
Member

主要的原因还是result里以前是没有signType的

@binarywang
Copy link
Member

之前都是通过config的signType去保证签名类型统一的,所以一般不会出问题,除非你统一下单时使用的其他的特定类型。

@binarywang
Copy link
Member

3.7.5.B 测试版本已优化

@bozer666
Copy link

没有signType的

我从3.7.0升到3.8.0发现支付回调验签失败,原因就是从回调报文里取到的signType为null导致sign不对,此处如果只从报文里面取是不是不太合适,报文里面是可能没有的,和公众号文档不太写的不太一样,改成从报文取不到就从配置文件取会不会好点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants