Skip to content

fix issue 3569 #3584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
* 获取订单列表
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,7 @@
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;

Expand All @@ -47,7 +36,14 @@ public WxChannelOrderServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {

@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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ public void testGetOrder() throws WxErrorException {
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();
Expand Down