From 2e3ac76412f936b1a99c490e90d881022fa3cac2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 03:15:21 +0000 Subject: [PATCH 1/3] Initial plan From 913b5c0e71cf6029a50938a5aefa9a209963ad2d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 03:20:09 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=9C=A8WxPayPa?= =?UTF-8?q?rtnerRefundV3Request=E4=B8=AD=E6=B7=BB=E5=8A=A0sp=5Fappid?= =?UTF-8?q?=E5=92=8Csub=5Fappid=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com> --- .../request/WxPayPartnerRefundV3Request.java | 30 +++++++++-- .../WxPayPartnerRefundV3RequestTest.java | 50 +++++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3RequestTest.java diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3Request.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3Request.java index 8f3e8ebd10..eaa771bcf8 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3Request.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3Request.java @@ -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; + /** + *
+   * 字段名:服务商应用ID
+   * 变量名:sp_appid
+   * 是否必填:是
+   * 类型:string[1, 32]
+   * 描述:
+   *  服务商申请的公众号或移动应用appid。
+   *  示例值:wx8888888888888888
+   * 
+ */ + @SerializedName(value = "sp_appid") + private String spAppid; + /** + *
+   * 字段名:子商户应用ID
+   * 变量名:sub_appid
+   * 是否必填:否
+   * 类型:string[1, 32]
+   * 描述:
+   *  子商户申请的公众号或移动应用appid。如果传了sub_appid,那sub_appid对应的订单必须存在。
+   *  示例值:wx8888888888888888
+   * 
+ */ + @SerializedName(value = "sub_appid") + private String subAppid; /** *
    * 字段名:退款资金来源
diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3RequestTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3RequestTest.java
new file mode 100644
index 0000000000..bdcb0b6cbf
--- /dev/null
+++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3RequestTest.java
@@ -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
+ */
+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();
+    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");
+  }
+
+  @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();
+  }
+}

From 5aa16cfd4db8eb8458f07cbaced6c003820f35e4 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 10 Mar 2026 07:51:33 +0000
Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E6=A0=B9=E6=8D=AE=20PR=20Review=20?=
 =?UTF-8?q?=E6=84=8F=E8=A7=81=E5=AE=8C=E5=96=84=E6=9C=8D=E5=8A=A1=E5=95=86?=
 =?UTF-8?q?=E9=80=80=E6=AC=BE=E5=AD=97=E6=AE=B5=E8=A1=A5=E9=BD=90=E9=80=BB?=
 =?UTF-8?q?=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
---
 .../wxpay/bean/request/WxPayPartnerRefundV3Request.java    | 1 -
 .../wxpay/service/impl/BaseWxPayServiceImpl.java           | 6 ++++++
 .../bean/request/WxPayPartnerRefundV3RequestTest.java      | 7 ++++++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3Request.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3Request.java
index eaa771bcf8..a565388e60 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3Request.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3Request.java
@@ -11,7 +11,6 @@
  * 微信支付服务商退款请求
  * 文档见:https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_1_9.shtml
  *
- * @author GitHub Copilot
  */
 @Data
 @NoArgsConstructor
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
index 06c7a24858..36987f637d 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
@@ -404,6 +404,12 @@ public WxPayRefundV3Result refundV3(WxPayRefundV3Request request) throws WxPayEx
 
   @Override
   public WxPayRefundV3Result partnerRefundV3(WxPayPartnerRefundV3Request request) throws WxPayException {
+    if (StringUtils.isBlank(request.getSpAppid())) {
+      request.setSpAppid(this.getConfig().getAppId());
+    }
+    if (StringUtils.isBlank(request.getSubAppid()) && StringUtils.isNotBlank(this.getConfig().getSubAppId())) {
+      request.setSubAppid(this.getConfig().getSubAppId());
+    }
     if (StringUtils.isBlank(request.getNotifyUrl())) {
       request.setNotifyUrl(this.getConfig().getRefundNotifyUrl());
     }
diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3RequestTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3RequestTest.java
index bdcb0b6cbf..ebdc992082 100644
--- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3RequestTest.java
+++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/request/WxPayPartnerRefundV3RequestTest.java
@@ -9,7 +9,6 @@
 /**
  * {@link WxPayPartnerRefundV3Request} 单元测试
  *
- * @author GitHub Copilot
  */
 public class WxPayPartnerRefundV3RequestTest {
 
@@ -26,10 +25,15 @@ public void testSpAppidAndSubAppidSerialization() {
     String json = gson.toJson(request);
     JsonObject jsonObject = gson.fromJson(json, JsonObject.class);
 
+    assertThat(jsonObject.has("sp_appid")).isTrue();
     assertThat(jsonObject.get("sp_appid").getAsString()).isEqualTo("wx8888888888888888");
+    assertThat(jsonObject.has("sub_appid")).isTrue();
     assertThat(jsonObject.get("sub_appid").getAsString()).isEqualTo("wxd678efh567hg6999");
+    assertThat(jsonObject.has("sub_mchid")).isTrue();
     assertThat(jsonObject.get("sub_mchid").getAsString()).isEqualTo("1230000109");
+    assertThat(jsonObject.has("out_refund_no")).isTrue();
     assertThat(jsonObject.get("out_refund_no").getAsString()).isEqualTo("1217752501201407033233368018");
+    assertThat(jsonObject.has("funds_account")).isTrue();
     assertThat(jsonObject.get("funds_account").getAsString()).isEqualTo("AVAILABLE");
   }
 
@@ -44,6 +48,7 @@ public void testSubAppidIsOptional() {
     String json = gson.toJson(request);
     JsonObject jsonObject = gson.fromJson(json, JsonObject.class);
 
+    assertThat(jsonObject.has("sp_appid")).isTrue();
     assertThat(jsonObject.get("sp_appid").getAsString()).isEqualTo("wx8888888888888888");
     assertThat(jsonObject.has("sub_appid")).isFalse();
   }