在JsapiResult中添加prepayId字段并提供静态工厂方法实现解耦 #3798
Draft
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.
微信支付V3的
createPartnerOrderV3接口返回的JsapiResult对象缺少prepay_id字段,导致用户无法存储并复用该标识,支付失败时必须重新下单。主要修改
JsapiResult中添加prepayId字段:使createPartnerOrderV3等方法返回的对象包含预支付交易会话标识getJsapiPayInfo(String prepayId, String appId, PrivateKey privateKey)- 根据已有prepay_id生成JSAPI支付参数getAppPayInfo(String prepayId, String appId, String mchId, PrivateKey privateKey)- 根据已有prepay_id生成APP支付参数使用示例
原有方式(现在可以获取prepay_id)
解耦方式(推荐用于支付重试场景)
兼容性
完全向后兼容,现有代码无需修改。
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.