Skip to content

fix: EntPayRequest 中 brandId 为 null 时引发的 NullPointerException#3946

Draft
Copilot wants to merge 1 commit intodevelopfrom
copilot/fix-ent-transfer-error
Draft

fix: EntPayRequest 中 brandId 为 null 时引发的 NullPointerException#3946
Copilot wants to merge 1 commit intodevelopfrom
copilot/fix-ent-transfer-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 29, 2026

EntPayRequest.storeMap() 对非必填的 Integer 类型字段 brandId 直接调用 .toString(),未做 null 保护,导致调用 entPay() 时抛出 NPE,并产生误导性的"无法找到对应 mchId/appId 商户号配置信息"错误日志。

变更内容

  • EntPayRequest.storeMap() — 为 brandId 添加 null 检查,仅在非 null 时写入 Map:
// before
map.put("brand_id", brandId.toString()); // NPE when brandId is null

// after
if (brandId != null) {
  map.put("brand_id", brandId.toString());
}
  • EntPayRequestTest — 新增覆盖两种场景的单元测试:
    • brandId 为 null 时 getSignParams() 不抛 NPE,且结果中不含 brand_id
    • brandId 非 null 时结果中正确包含对应值

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI linked an issue Mar 29, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix error in enterprise transfer to user零钱 interface fix: EntPayRequest 中 brandId 为 null 时引发的 NullPointerException Mar 29, 2026
Copilot AI requested a review from binarywang March 29, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

企业转账到用户零钱接口报错

2 participants