| @@ -852,13 +852,24 @@ public interface WxMpService { | |||||
| */ | */ | ||||
| public WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume) | public WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume) | ||||
| throws WxErrorException; | throws WxErrorException; | ||||
| /** | |||||
| /** | |||||
| * 卡券Code核销。核销失败会抛出异常 | * 卡券Code核销。核销失败会抛出异常 | ||||
| * | |||||
| * @param code 单张卡券的唯一标准 | * @param code 单张卡券的唯一标准 | ||||
| * @return 调用返回的JSON字符串。 | |||||
| * <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
| * @throws WxErrorException | |||||
| */ | |||||
| public String consumeCardCode(String code) throws WxErrorException; | |||||
| /** | |||||
| * 卡券Code核销。核销失败会抛出异常 | |||||
| * | |||||
| * @param code 单张卡券的唯一标准 | |||||
| * @param cardId 当自定义Code卡券时需要传入card_id | * @param cardId 当自定义Code卡券时需要传入card_id | ||||
| * @return 调用返回的JSON字符串。 | * @return 调用返回的JSON字符串。 | ||||
| * <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
| * <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
| * @throws WxErrorException | * @throws WxErrorException | ||||
| */ | */ | ||||
| public String consumeCardCode(String code, String cardId) throws WxErrorException; | public String consumeCardCode(String code, String cardId) throws WxErrorException; | ||||
| @@ -1159,6 +1159,22 @@ public class WxMpServiceImpl implements WxMpService { | |||||
| * 卡券Code核销。核销失败会抛出异常 | * 卡券Code核销。核销失败会抛出异常 | ||||
| * | * | ||||
| * @param code 单张卡券的唯一标准 | * @param code 单张卡券的唯一标准 | ||||
| * @return 调用返回的JSON字符串。 | |||||
| * <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
| * @throws WxErrorException | |||||
| */ | |||||
| @Override | |||||
| public String consumeCardCode(String code) throws WxErrorException { | |||||
| return consumeCardCode(code, null); | |||||
| } | |||||
| /** | |||||
| * 卡券Code核销。核销失败会抛出异常 | |||||
| * | |||||
| * @param code 单张卡券的唯一标准 | |||||
| * @param cardId 当自定义Code卡券时需要传入card_id | |||||
| * @return 调用返回的JSON字符串。 | |||||
| * <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
| * @throws WxErrorException | * @throws WxErrorException | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| @@ -1168,7 +1184,7 @@ public class WxMpServiceImpl implements WxMpService { | |||||
| param.addProperty("code", code); | param.addProperty("code", code); | ||||
| if (cardId != null && !"".equals(cardId)) { | if (cardId != null && !"".equals(cardId)) { | ||||
| param.addProperty("card_id", cardId); | |||||
| param.addProperty("card_id", cardId); | |||||
| } | } | ||||
| String responseContent = post(url, param.toString()); | String responseContent = post(url, param.toString()); | ||||