feat(pay): add merchant transfer user authorization APIs#4051
feat(pay): add merchant transfer user authorization APIs#4051zhangzhao0219 wants to merge 1 commit into
Conversation
|
@codex 请帮忙review一下 |
|
auggie review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1dce300d35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @SerializedName("close_reason") | ||
| private String closeReason; |
There was a problem hiding this comment.
| * @return PreTransferWithAuthorizationResult 发起结果 | ||
| * @throws WxPayException . | ||
| */ | ||
| PreTransferWithAuthorizationResult transferBillsWithAuthorization(PreTransferWithAuthorizationRequest request) throws WxPayException; |
| @SerializedName("notify_url") | ||
| private String notifyUrl; |
There was a problem hiding this comment.
用户授权后转账接口的请求体只包含 appid/out_bill_no/transfer_scene_id/user_name/transfer_amount/transfer_remark/user_recv_perception/transfer_scene_report_infos/authorization_id/sponsor_mchid/out_authorization_no,并没有 notify_url;如果调用方像普通转账一样设置这里的 notifyUrl,GSON.toJson(request) 会把多余字段发给微信支付,容易被接口按参数错误拒绝。建议移除此字段或确保该接口不会序列化它。
Useful? React with 👍 / 👎.
| StringBuilder url = new StringBuilder(); | ||
| url.append(this.payService.getPayBaseUrl()) | ||
| .append("/v3/fund-app/mch-transfer/user-confirm-authorization/out-authorization-no/") | ||
| .append(outAuthorizationNo); |
🤖 Augment PR SummarySummary: This PR extends Changes:
Technical Notes: Notify parsing reuses the existing v3 signature verification + AES-256-GCM resource decryption pipeline via 🤖 Was this summary useful? React with 👍 or 👎 |
| // ===================== 用户授权免确认模式相关接口实现 ===================== | ||
|
|
||
| @Override | ||
| public UserConfirmAuthorizationResult userConfirmAuthorization(UserConfirmAuthorizationRequest request) throws WxPayException { |
There was a problem hiding this comment.
userConfirmAuthorization directly posts GSON.toJson(request) without validating request (or required fields like outAuthorizationNo/appid/openid/transferSceneId/userDisplayName/authorizationNotifyUrl), so callers can accidentally send an invalid (or null) payload and only fail at the API side. Consider adding the same fast-fail parameter checks you added for the other new authorization-related APIs.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| * | ||
| * <p>CLOSE_VIA_MCH_API:商户通过 API 主动关闭;USER_CLOSE:用户主动关闭。</p> | ||
| */ | ||
| @SerializedName("close_reason") |
There was a problem hiding this comment.
Per the WeChat Pay “免确认收款授权结果通知” spec, when state=CLOSED the decrypted resource contains a close_info object (with close_reason/close_time), not a top-level close_reason; this model will silently drop close details. This can cause CLOSED notifications to lose the reason/time information during parsing.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
麻烦楼主处理下review建议,如果确认不需要做什么,点下面的resolve按钮即可 |
本次在 weixin-java-pay 模块中补充了微信支付商家转账免确认收款授权相关接口,完善“发起授权、授权回调、查询授权状态、授权后转账、解除授权”的使用链路。
主要改动:
新增发起转账并完成免确认收款授权接口:
transferBillsWithAuthorization(...)
新增发起免确认收款授权接口:
userConfirmAuthorization(...)
新增用户授权后转账接口:
transferBillsAfterAuthorization(...)
新增免确认收款授权结果通知解析方法:
parseUserAuthorizationNotifyResult(...)
新增商户侧授权单号查询授权结果接口:
getUserConfirmAuthorizationByOutAuthorizationNo(...)
新增解除免确认收款授权接口:
closeUserConfirmAuthorization(...)
新增对应的请求/响应实体类,并补充授权信息参数校验,避免必要授权字段缺失时继续发起请求。
新增兼容性测试,覆盖接口路径、请求体、响应解析、参数校验和回调解析类型绑定。