Skip to content

增加卡券失效接口;修复会员卡是否支持微信支付和会员卡二维码的属性问题; #745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Sep 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
29152db
恢复原有的key值
Apr 15, 2018
67277d9
升级3.0.1.01版本
Apr 15, 2018
06f7d36
升级版本
Apr 15, 2018
3c74bb4
增加会员卡创建接口。
Aug 28, 2018
fe75ab3
优化代码,同时增加通过json构建对象方法。
Aug 28, 2018
ca1bc83
升级3.1.7-SNAPSHOT版本
Aug 28, 2018
da297ee
增加直接传入json字符串的原始API
Aug 28, 2018
d75a764
Merge commit 'b3277244339c3f0f06d641f21f2ebdec4b1b6915' into develop
Aug 28, 2018
2ed200c
完善卡券及会员卡相关接口
Aug 29, 2018
b348ece
优化注释
Aug 29, 2018
3f8608a
还原开发分支版本号。
Aug 29, 2018
4910884
Merge branch 'develop' of https://github.com/Wechat-Group/weixin-java…
Aug 29, 2018
33e2d5e
#bugfix#:商户服务不对,应该为字符串列表
Aug 30, 2018
35b7c6f
直接返回消息
Aug 30, 2018
fa6b086
格式化代码。
Aug 30, 2018
6c909f1
格式化代码。
Aug 30, 2018
1c06e3f
Merge commit '28b09f7ed61970d7d2c3ead6e85e6648f67334c5' into develop
Aug 30, 2018
2ba9d20
增加微信激活会员卡,设置用户资料字段接口实现。
Aug 30, 2018
1fda901
增加创建卡券二维码的失效时间参数接口。
Aug 30, 2018
b6b1ea3
设置对象返回类型。
Aug 30, 2018
2810806
Merge commit '4dd67f46b8761bda57f57a9adcde1514aead172e' into develop
Aug 30, 2018
503fec8
增加卡券相关事件及xml消息解析
Aug 30, 2018
7dc4f83
Merge commit '699d5546b084bd1c14a4cbb20b31f7159db4dceb' into develop
Sep 1, 2018
14bdf22
Merge commit 'fca90244246065e4c18e88b5682161fbdbe32075' into develop
Sep 3, 2018
72739af
1、增加卡券失效接口;修复会员卡是否支持微信支付和会员卡二维码的属性问题;
Sep 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* 卡券相关接口
*
* @author YuJian(mgcnrx11@hotmail.com) on 01/11/2016
* @author YuJian(mgcnrx11 @ hotmail.com) on 01/11/2016
* @author yuanqixun 2018-08-29
*/
public interface WxMpCardService {
Expand All @@ -23,6 +23,10 @@ public interface WxMpCardService {
String CARD_TEST_WHITELIST = "https://api.weixin.qq.com/card/testwhitelist/set";
String CARD_QRCODE_CREAET = "https://api.weixin.qq.com/card/qrcode/create";
String CARD_LANDING_PAGE_CREAET = "https://api.weixin.qq.com/card/landingpage/create";
/**
* 将用户的卡券设置为失效状态
*/
String CARD_CODE_UNAVAILABLE = "https://api.weixin.qq.com/card/code/unavailable";

/**
* 得到WxMpService
Expand Down Expand Up @@ -132,33 +136,50 @@ void markCardCode(String code, String cardId, String openId, boolean isMark) thr

/**
* 添加测试白名单
*
* @param openid 用户的openid
* @return
*/
String addTestWhiteList(String openid) throws WxErrorException;

/**
* 创建卡券二维码
* @param cardId 卡券编号
*
* @param cardId 卡券编号
* @param outerStr 二维码标识
* @return WxMpCardQrcodeCreateResult
*/
WxMpCardQrcodeCreateResult createQrcodeCard(String cardId, String outerStr) throws WxErrorException;

/**
* 创建卡券二维码
* @param cardId 卡券编号
* @param outerStr 二维码标识
*
* @param cardId 卡券编号
* @param outerStr 二维码标识
* @param expiresIn 失效时间,单位秒,不填默认365天
* @return WxMpCardQrcodeCreateResult
*/
WxMpCardQrcodeCreateResult createQrcodeCard(String cardId, String outerStr,int expiresIn) throws WxErrorException;
WxMpCardQrcodeCreateResult createQrcodeCard(String cardId, String outerStr, int expiresIn) throws WxErrorException;

/**
* 创建卡券货架
*
* @param createRequest 货架创建参数
* @return
* @throws WxErrorException
*/
WxMpCardLandingPageCreateResult createLandingPage(WxMpCardLandingPageCreateRequest createRequest) throws WxErrorException;

/**
* 将用户的卡券设置为失效状态
* 详见:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025272&anchor=9
*
* @param cardId 卡券编号
* @param code 用户会员卡号
* @param reason 设置为失效的原因
* @return
* @throws WxErrorException
*/
String unavailableCardCode(String cardId, String code, String reason) throws WxErrorException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import me.chanjar.weixin.mp.bean.card.WxMpCardQrcodeCreateResult;
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -267,8 +268,9 @@ public WxMpCardQrcodeCreateResult createQrcodeCard(String cardId, String outerSt

/**
* 创建卡券二维码
* @param cardId 卡券编号
* @param outerStr 二维码标识
*
* @param cardId 卡券编号
* @param outerStr 二维码标识
* @param expiresIn 失效时间,单位秒,不填默认365天
* @return
* @throws WxErrorException
Expand Down Expand Up @@ -301,4 +303,26 @@ public WxMpCardLandingPageCreateResult createLandingPage(WxMpCardLandingPageCrea
String response = this.wxMpService.post(CARD_LANDING_PAGE_CREAET, GSON.toJson(request));
return WxMpCardLandingPageCreateResult.fromJson(response);
}

/**
* 将用户的卡券设置为失效状态
* 详见:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025272&anchor=9
*
* @param cardId 卡券编号
* @param code 用户会员卡号
* @param reason 设置为失效的原因
* @return
* @throws WxErrorException
*/
@Override
public String unavailableCardCode(String cardId, String code, String reason) throws WxErrorException {
if (StringUtils.isAnyBlank(cardId, code, reason))
throw new WxErrorException(WxError.builder().errorCode(41012).errorMsg("参数不完整").build());
JsonObject jsonRequest = new JsonObject();
jsonRequest.addProperty("card_id", cardId);
jsonRequest.addProperty("code", code);
jsonRequest.addProperty("reason", reason);
String response = this.wxMpService.post(CARD_CODE_UNAVAILABLE, GSON.toJson(jsonRequest));
return response;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ public class AdvancedInfo implements Serializable {
@SerializedName("time_limit")
private TimeLimit timeLimit;

/**
* 是否可以分享朋友
*/
@SerializedName("share_friends")
private Boolean shareFriends;

public void addBusinessService(BusinessServiceType businessServiceType) {
if (businessServiceType != null) {
if (businessServiceList == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public class BaseInfo implements Serializable {
@SerializedName("pay_info")
private PayInfo payInfo;

/**
* 是否设置该会员卡中部的按钮同时支持微信支付刷卡和会员卡二维码
*/
@SerializedName("is_pay_and_qrcode")
private boolean isPayAndQrcode;

/**
* 商户名字,字数上限为12个汉字
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ public class SwipeCard implements Serializable {
@SerializedName("is_swipe_card")
private boolean isSwipeCard;

/**
* 是否设置该会员卡中部的按钮同时支持微信支付刷卡和会员卡二维码
*/
@SerializedName("is_pay_and_qrcode")
private boolean isPayAndQrcode;

public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,13 @@ public void testGetCardDetail() throws Exception {
System.out.println(result);
}

@Test
public void testUnavailableCardCode() throws Exception {
String cardId = "p2iQk1luzj50RHue6yeTPQpAx_Z4";
String code = "134905347310";
String reason = "换成新卡了";
String result = this.wxService.getCardService().unavailableCardCode(cardId, code, reason);
assertNotNull(result);
System.out.println(result);
}
}