|
|
@@ -13,6 +13,8 @@ import me.chanjar.weixin.mp.bean.card.*; |
|
|
|
public interface WxMpCardService { |
|
|
|
/** |
|
|
|
* 得到WxMpService. |
|
|
|
* |
|
|
|
* @return WxMpService |
|
|
|
*/ |
|
|
|
WxMpService getWxMpService(); |
|
|
|
|
|
|
@@ -20,6 +22,7 @@ public interface WxMpCardService { |
|
|
|
* 获得卡券api_ticket,不强制刷新卡券api_ticket. |
|
|
|
* |
|
|
|
* @return 卡券api_ticket |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
* @see #getCardApiTicket(boolean) |
|
|
|
*/ |
|
|
|
String getCardApiTicket() throws WxErrorException; |
|
|
@@ -34,7 +37,7 @@ public interface WxMpCardService { |
|
|
|
* |
|
|
|
* @param forceRefresh 强制刷新 |
|
|
|
* @return 卡券api_ticket |
|
|
|
* @throws WxErrorException |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
String getCardApiTicket(boolean forceRefresh) throws WxErrorException; |
|
|
|
|
|
|
@@ -47,18 +50,19 @@ public interface WxMpCardService { |
|
|
|
* .9F.E6.88.90.E7.AE.97.E6.B3.95 |
|
|
|
* </pre> |
|
|
|
* |
|
|
|
* @param optionalSignParam 参与签名的参数数组。 |
|
|
|
* 可以为下列字段:app_id, card_id, card_type, code, openid, location_id |
|
|
|
* @param optionalSignParam 参与签名的参数数组。可以为下列字段:app_id, card_id, card_type, code, openid, location_id |
|
|
|
* </br>注意:当做wx.chooseCard调用时,必须传入app_id参与签名,否则会造成签名失败导致拉取卡券列表为空 |
|
|
|
* @return 卡券Api签名对象 |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
WxCardApiSignature createCardApiSignature(String... optionalSignParam) throws WxErrorException; |
|
|
|
WxCardApiSignature createCardApiSignature(String... optionalSignParam) throws WxErrorException; |
|
|
|
|
|
|
|
/** |
|
|
|
* 卡券Code解码. |
|
|
|
* |
|
|
|
* @param encryptCode 加密Code,通过JSSDK的chooseCard接口获得 |
|
|
|
* @return 解密后的Code |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
String decryptCardCode(String encryptCode) throws WxErrorException; |
|
|
|
|
|
|
@@ -70,16 +74,16 @@ public interface WxMpCardService { |
|
|
|
* @param code 单张卡券的唯一标准 |
|
|
|
* @param checkConsume 是否校验code核销状态,填入true和false时的code异常状态返回数据不同 |
|
|
|
* @return WxMpCardResult对象 |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume) |
|
|
|
throws WxErrorException; |
|
|
|
WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume) throws WxErrorException; |
|
|
|
|
|
|
|
/** |
|
|
|
* 卡券Code核销。核销失败会抛出异常 |
|
|
|
* |
|
|
|
* @param code 单张卡券的唯一标准 |
|
|
|
* @return 调用返回的JSON字符串。 |
|
|
|
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 |
|
|
|
* @return 调用返回的JSON字符串。可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
String consumeCardCode(String code) throws WxErrorException; |
|
|
|
|
|
|
@@ -88,13 +92,13 @@ public interface WxMpCardService { |
|
|
|
* |
|
|
|
* @param code 单张卡券的唯一标准 |
|
|
|
* @param cardId 当自定义Code卡券时需要传入card_id |
|
|
|
* @return 调用返回的JSON字符串。 |
|
|
|
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 |
|
|
|
* @return 调用返回的JSON字符串。可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
String consumeCardCode(String code, String cardId) throws WxErrorException; |
|
|
|
|
|
|
|
/** |
|
|
|
* 卡券Mark接口。 |
|
|
|
* 卡券Mark接口. |
|
|
|
* 开发者在帮助消费者核销卡券之前,必须帮助先将此code(卡券串码)与一个openid绑定(即mark住), |
|
|
|
* 才能进一步调用核销接口,否则报错。 |
|
|
|
* |
|
|
@@ -102,6 +106,7 @@ public interface WxMpCardService { |
|
|
|
* @param cardId 卡券的ID |
|
|
|
* @param openId 用券用户的openid |
|
|
|
* @param isMark 是否要mark(占用)这个code,填写true或者false,表示占用或解除占用 |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
void markCardCode(String code, String cardId, String openId, boolean isMark) throws WxErrorException; |
|
|
|
|
|
|
@@ -113,6 +118,7 @@ public interface WxMpCardService { |
|
|
|
* @return 返回的卡券详情JSON字符串 |
|
|
|
* <br> [注] 由于返回的JSON格式过于复杂,难以定义其对应格式的Bean并且难以维护,因此只返回String格式的JSON串。 |
|
|
|
* <br> 可由 com.google.gson.JsonParser#parse 等方法直接取JSON串中的某个字段。 |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
String getCardDetail(String cardId) throws WxErrorException; |
|
|
|
|
|
|
@@ -120,14 +126,17 @@ public interface WxMpCardService { |
|
|
|
* 添加测试白名单. |
|
|
|
* |
|
|
|
* @param openid 用户的openid |
|
|
|
* @return |
|
|
|
* @return string |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
String addTestWhiteList(String openid) throws WxErrorException; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param cardCreateMessage |
|
|
|
* @return |
|
|
|
* @throws WxErrorException |
|
|
|
* 创建卡券. |
|
|
|
* |
|
|
|
* @param cardCreateMessage 请求 |
|
|
|
* @return result |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
WxMpCardCreateResult createCard(WxMpCardCreateMessage cardCreateMessage) throws WxErrorException; |
|
|
|
|
|
|
@@ -137,6 +146,7 @@ public interface WxMpCardService { |
|
|
|
* @param cardId 卡券编号 |
|
|
|
* @param outerStr 二维码标识 |
|
|
|
* @return WxMpCardQrcodeCreateResult |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
WxMpCardQrcodeCreateResult createQrcodeCard(String cardId, String outerStr) throws WxErrorException; |
|
|
|
|
|
|
@@ -145,17 +155,33 @@ public interface WxMpCardService { |
|
|
|
* |
|
|
|
* @param cardId 卡券编号 |
|
|
|
* @param outerStr 二维码标识 |
|
|
|
* @param expiresIn 失效时间,单位秒,不填默认365天 |
|
|
|
* @param expiresIn 指定二维码的有效时间,范围是60 ~ 1800秒。不填默认为365天有效 |
|
|
|
* @return WxMpCardQrcodeCreateResult |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
WxMpCardQrcodeCreateResult createQrcodeCard(String cardId, String outerStr, int expiresIn) throws WxErrorException; |
|
|
|
|
|
|
|
/** |
|
|
|
* 创建卡券二维码. |
|
|
|
* |
|
|
|
* @param cardId 卡券编号 |
|
|
|
* @param outerStr 用户首次领卡时,会通过 领取事件推送 给商户; 对于会员卡的二维码,用户每次扫码打开会员卡后点击任何url,会将该值拼入url中,方便开发者定位扫码来源 |
|
|
|
* @param expiresIn 指定二维码的有效时间,范围是60 ~ 1800秒。不填默认为365天有效 |
|
|
|
* @param isUniqueCode 指定下发二维码,生成的二维码随机分配一个code,领取后不可再次扫描。填写true或false。默认false,注意填写该字段时,卡券须通过审核且库存不为0。 |
|
|
|
* @param code 卡券Code码,use_custom_code字段为true的卡券必须填写,非自定义code和导入code模式的卡券不必填写。 |
|
|
|
* @param openid 指定领取者的openid,只有该用户能领取。bind_openid字段为true的卡券必须填写,非指定openid不必填写。 |
|
|
|
* @return WxMpCardQrcodeCreateResult |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
WxMpCardQrcodeCreateResult createQrcodeCard(String cardId, String outerStr, int expiresIn, String openid, |
|
|
|
String code, boolean isUniqueCode) throws WxErrorException; |
|
|
|
|
|
|
|
/** |
|
|
|
* 创建卡券货架. |
|
|
|
* |
|
|
|
* @param createRequest 货架创建参数 |
|
|
|
* @return |
|
|
|
* @throws WxErrorException |
|
|
|
* @return WxMpCardLandingPageCreateResult |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
WxMpCardLandingPageCreateResult createLandingPage(WxMpCardLandingPageCreateRequest createRequest) throws WxErrorException; |
|
|
|
|
|
|
@@ -166,17 +192,17 @@ public interface WxMpCardService { |
|
|
|
* @param cardId 卡券编号 |
|
|
|
* @param code 用户会员卡号 |
|
|
|
* @param reason 设置为失效的原因 |
|
|
|
* @return |
|
|
|
* @throws WxErrorException |
|
|
|
* @return result |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
String unavailableCardCode(String cardId, String code, String reason) throws WxErrorException; |
|
|
|
|
|
|
|
/** |
|
|
|
* 删除卡券接口. |
|
|
|
* |
|
|
|
* @param cardId |
|
|
|
* @return |
|
|
|
* @throws WxErrorException |
|
|
|
* @param cardId 卡券id |
|
|
|
* @return 删除结果 |
|
|
|
* @throws WxErrorException 异常 |
|
|
|
*/ |
|
|
|
WxMpCardDeleteResult deleteCard(String cardId) throws WxErrorException; |
|
|
|
|
|
|
|