#900 增加新增团购券、现金抵扣券、折扣券、兑换券以及普通优惠券的接口

This commit is contained in:
IOMan
2018-12-29 19:45:52 +08:00
committed by Binary Wang
parent 556085997d
commit 6a2ff801f0
19 changed files with 537 additions and 6 deletions

View File

@@ -2,9 +2,7 @@ package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.bean.WxCardApiSignature;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.bean.card.WxMpCardLandingPageCreateRequest;
import me.chanjar.weixin.mp.bean.card.WxMpCardLandingPageCreateResult;
import me.chanjar.weixin.mp.bean.card.WxMpCardQrcodeCreateResult;
import me.chanjar.weixin.mp.bean.card.*;
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
/**
@@ -14,6 +12,7 @@ import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
* @author yuanqixun 2018-08-29
*/
public interface WxMpCardService {
String CARD_CREATE = "https://api.weixin.qq.com/card/create";
String CARD_GET = "https://api.weixin.qq.com/card/get";
String CARD_GET_TICKET = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=wx_card";
String CARD_CODE_DECRYPT = "https://api.weixin.qq.com/card/code/decrypt";
@@ -142,6 +141,14 @@ public interface WxMpCardService {
*/
String addTestWhiteList(String openid) throws WxErrorException;
/**
*
* @param cardCreateMessage
* @return
* @throws WxErrorException
*/
WxMpCardCreateResult createCard(WxMpCardCreateMessage cardCreateMessage) throws WxErrorException;
/**
* 创建卡券二维码
*

View File

@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api.impl;
import java.util.Arrays;
import java.util.concurrent.locks.Lock;
import me.chanjar.weixin.mp.bean.card.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -22,9 +23,6 @@ import me.chanjar.weixin.common.util.crypto.SHA1;
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
import me.chanjar.weixin.mp.api.WxMpCardService;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.card.WxMpCardLandingPageCreateRequest;
import me.chanjar.weixin.mp.bean.card.WxMpCardLandingPageCreateResult;
import me.chanjar.weixin.mp.bean.card.WxMpCardQrcodeCreateResult;
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
import me.chanjar.weixin.mp.enums.TicketType;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
@@ -265,6 +263,13 @@ public class WxMpCardServiceImpl implements WxMpCardService {
return respone;
}
@Override
public WxMpCardCreateResult createCard(WxMpCardCreateMessage cardCreateMessage) throws WxErrorException {
String response = this.wxMpService.post(CARD_CREATE, GSON.toJson(cardCreateMessage));
return WxMpCardCreateResult.fromJson(response);
}
/**
* 创建卡券二维码.
*/