Merged
Conversation
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 support for direct purchase of game props
添加小游戏道具直购(present_goods)API支持
Dec 19, 2025
There was a problem hiding this comment.
Pull request overview
本 PR 为微信小游戏虚拟支付模块新增道具直购(present_goods)API 支持,解决用户反馈的功能缺失问题。实现方式与现有的代币直购(presentCurrency)API 保持一致,遵循项目现有的代码风格和架构模式。
主要变更:
- 新增
presentGoodsAPI 接口及其请求/响应对象 - 完善的字段注释和文档说明
- 遵循现有 XPay 服务的实现模式
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| WxMaApiUrlConstants.java | 新增道具直购 API 的 URL 常量定义 |
| WxMaXPayPresentGoodsRequest.java | 新建道具直购请求对象,包含 openid、env、order_id、device_type、goods_id、goods_number 等字段 |
| WxMaXPayPresentGoodsResponse.java | 新建道具直购响应对象,返回 order_id |
| WxMaXPayService.java | 在服务接口中添加 presentGoods 方法声明 |
| WxMaXPayServiceImpl.java | 实现 presentGoods 方法,包含请求发送、响应解析和错误处理逻辑 |
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaXPayServiceImpl.java
Show resolved
Hide resolved
...a-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/xpay/WxMaXPayPresentGoodsResponse.java
Show resolved
Hide resolved
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.
用户反馈无法找到小游戏道具直购功能支持。根据微信官方文档,添加
present_goodsAPI 实现。新增内容
WxMaXPayService.presentGoods()WxMaXPayPresentGoodsRequest- 包含 openid、env、order_id、device_type、goods_id、goods_numberWxMaXPayPresentGoodsResponse- 返回 order_idWxMaApiUrlConstants.XPay.PRESENT_GOODS_URL使用示例
实现模式与现有虚拟支付 API(如
presentCurrency)保持一致。Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.