Skip to content

Commit 16f2922

Browse files
Molzxbinarywang
authored andcommitted
🆕 #3457【小程序】增加发货信息管理里的特殊发货报备接口和查询小程序是否已完成交易结算管理确认的接口
1 parent 5ece315 commit 16f2922

File tree

4 files changed

+103
-8
lines changed

4 files changed

+103
-8
lines changed

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package cn.binarywang.wx.miniapp.api;
22

33
import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*;
4-
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse;
5-
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetListResponse;
6-
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetResponse;
7-
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingIsTradeManagedResponse;
4+
import cn.binarywang.wx.miniapp.bean.shop.response.*;
85
import me.chanjar.weixin.common.error.WxErrorException;
96

107
/**
@@ -86,4 +83,25 @@ WxMaOrderShippingInfoBaseResponse notifyConfirmReceive(WxMaOrderShippingInfoNoti
8683
*/
8784
WxMaOrderShippingInfoBaseResponse setMsgJumpPath(String path)
8885
throws WxErrorException;
86+
87+
/**
88+
* 查询小程序是否已完成交易结算管理确认
89+
*
90+
* @param appId 待查询小程序的 appid,非服务商调用时仅能查询本账号
91+
* @return WxMaOrderShippingITMCCompletedResult
92+
* @throws WxErrorException e
93+
*/
94+
WxMaOrderShippingITMCCompletedResult isTradeManagementConfirmationCompleted(String appId)
95+
throws WxErrorException;
96+
97+
/**
98+
* 特殊发货报备
99+
* @param orderId 需要特殊发货报备的订单号,可传入微信支付单号或商户单号
100+
* @param type 特殊发货报备类型,1为预售商品订单,2为测试订单
101+
* @param delayTo 预计发货时间的unix时间戳,type为1时必填,type为2可省略
102+
* @return WxMaOrderShippingInfoBaseResponse
103+
* @throws WxErrorException e
104+
*/
105+
WxMaOrderShippingInfoBaseResponse opSpecialOrder(String orderId, Integer type, Long delayTo)
106+
throws WxErrorException;
89107
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaOrderShippingServiceImpl.java

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
import cn.binarywang.wx.miniapp.api.WxMaService;
55
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaOrderShippingIsTradeManagedRequest;
66
import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*;
7-
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse;
8-
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetListResponse;
9-
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetResponse;
10-
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingIsTradeManagedResponse;
7+
import cn.binarywang.wx.miniapp.bean.shop.response.*;
118
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
129
import com.google.gson.JsonObject;
1310
import lombok.RequiredArgsConstructor;
@@ -123,6 +120,34 @@ public WxMaOrderShippingInfoBaseResponse setMsgJumpPath(String path) throws WxEr
123120
return request(SET_MSG_JUMP_PATH, jsonObject, WxMaOrderShippingInfoBaseResponse.class);
124121
}
125122

123+
/**
124+
* 查询小程序是否已完成交易结算管理确认
125+
*
126+
* @param appId 待查询小程序的 appid,非服务商调用时仅能查询本账号
127+
* @return WxMaOrderShippingITMCCompletedResult
128+
* @throws WxErrorException e
129+
*/
130+
@Override
131+
public WxMaOrderShippingITMCCompletedResult isTradeManagementConfirmationCompleted(String appId) throws WxErrorException {
132+
JsonObject jsonObject = GsonHelper.buildJsonObject("appid", appId);
133+
return request(IS_TRADE_MANAGEMENT_CONFIRMATION_COMPLETED, jsonObject, WxMaOrderShippingITMCCompletedResult.class);
134+
}
135+
136+
/**
137+
* 特殊发货报备
138+
*
139+
* @param orderId 需要特殊发货报备的订单号,可传入微信支付单号或商户单号
140+
* @param type 特殊发货报备类型,1为预售商品订单,2为测试订单
141+
* @param delayTo 预计发货时间的unix时间戳,type为1时必填,type为2可省略
142+
* @return WxMaOrderShippingInfoBaseResponse
143+
* @throws WxErrorException e
144+
*/
145+
@Override
146+
public WxMaOrderShippingInfoBaseResponse opSpecialOrder(String orderId, Integer type, Long delayTo) throws WxErrorException {
147+
JsonObject jsonObject = GsonHelper.buildJsonObject("order_id", orderId, "type", type, "delay_to", delayTo);
148+
return request(OP_SPECIAL_ORDER, jsonObject, WxMaOrderShippingInfoBaseResponse.class);
149+
}
150+
126151
private <T> T request(String url, Object request, Class<T> resultT) throws WxErrorException {
127152
String responseContent = this.wxMaService.post(url, request);
128153
JsonObject jsonObject = GsonParser.parse(responseContent);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package cn.binarywang.wx.miniapp.bean.shop.response;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
6+
import java.io.Serializable;
7+
8+
/**
9+
* @author xzh
10+
* @Description 小程序是否已完成交易结算管理确认结果
11+
* @createTime 2024/12/21 15:01
12+
*/
13+
@Data
14+
public class WxMaOrderShippingITMCCompletedResult implements Serializable {
15+
16+
private static final long serialVersionUID = -5397007157487018762L;
17+
/**
18+
* 错误码
19+
*/
20+
@SerializedName("errcode")
21+
private Integer errCode;
22+
23+
/**
24+
* 错误原因
25+
*/
26+
@SerializedName("errmsg")
27+
private String errMsg;
28+
29+
/**
30+
* 是否已完成交易结算管理确认
31+
*/
32+
@SerializedName("completed")
33+
private Boolean completed;
34+
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,24 @@ public interface OrderShipping {
789789
* </pre>
790790
*/
791791
String SET_MSG_JUMP_PATH = "https://api.weixin.qq.com/wxa/sec/order/set_msg_jump_path";
792+
793+
/**
794+
* 查询小程序是否已完成交易结算管理确认.
795+
*
796+
* <pre>
797+
* 文档地址: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%85%AB%E3%80%81%E6%9F%A5%E8%AF%A2%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%98%AF%E5%90%A6%E5%B7%B2%E5%AE%8C%E6%88%90%E4%BA%A4%E6%98%93%E7%BB%93%E7%AE%97%E7%AE%A1%E7%90%86%E7%A1%AE%E8%AE%A4
798+
* </pre>
799+
*/
800+
String IS_TRADE_MANAGEMENT_CONFIRMATION_COMPLETED = "https://api.weixin.qq.com/wxa/sec/order/is_trade_management_confirmation_completed";
801+
/**
802+
* 特殊发货报备.
803+
*
804+
* <pre>
805+
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%8D%81%E3%80%81%E7%89%B9%E6%AE%8A%E5%8F%91%E8%B4%A7%E6%8A%A5%E5%A4%87
806+
* </pre>
807+
*/
808+
String OP_SPECIAL_ORDER = "https://api.weixin.qq.com/wxa/sec/order/opspecialorder";
809+
792810
}
793811

794812
public interface Vod {

0 commit comments

Comments
 (0)