🎨 #3569 【视频号】微信小店-订单详情查询接口增加参数

This commit is contained in:
altusea 2025-05-13 22:52:24 +08:00 committed by GitHub
parent 04c162f03a
commit 2762a98279
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 61 additions and 13 deletions

View File

@ -34,6 +34,17 @@ public interface WxChannelOrderService {
*/
OrderInfoResponse getOrder(String orderId) throws WxErrorException;
/**
* 获取订单详情
*
* @param orderId 订单id
* @param encodeSensitiveInfo 是否编码敏感信息
* @return 订单详情
*
* @throws WxErrorException 异常
*/
OrderInfoResponse getOrder(String orderId, Boolean encodeSensitiveInfo) throws WxErrorException;
/**
* 获取订单列表
*

View File

@ -14,18 +14,7 @@ import me.chanjar.weixin.channel.bean.delivery.DeliveryCompanyResponse;
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;
import me.chanjar.weixin.channel.bean.delivery.DeliverySendParam;
import me.chanjar.weixin.channel.bean.delivery.FreshInspectParam;
import me.chanjar.weixin.channel.bean.order.ChangeOrderInfo;
import me.chanjar.weixin.channel.bean.order.DecodeSensitiveInfoResponse;
import me.chanjar.weixin.channel.bean.order.DeliveryUpdateParam;
import me.chanjar.weixin.channel.bean.order.OrderAddressParam;
import me.chanjar.weixin.channel.bean.order.OrderIdParam;
import me.chanjar.weixin.channel.bean.order.OrderInfoResponse;
import me.chanjar.weixin.channel.bean.order.OrderListParam;
import me.chanjar.weixin.channel.bean.order.OrderListResponse;
import me.chanjar.weixin.channel.bean.order.OrderPriceParam;
import me.chanjar.weixin.channel.bean.order.OrderRemarkParam;
import me.chanjar.weixin.channel.bean.order.OrderSearchParam;
import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
import me.chanjar.weixin.channel.bean.order.*;
import me.chanjar.weixin.channel.util.ResponseUtils;
import me.chanjar.weixin.common.error.WxErrorException;
@ -47,7 +36,14 @@ public class WxChannelOrderServiceImpl implements WxChannelOrderService {
@Override
public OrderInfoResponse getOrder(String orderId) throws WxErrorException {
OrderIdParam param = new OrderIdParam(orderId);
OrderInfoParam param = new OrderInfoParam(orderId, null);
String resJson = shopService.post(ORDER_GET_URL, param);
return ResponseUtils.decode(resJson, OrderInfoResponse.class);
}
@Override
public OrderInfoResponse getOrder(String orderId, Boolean encodeSensitiveInfo) throws WxErrorException {
OrderInfoParam param = new OrderInfoParam(orderId, encodeSensitiveInfo);
String resJson = shopService.post(ORDER_GET_URL, param);
return ResponseUtils.decode(resJson, OrderInfoResponse.class);
}

View File

@ -0,0 +1,31 @@
package me.chanjar.weixin.channel.bean.order;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 获取订单详情参数
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OrderInfoParam implements Serializable {
private static final long serialVersionUID = 42L;
/** 订单ID */
@JsonProperty("order_id")
private String orderId;
/**
* 用于商家提前测试订单脱敏效果如果传true即对订单进行脱敏后期会默认对所有订单脱敏
*/
@JsonProperty("encode_sensitive_info")
private Boolean encodeSensitiveInfo;
}

View File

@ -45,6 +45,16 @@ public class WxChannelOrderServiceImplTest {
assertTrue(response.isSuccess());
}
@Test
public void testGetOrder2() throws WxErrorException {
WxChannelOrderService orderService = channelService.getOrderService();
String orderId = "";
boolean encodeSensitiveInfo = true;
OrderInfoResponse response = orderService.getOrder(orderId, encodeSensitiveInfo);
assertNotNull(response);
assertTrue(response.isSuccess());
}
@Test
public void testGetOrders() throws WxErrorException {
WxChannelOrderService orderService = channelService.getOrderService();