🎨 #3656 【微信支付】 修复平台收付通 - 合单支付 - 关闭订单接口,增加缺少的两个参数
Some checks failed
Publish to Maven Central / build-and-publish (push) Has been cancelled

This commit is contained in:
Copilot 2025-08-08 17:40:28 +08:00 committed by GitHub
parent 983e4f1e66
commit bc6fb7b58e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 75 additions and 0 deletions

View File

@ -87,5 +87,33 @@ public class CombineCloseRequest implements Serializable {
*/
@SerializedName(value = "out_trade_no")
private String outTradeNo;
/**
* <pre>
* 字段名二级商户号
* 变量名sub_mchid
* 是否必填
* 类型string[1,32]
* 描述
* 二级商户商户号由微信支付生成并下发服务商子商户的商户号被合单方直连商户不用传二级商户号
* 示例值1900000109
* </pre>
*/
@SerializedName(value = "sub_mchid")
private String subMchid;
/**
* <pre>
* 字段名子商户应用ID
* 变量名sub_appid
* 是否必填
* 类型string[1,32]
* 描述
* 子商户申请的应用ID全局唯一请求基础下单接口时请注意APPID的应用属性例如公众号场景下
* 需使用应用属性为公众号的APPID 若sub_openid有传的情况下
* sub_appid必填且sub_appid需与sub_openid对应
* 示例值wxd678efh567hg6999
* </pre>
*/
@SerializedName(value = "sub_appid")
private String subAppid;
}
}

View File

@ -0,0 +1,47 @@
package com.github.binarywang.wxpay.bean.request;
import com.google.gson.Gson;
import org.testng.annotations.Test;
import java.util.Arrays;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2024-12-19
*/
public class CombineCloseRequestTest {
@Test
public void testSerialization() {
CombineCloseRequest request = new CombineCloseRequest();
request.setCombineAppid("wxd678efh567hg6787");
request.setCombineOutTradeNo("P20150806125346");
CombineCloseRequest.SubOrders subOrder = new CombineCloseRequest.SubOrders();
subOrder.setMchid("1900000109");
subOrder.setOutTradeNo("20150806125346");
subOrder.setSubMchid("1230000109");
subOrder.setSubAppid("wxd678efh567hg6999");
request.setSubOrders(Arrays.asList(subOrder));
Gson gson = new Gson();
String json = gson.toJson(request);
// Verify that the JSON contains the new fields
assertThat(json).contains("\"sub_mchid\":\"1230000109\"");
assertThat(json).contains("\"sub_appid\":\"wxd678efh567hg6999\"");
assertThat(json).contains("\"combine_appid\":\"wxd678efh567hg6787\"");
assertThat(json).contains("\"mchid\":\"1900000109\"");
assertThat(json).contains("\"out_trade_no\":\"20150806125346\"");
// Verify deserialization works
CombineCloseRequest deserializedRequest = gson.fromJson(json, CombineCloseRequest.class);
assertThat(deserializedRequest.getCombineAppid()).isEqualTo("wxd678efh567hg6787");
assertThat(deserializedRequest.getSubOrders()).hasSize(1);
assertThat(deserializedRequest.getSubOrders().get(0).getSubMchid()).isEqualTo("1230000109");
assertThat(deserializedRequest.getSubOrders().get(0).getSubAppid()).isEqualTo("wxd678efh567hg6999");
}
}