diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java new file mode 100644 index 000000000..322d740d5 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java @@ -0,0 +1,89 @@ +package cn.binarywang.wx.miniapp.api; + +import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingIsTradeManagedResponse; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * @author xzh + * created on 2023/5/17 16:49 + */ +public interface WxMaOrderShippingService { + /** + * 查询小程序是否已开通发货信息管理服务 + * + * @param appId 待查询小程序的 appid,非服务商调用时仅能查询本账号 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + WxMaOrderShippingIsTradeManagedResponse isTradeManaged(String appId) + throws WxErrorException; + + /** + * 发货信息录入接口 + * + * @param request 请求 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + WxMaOrderShippingInfoBaseResponse upload(WxMaOrderShippingInfoUploadRequest request) + throws WxErrorException; + + + /** + * 发货信息合单录入接口 + * + * @param request 请求 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + WxMaOrderShippingInfoBaseResponse upload(WxMaOrderCombinedShippingInfoUploadRequest request) + throws WxErrorException; + + /** + * 查询订单发货状态 + * 你可以通过交易单号或商户号+商户单号来查询该支付单的发货状态。 + * + * @param request 请求 + * @return WxMaOrderShippingInfoGetResponse + * @throws WxErrorException e + */ + WxMaOrderShippingInfoGetResponse get(WxMaOrderShippingInfoGetRequest request) + throws WxErrorException; + + /** + * 查询订单列表 + * 你可以通过支付时间、支付者openid或订单状态来查询订单列表。 + * + * @param request 请求 + * @return WxMaOrderShippingInfoGetListResponse + * @throws WxErrorException e + */ + WxMaOrderShippingInfoGetListResponse getList(WxMaOrderShippingInfoGetListRequest request) + throws WxErrorException; + + /** + * 确认收货提醒接口 + * 如你已经从你的快递物流服务方获知到用户已经签收相关商品,可以通过该接口提醒用户及时确认收货,以提高资金结算效率,每个订单仅可调用一次。 + * + * @param request 请求 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + WxMaOrderShippingInfoBaseResponse notifyConfirmReceive(WxMaOrderShippingInfoNotifyConfirmRequest request) + throws WxErrorException; + + /** + * 消息跳转路径设置接口 + * 如你已经在小程序内接入平台提供的确认收货组件,可以通过该接口设置发货消息及确认收货消息的跳转动作,用户点击发货消息时会直接进入你的小程序订单列表页面或详情页面进行确认收货,进一步优化用户体验。 + * + * @param path 商户自定义跳转路径 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + WxMaOrderShippingInfoBaseResponse setMsgJumpPath(String path) + throws WxErrorException; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java index dd0c5bede..ad1dc1506 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java @@ -496,36 +496,49 @@ public interface WxMaService extends WxService { /** * 分享人接口 + * * @return WxMaShopSharerService */ WxMaShopSharerService getShopSharerService(); /** * 标准交易组件接口 + * * @return WxMaProductService */ WxMaProductService getProductService(); /** * 小商店-标准交易组件-订单服务 + * * @return getProductOrderService */ WxMaProductOrderService getProductOrderService(); /** * 小商店-标准交易组件-优惠券 + * * @return getWxMaShopCouponService */ WxMaShopCouponService getWxMaShopCouponService(); /** * 小程序支付管理-订单支付 + * * @return getWxMaShopPayService */ WxMaShopPayService getWxMaShopPayService(); + /** + * 小程序发货信息管理服务 + * + * @return getWxMaOrderShippingService + */ + WxMaOrderShippingService getWxMaOrderShippingService(); + /** * 小程序openApi管理 + * * @return getWxMaOpenApiService */ WxMaOpenApiService getWxMaOpenApiService(); diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java index dd30115ca..9f3d230c8 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java @@ -85,7 +85,11 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH private final WxMaProductOrderService productOrderService = new WxMaProductOrderServiceImpl(this); private final WxMaShopCouponService wxMaShopCouponService = new WxMaShopCouponServiceImpl(this); private final WxMaShopPayService wxMaShopPayService = new WxMaShopPayServiceImpl(this); + + private final WxMaOrderShippingService wxMaOrderShippingService = new WxMaOrderShippingServiceImpl(this); + private final WxMaOpenApiService wxMaOpenApiService = new WxMaOpenApiServiceImpl(this); + private Map configMap; private int retrySleepMillis = 1000; private int maxRetryTimes = 5; @@ -602,10 +606,14 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH } @Override - public WxMaDeviceSubscribeService getDeviceSubscribeService(){ return this.deviceSubscribeService; } + public WxMaDeviceSubscribeService getDeviceSubscribeService() { + return this.deviceSubscribeService; + } @Override - public WxMaMarketingService getMarketingService() {return this.marketingService; } + public WxMaMarketingService getMarketingService() { + return this.marketingService; + } @Override public WxMaImmediateDeliveryService getWxMaImmediateDeliveryService() { @@ -613,13 +621,19 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH } @Override - public WxMaSafetyRiskControlService getSafetyRiskControlService(){ return this.safetyRiskControlService; } + public WxMaSafetyRiskControlService getSafetyRiskControlService() { + return this.safetyRiskControlService; + } @Override - public WxMaShopSharerService getShopSharerService() {return this.shopSharerService; } + public WxMaShopSharerService getShopSharerService() { + return this.shopSharerService; + } @Override - public WxMaProductService getProductService() { return this.productService; } + public WxMaProductService getProductService() { + return this.productService; + } @Override public WxMaProductOrderService getProductOrderService() { @@ -636,6 +650,16 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH return this.wxMaShopPayService; } + /** + * 小程序发货信息管理服务 + * + * @return getWxMaOrderShippingService + */ + @Override + public WxMaOrderShippingService getWxMaOrderShippingService() { + return this.wxMaOrderShippingService; + } + @Override public WxMaOpenApiService getWxMaOpenApiService() { return this.wxMaOpenApiService; diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaOrderShippingServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaOrderShippingServiceImpl.java new file mode 100644 index 000000000..4aee53e15 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaOrderShippingServiceImpl.java @@ -0,0 +1,134 @@ +package cn.binarywang.wx.miniapp.api.impl; + +import cn.binarywang.wx.miniapp.api.WxMaOrderShippingService; +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaOrderShippingIsTradeManagedRequest; +import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingIsTradeManagedResponse; +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.JsonObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.api.WxConsts; +import me.chanjar.weixin.common.enums.WxType; +import me.chanjar.weixin.common.error.WxError; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.common.util.json.GsonHelper; +import me.chanjar.weixin.common.util.json.GsonParser; + +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.OrderShipping.*; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.OTHER.GET_CATEGORY; + + +/** + * @author xzh + * created on 2023/5/17 17:44 + */ +@Slf4j +@RequiredArgsConstructor +public class WxMaOrderShippingServiceImpl implements WxMaOrderShippingService { + + private final WxMaService wxMaService; + + /** + * 查询小程序是否已开通发货信息管理服务 + * + * @param appId 待查询小程序的 appid,非服务商调用时仅能查询本账号 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + @Override + public WxMaOrderShippingIsTradeManagedResponse isTradeManaged(String appId) throws WxErrorException { + WxMaOrderShippingIsTradeManagedRequest request = WxMaOrderShippingIsTradeManagedRequest.builder().appId(appId).build(); + return request(IS_TRADE_MANAGED, request, WxMaOrderShippingIsTradeManagedResponse.class); + } + + /** + * 发货信息录入接口 + * + * @param request 请求 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + @Override + public WxMaOrderShippingInfoBaseResponse upload(WxMaOrderShippingInfoUploadRequest request) throws WxErrorException { + return request(UPLOAD_SHIPPING_INFO, request, WxMaOrderShippingInfoBaseResponse.class); + } + + /** + * 发货信息合单录入接口 + * + * @param request 请求 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + @Override + public WxMaOrderShippingInfoBaseResponse upload(WxMaOrderCombinedShippingInfoUploadRequest request) throws WxErrorException { + return request(UPLOAD_COMBINED_SHIPPING_INFO, request, WxMaOrderShippingInfoBaseResponse.class); + } + + /** + * 查询订单发货状态 + * 你可以通过交易单号或商户号+商户单号来查询该支付单的发货状态。 + * + * @param request 请求 + * @return WxMaOrderShippingInfoGetResponse + * @throws WxErrorException e + */ + @Override + public WxMaOrderShippingInfoGetResponse get(WxMaOrderShippingInfoGetRequest request) throws WxErrorException { + return request(GET_SHIPPING_INFO, request, WxMaOrderShippingInfoGetResponse.class); + } + + /** + * 查询订单列表 + * 你可以通过支付时间、支付者openid或订单状态来查询订单列表。 + * + * @param request 请求 + * @return WxMaOrderShippingInfoGetListResponse + * @throws WxErrorException e + */ + @Override + public WxMaOrderShippingInfoGetListResponse getList(WxMaOrderShippingInfoGetListRequest request) throws WxErrorException { + return request(GET_SHIPPING_INFO_LIST, request, WxMaOrderShippingInfoGetListResponse.class); + } + + /** + * 确认收货提醒接口 + * 如你已经从你的快递物流服务方获知到用户已经签收相关商品,可以通过该接口提醒用户及时确认收货,以提高资金结算效率,每个订单仅可调用一次。 + * + * @param request 请求 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + @Override + public WxMaOrderShippingInfoBaseResponse notifyConfirmReceive(WxMaOrderShippingInfoNotifyConfirmRequest request) throws WxErrorException { + return request(NOTIFY_CONFIRM_RECEIVE, request, WxMaOrderShippingInfoBaseResponse.class); + } + + /** + * 消息跳转路径设置接口 + * 如你已经在小程序内接入平台提供的确认收货组件,可以通过该接口设置发货消息及确认收货消息的跳转动作,用户点击发货消息时会直接进入你的小程序订单列表页面或详情页面进行确认收货,进一步优化用户体验。 + * + * @param path 商户自定义跳转路径 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + @Override + public WxMaOrderShippingInfoBaseResponse setMsgJumpPath(String path) throws WxErrorException { + JsonObject jsonObject = GsonHelper.buildJsonObject("path", path); + return request(SET_MSG_JUMP_PATH, jsonObject, WxMaOrderShippingInfoBaseResponse.class); + } + + private T request(String url, Object request, Class resultT) throws WxErrorException { + String responseContent = this.wxMaService.post(url, request); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, resultT); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaOrderShippingIsTradeManagedRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaOrderShippingIsTradeManagedRequest.java new file mode 100644 index 000000000..d70e04327 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaOrderShippingIsTradeManagedRequest.java @@ -0,0 +1,30 @@ +package cn.binarywang.wx.miniapp.bean.shop.request; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaOrderShippingIsTradeManagedRequest implements Serializable { + + private static final long serialVersionUID = -5735132900385013330L; + /** + * 必填 + * 待查询小程序的 appid,非服务商调用时仅能查询本账号 + */ + @SerializedName("appid") + private String appId; + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/ContactBean.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/ContactBean.java new file mode 100644 index 000000000..685061aee --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/ContactBean.java @@ -0,0 +1,33 @@ +package cn.binarywang.wx.miniapp.bean.shop.request.shipping; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author xzh + * @Description + * @createTime 2023/07/10 10:38 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ContactBean implements Serializable { + private static final long serialVersionUID = 3388264169113920140L; + + /** + * 寄件人联系方式,寄件人联系方式,采用掩码传输,最后4位数字不能打掩码 示例值: `189****1234, 021-****1234, ****1234, 0**2-***1234, 0**2-******23-10, ****123-8008` 值限制: 0 ≤ value ≤ 1024 + */ + @SerializedName("consignor_contact") + private String consignorContact; + /** + * 收件人联系方式,收件人联系方式为,采用掩码传输,最后4位数字不能打掩码 示例值: `189****1234, 021-****1234, ****1234, 0**2-***1234, 0**2-******23-10, ****123-8008` 值限制: 0 ≤ value ≤ 1024 + */ + @SerializedName("receiver_contact") + private String receiverContact; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/OrderKeyBean.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/OrderKeyBean.java new file mode 100644 index 000000000..87372479a --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/OrderKeyBean.java @@ -0,0 +1,44 @@ +package cn.binarywang.wx.miniapp.bean.shop.request.shipping; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author xzh + * @Description + * @createTime 2023/07/10 10:37 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class OrderKeyBean implements Serializable { + private static final long serialVersionUID = -6322907878214196106L; + + /** + * 必填 + * 订单单号类型,用于确认需要上传详情的订单。枚举值1,使用下单商户号和商户侧单号;枚举值2,使用微信支付单号。 + */ + @SerializedName("order_number_type") + private int orderNumberType; + /** + * 原支付交易对应的微信订单号 + */ + @SerializedName("transaction_id") + private String transactionId; + /** + * 支付下单商户的商户号,由微信支付生成并下发。 + */ + @SerializedName("mchid") + private String mchId; + /** + * 商户系统内部订单号,只能是数字、大小写字母`_-*`且在同一个商户号下唯一 + */ + @SerializedName("out_trade_no") + private String outTradeNo; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/PayerBean.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/PayerBean.java new file mode 100644 index 000000000..f6dd55ce8 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/PayerBean.java @@ -0,0 +1,29 @@ +package cn.binarywang.wx.miniapp.bean.shop.request.shipping; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author xzh + * @Description + * @createTime 2023/07/10 10:38 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PayerBean implements Serializable { + + private static final long serialVersionUID = 6628077253606871512L; + /** + * 必填 + * 用户标识,用户在小程序appid下的唯一标识。 下单前需获取到用户的Openid 示例值: oUpF8uMuAJO_M2pxb1Q9zNjWeS6o 字符字节限制: [1, 128] + */ + @SerializedName("openid") + private String openid; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/ShippingListBean.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/ShippingListBean.java new file mode 100644 index 000000000..136f8b504 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/ShippingListBean.java @@ -0,0 +1,44 @@ +package cn.binarywang.wx.miniapp.bean.shop.request.shipping; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author xzh + * @Description + * @createTime 2023/07/10 10:39 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ShippingListBean implements Serializable { + private static final long serialVersionUID = -6554762808990702774L; + + /** + * 物流单号,物流快递发货时必填,示例值: 323244567777 字符字节限制: [1, 128] + */ + @SerializedName("tracking_no") + private String trackingNo; + /** + * 物流公司编码,快递公司ID,参见「查询物流公司编码列表」,物流快递发货时必填, 示例值: DHL 字符字节限制: [1, 128] + */ + @SerializedName("express_company") + private String expressCompany; + /** + * 必填 + * 商品信息,例如:微信红包抱枕*1个,限120个字以内 + */ + @SerializedName("item_desc") + private String itemDesc; + /** + * 联系方式,当发货的物流公司为顺丰时,联系方式为必填,收件人或寄件人联系方式二选一 + */ + @SerializedName("contact") + private ContactBean contact; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderCombinedShippingInfoUploadRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderCombinedShippingInfoUploadRequest.java new file mode 100644 index 000000000..74c4a7678 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderCombinedShippingInfoUploadRequest.java @@ -0,0 +1,96 @@ +package cn.binarywang.wx.miniapp.bean.shop.request.shipping; + +import cn.binarywang.wx.miniapp.bean.shop.request.shipping.ContactBean; +import cn.binarywang.wx.miniapp.bean.shop.request.shipping.OrderKeyBean; +import cn.binarywang.wx.miniapp.bean.shop.request.shipping.PayerBean; +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaOrderCombinedShippingInfoUploadRequest implements Serializable { + private static final long serialVersionUID = -334322216049787167L; + + /** + * 必填 + * 订单,需要上传物流信息的订单 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + @SerializedName("sub_orders") + private List subOrders; + + /** + * 必填 + * 上传时间,用于标识请求的先后顺序 示例值: `2022-12-15T13:29:35.120+08:00 + */ + @SerializedName("upload_time") + private String uploadTime; + + /** + * 必填 + * 支付者,支付者信息 + */ + @SerializedName("payer") + private PayerBean payer; + + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class SubOrderBean implements Serializable { + + private static final long serialVersionUID = -8999547192454376968L; + + /** + * 必填 + * 需要上传物流详情的子单订单,订单类型与合单订单保持一致 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + /** + * 必填 + * 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 + */ + @SerializedName("logistics_type") + private int logisticsType; + + /** + * 必填 + * 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) + * 示例值: UNIFIED_DELIVERY + */ + @SerializedName("delivery_mode") + private int deliveryMode; + + /** + * 分拆发货模式时必填,用于标识分拆发货模式下是否已全部发货完成,只有全部发货完成的情况下才会向用户推送发货完成通知。 + * 示例值: true/false + */ + @SerializedName("is_all_delivered") + private Boolean isAllDelivered; + + /** + * 子单物流信息列表 多重性: [1, 10] + */ + @SerializedName("shipping_list") + private List shippingList; + } + + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoGetListRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoGetListRequest.java new file mode 100644 index 000000000..fd9be83ae --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoGetListRequest.java @@ -0,0 +1,67 @@ +package cn.binarywang.wx.miniapp.bean.shop.request.shipping; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaOrderShippingInfoGetListRequest implements Serializable { + + private static final long serialVersionUID = -3682480001426075609L; + + /** + * 支付时间所属范围 + */ + @SerializedName("pay_time_range") + private PayTimeRange payTimeRange; + + /** + * 订单状态枚举:(1) 待发货;(2) 已发货;(3) 确认收货;(4) 交易完成;(5) 已退款。 + */ + @SerializedName("order_state") + private Integer orderState; + /** + * 支付者openid + */ + @SerializedName("openid") + private String openId; + /** + * 翻页时使用,获取第一页时不用传入,如果查询结果中 has_more 字段为 true,则传入该次查询结果中返回的 last_index 字段可获取下一页。 + */ + @SerializedName("last_index") + private String lastIndex; + /** + * 翻页时使用,返回列表的长度,默认为100。 + */ + @SerializedName("page_size") + private Long pageSize; + + @Data + public static class PayTimeRange implements Serializable { + + private static final long serialVersionUID = -1477231289550635468L; + + /** + * 起始时间,时间戳形式,不填则视为从0开始 + */ + @SerializedName("begin_time") + private Long beginTime; + /** + * 结束时间(含),时间戳形式,不填则视为32位无符号整型的最大值 + */ + @SerializedName("end_time") + private Long endTime; + } + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoGetRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoGetRequest.java new file mode 100644 index 000000000..3d4f33e3c --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoGetRequest.java @@ -0,0 +1,43 @@ +package cn.binarywang.wx.miniapp.bean.shop.request.shipping; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaOrderShippingInfoGetRequest implements Serializable { + + private static final long serialVersionUID = -6868378515860675152L; + + /** + * 原支付交易对应的微信订单号 + */ + @SerializedName("transaction_id") + private String transactionId; + /** + * 支付下单商户的商户号,由微信支付生成并下发 + */ + @SerializedName("merchant_id") + private String merchantId; + /** + * 二级商户号 + */ + @SerializedName("sub_merchant_id") + private String subMerchantId; + /** + * 商户系统内部订单号,只能是数字、大小写字母`_-*`且在同一个商户号下唯一。 + */ + @SerializedName("merchant_trade_no") + private String merchantTradeNo; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoNotifyConfirmRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoNotifyConfirmRequest.java new file mode 100644 index 000000000..5ddcb53a0 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoNotifyConfirmRequest.java @@ -0,0 +1,49 @@ +package cn.binarywang.wx.miniapp.bean.shop.request.shipping; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaOrderShippingInfoNotifyConfirmRequest implements Serializable { + + private static final long serialVersionUID = -6868378515860675152L; + + /** + * 原支付交易对应的微信订单号 + */ + @SerializedName("transaction_id") + private String transactionId; + /** + * 支付下单商户的商户号,由微信支付生成并下发 + */ + @SerializedName("merchant_id") + private String merchantId; + /** + * 二级商户号 + */ + @SerializedName("sub_merchant_id") + private String subMerchantId; + /** + * 商户系统内部订单号,只能是数字、大小写字母`_-*`且在同一个商户号下唯一。 + */ + @SerializedName("merchant_trade_no") + private String merchantTradeNo; + + /** + * 快递签收时间,时间戳形式。 + */ + @SerializedName("received_time") + private Long receivedTime; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoUploadRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoUploadRequest.java new file mode 100644 index 000000000..27cb57e5d --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/shipping/WxMaOrderShippingInfoUploadRequest.java @@ -0,0 +1,74 @@ +package cn.binarywang.wx.miniapp.bean.shop.request.shipping; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaOrderShippingInfoUploadRequest implements Serializable { + private static final long serialVersionUID = -334322216049787167L; + + + /** + * 必填 + * 订单,需要上传物流信息的订单 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + /** + * 必填 + * 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 + */ + @SerializedName("logistics_type") + private int logisticsType; + + /** + * 必填 + * 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) + * 示例值: UNIFIED_DELIVERY + */ + @SerializedName("delivery_mode") + private int deliveryMode; + + /** + * 分拆发货模式时必填,用于标识分拆发货模式下是否已全部发货完成,只有全部发货完成的情况下才会向用户推送发货完成通知。 + * 示例值: true/false + */ + @SerializedName("is_all_delivered") + private Boolean isAllDelivered; + + /** + * 必填 + * 物流信息列表,发货物流单列表,支持统一发货(单个物流单)和分拆发货(多个物流单)两种模式,多重性: [1, 10] + */ + @SerializedName("shipping_list") + private List shippingList; + + /** + * 必填 + * 上传时间,用于标识请求的先后顺序 示例值: `2022-12-15T13:29:35.120+08:00 + */ + @SerializedName("upload_time") + private String uploadTime; + + /** + * 必填 + * 支付者,支付者信息 + */ + @SerializedName("payer") + private PayerBean payer; + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingInfoBaseResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingInfoBaseResponse.java new file mode 100644 index 000000000..4ac48aacf --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingInfoBaseResponse.java @@ -0,0 +1,187 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +public class WxMaOrderShippingInfoBaseResponse implements Serializable { + private static final long serialVersionUID = -5414031943436195493L; + /** + * 错误码 + */ + @SerializedName("errcode") + private Integer errCode; + + /** + * 错误原因 + */ + @SerializedName("errmsg") + private String errMsg; + + //region 类型定义 + @Data + public static class Order implements Serializable { + private static final long serialVersionUID = -1390355751615987663L; + /** + * 原支付交易对应的微信订单号 + */ + @SerializedName("transaction_id") + private String transactionId; + /** + * 支付下单商户的商户号,由微信支付生成并下发 + */ + @SerializedName("merchant_id") + private String merchantId; + /** + * 二级商户号 + */ + @SerializedName("sub_merchant_id") + private String subMerchantId; + /** + * 商户系统内部订单号,只能是数字、大小写字母`_-*`且在同一个商户号下唯一。 + */ + @SerializedName("merchant_trade_no") + private String merchantTradeNo; + + /** + * 以分号连接的该支付单的所有商品描述,当超过120字时自动截断并以 “...” 结尾。 + */ + @SerializedName("description") + private String description; + + /** + * 支付单实际支付金额,整型,单位:分钱。 + */ + @SerializedName("paid_amount") + private Long paidAmount; + /** + * 支付者openid + */ + @SerializedName("openid") + private String openId; + + /** + * 交易创建时间,时间戳形式 + */ + @SerializedName("trade_create_time") + private Long tradeCreateTime; + /** + * 支付时间,时间戳形式。 + */ + @SerializedName("pay_time") + private Long payTime; + + /** + * 订单状态枚举:(1) 待发货;(2) 已发货;(3) 确认收货;(4) 交易完成;(5) 已退款。 + */ + @SerializedName("order_state") + private Integer orderState; + /** + * 是否处在交易纠纷中 + */ + @SerializedName("in_complaint") + private Boolean inComplaint; + + /** + * 发货信息 + */ + @SerializedName("shipping") + private Shipping shipping; + } + + @Data + public static class Shipping implements Serializable { + + private static final long serialVersionUID = -3527308640256070121L; + + /** + * 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) 示例值: UNIFIED_DELIVERY + */ + @SerializedName("delivery_mode") + private Integer deliveryMode; + /** + * 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 + */ + @SerializedName("logistics_type") + private Integer logisticsType; + /** + * 是否已完成全部发货 + */ + @SerializedName("finish_shipping") + private Boolean finishShipping; + /** + * 在小程序后台发货信息录入页录入的商品描述 + */ + @SerializedName("goods_desc") + private String goodsDesc; + /** + * 已完成全部发货的次数,未完成时为 0,完成时为 1,重新发货并完成后为 2。 + */ + @SerializedName("finish_shipping_count") + private Integer finishShippingCount; + /** + * 物流信息列表,发货物流单列表,支持统一发货(单个物流单)和分拆发货(多个物流单)两种模式。 + */ + @SerializedName("shipping_list") + private List shippingList; + + } + + @Data + public static class ShippingItem implements Serializable { + + private static final long serialVersionUID = 7064368114873624112L; + + /** + * 物流单号,示例值: "323244567777"。 + */ + @SerializedName("tracking_no") + private String trackingNo; + /** + * 同城配送公司名或物流公司编码,快递公司ID,参见「查询物流公司编码列表」 示例值: "DHL"。 + */ + @SerializedName("express_company") + private String expressCompany; + /** + * 使用上传物流信息 API 录入的该物流信息的商品描述。 + */ + @SerializedName("goods_desc") + private String goodsDesc; + /** + * 该物流信息的上传时间,时间戳形式。 + */ + @SerializedName("upload_time") + private Long uploadTime; + + /** + * 联系方式 + */ + @SerializedName("contact") + private Contact contact; + } + + @Data + public static class Contact implements Serializable { + private static final long serialVersionUID = -320914533207502380L; + + /** + * 寄件人联系方式 + */ + @SerializedName("consignor_contact") + private String consignorContact; + + /** + * 收件人联系方式 + */ + @SerializedName("receiver_contact") + private String receiverContact; + } + //endregion +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingInfoGetListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingInfoGetListResponse.java new file mode 100644 index 000000000..2c40ad41b --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingInfoGetListResponse.java @@ -0,0 +1,34 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +public class WxMaOrderShippingInfoGetListResponse extends WxMaOrderShippingInfoBaseResponse implements Serializable { + private static final long serialVersionUID = -5414031943436195493L; + + /** + * 翻页时使用 + */ + @SerializedName("last_index") + private String lastIndex; + /** + * 是否还有更多支付单 + */ + @SerializedName("has_more") + private Boolean hasMore; + + /** + * 支付单信息列表。 + */ + @SerializedName("order_list") + private List orderList; + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingInfoGetResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingInfoGetResponse.java new file mode 100644 index 000000000..28e702fcb --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingInfoGetResponse.java @@ -0,0 +1,22 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +public class WxMaOrderShippingInfoGetResponse extends WxMaOrderShippingInfoBaseResponse implements Serializable { + private static final long serialVersionUID = -5414031943436195493L; + + /** + * 支付单信息 + */ + @SerializedName("order") + private Order order; + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingIsTradeManagedResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingIsTradeManagedResponse.java new file mode 100644 index 000000000..460629834 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingIsTradeManagedResponse.java @@ -0,0 +1,33 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author xzh + * created on 2023/5/17 17:01 + */ +@Data +public class WxMaOrderShippingIsTradeManagedResponse implements Serializable { + + private static final long serialVersionUID = -5397007157487018762L; + /** + * 错误码 + */ + @SerializedName("errcode") + private Integer errCode; + + /** + * 错误原因 + */ + @SerializedName("errmsg") + private String errMsg; + + /** + * 是否已开通小程序发货信息管理服务 + */ + @SerializedName("is_trade_managed") + private Boolean tradeManaged; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java index e4d43fdfd..1139c98f7 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java @@ -764,4 +764,69 @@ public class WxMaApiUrlConstants { } + /** + * 发货信息管理服务相关接口 + *
+   * 文档地址: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%B8%80%E3%80%81%E5%8F%91%E8%B4%A7%E4%BF%A1%E6%81%AF%E5%BD%95%E5%85%A5%E6%8E%A5%E5%8F%A3
+   * 
+ */ + public interface OrderShipping { + + /** + * 查询小程序是否已开通发货信息管理服务. + *
+     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%B8%83%E3%80%81%E6%9F%A5%E8%AF%A2%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%98%AF%E5%90%A6%E5%B7%B2%E5%BC%80%E9%80%9A%E5%8F%91%E8%B4%A7%E4%BF%A1%E6%81%AF%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1
+     * 
+ */ + String IS_TRADE_MANAGED = "https://api.weixin.qq.com/wxa/sec/order/is_trade_managed"; + + /** + * 发货信息录入接口. + *
+     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%B8%80%E3%80%81%E5%8F%91%E8%B4%A7%E4%BF%A1%E6%81%AF%E5%BD%95%E5%85%A5%E6%8E%A5%E5%8F%A3
+     * 
+ */ + String UPLOAD_SHIPPING_INFO = "https://api.weixin.qq.com/wxa/sec/order/upload_shipping_info"; + + /** + * 发货信息合单录入接口. + *
+     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%BA%8C%E3%80%81%E5%8F%91%E8%B4%A7%E4%BF%A1%E6%81%AF%E5%90%88%E5%8D%95%E5%BD%95%E5%85%A5%E6%8E%A5%E5%8F%A3
+     * 
+ */ + String UPLOAD_COMBINED_SHIPPING_INFO = "https://api.weixin.qq.com/wxa/sec/order/upload_combined_shipping_info"; + + /** + * 查询订单发货状态. + *
+     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%BA%8C%E3%80%81%E5%8F%91%E8%B4%A7%E4%BF%A1%E6%81%AF%E5%90%88%E5%8D%95%E5%BD%95%E5%85%A5%E6%8E%A5%E5%8F%A3
+     * 
+ */ + String GET_SHIPPING_INFO = "https://api.weixin.qq.com/wxa/sec/order/get_order"; + + /** + * 查询订单发货状态列表. + *
+     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%9B%9B%E3%80%81%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E5%88%97%E8%A1%A8
+     * 
+ */ + String GET_SHIPPING_INFO_LIST = "https://api.weixin.qq.com/wxa/sec/order/get_order_list"; + + /** + * 确认收货提醒接口. + *
+     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%BA%94%E3%80%81%E7%A1%AE%E8%AE%A4%E6%94%B6%E8%B4%A7%E6%8F%90%E9%86%92%E6%8E%A5%E5%8F%A3
+     * 
+ */ + String NOTIFY_CONFIRM_RECEIVE = "https://api.weixin.qq.com/wxa/sec/order/notify_confirm_receive"; + + /** + * 消息跳转路径设置接口. + *
+     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%85%AD%E3%80%81%E6%B6%88%E6%81%AF%E8%B7%B3%E8%BD%AC%E8%B7%AF%E5%BE%84%E8%AE%BE%E7%BD%AE%E6%8E%A5%E5%8F%A3
+     * 
+ */ + String SET_MSG_JUMP_PATH = "https://api.weixin.qq.com/wxa/sec/order/set_msg_jump_path"; + + } } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java index 5c0d75e3c..2e41205e0 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java @@ -8,6 +8,7 @@ import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.open.bean.WxOpenCreateResult; import me.chanjar.weixin.open.bean.WxOpenGetResult; import me.chanjar.weixin.open.bean.WxOpenMaCodeTemplate; +import me.chanjar.weixin.open.bean.ma.WxOpenMaApplyOrderPathInfo; import me.chanjar.weixin.open.bean.message.WxOpenXmlMessage; import me.chanjar.weixin.open.bean.minishop.*; import me.chanjar.weixin.open.bean.minishop.coupon.WxMinishopCoupon; @@ -1097,4 +1098,20 @@ public interface WxOpenComponentService { */ WxOpenResult clearQuotaV2(String appid) throws WxErrorException; + ////////////////////////////////////////////////////////////// + /** + * 申请设置订单页path信息 + */ + String OPEN_APPLY_SET_ORDER_PATH_INFO = "https://api.weixin.qq.com/wxa/security/applysetorderpathinfo"; + + /** + * 申请设置订单页path信息 + * 注意:一次提交不超过100个appid + * + * @param info 订单页path信息 + * @return . + * @throws WxErrorException . + */ + WxOpenResult applySetOrderPathInfo(WxOpenMaApplyOrderPathInfo info) throws WxErrorException; + } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java index 194da4b9b..cae5faa78 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java @@ -2,6 +2,7 @@ package me.chanjar.weixin.open.api; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.open.bean.ma.WxFastMaCategory; +import me.chanjar.weixin.open.bean.ma.WxOpenMaApplyOrderPathInfo; import me.chanjar.weixin.open.bean.result.*; import java.util.List; @@ -69,6 +70,11 @@ public interface WxOpenMaBasicService { */ String OPEN_MODIFY_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/modifycategory"; + /** + * 获取订单页path信息 + */ + String OPEN_GET_ORDER_PATH_INFO = "https://api.weixin.qq.com/wxa/security/getorderpathinfo"; + /** * 1.获取小程序的信息 @@ -196,4 +202,13 @@ public interface WxOpenMaBasicService { * @throws WxErrorException . */ WxOpenResult modifyCategory(WxFastMaCategory category) throws WxErrorException; + + /** + * 获取订单页Path信息 + * + * @param infoType 0:线上版,1:审核版 + * @return 订单页Path信息 + * @throws WxErrorException . + */ + WxOpenMaGetOrderPathResult getOrderPathInfo(int infoType) throws WxErrorException; } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java index 9e3156a1b..7b34d2761 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java @@ -684,6 +684,12 @@ public interface WxOpenMaService extends WxMaService { */ WxOpenMaPrivacyService getPrivacyService(); + /** + * 购物订单 + * @return 购物订单服务 + */ + WxOpenMaShoppingOrdersService getShoppingOrdersService(); + /** * 小程序审核 提审素材上传接口 * diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaShoppingOrdersService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaShoppingOrdersService.java new file mode 100644 index 000000000..1cd96a2b3 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaShoppingOrdersService.java @@ -0,0 +1,111 @@ +package me.chanjar.weixin.open.api; + +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.open.bean.result.WxOpenResult; +import me.chanjar.weixin.open.bean.shoppingOrders.*; + +/** + * @author xzh + * created on 2023/5/17 16:49 + */ +public interface WxOpenMaShoppingOrdersService { + + + /** + * 上传购物详情 + */ + String UPLOAD_SHOPPING_INFO = "https://api.weixin.qq.com/user-order/orders"; + + /** + * 上传物流信息 + */ + String UPLOAD_SHIPPING_INFO = "https://api.weixin.qq.com/user-order/orders/shippings"; + + /** + * 上传合单购物详情 + */ + String UPLOAD_COMBINED_SHOPPING_INFO = "https://api.weixin.qq.com/user-order/combine-orders"; + + /** + * 上传合单物流信息 + */ + String UPLOAD_COMBINED_SHIPPING_INFO = "https://api.weixin.qq.com/user-order/combine-orders/shippings"; + + /** + * 开通购物订单产品权限 + */ + String OPEN_SHOPPING_ORDER_PRODUCT_PERMISSION = "https://api.weixin.qq.com/user-order/orders-permission/open"; + + /** + * 提交购物订单接入审核 + */ + String CONFIRM_PRODUCT_PERMISSION = "https://api.weixin.qq.com/user-order/orders-permission/confirm"; + + /** + * 验证购物订单上传结果 + */ + String SHOPPING_INFO_VERIFY_UPLOAD_RESULT = "https://api.weixin.qq.com/user-order/shoppinginfo/verify"; + + + /** + * 上传购物详情 + * + * @param info 购物详情 + * @return WxOpenResult + * @throws WxErrorException + */ + WxOpenResult upload(ShoppingInfo info) throws WxErrorException; + + /** + * 上传物流信息 + * + * @param info 物流信息 + * @return WxOpenResult + * @throws WxErrorException + */ + WxOpenResult upload(ShippingInfo info) throws WxErrorException; + + /** + * 上传合单购物详情 + * + * @param info 购物详情 + * @return WxOpenResult + * @throws WxErrorException + */ + WxOpenResult upload(CombinedShoppingInfo info) throws WxErrorException; + + /** + * 上传合单物流信息 + * + * @param info 物流信息 + * @return WxOpenResult + * @throws WxErrorException + */ + WxOpenResult upload(CombinedShippingInfo info) throws WxErrorException; + + /** + * 开通购物订单产品权限 + * + * @return WxOpenResult + * @throws WxErrorException + */ + WxOpenResult openShoppingOrderProductPermission() throws WxErrorException; + + /** + * 提交购物订单接入审核 + * + * @return WxOpenShoppingOrdersConfirmResult + * @throws WxErrorException + */ + WxOpenShoppingOrdersConfirmResult confirmProductPermission() throws WxErrorException; + + /** + * 验证购物订单上传结果 + * + * @param info 信息 + * @return WxOpenResult + * @throws WxErrorException + */ + WxOpenShoppingInfoVerifyUploadResult verifyUploadResult(ShoppingInfoVerifyUpload info) throws WxErrorException; + +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java index 91a525bb6..84be75169 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java @@ -21,6 +21,7 @@ import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.open.api.*; import me.chanjar.weixin.open.bean.*; import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizationInfo; +import me.chanjar.weixin.open.bean.ma.WxOpenMaApplyOrderPathInfo; import me.chanjar.weixin.open.bean.message.WxOpenXmlMessage; import me.chanjar.weixin.open.bean.minishop.*; import me.chanjar.weixin.open.bean.minishop.coupon.WxMinishopCoupon; @@ -1237,7 +1238,7 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService { public GetShareCloudBaseEnvResponse getShareCloudBaseEnv(List appids) throws WxErrorException { JsonObject jsonObject = new JsonObject(); JsonArray jsonArray = new JsonArray(); - for(String appId : appids) { + for (String appId : appids) { jsonArray.add(appId); } jsonObject.add("appids", jsonArray); @@ -1275,4 +1276,19 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService { String response = getWxOpenService().post(COMPONENT_CLEAR_QUOTA_URL, jsonObject.toString()); return WxOpenResult.fromJson(response); } + + /** + * 申请设置订单页path信息 + * 注意:一次提交不超过100个appid + * + * @param info 订单页path信息 + * @return . + * @throws WxErrorException . + */ + @Override + public WxOpenResult applySetOrderPathInfo(WxOpenMaApplyOrderPathInfo info) throws WxErrorException { + Gson gson = new Gson(); + String response = post(OPEN_APPLY_SET_ORDER_PATH_INFO, gson.toJson(info)); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImpl.java index f5f2160d2..911488ffa 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImpl.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImpl.java @@ -8,6 +8,7 @@ import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.open.api.WxOpenComponentService; import me.chanjar.weixin.open.api.WxOpenFastMaService; import me.chanjar.weixin.open.bean.ma.WxFastMaCategory; +import me.chanjar.weixin.open.bean.ma.WxOpenMaApplyOrderPathInfo; import me.chanjar.weixin.open.bean.result.*; import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; @@ -141,6 +142,18 @@ public class WxOpenFastMaServiceImpl extends WxMaServiceImpl implements WxOpenFa return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); } + /** + * 获取订单页Path信息 + * + * @param infoType 0:线上版,1:审核版 + * @return 订单页Path信息 + * @throws WxErrorException . + */ + @Override + public WxOpenMaGetOrderPathResult getOrderPathInfo(int infoType) throws WxErrorException { + throw new UnsupportedOperationException(); + } + private JsonArray toJsonArray(List strList) { JsonArray jsonArray = new JsonArray(); if (strList != null && !strList.isEmpty()) { diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaBasicServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaBasicServiceImpl.java index 4e4db7525..943d61011 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaBasicServiceImpl.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaBasicServiceImpl.java @@ -6,6 +6,7 @@ import com.google.gson.JsonObject; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.open.api.WxOpenMaBasicService; import me.chanjar.weixin.open.bean.ma.WxFastMaCategory; +import me.chanjar.weixin.open.bean.ma.WxOpenMaApplyOrderPathInfo; import me.chanjar.weixin.open.bean.result.*; import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; @@ -123,6 +124,21 @@ public class WxOpenMaBasicServiceImpl implements WxOpenMaBasicService { return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); } + /** + * 获取订单页Path信息 + * + * @param infoType 0:线上版,1:审核版 + * @return 订单页Path信息 + * @throws WxErrorException . + */ + @Override + public WxOpenMaGetOrderPathResult getOrderPathInfo(int infoType) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("info_type", infoType); + String response = wxMaService.post(OPEN_GET_ORDER_PATH_INFO, params); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenMaGetOrderPathResult.class); + } + private JsonArray toJsonArray(List strList) { JsonArray jsonArray = new JsonArray(); if (strList != null && !strList.isEmpty()) { diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java index 5c5e6f65e..886fbe127 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java @@ -13,10 +13,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import lombok.Getter; import me.chanjar.weixin.common.error.WxErrorException; -import me.chanjar.weixin.open.api.WxOpenComponentService; -import me.chanjar.weixin.open.api.WxOpenMaBasicService; -import me.chanjar.weixin.open.api.WxOpenMaPrivacyService; -import me.chanjar.weixin.open.api.WxOpenMaService; +import me.chanjar.weixin.open.api.*; import me.chanjar.weixin.open.bean.ma.WxMaPrefetchDomain; import me.chanjar.weixin.open.bean.ma.WxMaQrcodeParam; import me.chanjar.weixin.open.bean.ma.WxMaScheme; @@ -46,6 +43,8 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ private final WxOpenMaBasicService basicService; @Getter private final WxOpenMaPrivacyService privacyService; + @Getter + private final WxOpenMaShoppingOrdersService shoppingOrdersService; public WxOpenMaServiceImpl(WxOpenComponentService wxOpenComponentService, String appId, WxMaConfig wxMaConfig) { this.wxOpenComponentService = wxOpenComponentService; @@ -53,6 +52,7 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ this.wxMaConfig = wxMaConfig; this.basicService = new WxOpenMaBasicServiceImpl(this); this.privacyService = new WxOpenMaPrivacyServiceImpl(this); + this.shoppingOrdersService = new WxOpenMaShoppingOrdersServiceImpl(this); initHttp(); } @@ -450,8 +450,8 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ @Override public WxOpenMaApplyLiveInfoResult applyLiveInfo() throws WxErrorException { JsonObject params = new JsonObject(); - params.addProperty("action","apply"); + params.addProperty("action", "apply"); String response = post(API_WX_APPLY_LIVE_INFO, GSON.toJson(params)); - return WxMaGsonBuilder.create().fromJson(response,WxOpenMaApplyLiveInfoResult.class); + return WxMaGsonBuilder.create().fromJson(response, WxOpenMaApplyLiveInfoResult.class); } } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaShoppingOrdersServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaShoppingOrdersServiceImpl.java new file mode 100644 index 000000000..040a8d638 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaShoppingOrdersServiceImpl.java @@ -0,0 +1,107 @@ +package me.chanjar.weixin.open.api.impl; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.open.api.WxOpenMaShoppingOrdersService; +import me.chanjar.weixin.open.bean.result.WxOpenResult; +import me.chanjar.weixin.open.bean.shoppingOrders.*; +import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; + +@Slf4j +@AllArgsConstructor +public class WxOpenMaShoppingOrdersServiceImpl implements WxOpenMaShoppingOrdersService { + + private final WxMaService wxMaService; + + /** + * 上传购物详情 + * + * @param info 购物详情 + * @return WxOpenResult + * @throws WxErrorException + */ + @Override + public WxOpenResult upload(ShoppingInfo info) throws WxErrorException { + String response = wxMaService.post(UPLOAD_SHOPPING_INFO, WxOpenGsonBuilder.create().toJson(info)); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + /** + * 上传物流信息 + * + * @param info 物流信息 + * @return WxOpenResult + * @throws WxErrorException + */ + @Override + public WxOpenResult upload(ShippingInfo info) throws WxErrorException { + String response = wxMaService.post(UPLOAD_SHIPPING_INFO, WxOpenGsonBuilder.create().toJson(info)); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + /** + * 上传合单购物详情 + * + * @param info 购物详情 + * @return WxOpenResult + * @throws WxErrorException + */ + @Override + public WxOpenResult upload(CombinedShoppingInfo info) throws WxErrorException { + String response = wxMaService.post(UPLOAD_COMBINED_SHOPPING_INFO, WxOpenGsonBuilder.create().toJson(info)); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + /** + * 上传合单物流信息 + * + * @param info 物流信息 + * @return WxOpenResult + * @throws WxErrorException + */ + @Override + public WxOpenResult upload(CombinedShippingInfo info) throws WxErrorException { + String response = wxMaService.post(UPLOAD_COMBINED_SHIPPING_INFO, WxOpenGsonBuilder.create().toJson(info)); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + /** + * 开通购物订单产品权限 + * + * @return WxOpenResult + * @throws WxErrorException + */ + @Override + public WxOpenResult openShoppingOrderProductPermission() throws WxErrorException { + String response = wxMaService.post(OPEN_SHOPPING_ORDER_PRODUCT_PERMISSION, ""); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + /** + * 提交购物订单接入审核 + * + * @return WxOpenShoppingOrdersConfirmResult + * @throws WxErrorException + */ + @Override + public WxOpenShoppingOrdersConfirmResult confirmProductPermission() throws WxErrorException { + String response = wxMaService.post(CONFIRM_PRODUCT_PERMISSION, ""); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenShoppingOrdersConfirmResult.class); + } + + /** + * 验证购物订单上传结果 + * + * @param info 信息 + * @return WxOpenResult + * @throws WxErrorException + */ + @Override + public WxOpenShoppingInfoVerifyUploadResult verifyUploadResult(ShoppingInfoVerifyUpload info) throws WxErrorException { + String response = wxMaService.post(SHOPPING_INFO_VERIFY_UPLOAD_RESULT, WxOpenGsonBuilder.create().toJson(info)); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenShoppingInfoVerifyUploadResult.class); + } + +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/ma/WxOpenMaApplyOrderPathInfo.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/ma/WxOpenMaApplyOrderPathInfo.java new file mode 100644 index 000000000..a25bf038c --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/ma/WxOpenMaApplyOrderPathInfo.java @@ -0,0 +1,74 @@ +package me.chanjar.weixin.open.bean.ma; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author xzh + * @Description 申请设置订单页path信息 接口的相关信息 + * @createTime 2023/05/23 15:19 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxOpenMaApplyOrderPathInfo implements Serializable { + + private static final long serialVersionUID = -1812688861780119219L; + /** + * 批量申请的信息 + */ + @SerializedName("batch_req") + private BatchReqBean batchReq; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class BatchReqBean implements Serializable { + + private static final long serialVersionUID = 1816976472441827961L; + /** + * 申请提交的订单页path + */ + @SerializedName("path") + private String path; + /** + * 申请提交的图片url,审核版会显示 + */ + @SerializedName("img_list") + private List imgList; + /** + * 申请提交的视频url,审核版会显示 + */ + @SerializedName("video") + private String video; + /** + * 申请提交的测试账号,审核版会显示 + */ + @SerializedName("test_account") + private String testAccount; + /** + * 申请提交的测试密码,审核版会显示 + */ + @SerializedName("test_pwd") + private String testPwd; + /** + * 申请提交的测试备注,审核版会显示 + */ + @SerializedName("test_remark") + private String testRemark; + /** + * 申请提交的批量的appid + * NOTE: 一次提交不超过100个appid + */ + @SerializedName("appid_list") + private List appIdList; + } +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaGetOrderPathResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaGetOrderPathResult.java new file mode 100644 index 000000000..d1346e577 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaGetOrderPathResult.java @@ -0,0 +1,75 @@ +package me.chanjar.weixin.open.bean.result; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +/** + * @author xzh + * @Description 获取订单页path信息接口返回结果 + * @createTime 2023/05/23 15:07 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class WxOpenMaGetOrderPathResult extends WxOpenResult { + + private static final long serialVersionUID = 1988636135032104851L; + + /** + * 订单页path信息 + */ + @SerializedName("msg") + private MsgBean msg; + + @Data + public static class MsgBean implements Serializable { + private static final long serialVersionUID = 2153432209800394925L; + + /** + * 订单页path + */ + @SerializedName("path") + private String path; + /** + * 申请提交的图片url,审核版会显示 + */ + @SerializedName("img_list") + private List imgList; + /** + * 申请提交的视频url,审核版会显示 + */ + @SerializedName("video") + private String video; + /** + * 申请提交的测试账号,审核版会显示 + */ + @SerializedName("test_account") + private String testAccount; + /** + * 申请提交的测试密码,审核版会显示 + */ + @SerializedName("test_pwd") + private String testPwd; + /** + * 申请提交的测试备注,审核版会显示 + */ + @SerializedName("test_remark") + private String testRemark; + /** + * 申请状态说明 + * 2 审核中 + * 3 审核失败 + * 4 审核通过 + */ + @SerializedName("status") + private int status; + /** + * 申请时间 + */ + @SerializedName("apply_time") + private long applyTime; + } +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/CombinedShippingInfo.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/CombinedShippingInfo.java new file mode 100644 index 000000000..45abbf32e --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/CombinedShippingInfo.java @@ -0,0 +1,77 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CombinedShippingInfo implements Serializable { + private static final long serialVersionUID = -2338140924295957062L; + /** + * 必填 + * 合单订单,需要上传物流详情的合单订单,根据订单类型二选一 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + /** + * 子单物流详情 + */ + @SerializedName("sub_orders") + private List subOrders; + + /** + * 必填 + * 支付者,支付者信息 + */ + @SerializedName("payer") + private PayerBean payer; + + + /** + * 必填 + * 上传时间,用于标识请求的先后顺序 示例值: `2022-12-15T13:29:35.120+08:00 + */ + @SerializedName("upload_time") + private String uploadTime; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class SubOrderListBean implements Serializable { + private static final long serialVersionUID = -8792281478692710237L; + + /** + * 必填 + * 订单,需要上传购物详情的订单,根据订单类型二选一 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + + /** + * 必填 + * 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) + * 示例值: UNIFIED_DELIVERY + */ + @SerializedName("delivery_mode") + private int deliveryMode; + + /** + * 必填 + * 物流信息列表,发货物流单列表,支持统一发货(单个物流单)和分拆发货(多个物流单)两种模式,多重性: [1, 10] + */ + @SerializedName("shipping_list") + private List shippingList; + + } +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/CombinedShoppingInfo.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/CombinedShoppingInfo.java new file mode 100644 index 000000000..fa51d28f3 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/CombinedShoppingInfo.java @@ -0,0 +1,88 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CombinedShoppingInfo implements Serializable { + private static final long serialVersionUID = 8325009858985444023L; + /** + * 必填 + * 合单订单,需要上传购物详情的合单订单,根据订单类型二选一 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + /** + * 子单购物详情 + */ + @SerializedName("sub_orders") + private List subOrders; + + /** + * 必填 + * 支付者,支付者信息 + */ + @SerializedName("payer") + private PayerBean payer; + + + /** + * 必填 + * 上传时间,用于标识请求的先后顺序 示例值: `2022-12-15T13:29:35.120+08:00 + */ + @SerializedName("upload_time") + private String uploadTime; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class SubOrderListBean implements Serializable { + private static final long serialVersionUID = -8792281478692710237L; + + /** + * 必填 + * 订单,需要上传购物详情的订单,根据订单类型二选一 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + /** + * 必填 + * 商户交易订单编号,商户侧的交易订单详情页向用户展示的订单编号 + * 示例值: 232457563423 字符字节限制: [1, 64] + */ + @SerializedName("merchant_order_no") + private String merchantOrderNo; + + /** + * 必填 + * 商户交易订单详情页链接,用户查看“商城订单”时,跳转至商户侧查看交易订单详情页的链接。详情页类别可以为H5或小程序 + */ + @SerializedName("order_detail_jump_link") + private ShoppingInfo.OrderDetailBean orderDetailJumpLink; + + /** + * 订单购买的商品列表,用户在订单中购买的全部商品明细的列表,最多可以上传50个商品 + * 多重性: [1, 50] + */ + @SerializedName("item_list") + private List itemList; + /** + * 物流形式,订单商品配送的物流形式,默认为实体物流 + * 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 + */ + @SerializedName("logistics_type") + private int logisticsType; + } +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ContactBean.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ContactBean.java new file mode 100644 index 000000000..f083a1c40 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ContactBean.java @@ -0,0 +1,27 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ContactBean implements Serializable { + private static final long serialVersionUID = 2256209964320569284L; + /** + * 寄件人联系方式,寄件人联系方式,采用掩码传输,最后4位数字不能打掩码 示例值: `189****1234, 021-****1234, ****1234, 0**2-***1234, 0**2-******23-10, ****123-8008` 值限制: 0 ≤ value ≤ 1024 + */ + @SerializedName("consignor_contact") + private String consignorContact; + /** + * 收件人联系方式,收件人联系方式为,采用掩码传输,最后4位数字不能打掩码 示例值: `189****1234, 021-****1234, ****1234, 0**2-***1234, 0**2-******23-10, ****123-8008` 值限制: 0 ≤ value ≤ 1024 + */ + @SerializedName("receiver_contact") + private String receiverContact; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/OrderKeyBean.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/OrderKeyBean.java new file mode 100644 index 000000000..6b9cd1000 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/OrderKeyBean.java @@ -0,0 +1,39 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class OrderKeyBean implements Serializable { + + private static final long serialVersionUID = 1486092394664728388L; + /** + * 必填 + * 订单单号类型,用于确认需要上传详情的订单。枚举值1,使用下单商户号和商户侧单号;枚举值2,使用微信支付单号。 + */ + @SerializedName("order_number_type") + private int orderNumberType; + /** + * 原支付交易对应的微信订单号 + */ + @SerializedName("transaction_id") + private String transactionId; + /** + * 支付下单商户的商户号,由微信支付生成并下发。 + */ + @SerializedName("mchid") + private String mchId; + /** + * 商户系统内部订单号,只能是数字、大小写字母`_-*`且在同一个商户号下唯一 + */ + @SerializedName("out_trade_no") + private String outTradeNo; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/PayerBean.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/PayerBean.java new file mode 100644 index 000000000..ffd5713cb --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/PayerBean.java @@ -0,0 +1,23 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PayerBean implements Serializable { + private static final long serialVersionUID = -7943088204264205895L; + /** + * 必填 + * 用户标识,用户在小程序appid下的唯一标识。 下单前需获取到用户的Openid 示例值: oUpF8uMuAJO_M2pxb1Q9zNjWeS6o 字符字节限制: [1, 128] + */ + @SerializedName("openid") + private String openid; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShippingInfo.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShippingInfo.java new file mode 100644 index 000000000..c548cb2ec --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShippingInfo.java @@ -0,0 +1,48 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ShippingInfo implements Serializable { + + private static final long serialVersionUID = 2105037984591600658L; + /** + * 必填 + * 订单,需要上传物流信息的订单 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + + /** + * 必填 + * 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) + * 示例值: UNIFIED_DELIVERY + */ + @SerializedName("delivery_mode") + private int deliveryMode; + + /** + * 必填 + * 物流信息列表,发货物流单列表,支持统一发货(单个物流单)和分拆发货(多个物流单)两种模式,多重性: [1, 10] + */ + @SerializedName("shipping_list") + private List shippingList; + + /** + * 必填 + * 上传时间,用于标识请求的先后顺序 示例值: `2022-12-15T13:29:35.120+08:00 + */ + @SerializedName("upload_time") + private String uploadTime; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShippingListBean.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShippingListBean.java new file mode 100644 index 000000000..3111a10ba --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShippingListBean.java @@ -0,0 +1,54 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ShippingListBean implements Serializable { + + private static final long serialVersionUID = -6884739637300493109L; + /** + * 物流单号,物流快递发货时必填,示例值: 323244567777 字符字节限制: [1, 128] + */ + @SerializedName("tracking_no") + private String trackingNo; + /** + * 物流公司编码,快递公司ID,参见「查询物流公司编码列表」,物流快递发货时必填, 示例值: DHL 字符字节限制: [1, 128] + */ + @SerializedName("express_company") + private String expressCompany; + /** + * 物流关联的商品列表,当统一发货(单个物流单)时,该项不填;当分拆发货(多个物流单)时,需填入各物流单关联的商品列表 多重性: [0, 50] + */ + @SerializedName("item_list") + private List itemList; + /** + * 联系方式,当发货的物流公司为顺丰时,联系方式为必填,收件人或寄件人联系方式二选一 + */ + @SerializedName("contact") + private ContactBean contact; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class ShippingItemListBean implements Serializable { + + private static final long serialVersionUID = -1433227869321841858L; + /** + * 商户侧商品ID,商户系统内部商品编码,分拆发货模式下为必填,用于标识每笔物流单号内包含的商品,需与「上传购物详情」中传入的商品ID匹配 + * 示例值: 1246464644 字符字节限制: [1, 64] + */ + @SerializedName("merchant_item_id") + private String merchantItemId; + } +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShoppingInfo.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShoppingInfo.java new file mode 100644 index 000000000..e913b3ba3 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShoppingInfo.java @@ -0,0 +1,166 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ShoppingInfo implements Serializable { + + private static final long serialVersionUID = 2105037984591600658L; + /** + * 必填 + * 订单,需要上传物流信息的订单 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + /** + * 购物详情列表 + */ + @SerializedName("order_list") + private List orderList; + + /** + * 必填 + * 支付者,支付者信息 + */ + @SerializedName("payer") + private PayerBean payer; + + /** + * 物流形式,订单商品配送的物流形式,默认为实体物流 + * 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 + */ + @SerializedName("logistics_type") + private int logisticsType; + + /** + * 必填 + * 上传时间,用于标识请求的先后顺序 示例值: `2022-12-15T13:29:35.120+08:00 + */ + @SerializedName("upload_time") + private String uploadTime; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class OrderListBean implements Serializable { + private static final long serialVersionUID = -7690807867756471672L; + /** + * 必填 + * 商户交易订单编号,商户侧的交易订单详情页向用户展示的订单编号 + * 示例值: 232457563423 字符字节限制: [1, 64] + */ + @SerializedName("merchant_order_no") + private String merchantOrderNo; + + /** + * 必填 + * 商户交易订单详情页链接,用户查看“商城订单”时,跳转至商户侧查看交易订单详情页的链接。详情页类别可以为H5或小程序 + */ + @SerializedName("order_detail_jump_link") + private OrderDetailBean orderDetailJumpLink; + + /** + * 订单购买的商品列表,用户在订单中购买的全部商品明细的列表,最多可以上传50个商品 + * 多重性: [1, 50] + */ + @SerializedName("item_list") + private List itemList; + } + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class OrderDetailBean implements Serializable { + private static final long serialVersionUID = -8002249022516272034L; + /** + * 链接地址(链接类型为H5时必填) + * 示例值: https://www.weixin.qq.com/wxpay/pay.php + * 字符字节限制: [1, 1024] + * 匹配正则表达式: ^https?😕/([^\s/?#[]@]+@)?([^\s/?#@:]+)(?::\d{2,5})?([^[]]*)$ + */ + @SerializedName("url") + private String url; + /** + * 小程序appid(链接类型为MINIAPP时必填) + * 示例值: wxd678efh567hg6787 字符字节限制: [1, 32] + */ + @SerializedName("appid") + private String appId; + /** + * 小程序path(链接类型为MINIAPP时必填) + * 示例值: /path/index/index 字符字节限制: [1, 512] + */ + @SerializedName("path") + private String path; + /** + * 必填 + * 链接类型枚举值:1、URL;2、MINI_PROGRAM + * 示例值: MINI_PROGRAM + */ + @SerializedName("type") + private int type; + } + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class OrderItemListBean implements Serializable { + private static final long serialVersionUID = -2989527770771246748L; + /** + * 商户侧商品ID,商户系统内部商品编码,用于标识不同的商品。请注意,当发货模式选择“分拆发货”时,需要使用商户侧商品ID来标记各物流单中包含的具体商品 + * 示例值: 1246464644 字符字节限制: [1, 64] + */ + @SerializedName("merchant_item_id") + private String merchantItemId; + /** + * 必填 + * 商品名称 + * 示例值: iPhoneX 256G 字符长度限制: [1, 256] + */ + @SerializedName("name") + private String name; + /** + * 商品描述 + * 示例值: Image形象店-深圳腾大-QQ公仔 字符长度限制: [1, 512] + */ + @SerializedName("description") + private String description; + /** + * 必填 + * 商品单价(单位:分) + */ + @SerializedName("unit_price") + private long unitPrice; + /** + * 必填 + * 购买数量 + * 示例值: 2 + */ + @SerializedName("quantity") + private long quantity; + /** + * 商品图片链接 + * 示例值: https://qpic.cn/xxx + * 多重性: [1, 3] + * 字符字节限制: [1, 1024] + * 匹配正则表达式: ^https?😕/([^\s/?#[]@]+@)?([^\s/?#@:]+)(?::\d{2,5})?([^[]]*)$ + */ + @SerializedName("image_url") + private List imageUrl; + } + +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShoppingInfoVerifyUpload.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShoppingInfoVerifyUpload.java new file mode 100644 index 000000000..30b778f6f --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/ShoppingInfoVerifyUpload.java @@ -0,0 +1,32 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ShoppingInfoVerifyUpload implements Serializable { + + private static final long serialVersionUID = 4295431037060277496L; + /** + * 必填 + * 订单,需要上传购物详情的订单,根据订单类型二选一 + */ + @SerializedName("order_key") + private OrderKeyBean orderKey; + + /** + * 必填 + * 支付者,支付者信息 + */ + @SerializedName("payer") + private PayerBean payer; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/WxOpenShoppingInfoVerifyUploadResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/WxOpenShoppingInfoVerifyUploadResult.java new file mode 100644 index 000000000..8e602ed9b --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/WxOpenShoppingInfoVerifyUploadResult.java @@ -0,0 +1,18 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import me.chanjar.weixin.open.bean.result.WxOpenResult; + +@Data +@EqualsAndHashCode(callSuper = true) +public class WxOpenShoppingInfoVerifyUploadResult extends WxOpenResult { + + private static final long serialVersionUID = -3223834939130803964L; + /** + * 验证结果 + */ + @SerializedName("verify_result") + private String verifyResult; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/WxOpenShoppingOrdersConfirmResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/WxOpenShoppingOrdersConfirmResult.java new file mode 100644 index 000000000..6b1d37973 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/shoppingOrders/WxOpenShoppingOrdersConfirmResult.java @@ -0,0 +1,17 @@ +package me.chanjar.weixin.open.bean.shoppingOrders; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import me.chanjar.weixin.open.bean.result.WxOpenResult; + +@Data +@EqualsAndHashCode(callSuper = true) +public class WxOpenShoppingOrdersConfirmResult extends WxOpenResult { + private static final long serialVersionUID = 8534868743462740891L; + /** + * 最近一次审核的结果 + */ + @SerializedName("last_result") + private String lastResult; +}