Skip to content

Commit 9f21f59

Browse files
qrpcodeBinary Wang
authored andcommitted
🆕 【视频号】增加视频号小店的同意和拒绝修改地址的接口 !114
1 parent b9bd619 commit 9f21f59

5 files changed

Lines changed: 69 additions & 7 deletions

File tree

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelOrderService.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,26 @@ WxChannelBaseResponse updatePrice(String orderId, Integer expressFee, List<Chang
9696
*/
9797
WxChannelBaseResponse updateDelivery(DeliveryUpdateParam param) throws WxErrorException;
9898

99+
/**
100+
* 同意用户修改收货地址请求
101+
*
102+
* @param orderId 订单id
103+
* @return BaseResponse
104+
*
105+
* @throws WxErrorException 异常
106+
*/
107+
WxChannelBaseResponse acceptAddressModify(String orderId) throws WxErrorException;
108+
109+
/**
110+
* 拒接用户修改收货地址请求
111+
*
112+
* @param orderId 订单id
113+
* @return BaseResponse
114+
*
115+
* @throws WxErrorException 异常
116+
*/
117+
WxChannelBaseResponse rejectAddressModify(String orderId) throws WxErrorException;
118+
99119
/**
100120
* 关闭订单 (需要订单状态为未付款状态)
101121
*

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImpl.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22

33
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.DELIVERY_SEND_URL;
44
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.GET_DELIVERY_COMPANY_URL;
5-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_GET_URL;
6-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_LIST_URL;
7-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_SEARCH_URL;
8-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_ADDRESS_URL;
9-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_EXPRESS_URL;
10-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_PRICE_URL;
11-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_REMARK_URL;
5+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.*;
126

137
import java.util.List;
148
import lombok.extern.slf4j.Slf4j;
@@ -95,6 +89,20 @@ public WxChannelBaseResponse updateDelivery(DeliveryUpdateParam param) throws Wx
9589
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
9690
}
9791

92+
@Override
93+
public WxChannelBaseResponse acceptAddressModify(String orderId) throws WxErrorException {
94+
OrderIdParam param = new OrderIdParam(orderId);
95+
String resJson = shopService.post(ACCEPT_ADDRESS_MODIFY_URL, param);
96+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
97+
}
98+
99+
@Override
100+
public WxChannelBaseResponse rejectAddressModify(String orderId) throws WxErrorException {
101+
OrderIdParam param = new OrderIdParam(orderId);
102+
String resJson = shopService.post(REJECT_ADDRESS_MODIFY_URL, param);
103+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
104+
}
105+
98106
@Override
99107
public WxChannelBaseResponse closeOrder(String orderId) {
100108
// 暂不支持

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderDeliveryInfo.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,16 @@ public class OrderDeliveryInfo implements Serializable {
3232
@JsonProperty("deliver_method")
3333
private Integer deliverMethod;
3434

35+
/** 用户下单后申请修改收货地址,商家同意后该字段会覆盖订单地址信息 */
36+
@JsonProperty("address_under_review")
37+
private OrderAddressInfo addressUnderReview;
38+
39+
/** 修改地址申请时间,秒级时间戳 */
40+
@JsonProperty("address_apply_time")
41+
private Long addressApplyTime;
42+
43+
/** 电子面单代发时的订单密文 */
44+
@JsonProperty("ewaybill_order_code")
45+
private String ewaybillOrderCode;
46+
3547
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ public interface Order {
144144
String UPDATE_ADDRESS_URL = "https://api.weixin.qq.com/channels/ec/order/address/update";
145145
/** 修改物流信息 */
146146
String UPDATE_EXPRESS_URL = "https://api.weixin.qq.com/channels/ec/order/deliveryinfo/update";
147+
/** 同意用户修改收货地址申请 */
148+
String ACCEPT_ADDRESS_MODIFY_URL = "https://api.weixin.qq.com/channels/ec/order/addressmodify/accept";
149+
/** 拒绝用户修改收货地址申请 */
150+
String REJECT_ADDRESS_MODIFY_URL = "https://api.weixin.qq.com/channels/ec/order/addressmodify/reject";
147151
/** 订单搜索 */
148152
String ORDER_SEARCH_URL = "https://api.weixin.qq.com/channels/ec/order/search";
149153
}

weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImplTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,24 @@ public void testUpdateDelivery() throws WxErrorException {
102102
assertTrue(response.isSuccess());
103103
}
104104

105+
@Test
106+
public void testAcceptAddressModify() throws WxErrorException {
107+
WxChannelOrderService orderService = channelService.getOrderService();
108+
String orderId = "";
109+
WxChannelBaseResponse response = orderService.acceptAddressModify(orderId);
110+
assertNotNull(response);
111+
assertTrue(response.isSuccess());
112+
}
113+
114+
@Test
115+
public void testRejectAddressModify() throws WxErrorException {
116+
WxChannelOrderService orderService = channelService.getOrderService();
117+
String orderId = "";
118+
WxChannelBaseResponse response = orderService.rejectAddressModify(orderId);
119+
assertNotNull(response);
120+
assertTrue(response.isSuccess());
121+
}
122+
105123
@Test
106124
public void testCloseOrder() {
107125
WxChannelOrderService orderService = channelService.getOrderService();

0 commit comments

Comments
 (0)