Skip to content

下载账单文件都转换为inputSteam了,然后使用DigestBillEntity.verifyHash返回false? #384

@cjyGoodLuck

Description

@cjyGoodLuck

错误描述

GetTradeBillRequest request = new GetTradeBillRequest();
request.setBillDate("xxxxxxxx");
request.setBillType(BillType.ALL);
request.setTarType(TarType.GZIP);
BillDownloadServiceExtension downloadService = new BillDownloadServiceExtension.Builder().config(config).build();
DigestBillEntity tradeBill = downloadService.getTradeBill(request);
tradeBill.verifyHash()返回的inputStream都有能正常使用,然后这个官方的返回false?
文件都下载下来了啊,文件也没有错误,调用的就这个简单的代码

重现bug的步骤

GetTradeBillRequest request = new GetTradeBillRequest();
request.setBillDate("xxxxxxxx");
request.setBillType(BillType.ALL);
request.setTarType(TarType.GZIP);
BillDownloadServiceExtension downloadService = new BillDownloadServiceExtension.Builder().config(config).build();
DigestBillEntity tradeBill = downloadService.getTradeBill(request);
tradeBill.verifyHash()

预期行为

tradeBill.verifyHash() 返回true啊
/**

    • 通过计算摘要并同申请下载账单时获得的摘要对比,验证下载账单的完整性
  • @return 如果验证结果为真,账单是完整准确,未经篡改的。如果为假,账单是不完整或被篡改,应清理之前保存的文件。
    */
    public final boolean verifyHash() {
    final String digest = digestAndEncodeHex();
    return digest.equalsIgnoreCase(hashValue);
    }
    这不是官方的自己写的sdk里面的吗

导致错误的代码片段

操作系统

macos

Java 版本

java8

wechatpay-java 版本

0.2.17

其他信息

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions