Skip to content

BaseWxPayServiceImpl.java中签名方法写死为MD5方式 #888

Closed

Description

@alcoholwang

主要有2种形式:

  1. 直接写死MD5方式

例如BaseWxPayServiceImpl.java的357行,生成JSAPI签名时采用MD5。但是如果之前的prepay使用的是HMAC-SHA256的话,会导致微信内支付显示签名错误。

  1. 另外一种是调用SignUtils.createSign方法时,好几处第二个参数signType都传了null,实际最终就等于使用了MD5模式。

Activity

  1. binarywang commented on Dec 20, 2018

    @binarywang
    Owner

    这确实是个问题,稍后修复统一一下

  2. added a commit that references this issue on Dec 21, 2018
  3. alcoholwang commented on Dec 24, 2018

    @alcoholwang
    Author

    😄 👍👍

  4. binarywang commented on Dec 24, 2018

    @binarywang
    Owner

    忘了说了,最新3.3.0已修复

  5. sinfere commented on Nov 28, 2019

    @sinfere

    JSAPI 还未修复

          case TradeType.JSAPI: {
            String signType = SignType.MD5;
            String appid = unifiedOrderResult.getAppid();
            if (StringUtils.isNotEmpty(unifiedOrderResult.getSubAppId())) {
              appid = unifiedOrderResult.getSubAppId();
            }
    
            WxPayMpOrderResult payResult = WxPayMpOrderResult.builder()
              .appId(appid)
              .timeStamp(timestamp)
              .nonceStr(nonceStr)
              .packageValue("prepay_id=" + prepayId)
              .signType(signType)
              .build();
    
            payResult.setPaySign(SignUtils.createSign(payResult, signType, this.getConfig().getMchKey(), null));
            return (T) payResult;
          }
  6. sinfere commented on Nov 28, 2019

    @sinfere

    @binarywang 麻烦关注下

  7. binarywang commented on Nov 28, 2019

    @binarywang
    Owner

    @binarywang 麻烦关注下

    收到,不过最好下次新增issue,可以关联此issue,谢谢

  8. sinfere commented on Nov 28, 2019

    @sinfere

    👌好的

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions