收藏
回答

apiv3接口报签名验证失败?

修改单据信息

|应用场景

该接口只适用于修改已经审核失败的单据。

|接口说明

适用对象:从业机构

请求地址:https://api.mch.weixin.qq.com/v3/rate-activity/applications/id/{application_id}

请求方式:PATCH

接口规则:https://wechatpay-api.gitbook.io/wechatpay-api-v3

@Override
public WechatActivityResult updateDocumentInformation(UpdateDocumentInformationParamDTO updateDocumentInformationParamDTO) {
    CloseableHttpClient build = null;
    CloseableHttpResponse execute = null;
    try {
        logger.info("修改单据信息开始", updateDocumentInformationParamDTO);
        String url;
        if (null == updateDocumentInformationParamDTO.getApplication_id()) {
            return new WechatActivityResult(WechatActivityResultEnum.MISSING_PARAMTER.getCode(), WechatActivityResultEnum.MISSING_PARAMTER.getMessage());
        }
        url = wechatQueryUrl + updateDocumentInformationParamDTO.getApplication_id();
        JSONObject param = new JSONObject();
        if (null != updateDocumentInformationParamDTO.getActivity_detail_modification()) {
            param.put("activity_detail_modification", updateDocumentInformationParamDTO.getActivity_detail_modification());
        }
        if (null != updateDocumentInformationParamDTO.getAdditional_information()) {
            param.put("additional_information", updateDocumentInformationParamDTO.getAdditional_information());
        }
        String paramStr = param.toJSONString();
        String token = WeChatBaseUtil.getToken(paramStr, url, "PATCH", rsaPrivateKey, mchId, mchPrivateSerialNo);
        url=baseUrl+url;
        HttpPatch httpPatch = new HttpPatch(url);
        httpPatch.addHeader("Charsert", "UTF-8");
        httpPatch.addHeader("Accept", "application/json");
        httpPatch.addHeader("Content-Type", "application/json");
        httpPatch.addHeader("Authorization", "WECHATPAY2-SHA256-RSA2048 " + token);
        httpPatch.addHeader("Wechatpay-Serial", WechantSerial);
        StringEntity stringEntity = new StringEntity(paramStr);
        httpPatch.setEntity(stringEntity);
        HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
        build = httpClientBuilder.build();
        execute = build.execute(httpPatch);
        String result = EntityUtils.toString(execute.getEntity());
        logger.info("修改单据信息成功");
        return new WechatActivityResult(WechatActivityResultEnum.SUCCESS.getCode(), WechatActivityResultEnum.SUCCESS.getMessage(), result);
    } catch (Exception e) {
        logger.error("系统异常", e);
        return new WechatActivityResult(WechatActivityResultEnum.SYSTEM_EXCEPTION.getCode(), WechatActivityResultEnum.SYSTEM_EXCEPTION.getMessage());
    } finally {
        closeStream(build, execute);
    }
b报签名验证失败,麻烦帮忙看一下哪里有问题
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容