10000 微信客服&小程序物流服务&交易组件 部分更新 by borisbao · Pull Request #2715 · binarywang/WxJava · GitHub
[go: up one dir, main page]

Skip to content

微信客服&小程序物流服务&交易组件 部分更新 #2715

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 23 commits into from
Jun 27, 2022
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
8000
Prev Previous commit
Next Next commit
物流查询服务
  • Loading branch information
boris.bao committed Apr 3, 2022
commit aa33ad97d6d2ccf51246a3cd66d86394ee2b4476
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
import cn.binarywang.wx.miniapp.bean.delivery.BindAccountResponse;
import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderResponse;
import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillRequest;
import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillResponse;
import cn.binarywang.wx.miniapp.bean.delivery.GetOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.GetOrderResponse;
import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderResponse;
import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceRequest;
import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceResponse;
import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceRequest;
import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceResponse;
import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillRequest;
Expand Down Expand Up @@ -129,4 +133,34 @@ QueryWaybillTraceResponse queryWaybillTrace(QueryWaybillTraceRequest request)
throws WxErrorException;


/**
* 传运单接口 follow_waybill 订阅微信后台会跟踪运单的状态变化
* <pre>
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html
* </pre>
*
* @param request request
* @return 响应
* @throws WxErrorException 异常
*/
FollowWaybillResponse followWaybill(FollowWaybillRequest request)
throws WxErrorException;


/**
* 查运单接口 query_follow_trace
*
* <pre>
* 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html
* </pre>
*
* @param request request
* @return 响应
* @throws WxErrorException 异常
*/
QueryFollowTraceResponse queryFollowTrace(QueryFollowTraceRequest request)
throws WxErrorException ;


}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
import cn.binarywang.wx.miniapp.bean.delivery.BindAccountResponse;
import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderResponse;
import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillRequest;
import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillResponse;
import cn.binarywang.wx.miniapp.bean.delivery.GetOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.GetOrderResponse;
import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderResponse;
import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceRequest;
import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceResponse;
import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceRequest;
import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceResponse;
import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillRequest;
Expand Down Expand Up @@ -186,6 +190,28 @@ public QueryWaybillTraceResponse queryWaybillTrace(
return response;
}

@Override
public FollowWaybillResponse followWaybill(
FollowWaybillRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(InstantDelivery.FOLLOW_WAYBILL_URL, request);
FollowWaybillResponse response = FollowWaybillResponse.fromJson(responseContent);
if (response.getErrcode() == -1) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return response;
}

@Override
public QueryFollowTraceResponse queryFollowTrace(
QueryFollowTraceRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(InstantDelivery.QUERY_FOLLOW_TRACE_URL, request);
QueryFollowTraceResponse response = QueryFollowTraceResponse.fromJson(responseContent);
if (response.getErrcode() == -1) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return response;
}

/**
* 解析响应.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package cn.binarywang.wx.miniapp.bean.delivery;


import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
* <pre>
* 传运单接口 follow_waybil
*
* 商户使用此接口向微信提供某交易单号对应的运单号。微信后台会跟踪运单的状态变化,在关键物流节点给下单用户推送消息通知。
* </pre>
*
* @author boris
* @since 2022-04-01
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class FollowWaybillRequest implements Serializable {

private static final long serialVersionUID = -7538739003766268386L;


/**
* 用户openid
* <pre>
* 是否必填: 是
* 描述: 用户openid
* </pre>
*/
@SerializedName("openid")
private String openid;

/**
* 寄件人手机号
* <pre>
* 是否必填: 否
* 描述:
* </pre>
*/
@SerializedName("sender_phone")
private String senderPhone;

/**
* 收件人手机号
* <pre>
* 是否必填: 否
* 描述:部分运力需要用户手机号作为查单依据
* </pre>
*/
@SerializedName("receiver_phone")
private String receiverPhone;

/**
* 运单ID
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("waybill_id")
private String waybillId;

/**
* 交易单号(微信支付生成的交易单号,一般以420开头)
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("trans_id")
private String transId;


/**
* 点击落地页商品卡片跳转路径(建议为订单详情页path),不传默认跳转小程序首页。
* <pre>
* 是否必填: 否
* </pre>
*/
@SerializedName("order_detail 8000 _path")
private String orderDetailPath;

/**
* 商品信息
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("goods_info")
private WaybillGoodsInfo goodsInfo;

public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cn.binarywang.wx.miniapp.bean.delivery;

import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;

/**
* <pre>
* 查运单接口 query_follow_trace 响应参数
* </pre>
*
* @author boris
* @since 2022-04-01
*/
@Data
@Accessors(chain = true)
public class FollowWaybillResponse extends WxMaBaseResponse implements Serializable {

private static final long serialVersionUID = 3773007367000633663L;

/**
* 查询id.
*/
@SerializedName("waybill_token")
private String waybillToken;


public static FollowWaybillResponse fromJson(String json) {
return WxMaGsonBuilder.create().fromJson(json, FollowWaybillResponse.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package cn.binarywang.wx.miniapp.bean.delivery;


import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
* <pre>
* 消息组件-查运单接口 query_follow_trace
*
* 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息
* </pre>
*
* @author boris
* @since 2022-04-01
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class QueryFollowTraceRequest implements Serializable {

private static final long serialVersionUID = -7538739003766268386L;


/**
* 查询id
* <pre>
* 是否必填: 是
* 描述: 可以从 传运单接口 follow_waybill 取数据
* </pre>
*/
@SerializedName("waybill_token")
private String waybillToken;

public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}
Loading
0