Merged
Conversation
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add WeChat Pay video upload interface implementation
添加微信支付视频上传接口
Jan 26, 2026
🤖 Augment PR SummarySummary: 本 PR 为微信支付 V3 通用媒体接口新增视频上传能力,与既有图片上传接口保持一致的调用方式。
/v3/merchant/media/video_upload 端点以 multipart 方式提交。
🤖 Was this summary useful? React with 👍 or 👎 |
...ava-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MerchantMediaServiceImpl.java
Outdated
Show resolved
Hide resolved
|
|
||
| log.info("视频上传成功,mediaId:[{}]", mediaId); | ||
|
|
||
| VideoUploadResult videoUploadResult2 = merchantMediaService.videoUploadV3(file); |
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MerchantMediaService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
本PR实现了微信支付V3视频上传API(/v3/merchant/media/video_upload),与现有的图片上传功能保持一致的设计模式和代码结构。
变更内容:
- 新增VideoUploadResult bean类用于封装视频上传返回结果
- 在MerchantMediaService接口中添加两个视频上传方法(File版本和InputStream版本)
- 在MerchantMediaServiceImpl中实现视频上传逻辑,使用SHA256计算文件摘要
- 重构WechatPayUploadHttpPost,提取私有的withMedia方法消除代码重复,并添加withVideo方法
- 添加视频上传测试用例
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| VideoUploadResult.java | 新增视频上传返回结果bean,结构与ImageUploadResult保持一致 |
| MerchantMediaService.java | 添加videoUploadV3的两个重载方法声明,附带完整的Javadoc文档 |
| MerchantMediaServiceImpl.java | 实现视频上传逻辑,代码结构与图片上传方法高度一致 |
| WechatPayUploadHttpPost.java | 重构代码,提取withMedia私有方法,添加withVideo公共方法,泛化错误消息 |
| MerchantMediaServiceImplTest.java | 添加视频上传测试方法,测试File参数版本的上传功能 |
...ava-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MerchantMediaServiceImpl.java
Outdated
Show resolved
Hide resolved
...pay/src/test/java/com/github/binarywang/wxpay/service/impl/MerchantMediaServiceImplTest.java
Show resolved
Hide resolved
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/media/VideoUploadResult.java
Outdated
Show resolved
Hide resolved
…ice/impl/MerchantMediaServiceImpl.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Owner
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Contributor
Author
所有评审意见都已处理完成:
当前代码状态良好,所有修改都已正确应用。 |
1. 在videoUploadV3方法的Javadoc中添加@throws IOException 2. 修复try(格式问题,改为try ( 3. 在videoUploadV3(InputStream, String)方法中添加OOM风险警告
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
微信支付视频上传接口实现
实现总结
本PR成功实现了微信支付视频上传接口,遵循了项目现有的代码风格和实现模式:
新增文件
修改文件
API说明
测试覆盖
使用示例
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.