-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
fix: WxPayPartnerRefundV3Request 缺少 sp_appid 和 sub_appid 字段 #3918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,15 +11,39 @@ | |
| * 微信支付服务商退款请求 | ||
| * 文档见:https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_1_9.shtml | ||
| * | ||
| * @author Pursuer | ||
| * @version 1.0 | ||
| * @date 2023/3/2 | ||
| * @author GitHub Copilot | ||
| */ | ||
| @Data | ||
| @NoArgsConstructor | ||
| @Accessors(chain = true) | ||
| public class WxPayPartnerRefundV3Request extends WxPayRefundV3Request implements Serializable { | ||
| private static final long serialVersionUID = -1L; | ||
| /** | ||
| * <pre> | ||
| * 字段名:服务商应用ID | ||
| * 变量名:sp_appid | ||
| * 是否必填:是 | ||
| * 类型:string[1, 32] | ||
| * 描述: | ||
| * 服务商申请的公众号或移动应用appid。 | ||
| * 示例值:wx8888888888888888 | ||
| * </pre> | ||
| */ | ||
| @SerializedName(value = "sp_appid") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| private String spAppid; | ||
binarywang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /** | ||
| * <pre> | ||
| * 字段名:子商户应用ID | ||
| * 变量名:sub_appid | ||
| * 是否必填:否 | ||
| * 类型:string[1, 32] | ||
| * 描述: | ||
| * 子商户申请的公众号或移动应用appid。如果传了sub_appid,那sub_appid对应的订单必须存在。 | ||
| * 示例值:wx8888888888888888 | ||
| * </pre> | ||
| */ | ||
| @SerializedName(value = "sub_appid") | ||
| private String subAppid; | ||
| /** | ||
| * <pre> | ||
| * 字段名:退款资金来源 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package com.github.binarywang.wxpay.bean.request; | ||
|
|
||
| import com.google.gson.Gson; | ||
| import com.google.gson.JsonObject; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| /** | ||
| * {@link WxPayPartnerRefundV3Request} 单元测试 | ||
| * | ||
| * @author GitHub Copilot | ||
binarywang marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| */ | ||
| public class WxPayPartnerRefundV3RequestTest { | ||
|
|
||
| @Test | ||
| public void testSpAppidAndSubAppidSerialization() { | ||
| WxPayPartnerRefundV3Request request = new WxPayPartnerRefundV3Request(); | ||
| request.setSpAppid("wx8888888888888888"); | ||
| request.setSubAppid("wxd678efh567hg6999"); | ||
| request.setSubMchid("1230000109"); | ||
| request.setOutRefundNo("1217752501201407033233368018"); | ||
| request.setFundsAccount("AVAILABLE"); | ||
|
|
||
| Gson gson = new Gson(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里使用 Severity: low Other Locations
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
| String json = gson.toJson(request); | ||
| JsonObject jsonObject = gson.fromJson(json, JsonObject.class); | ||
|
|
||
| assertThat(jsonObject.get("sp_appid").getAsString()).isEqualTo("wx8888888888888888"); | ||
| assertThat(jsonObject.get("sub_appid").getAsString()).isEqualTo("wxd678efh567hg6999"); | ||
| assertThat(jsonObject.get("sub_mchid").getAsString()).isEqualTo("1230000109"); | ||
| assertThat(jsonObject.get("out_refund_no").getAsString()).isEqualTo("1217752501201407033233368018"); | ||
| assertThat(jsonObject.get("funds_account").getAsString()).isEqualTo("AVAILABLE"); | ||
binarywang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| @Test | ||
| public void testSubAppidIsOptional() { | ||
| WxPayPartnerRefundV3Request request = new WxPayPartnerRefundV3Request(); | ||
| request.setSpAppid("wx8888888888888888"); | ||
| request.setSubMchid("1230000109"); | ||
| request.setOutRefundNo("1217752501201407033233368018"); | ||
|
|
||
| Gson gson = new Gson(); | ||
| String json = gson.toJson(request); | ||
| JsonObject jsonObject = gson.fromJson(json, JsonObject.class); | ||
|
|
||
| assertThat(jsonObject.get("sp_appid").getAsString()).isEqualTo("wx8888888888888888"); | ||
| assertThat(jsonObject.has("sub_appid")).isFalse(); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.