Visitar URL original
【视频号】更新视频号小店/微信小店类目、订单、商品、主页管理相关接口,补充starter文档 by lixize · Pull Request #3426 · binarywang/WxJava · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
🎨 【视频号】新增兑换虚拟号,更新订单详情接口
  • Loading branch information
lixize committed Nov 29, 2024
commit 2da013e9a1bbabd0d43189e01ad9847d269b82bc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import me.chanjar.weixin.channel.bean.delivery.DeliveryCompanyResponse;
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;
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.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.VirtualTelNumberResponse;
import me.chanjar.weixin.common.error.WxErrorException;

/**
Expand Down Expand Up @@ -159,4 +161,22 @@ WxChannelBaseResponse updatePrice(String orderId, Integer expressFee, List<Chang
* @throws WxErrorException 异常
*/
WxChannelBaseResponse uploadFreshInspect(String orderId, List<PackageAuditInfo> items) throws WxErrorException;

/**
* 兑换虚拟号
*
* @param orderId 订单id
* @return 虚拟号信息
* @throws WxErrorException 异常
*/
VirtualTelNumberResponse getVirtualTelNumber(String orderId) throws WxErrorException;

/**
* 解码订单包含的敏感数据
*
* @param orderId 订单id
* @return 解码结果
* @throws WxErrorException 异常
*/
DecodeSensitiveInfoResponse decodeSensitiveInfo(String orderId) throws WxErrorException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;
Expand All @@ -24,6 +25,7 @@
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.util.ResponseUtils;
import me.chanjar.weixin.common.error.WxErrorException;

Expand Down Expand Up @@ -132,4 +134,18 @@ public WxChannelBaseResponse uploadFreshInspect(String orderId, List<PackageAudi
String resJson = shopService.post(UPLOAD_FRESH_INSPECT_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}

@Override
public VirtualTelNumberResponse getVirtualTelNumber(String orderId) throws WxErrorException {
String reqJson = "{\"order_id\":\"" + orderId + "\"}";
String resJson = shopService.post(VIRTUAL_TEL_NUMBER_URL, reqJson);
return ResponseUtils.decode(resJson, VirtualTelNumberResponse.class);
}

@Override
public DecodeSensitiveInfoResponse decodeSensitiveInfo(String orderId) throws WxErrorException {
String reqJson = "{\"order_id\":\"" + orderId + "\"}";
String resJson = shopService.post(DECODE_SENSITIVE_INFO_URL, reqJson);
return ResponseUtils.decode(resJson, DecodeSensitiveInfoResponse.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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.AddressInfo;

/**
* 解码地址数据
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class DecodeAddressInfo extends AddressInfo {

/** 虚拟发货订单联系方式,在发货方式为无需快递(deliver_method=1)时返回 */
@JsonProperty("virtual_order_tel_number")
private String virtualOrderTelNumber;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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;

/**
* 解码订单包含的敏感数据响应
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class DecodeSensitiveInfoResponse extends WxChannelBaseResponse {

private static final long serialVersionUID = 935829924760021624L;

/** 收货信息 */
@JsonProperty("address_info")
private DecodeAddressInfo addressInfo;

/** 虚拟号信息 */
@JsonProperty("virtual_number_info")
private VirtualNumberInfo virtualNumberInfo;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,16 @@ public class OrderDeliveryInfo implements Serializable {
@JsonProperty("ewaybill_order_code")
private String ewaybillOrderCode;

/** 订单质检类型 2生鲜类质检 1珠宝玉石类质检 0不需要;不传递本字段表示不需要 */
@JsonProperty("quality_inspect_type")
private String qualityInspectType;

/** 质检信息 */
@JsonProperty("quality_inspect_info")
private QualityInsepctInfo qualityInspectInfo;

/** 虚拟商品充值账户信息 */
@JsonProperty("recharge_info")
private RechargeInfo rechargeInfo;

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,33 @@ public class OrderSearchCondition implements Serializable {
@JsonProperty("user_name")
private String userName;

/** 收件人电话 */
/**
* 收件人电话
* @deprecated 当前字段已经废弃,请勿使用,如果原本填手机后四位,可正常使用,否则接口报错
*/
@JsonProperty("tel_number")
@Deprecated
private String telNumber;

/**
* 收件人电话后四位
*/
@JsonProperty("tel_number_last4")
private String telNumberLast4;

/** 选填,只搜一个订单时使用 */
@JsonProperty("order_id")
private String orderId;

/** 商家备注 */
@JsonProperty("merchant_notes")
private String merchantNotes;

/** 买家备注 */
@JsonProperty("customer_notes")
private String customerNotes;

/** 申请修改地址审核中 */
@JsonProperty("address_under_review")
private Boolean addressUnderReview;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package me.chanjar.weixin.channel.bean.order;

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

/**
* 质检信息
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
public class QualityInsepctInfo implements Serializable {

private static final long serialVersionUID = 8109819414306253475L;

/** 质检状态 */
@JsonProperty("inspect_status")
private Integer inspectStatus;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package me.chanjar.weixin.channel.bean.order;

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

/**
* 虚拟商品充值账户信息
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
public class RechargeInfo implements Serializable {

/** 虚拟商品充值账号,当account_type=qq或phone_number或mail的时候返回 */
@JsonProperty("account_no")
private String accountNo;

/** 账号充值类型,可选项: weixin(微信号),qq(qq),phone_number(电话号码),mail(邮箱) */
@JsonProperty("account_type")
private String accountType;

/** 当account_type="weixin"的时候返回 */
@JsonProperty("wx_openid")
private String wxOpenId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package me.chanjar.weixin.channel.bean.order;

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

/**
* 虚拟号信息
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
public class VirtualNumberInfo implements Serializable {

private static final long serialVersionUID = -372834823737476644L;

/** 虚拟号 */
@JsonProperty("virtual_number")
private String virtualNumber;

/** 分机号 */
@JsonProperty("extension")
private String extension;

/** 过期时间戳 */
@JsonProperty("expiration")
private Long expiration;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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;

/**
* 兑换虚拟号 返回结果
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class VirtualTelNumberResponse extends WxChannelBaseResponse {

/** 虚拟号码 */
@JsonProperty("virtual_tel_number")
private String virtualTelNumber;

/** 虚拟号码过期时间 */
@JsonProperty("virtual_tel_expire_time")
private Long virtualTelExpireTime;

/** 兑换虚拟号码次数 */
@JsonProperty("get_virtual_tel_cnt")
private Integer getVirtualTelCnt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ public interface Order {
String ORDER_SEARCH_URL = "https://api.weixin.qq.com/channels/ec/order/search";
/** 上传生鲜质检信息 */
String UPLOAD_FRESH_INSPECT_URL = "https://api.weixin.qq.com/channels/ec/order/freshinspect/submit";
/** 兑换虚拟号 */
String VIRTUAL_TEL_NUMBER_URL = "https://api.weixin.qq.com/channels/ec/order/virtualtelnumber/get";
/** 解码订单包含的敏感数据 */
String DECODE_SENSITIVE_INFO_URL = "https://api.weixin.qq.com/channels/ec/order/sensitiveinfo/decode";
}

/** 售后相关接口 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;
import me.chanjar.weixin.channel.bean.delivery.PackageAuditInfo;
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.OrderAddressInfo;
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.VirtualTelNumberResponse;
import me.chanjar.weixin.channel.test.ApiTestModule;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Guice;
Expand Down Expand Up @@ -163,4 +165,22 @@ public void testUploadFreshInspect() throws WxErrorException {
assertNotNull(response);
assertTrue(response.isSuccess());
}

@Test
public void testGetVirtualTelNumber() throws WxErrorException {
WxChannelOrderService orderService = channelService.getOrderService();
String orderId = "123";
VirtualTelNumberResponse response = orderService.getVirtualTelNumber(orderId);
assertNotNull(response);
assertTrue(response.isSuccess());
}

@Test
public void testDecodeSensitiveInfo() throws WxErrorException {
WxChannelOrderService orderService = channelService.getOrderService();
String orderId = "123";
DecodeSensitiveInfoResponse response = orderService.decodeSensitiveInfo(orderId);
assertNotNull(response);
assertTrue(response.isSuccess());
}
}