Skip to content
Open
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 @@ -9,10 +9,15 @@
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.OrderCompensationDeliveryParam;
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.OrderSearchParam;
import me.chanjar.weixin.channel.bean.order.PreShipmentChangeSkuResponse;
import me.chanjar.weixin.channel.bean.order.PresentSubOrderResponse;
import me.chanjar.weixin.channel.bean.order.PrivateNumberGetPhoneResponse;
import me.chanjar.weixin.channel.bean.order.RealNumberViewAuditResponse;
import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
import me.chanjar.weixin.common.error.WxErrorException;

Expand Down Expand Up @@ -200,4 +205,122 @@ WxChannelBaseResponse updatePrice(String orderId, Integer expressFee, List<Chang
* @throws WxErrorException 异常
*/
DecodeSensitiveInfoResponse decodeSensitiveInfo(String orderId) throws WxErrorException;

/**
* 礼物订单新增备注信息
*
* @param orderId 礼物订单ID
* @param note 备注内容
* @return BaseResponse
* @throws WxErrorException 异常
*/
WxChannelBaseResponse addPresentNote(String orderId, String note) throws WxErrorException;

/**
* 获取礼物单的子单列表
*
* @param orderId 礼物订单ID
* @return 子单列表
* @throws WxErrorException 异常
*/
PresentSubOrderResponse getPresentSubOrders(String orderId) throws WxErrorException;

/**
* 获取待发货前更换SKU待处理请求
*
* @param orderId 订单ID
* @return 换SKU信息
* @throws WxErrorException 异常
*/
PreShipmentChangeSkuResponse getPreShipmentChangeSku(String orderId) throws WxErrorException;

/**
* 同意待发货前更换SKU请求
*
* @param orderId 订单ID
* @return BaseResponse
* @throws WxErrorException 异常
*/
WxChannelBaseResponse approvePreShipmentChangeSku(String orderId) throws WxErrorException;

/**
* 拒绝待发货前更换SKU请求
*
* @param orderId 订单ID
* @param rejectReason 拒绝原因
* @return BaseResponse
* @throws WxErrorException 异常
*/
WxChannelBaseResponse rejectPreShipmentChangeSku(String orderId, String rejectReason) throws WxErrorException;

/**
* 申请查看订单真实号码
*
* @param orderId 订单ID
* @return BaseResponse
* @throws WxErrorException 异常
*/
WxChannelBaseResponse applyRealNumber(String orderId) throws WxErrorException;

/**
* 查看订单真实号审核状态
*
* @param orderId 订单ID
* @return 审核状态
* @throws WxErrorException 异常
*/
RealNumberViewAuditResponse getRealNumberViewAudit(String orderId) throws WxErrorException;

/**
* 订单再次申请虚拟号
*
* @param orderId 订单ID
* @return BaseResponse
* @throws WxErrorException 异常
*/
WxChannelBaseResponse applyVirtualNumberAgain(String orderId) throws WxErrorException;

/**
* 订单虚拟号延期
*
* @param orderId 订单ID
* @return BaseResponse
* @throws WxErrorException 异常
*/
WxChannelBaseResponse delayVirtualNumber(String orderId) throws WxErrorException;

/**
* 添加待认证的手机号
*
* @param phone 手机号
* @return BaseResponse
* @throws WxErrorException 异常
*/
WxChannelBaseResponse addPrivatePhone(String phone) throws WxErrorException;

/**
* 获取短信验证码
*
* @param phone 手机号
* @return BaseResponse
* @throws WxErrorException 异常
*/
WxChannelBaseResponse sendPrivatePhoneVerifyCode(String phone) throws WxErrorException;

/**
* 获取小店手机号认证状态
*
* @return 手机号认证状态
* @throws WxErrorException 异常
*/
PrivateNumberGetPhoneResponse getPrivatePhone() throws WxErrorException;

/**
* 订单补发货
*
* @param param 补发货参数
* @return BaseResponse
* @throws WxErrorException 异常
*/
WxChannelBaseResponse compensationDelivery(OrderCompensationDeliveryParam param) throws WxErrorException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,29 @@
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.GET_DELIVERY_COMPANY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ACCEPT_ADDRESS_MODIFY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.DECODE_SENSITIVE_INFO_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.DELIVERY_COMPENSATION_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_GET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_LIST_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_SEARCH_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRE_SHIPMENT_CHANGE_SKU_APPROVE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRE_SHIPMENT_CHANGE_SKU_GET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRE_SHIPMENT_CHANGE_SKU_REJECT_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRESENT_NOTE_ADD_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRESENT_SUB_ORDER_GET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.REAL_NUMBER_APPLY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.REAL_NUMBER_VIEW_AUDIT_GET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.REJECT_ADDRESS_MODIFY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_ADDRESS_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_EXPRESS_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_PRICE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_REMARK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPLOAD_FRESH_INSPECT_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.VIRTUAL_NUMBER_APPLY_AGAIN_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.VIRTUAL_NUMBER_DELAY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.VIRTUAL_TEL_NUMBER_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.PrivateNumber.ADD_PHONE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.PrivateNumber.GET_PHONE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.PrivateNumber.SEND_VERIFY_CODE_URL;

import java.util.List;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -30,6 +43,7 @@
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.OrderCompensationDeliveryParam;
import me.chanjar.weixin.channel.bean.order.OrderIdParam;
import me.chanjar.weixin.channel.bean.order.OrderInfoParam;
import me.chanjar.weixin.channel.bean.order.OrderInfoResponse;
Expand All @@ -38,6 +52,14 @@
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.PreShipmentChangeSkuRejectParam;
import me.chanjar.weixin.channel.bean.order.PreShipmentChangeSkuResponse;
import me.chanjar.weixin.channel.bean.order.PresentNoteAddParam;
import me.chanjar.weixin.channel.bean.order.PresentSubOrderResponse;
import me.chanjar.weixin.channel.bean.order.PrivateNumberAddPhoneParam;
import me.chanjar.weixin.channel.bean.order.PrivateNumberGetPhoneResponse;
import me.chanjar.weixin.channel.bean.order.PrivateNumberSendVerifyCodeParam;
import me.chanjar.weixin.channel.bean.order.RealNumberViewAuditResponse;
import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
import me.chanjar.weixin.channel.util.ResponseUtils;
import me.chanjar.weixin.common.error.WxErrorException;
Expand Down Expand Up @@ -178,4 +200,95 @@ public DecodeSensitiveInfoResponse decodeSensitiveInfo(String orderId) throws Wx
String resJson = shopService.post(DECODE_SENSITIVE_INFO_URL, reqJson);
return ResponseUtils.decode(resJson, DecodeSensitiveInfoResponse.class);
}

@Override
public WxChannelBaseResponse addPresentNote(String orderId, String note) throws WxErrorException {
PresentNoteAddParam param = new PresentNoteAddParam(orderId, note);
String resJson = shopService.post(PRESENT_NOTE_ADD_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public PresentSubOrderResponse getPresentSubOrders(String orderId) throws WxErrorException {
OrderIdParam param = new OrderIdParam(orderId);
String resJson = shopService.post(PRESENT_SUB_ORDER_GET_URL, param);
return ResponseUtils.decode(resJson, PresentSubOrderResponse.class);
}

@Override
public PreShipmentChangeSkuResponse getPreShipmentChangeSku(String orderId) throws WxErrorException {
OrderIdParam param = new OrderIdParam(orderId);
String resJson = shopService.post(PRE_SHIPMENT_CHANGE_SKU_GET_URL, param);
return ResponseUtils.decode(resJson, PreShipmentChangeSkuResponse.class);
}

@Override
public WxChannelBaseResponse approvePreShipmentChangeSku(String orderId) throws WxErrorException {
OrderIdParam param = new OrderIdParam(orderId);
String resJson = shopService.post(PRE_SHIPMENT_CHANGE_SKU_APPROVE_URL, param);
Comment on lines +226 to +228
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pass the SKU-change id when approving a change

Approving a pre-shipment SKU change requires identifying the specific change request with sku_change_id as well as the order, but this implementation posts only order_id. For orders with a pending SKU-change request, WeChat cannot know which request to approve, and the new API method will be rejected rather than approving the change.

Useful? React with 👍 / 👎.

return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public WxChannelBaseResponse rejectPreShipmentChangeSku(String orderId, String rejectReason)
throws WxErrorException {
PreShipmentChangeSkuRejectParam param = new PreShipmentChangeSkuRejectParam(orderId, rejectReason);
String resJson = shopService.post(PRE_SHIPMENT_CHANGE_SKU_REJECT_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public WxChannelBaseResponse applyRealNumber(String orderId) throws WxErrorException {
OrderIdParam param = new OrderIdParam(orderId);
String resJson = shopService.post(REAL_NUMBER_APPLY_URL, param);
Comment on lines +241 to +243
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include the required reason when applying for real numbers

The real-number application API requires a merchant-supplied reason in addition to order_id, but this method constructs an OrderIdParam and the public signature only accepts orderId. Callers cannot provide the required reason, so every request made through this new method is missing mandatory data and will be rejected by WeChat.

Useful? React with 👍 / 👎.

return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public RealNumberViewAuditResponse getRealNumberViewAudit(String orderId) throws WxErrorException {
OrderIdParam param = new OrderIdParam(orderId);
String resJson = shopService.post(REAL_NUMBER_VIEW_AUDIT_GET_URL, param);
return ResponseUtils.decode(resJson, RealNumberViewAuditResponse.class);
}

@Override
public WxChannelBaseResponse applyVirtualNumberAgain(String orderId) throws WxErrorException {
OrderIdParam param = new OrderIdParam(orderId);
String resJson = shopService.post(VIRTUAL_NUMBER_APPLY_AGAIN_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public WxChannelBaseResponse delayVirtualNumber(String orderId) throws WxErrorException {
OrderIdParam param = new OrderIdParam(orderId);
String resJson = shopService.post(VIRTUAL_NUMBER_DELAY_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public WxChannelBaseResponse addPrivatePhone(String phone) throws WxErrorException {
PrivateNumberAddPhoneParam param = new PrivateNumberAddPhoneParam(phone);
String resJson = shopService.post(ADD_PHONE_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public WxChannelBaseResponse sendPrivatePhoneVerifyCode(String phone) throws WxErrorException {
PrivateNumberSendVerifyCodeParam param = new PrivateNumberSendVerifyCodeParam(phone);
String resJson = shopService.post(SEND_VERIFY_CODE_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public PrivateNumberGetPhoneResponse getPrivatePhone() throws WxErrorException {
String resJson = shopService.post(GET_PHONE_URL, "{}");
return ResponseUtils.decode(resJson, PrivateNumberGetPhoneResponse.class);
}

@Override
public WxChannelBaseResponse compensationDelivery(OrderCompensationDeliveryParam param)
throws WxErrorException {
String resJson = shopService.post(DELIVERY_COMPENSATION_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package me.chanjar.weixin.channel.bean.order;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;

/**
* 订单补发货 请求参数
*
* @author GitHub Copilot
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class OrderCompensationDeliveryParam implements Serializable {

private static final long serialVersionUID = 1L;

/** 订单ID */
@JsonProperty("order_id")
private String orderId;

/** 物流信息列表 */
@JsonProperty("delivery_list")
private List<DeliveryInfo> deliveryList;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package me.chanjar.weixin.channel.bean.order;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* 拒绝待发货前更换SKU请求 请求参数
*
* @author GitHub Copilot
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class PreShipmentChangeSkuRejectParam implements Serializable {

private static final long serialVersionUID = 1L;

/** 订单ID */
@JsonProperty("order_id")
private String orderId;

/** 拒绝原因 */
@JsonProperty("reject_reason")
private String rejectReason;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package me.chanjar.weixin.channel.bean.order;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;

/**
* 获取待发货前更换SKU待处理请求 响应
*
* @author GitHub Copilot
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class PreShipmentChangeSkuResponse extends WxChannelBaseResponse {

private static final long serialVersionUID = 1L;

/** 更换SKU信息 */
@JsonProperty("change_sku_info")
private ChangeSkuInfo changeSkuInfo;

}
Loading
Loading