🆕 #3457【小程序】增加发货信息管理里的特殊发货报备接口和查询小程序是否已完成交易结算管理确认的接口

This commit is contained in:
Molzx 2024-12-24 13:19:14 +08:00 committed by Binary Wang
parent 5ece315b87
commit 16f2922fd5
4 changed files with 103 additions and 8 deletions

View File

@ -1,10 +1,7 @@
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetListResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingIsTradeManagedResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.*;
import me.chanjar.weixin.common.error.WxErrorException;
/**
@ -86,4 +83,25 @@ public interface WxMaOrderShippingService {
*/
WxMaOrderShippingInfoBaseResponse setMsgJumpPath(String path)
throws WxErrorException;
/**
* 查询小程序是否已完成交易结算管理确认
*
* @param appId 待查询小程序的 appid非服务商调用时仅能查询本账号
* @return WxMaOrderShippingITMCCompletedResult
* @throws WxErrorException e
*/
WxMaOrderShippingITMCCompletedResult isTradeManagementConfirmationCompleted(String appId)
throws WxErrorException;
/**
* 特殊发货报备
* @param orderId 需要特殊发货报备的订单号可传入微信支付单号或商户单号
* @param type 特殊发货报备类型1为预售商品订单2为测试订单
* @param delayTo 预计发货时间的unix时间戳type为1时必填type为2可省略
* @return WxMaOrderShippingInfoBaseResponse
* @throws WxErrorException e
*/
WxMaOrderShippingInfoBaseResponse opSpecialOrder(String orderId, Integer type, Long delayTo)
throws WxErrorException;
}

View File

@ -4,10 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaOrderShippingService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaOrderShippingIsTradeManagedRequest;
import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetListResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingIsTradeManagedResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.*;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.JsonObject;
import lombok.RequiredArgsConstructor;
@ -123,6 +120,34 @@ public class WxMaOrderShippingServiceImpl implements WxMaOrderShippingService {
return request(SET_MSG_JUMP_PATH, jsonObject, WxMaOrderShippingInfoBaseResponse.class);
}
/**
* 查询小程序是否已完成交易结算管理确认
*
* @param appId 待查询小程序的 appid非服务商调用时仅能查询本账号
* @return WxMaOrderShippingITMCCompletedResult
* @throws WxErrorException e
*/
@Override
public WxMaOrderShippingITMCCompletedResult isTradeManagementConfirmationCompleted(String appId) throws WxErrorException {
JsonObject jsonObject = GsonHelper.buildJsonObject("appid", appId);
return request(IS_TRADE_MANAGEMENT_CONFIRMATION_COMPLETED, jsonObject, WxMaOrderShippingITMCCompletedResult.class);
}
/**
* 特殊发货报备
*
* @param orderId 需要特殊发货报备的订单号可传入微信支付单号或商户单号
* @param type 特殊发货报备类型1为预售商品订单2为测试订单
* @param delayTo 预计发货时间的unix时间戳type为1时必填type为2可省略
* @return WxMaOrderShippingInfoBaseResponse
* @throws WxErrorException e
*/
@Override
public WxMaOrderShippingInfoBaseResponse opSpecialOrder(String orderId, Integer type, Long delayTo) throws WxErrorException {
JsonObject jsonObject = GsonHelper.buildJsonObject("order_id", orderId, "type", type, "delay_to", delayTo);
return request(OP_SPECIAL_ORDER, jsonObject, WxMaOrderShippingInfoBaseResponse.class);
}
private <T> T request(String url, Object request, Class<T> resultT) throws WxErrorException {
String responseContent = this.wxMaService.post(url, request);
JsonObject jsonObject = GsonParser.parse(responseContent);

View File

@ -0,0 +1,34 @@
package cn.binarywang.wx.miniapp.bean.shop.response;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import java.io.Serializable;
/**
* @author xzh
* @Description 小程序是否已完成交易结算管理确认结果
* @createTime 2024/12/21 15:01
*/
@Data
public class WxMaOrderShippingITMCCompletedResult implements Serializable {
private static final long serialVersionUID = -5397007157487018762L;
/**
* 错误码
*/
@SerializedName("errcode")
private Integer errCode;
/**
* 错误原因
*/
@SerializedName("errmsg")
private String errMsg;
/**
* 是否已完成交易结算管理确认
*/
@SerializedName("completed")
private Boolean completed;
}

View File

@ -789,6 +789,24 @@ public class WxMaApiUrlConstants {
* </pre>
*/
String SET_MSG_JUMP_PATH = "https://api.weixin.qq.com/wxa/sec/order/set_msg_jump_path";
/**
* 查询小程序是否已完成交易结算管理确认.
*
* <pre>
* 文档地址 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
* </pre>
*/
String IS_TRADE_MANAGEMENT_CONFIRMATION_COMPLETED = "https://api.weixin.qq.com/wxa/sec/order/is_trade_management_confirmation_completed";
/**
* 特殊发货报备.
*
* <pre>
* 文档地址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
* </pre>
*/
String OP_SPECIAL_ORDER = "https://api.weixin.qq.com/wxa/sec/order/opspecialorder";
}
public interface Vod {