🆕 #2059 【小程序】增加小程序交易组件部分接口

This commit is contained in:
Boris
2021-03-30 13:46:24 +08:00
committed by GitHub
parent d9de6f1169
commit 4730b334b6
39 changed files with 1877 additions and 0 deletions

View File

@ -377,4 +377,29 @@ public interface WxMaService extends WxService {
*/
WxImgProcService getImgProcService();
// /**
// * 返回小程序交易组件-售后服务接口
// * @return
// */
// WxMaShopAfterSaleService getShopAfterSaleService();
//
//
// /**
// * 返回小程序交易组件-物流服务接口
// * @return
// */
// WxMaShopDeliveryService getShopDeliveryService();
/**
* 返回小程序交易组件-订单服务接口
* @return
*/
WxMaShopOrderService getShopOrderService();
/**
* 返回小程序交易组件-spu商品服务接口
* @return
*/
WxMaShopSpuService getShopSpuService();
}

View File

@ -0,0 +1,10 @@
package cn.binarywang.wx.miniapp.api;
/**
* 小程序交易组件-售后服务
*
* @author boris
*/
public interface WxMaShopAfterSaleService {
}

View File

@ -0,0 +1,10 @@
package cn.binarywang.wx.miniapp.api;
/**
* 小程序交易组件-物流发货服务
*
* @author boris
*/
public interface WxMaShopDeliveryService {
}

View File

@ -0,0 +1,24 @@
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopOrderInfo;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopOrderPayRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAddOrderResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetOrderResponse;
import me.chanjar.weixin.common.error.WxErrorException;
/**
* 小程序交易组件-订单服务
*
* @author boris
*/
public interface WxMaShopOrderService {
Boolean checkScene(Integer scene) throws WxErrorException;
WxMaShopAddOrderResponse addOrder(WxMaShopOrderInfo orderInfo) throws WxErrorException;
WxMaShopBaseResponse orderPay(WxMaShopOrderPayRequest request) throws WxErrorException;
WxMaShopGetOrderResponse getOrder(Integer orderId, String outOrderId, String openid)
throws WxErrorException;
}

View File

@ -0,0 +1,38 @@
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuInfo;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuWithoutAuditInfo;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAddSpuResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuListResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuResponse;
import me.chanjar.weixin.common.error.WxErrorException;
/**
* 小程序交易组件-商品服务
*
* @author boris
*/
public interface WxMaShopSpuService {
WxMaShopAddSpuResponse addSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException;
WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId) throws WxErrorException;
WxMaShopGetSpuResponse getSpu(Integer productId, String outProductId, Integer needEditSpu)
throws WxErrorException;
WxMaShopGetSpuListResponse getSpuList(WxMaShopSpuPageRequest request)
throws WxErrorException;
WxMaShopAddSpuResponse updateSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException;
WxMaShopAddSpuResponse updateSpuWithoutAudit(WxMaShopSpuWithoutAuditInfo spuInfo)
throws WxErrorException;
WxMaShopBaseResponse listingSpu(Integer productId, String outProductId)
throws WxErrorException;
WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId)
throws WxErrorException;
}

View File

@ -63,6 +63,8 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
private final WxMaLiveMemberService liveMemberService = new WxMaLiveMemberServiceImpl(this);
private final WxOcrService ocrService = new WxMaOcrServiceImpl(this);
private final WxImgProcService imgProcService = new WxMaImgProcServiceImpl(this);
private final WxMaShopSpuService shopSpuService = new WxMaShopSpuServiceImpl(this);
private final WxMaShopOrderService shopOrderService = new WxMaShopOrderServiceImpl(this);
private Map<String, WxMaConfig> configMap;
private int retrySleepMillis = 1000;
private int maxRetryTimes = 5;
@ -499,4 +501,13 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
return this.imgProcService;
}
@Override
public WxMaShopSpuService getShopSpuService() {
return this.shopSpuService;
}
@Override
public WxMaShopOrderService getShopOrderService() {
return this.shopOrderService;
}
}

View File

@ -0,0 +1,19 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.WxMaShopAfterSaleService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* @author boris
*/
@RequiredArgsConstructor
@Slf4j
public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
private final WxMaService service;
}

View File

@ -0,0 +1,16 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.WxMaShopDeliveryService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* @author boris
*/
@RequiredArgsConstructor
@Slf4j
public class WxMaShopDeliveryServiceImpl implements WxMaShopDeliveryService {
private final WxMaService service;
}

View File

@ -0,0 +1,78 @@
package cn.binarywang.wx.miniapp.api.impl;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Order.ORDER_ADD;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Order.ORDER_CHECK_SCENE;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Order.ORDER_GET;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Order.ORDER_PAY;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.WxMaShopOrderService;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopOrderInfo;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopOrderPayRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAddOrderResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetOrderResponse;
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.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;
/**
* @author boris
*/
@RequiredArgsConstructor
@Slf4j
public class WxMaShopOrderServiceImpl implements WxMaShopOrderService {
private static final String ERR_CODE = "errcode";
private static final String MATCH_KEY = "is_matched";
private final WxMaService wxMaService;
@Override
public Boolean checkScene(Integer scene) throws WxErrorException {
String responseContent = this.wxMaService
.post(ORDER_CHECK_SCENE, GsonHelper.buildJsonObject("scene", scene));
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return jsonObject.get(MATCH_KEY).getAsBoolean();
}
@Override
public WxMaShopAddOrderResponse addOrder(WxMaShopOrderInfo orderInfo) throws WxErrorException {
String responseContent = this.wxMaService.post(ORDER_ADD, orderInfo);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAddOrderResponse.class);
}
@Override
public WxMaShopBaseResponse orderPay(WxMaShopOrderPayRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(ORDER_PAY, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
}
@Override
public WxMaShopGetOrderResponse getOrder(Integer orderId, String outOrderId, String openid)
throws WxErrorException {
String responseContent = this.wxMaService.post(ORDER_GET,
GsonHelper.buildJsonObject("order_id", orderId, "out_order_id", outOrderId,
"openid", openid));
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopGetOrderResponse.class);
}
}

View File

@ -0,0 +1,134 @@
package cn.binarywang.wx.miniapp.api.impl;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_ADD_URL;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_DELISTING_URL;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_DEL_URL;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_GET_LIST_URL;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_GET_URL;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_LISTING_URL;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_UPDATE_URL;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_UPDATE_WITHOUT_URL;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.WxMaShopSpuService;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuInfo;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuWithoutAuditInfo;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAddSpuResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuListResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuResponse;
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.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;
/**
* @author boris
*/
@RequiredArgsConstructor
@Slf4j
public class WxMaShopSpuServiceImpl implements WxMaShopSpuService {
private static final String ERR_CODE = "errcode";
private final WxMaService wxMaService;
@Override
public WxMaShopAddSpuResponse addSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException {
String responseContent = this.wxMaService.post(SPU_ADD_URL, spuInfo);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAddSpuResponse.class);
}
@Override
public WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId)
throws WxErrorException {
String responseContent = this.wxMaService
.post(SPU_DEL_URL, GsonHelper.buildJsonObject("product_id", productId,
"out_product_id", outProductId));
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
}
@Override
public WxMaShopGetSpuResponse getSpu(Integer productId, String outProductId, Integer needEditSpu)
throws WxErrorException {
String responseContent = this.wxMaService
.post(SPU_GET_URL, GsonHelper.buildJsonObject("product_id", productId,
"out_product_id", outProductId, "need_edit_spu", needEditSpu));
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopGetSpuResponse.class);
}
@Override
public WxMaShopGetSpuListResponse getSpuList(WxMaShopSpuPageRequest request)
throws WxErrorException {
String responseContent = this.wxMaService.post(SPU_GET_LIST_URL, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopGetSpuListResponse.class);
}
@Override
public WxMaShopAddSpuResponse updateSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException {
String responseContent = this.wxMaService.post(SPU_UPDATE_URL, spuInfo);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAddSpuResponse.class);
}
@Override
public WxMaShopAddSpuResponse updateSpuWithoutAudit(WxMaShopSpuWithoutAuditInfo spuInfo)
throws WxErrorException {
String responseContent = this.wxMaService.post(SPU_UPDATE_WITHOUT_URL, spuInfo);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAddSpuResponse.class);
}
@Override
public WxMaShopBaseResponse listingSpu(Integer productId, String outProductId)
throws WxErrorException {
String responseContent = this.wxMaService
.post(SPU_LISTING_URL, GsonHelper.buildJsonObject("product_id", productId,
"out_product_id", outProductId));
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
}
@Override
public WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId)
throws WxErrorException {
String responseContent = this.wxMaService
.post(SPU_DELISTING_URL, GsonHelper.buildJsonObject("product_id", productId,
"out_product_id", outProductId));
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
}
}

View File

@ -0,0 +1,41 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopAddOrderResult implements Serializable {
/**
* 交易组件平台订单ID
*/
@SerializedName("order_id")
private Long orderId;
/**
* 交易组件平台订单ID
*/
@SerializedName("out_order_id")
private String outOrderId;
/**
* 拉起收银台的ticket
*/
@SerializedName("ticket")
private String ticket;
/**
* ticket有效截止时间
*/
@SerializedName("ticket_expire_time")
private String ticketExpireTime;
/**
* 订单最终价格(单位:分)
*/
@SerializedName("final_price")
private Integer finalPrice;
}

View File

@ -0,0 +1,60 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description: 添加商品参数返回
*/
@Data
public class WxMaShopAddSpuResult implements Serializable {
private static final long serialVersionUID = 2520459849240776617L;
/**
* 交易组件平台内部商品ID
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("product_id")
private String productId;
/**
* 商家自定义商品ID
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("out_product_id")
private String outProductId;
/**
* 创建时间,新建时返回
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("create_time")
private String createTime;
/**
* 更新时间,修改时返回
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("update_time")
private String updateTime;
/**
* sku数组
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("skus")
private List<WxMaShopSkuResult> skus;
}

View File

@ -0,0 +1,70 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopAddressInfo implements Serializable {
/**
* 收件人姓名
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("receiver_name")
private String receiverName;
/**
* 详细收货地址信息
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("detailed_address")
private String detailedAddress;
/**
* 收件人手机号码
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("tel_number")
private String telNumber;
/**
* 国家
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("country")
private String country;
/**
* 省份
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("province")
private String province;
/**
* 城市
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("city")
private String city;
/**
* 乡镇
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("town")
private String town;
}

View File

@ -0,0 +1,41 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopDeliveryDetail implements Serializable {
private static final long serialVersionUID = 9074573142867543744L;
/**
*
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("delivery_type")
private Integer deliveryType;
// 以下字段仅作为返回数据展示填充
/**
* 是否发货完成
*/
@SerializedName("finish_all_delivery")
private Integer finishAllDelivery;
/**
* 快递信息
*/
@SerializedName("delivery_list")
private List<WxMaShopDeliveryItem> deliveryList;
}

View File

@ -0,0 +1,28 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopDeliveryItem implements Serializable {
private static final long serialVersionUID = -161617470937369136L;
/**
* 快递公司ID通过获取快递公司列表获取
*/
@SerializedName("delivery_id")
private String deliveryId;
/**
* 快递单号
*/
@SerializedName("waybill_id")
private String waybillId;
}

View File

@ -0,0 +1,59 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopGetSpuResult extends WxMaShopSpuInfo implements Serializable {
private static final long serialVersionUID = -3859372286926181933L;
/**
* 商品审核信息
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("audit_info")
private WxMaShopSpuAudit auditInfo;
/**
* 商品线上状态
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("status")
private Integer status;
/**
* 商品草稿状态
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("edit_status")
private Integer editStatus;
/**
* 创建时间
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("create_time")
private String createTime;
/**
* 更新时间
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("update_time")
private String updateTime;
}

View File

@ -0,0 +1,55 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopOrderDetail implements Serializable {
/**
* 下单商品信息
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("product_infos")
private List<WxMaShopProductInfo> productInfos;
/**
* 支付信息 (当作为返回结果payorder时action_type!=6时存在)
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("pay_info")
private WxMaShopPayInfo payInfo;
/**
* 价格信息
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("price_info")
private WxMaShopPriceInfo priceInfo;
// 以下字段仅作为结果返回展示字段
/**
* payorder时action_type=6时存在
*/
@SerializedName("multi_pay_info")
private List<WxMaShopPayInfo> multiPayInfo;
/**
* 必须调过发货接口才会存在这个字段
*/
@SerializedName("delivery_detail")
private WxMaShopDeliveryDetail deliveryDetail;
}

View File

@ -0,0 +1,84 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
@Data
public class WxMaShopOrderInfo implements Serializable {
private static final long serialVersionUID = -159624260640727372L;
/**
* 创建时间
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("create_time")
private String createTime;
/**
* 商家自定义订单ID
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("out_order_id")
private String outOrderId;
/**
* 用户的openid
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("openid")
private String openid;
/**
* 商家小程序该订单的页面path用于微信侧订单中心跳转
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("path")
private String path;
/**
* 商家小程序该订单的用户id
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("out_user_id")
private String outUserId;
/**
* 订单详情
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("order_detail")
private WxMaShopOrderDetail orderDetail;
/**
* 快递信息
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("delivery_detail")
private WxMaShopDeliveryDetail deliveryDetail;
/**
* 地址信息
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("address_info")
private WxMaShopAddressInfo addressInfo;
}

View File

@ -0,0 +1,52 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopOrderResult implements Serializable {
private static final long serialVersionUID = -2665426592693969921L;
/**
* 交易组件平台订单ID
*/
@SerializedName("order_id")
private Long orderId;
/**
* 商家自定义订单ID
*/
@SerializedName("out_order_id")
private String outOrderId;
/**
* 订单状态
*/
@SerializedName("status")
private Integer status;
/**
* 商家小程序该订单的页面path用于微信侧订单中心跳转
*/
@SerializedName("path")
private String path;
/**
* 商家小程序该订单的用户id
*/
@SerializedName("out_user_id")
private String outUserId;
/**
* 订单详情
*/
@SerializedName("order_detail")
private WxMaShopOrderDetail orderDetail;
}

View File

@ -0,0 +1,62 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopPayInfo implements Serializable {
private static final long serialVersionUID = 687488209024968647L;
/**
* 支付方式(目前只有"微信支付"
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("pay_method")
private String payMethod;
/**
* 预支付ID
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("prepay_id")
private String prepayId;
/**
* 预付款时间拿到prepay_id的时间
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("prepay_time")
private String prepayTime;
// 以下字段仅作为返回数据
/**
* 支付ID调过同步订单支付结果且action_type=1时才存在
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("transaction_id")
private String transactionId;
/**
* 付款时间拿到transaction_id的时间
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("pay_time")
private String payTime;
}

View File

@ -0,0 +1,56 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopPriceInfo implements Serializable {
private static final long serialVersionUID = 1588840927992523263L;
/**
* 该订单最终的金额(单位:分)
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("order_price")
private Integer orderPrice;
/**
* 运费(单位:分)
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("freight")
private Integer freight;
/**
* 优惠金额(单位:分)
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("discounted_price")
private Integer discountedPrice;
/**
* 附加金额(单位:分)
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("additional_price")
private Integer additionalPrice;
/**
* 附加金额备注
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("additional_remarks")
private String additionalRemarks;
}

View File

@ -0,0 +1,83 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopProductInfo {
/**
* 商家自定义商品ID
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("out_product_id")
private String outProductId;
/**
* 商家自定义商品skuID可填空字符串如果这个product_id下没有sku
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("out_sku_id")
private String outSkuId;
/**
* 购买的数量
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("product_cnt")
private Integer productCnt;
/**
* 生成订单时商品的售卖价(单位:分),可以跟上传商品接口的价格不一致
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("sale_price")
private Integer salePrice;
/**
* 生成订单时商品的头图
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("head_img")
private String headImg;
/**
* 生成订单时商品的标题
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("title")
private String title;
/**
* 绑定的小程序商品路径
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("path")
private String path;
// 以下字段仅作为订单信息返回字段
/**
* 交易组件平台内部商品ID
*/
@SerializedName("product_id")
private Integer productId;
/**
* 交易组件平台内部skuID可填0如果这个product_id下没有sku
*/
@SerializedName("sku_id")
private Integer skuId;
}

View File

@ -0,0 +1,39 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <pre>
* sku对象
* </pre>
*
* @author <a href="https://github.com/borisbao">boris</a>
* @since 2021-03-22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaShopSkuAttribute implements Serializable {
private static final long serialVersionUID = -3617077838017818865L;
/**
* 销售属性key自定义
* <pre>
* 是否必填: 否
* </pre>
*/
@SerializedName("attr_key")
private String attrKey;
@SerializedName("attr_value")
private String attrValue;
}

View File

@ -0,0 +1,111 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <pre>
* sku对象
* </pre>
*
* @author <a href="https://github.com/borisbao">boris</a>
* @since 2021-03-22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaShopSkuInfo implements Serializable {
private static final long serialVersionUID = -3617077838017818865L;
/**
* 商家自定义商品ID
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("out_product_id")
private String outProductId;
/**
* 商家自定义商品ID
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("out_sku_id")
private String outSkuId;
/**
* sku小图
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("thumb_img")
private String thumbImg;
/**
* 售卖价格,以分为单位
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("sale_price")
private Integer salePrice;
/**
* 售卖价格,以分为单位
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("market_price")
private Integer marketPrice;
/**
* 库存
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("stock_num")
private Integer stockNum;
/**
* 条形码
* <pre>
* 是否必填: 否
* </pre>
*/
@SerializedName("barcode")
private String barcode;
/**
* 商品编码
* <pre>
* 是否必填: 否
* </pre>
*/
@SerializedName("sku_code")
private String skuCode;
/**
* 销售属性
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("sku_attrs")
private List<WxMaShopSkuAttribute> skuAttributeList;
}

View File

@ -0,0 +1,33 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopSkuResult implements Serializable {
private static final long serialVersionUID = 7127892618805299305L;
/**
* 交易组件平台自定义skuID
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("sku_id")
private String skuId;
/**
* 商家自定义skuID
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("out_sku_id")
private String outSkuId;
}

View File

@ -0,0 +1,72 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopSkuWithoutAuditInfo implements Serializable {
private static final long serialVersionUID = 3354108922805323888L;
/**
* 商家自定义skuID
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("out_sku_id")
private String outSkuId;
/**
* 售卖价格,以分为单位
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("sale_price")
private Integer salePrice;
/**
* 售卖价格,以分为单位
* <pre>
* 是否必填: 是
* </pre>
*/
@SerializedName("market_price")
private Integer marketPrice;
/**
* 库存
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("stock_num")
private Integer stockNum;
/**
* 条形码
* <pre>
* 是否必填: 否
* </pre>
*/
@SerializedName("barcode")
private String barcode;
/**
* 商品编码
* <pre>
* 是否必填: 否
* </pre>
*/
@SerializedName("sku_code")
private String skuCode;
}

View File

@ -0,0 +1,33 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopSpuAudit implements Serializable {
private static final long serialVersionUID = -3793445161382782265L;
/**
* 上一次审核时间, yyyy-MM-dd HH:mm:ss
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("audit_time")
private String auditTime;
/**
* 拒绝理由
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("reject_reason")
private String rejectReason;
}

View File

@ -0,0 +1,41 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <pre>
* 交易组件-spu商品详情图文
* </pre>
* @author <a href="https://github.com/borisbao">boris</a>
* @since 2021-03-22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaShopSpuDescInfo {
/**
* 商品详情图文-描述
* <pre>
* 是否必填: 否
* </pre>
*/
@SerializedName("desc")
private String desc;
/**
* 商品详情图片
* <pre>
* 是否必填: 否
* </pre>
*/
@SerializedName("imgs")
private List<String> imgList;
}

View File

@ -0,0 +1,102 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
@Data
public class WxMaShopSpuInfo implements Serializable {
private static final long serialVersionUID = 7237829277693177420L;
/**
* 交易组件平台内部商品ID修改时与out_product_id二选一
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("product_id")
private String productId;
/**
* 商家自定义商品ID新建必填修改时与product_id二选一
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("out_product_id")
private String outProductId;
/**
* 标题
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("title")
private String title;
/**
* 绑定的小程序商品路径
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("path")
private String path;
/**
* 主图,多张,列表
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("head_img")
private List<String> headImg;
/**
* 商品资质图片
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("qualification_pics")
private List<String> qualificationPics;
/**
* 商品详情
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("desc_info")
private WxMaShopSpuDescInfo descInfo;
/**
* 第三级类目ID
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("third_cat_id")
private Integer thirdCatId;
/**
* 品牌id
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("brand_id")
private Integer brandId;
/**
* sku数组
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("skus")
private List<WxMaShopSkuInfo> skus;
}

View File

@ -0,0 +1,50 @@
package cn.binarywang.wx.miniapp.bean.shop;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopSpuWithoutAuditInfo {
/**
* 交易组件平台内部商品ID修改时与out_product_id二选一
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("product_id")
private String productId;
/**
* 商家自定义商品ID新建必填修改时与product_id二选一
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("out_product_id")
private String outProductId;
/**
* 绑定的小程序商品路径
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("path")
private String path;
/**
* sku数组
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("skus")
private List<WxMaShopSkuWithoutAuditInfo> skus;
}

View File

@ -0,0 +1,74 @@
package cn.binarywang.wx.miniapp.bean.shop.request;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopOrderPayRequest implements Serializable {
private static final long serialVersionUID = -954667936670521398L;
/**
* 订单ID
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("order_id")
private Long orderId;
/**
* 商家自定义订单ID与 order_id 二选一
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("out_order_id")
private String outOrderId;
/**
* 用户的openid
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("openid")
private String openid;
/**
* 类型默认1:支付成功,2:支付失败,3:用户取消,4:超时未支付;5:商家取消
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("action_type")
private Integer actionType;
/**
* 其他具体原因
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("action_remark")
private String actionRemark;
/**
* 支付订单号action_type=1时必填
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("transaction_id")
private String transactionId;
/**
* 支付完成时间action_type=1时必填
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("pay_time")
private String payTime;
}

View File

@ -0,0 +1,89 @@
package cn.binarywang.wx.miniapp.bean.shop.request;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description: spu分页参数
*/
@Data
public class WxMaShopSpuPageRequest implements Serializable {
private static final long serialVersionUID = -4927300283039328661L;
/**
* 商品状态
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("status")
private Integer status;
/**
* 开始创建时间
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("start_create_time")
private String startCreateTime;
/**
* 结束创建时间
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("end_create_time")
private String endCreateTime;
/**
* 开始更新时间
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("start_update_time")
private String startUpdateTime;
/**
* 结束更新时间
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("end_update_time")
private String endUpdateTime;
/**
* 默认0:获取线上数据, 1:获取草稿数据
* <pre>
* 是否必填:否
* </pre>
*/
@SerializedName("need_edit_spu")
private Integer needEditSpu;
/**
* 页号
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("page")
private Integer page;
/**
* 页面大小
* <pre>
* 是否必填:是
* </pre>
*/
@SerializedName("page_size")
private Integer pageSize;
}

View File

@ -0,0 +1,20 @@
package cn.binarywang.wx.miniapp.bean.shop.response;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopAddOrderResult;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopAddOrderResponse extends WxMaShopBaseResponse implements Serializable {
private static final long serialVersionUID = -8923439859095040010L;
@SerializedName("data")
private WxMaShopAddOrderResult date;
}

View File

@ -0,0 +1,21 @@
package cn.binarywang.wx.miniapp.bean.shop.response;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopAddSpuResult;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopAddSpuResponse extends WxMaShopBaseResponse implements Serializable {
private static final long serialVersionUID = 4370719678135233135L;
@SerializedName("data")
private WxMaShopAddSpuResult data;
}

View File

@ -0,0 +1,34 @@
package cn.binarywang.wx.miniapp.bean.shop.response;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopBaseResponse implements Serializable {
private static final long serialVersionUID = -4647161641538864187L;
/**
* 错误码
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("errcode")
private Integer errcode;
/**
* 错误信息
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("errmsg")
private String errmsg;
}

View File

@ -0,0 +1,20 @@
package cn.binarywang.wx.miniapp.bean.shop.response;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopOrderResult;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopGetOrderResponse extends WxMaShopBaseResponse implements Serializable {
private static final long serialVersionUID = -5036075669789800464L;
@SerializedName("order")
private WxMaShopOrderResult order;
}

View File

@ -0,0 +1,36 @@
package cn.binarywang.wx.miniapp.bean.shop.response;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopGetSpuResult;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopGetSpuListResponse extends WxMaShopBaseResponse implements Serializable {
private static final long serialVersionUID = 1423766388278762123L;
/**
* 总数
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("total_num")
private Integer totalNum;
/**
* spu信息
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("spus")
private List<WxMaShopGetSpuResult> spus;
}

View File

@ -0,0 +1,26 @@
package cn.binarywang.wx.miniapp.bean.shop.response;
import cn.binarywang.wx.miniapp.bean.shop.WxMaShopGetSpuResult;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import lombok.Data;
/**
* @author leiin
* @date 2021/3/23
* @description:
*/
@Data
public class WxMaShopGetSpuResponse extends WxMaShopBaseResponse implements Serializable {
private static final long serialVersionUID = -3781992184787152637L;
/**
* spu信息
* <pre>
* 是否必填:
* </pre>
*/
@SerializedName("spu")
private WxMaShopGetSpuResult spu;
}

View File

@ -296,4 +296,24 @@ public class WxMaApiUrlConstants {
String COMM = "https://api.weixin.qq.com/cv/ocr/comm?img_url=%s";
String FILE_COMM = "https://api.weixin.qq.com/cv/ocr/comm";
}
public interface Shop {
interface Spu {
String SPU_ADD_URL = "https://api.weixin.qq.com/shop/spu/add";
String SPU_DEL_URL = "https://api.weixin.qq.com/shop/spu/del";
String SPU_GET_URL = "https://api.weixin.qq.com/shop/spu/get";
String SPU_GET_LIST_URL = "https://api.weixin.qq.com/shop/spu/get_list";
String SPU_UPDATE_URL = "https://api.weixin.qq.com/shop/spu/update";
String SPU_UPDATE_WITHOUT_URL = "https://api.weixin.qq.com/shop/spu/update_without_audit";
String SPU_LISTING_URL = "https://api.weixin.qq.com/shop/spu/listing";
String SPU_DELISTING_URL = "https://api.weixin.qq.com/shop/spu/delisting";
}
interface Order {
String ORDER_CHECK_SCENE = "https://api.weixin.qq.com/shop/scene/check";
String ORDER_ADD = "https://api.weixin.qq.com/shop/order/add";
String ORDER_PAY = "https://api.weixin.qq.com/shop/order/pay";
String ORDER_GET = "https://api.weixin.qq.com/shop/order/get";
}
}
}