model包拆分media/paging & 包拆分card/mch & 新增card卡券相关类 & 新增CardApi:创建卡券接口
This commit is contained in:
@@ -8,7 +8,6 @@ import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.model.Consts;
|
||||
import com.foxinmy.weixin4j.model.Token;
|
||||
import com.foxinmy.weixin4j.model.WeixinAccount;
|
||||
import com.foxinmy.weixin4j.mp.api.ComponentApi;
|
||||
@@ -16,6 +15,7 @@ import com.foxinmy.weixin4j.mp.model.WeixinMpAccount;
|
||||
import com.foxinmy.weixin4j.mp.type.URLConsts;
|
||||
import com.foxinmy.weixin4j.setting.Weixin4jSettings;
|
||||
import com.foxinmy.weixin4j.token.TicketManager;
|
||||
import com.foxinmy.weixin4j.util.Consts;
|
||||
import com.foxinmy.weixin4j.util.StringUtil;
|
||||
import com.foxinmy.weixin4j.util.Weixin4jConfigUtil;
|
||||
|
||||
|
||||
@@ -4,16 +4,19 @@ import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.foxinmy.weixin4j.card.CardCoupon;
|
||||
import com.foxinmy.weixin4j.card.CardCoupons;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.http.weixin.ApiResult;
|
||||
import com.foxinmy.weixin4j.model.Button;
|
||||
import com.foxinmy.weixin4j.model.MediaCounter;
|
||||
import com.foxinmy.weixin4j.model.MediaDownloadResult;
|
||||
import com.foxinmy.weixin4j.model.MediaItem;
|
||||
import com.foxinmy.weixin4j.model.MediaRecord;
|
||||
import com.foxinmy.weixin4j.model.MediaUploadResult;
|
||||
import com.foxinmy.weixin4j.model.Pageable;
|
||||
import com.foxinmy.weixin4j.model.WeixinAccount;
|
||||
import com.foxinmy.weixin4j.model.media.MediaCounter;
|
||||
import com.foxinmy.weixin4j.model.media.MediaDownloadResult;
|
||||
import com.foxinmy.weixin4j.model.media.MediaItem;
|
||||
import com.foxinmy.weixin4j.model.media.MediaRecord;
|
||||
import com.foxinmy.weixin4j.model.media.MediaUploadResult;
|
||||
import com.foxinmy.weixin4j.model.paging.Pageable;
|
||||
import com.foxinmy.weixin4j.mp.api.CardApi;
|
||||
import com.foxinmy.weixin4j.mp.api.CustomApi;
|
||||
import com.foxinmy.weixin4j.mp.api.DataApi;
|
||||
import com.foxinmy.weixin4j.mp.api.GroupApi;
|
||||
@@ -122,6 +125,10 @@ public class WeixinProxy {
|
||||
* 标签API
|
||||
*/
|
||||
private final TagApi tagApi;
|
||||
/**
|
||||
* 卡券API
|
||||
*/
|
||||
private final CardApi cardApi;
|
||||
/**
|
||||
* token实现
|
||||
*/
|
||||
@@ -192,6 +199,7 @@ public class WeixinProxy {
|
||||
this.helperApi = new HelperApi(tokenManager);
|
||||
this.dataApi = new DataApi(tokenManager);
|
||||
this.tagApi = new TagApi(tokenManager);
|
||||
this.cardApi = new CardApi(tokenManager);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,7 +291,7 @@ public class WeixinProxy {
|
||||
* @see <a href=
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">
|
||||
* 上传永久素材</a>
|
||||
* @see com.foxinmy.weixin4j.model.MediaUploadResult
|
||||
* @see com.foxinmy.weixin4j.model.media.MediaUploadResult
|
||||
* @see com.foxinmy.weixin4j.type.MediaType
|
||||
* @see com.foxinmy.weixin4j.mp.api.MediaApi
|
||||
* @throws WeixinException
|
||||
@@ -303,7 +311,7 @@ public class WeixinProxy {
|
||||
* @return 媒体文件下载结果
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.MediaApi
|
||||
* @see com.foxinmy.weixin4j.model.MediaDownloadResult
|
||||
* @see com.foxinmy.weixin4j.model.media.MediaDownloadResult
|
||||
* @see <a href=
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738727&token=&lang=zh_CN">
|
||||
* 下载临时媒体素材</a>
|
||||
@@ -420,7 +428,7 @@ public class WeixinProxy {
|
||||
*
|
||||
* @return 总数对象
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.model.MediaCounter
|
||||
* @see com.com.foxinmy.weixin4j.model.media.MediaCounter
|
||||
* @see <a href=
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738733&token=&lang=zh_CN">
|
||||
* 获取素材总数</a>
|
||||
@@ -440,11 +448,11 @@ public class WeixinProxy {
|
||||
* @return 媒体素材的记录对象
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.MediaApi
|
||||
* @see com.foxinmy.weixin4j.mp.model.MediaRecord
|
||||
* @see com.com.foxinmy.weixin4j.model.media.MediaRecord
|
||||
* @see com.foxinmy.weixin4j.type.MediaType
|
||||
* @see com.foxinmy.weixin4j.model.MediaItem
|
||||
* @see com.foxinmy.weixin4j.model.Pageable
|
||||
* @see com.foxinmy.weixin4j.model.Pagedata
|
||||
* @see com.foxinmy.weixin4j.model.media.MediaItem
|
||||
* @see com.foxinmy.weixin4j.model.paging.Pageable
|
||||
* @see com.foxinmy.weixin4j.model.paging.Pagedata
|
||||
* @see <a href=
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738734&token=&lang=zh_CN">
|
||||
* 获取素材列表</a>
|
||||
@@ -1835,5 +1843,66 @@ public class WeixinProxy {
|
||||
public Integer[] getUserTags(String openId) throws WeixinException {
|
||||
return tagApi.getUserTags(openId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建卡券:创建卡券接口是微信卡券的基础接口,用于创建一类新的卡券,获取card_id,创建成功并通过审核后,
|
||||
* 商家可以通过文档提供的其他接口将卡券下发给用户,每次成功领取,库存数量相应扣除。
|
||||
*
|
||||
* <li>1.需自定义Code码的商家必须在创建卡券时候,设定use_custom_code为true,且在调用投放卡券接口时填入指定的Code码。
|
||||
* 指定OpenID同理。特别注意:在公众平台创建的卡券均为非自定义Code类型。 <li>
|
||||
* 2.can_share字段指领取卡券原生页面是否可分享,建议指定Code码、指定OpenID等强限制条件的卡券填写false。 <li>
|
||||
* 3.创建成功后该卡券会自动提交审核
|
||||
* ,审核结果将通过事件通知商户。开发者可调用设置白名单接口设置用户白名单,领取未通过审核的卡券,测试整个卡券的使用流程。
|
||||
*
|
||||
* @param cardCoupon
|
||||
* 卡券对象
|
||||
* @see <a
|
||||
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025056&token=&lang=zh_CN">创建卡券</a>
|
||||
* @see CardCoupons
|
||||
* @see MediaApi#uploadImage(java.io.InputStream, String)
|
||||
* @see com.foxinmy.weixin4j.mp.api.CardApi
|
||||
* @return 卡券ID
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public String createCardCoupon(CardCoupon cardCoupon)
|
||||
throws WeixinException {
|
||||
return cardApi.createCardCoupon(cardCoupon);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置卡券买单:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持微信买单功能。值得开发者注意的是,
|
||||
* 设置买单的card_id必须已经配置了门店,否则会报错。
|
||||
*
|
||||
* @param cardId
|
||||
* 卡券ID
|
||||
* @param isOpen
|
||||
* 是否开启买单功能,填true/false
|
||||
* @see #createCardCoupon(CardCoupon)
|
||||
* @see com.foxinmy.weixin4j.mp.api.CardApi
|
||||
* @return 操作结果
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public ApiResult setCardPayCell(String cardId, boolean isOpen)
|
||||
throws WeixinException {
|
||||
return cardApi.setCardPayCell(cardId, isOpen);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自助核销:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持自助核销功能。值得开发者注意的是,
|
||||
* 设置自助核销的card_id必须已经配置了门店,否则会报错。
|
||||
*
|
||||
* @param cardId
|
||||
* 卡券ID
|
||||
* @param isOpen
|
||||
* 是否开启买单功能,填true/false
|
||||
* @see #createCardCoupon(CardCoupon)
|
||||
* @see com.foxinmy.weixin4j.mp.api.CardApi
|
||||
* @return 操作结果
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public ApiResult setCardSelfConsumeCell(String cardId, boolean isOpen)
|
||||
throws WeixinException {
|
||||
return cardApi.setCardSelfConsumeCell(cardId, isOpen);
|
||||
}
|
||||
|
||||
public final static String VERSION = "1.7.0";
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.foxinmy.weixin4j.mp.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.foxinmy.weixin4j.card.CardCoupon;
|
||||
import com.foxinmy.weixin4j.card.CardCoupons;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.http.weixin.ApiResult;
|
||||
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||
import com.foxinmy.weixin4j.model.Token;
|
||||
import com.foxinmy.weixin4j.token.TokenManager;
|
||||
|
||||
/**
|
||||
* 卡券API
|
||||
*
|
||||
* @className CardApi
|
||||
* @author jinyu(foxinmy@gmail.com)
|
||||
* @date 2016年8月3日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025056&token=&lang=zh_CN">卡券说明</a>
|
||||
*/
|
||||
public class CardApi extends MpApi {
|
||||
private final TokenManager tokenManager;
|
||||
|
||||
public CardApi(TokenManager tokenManager) {
|
||||
this.tokenManager = tokenManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建卡券:创建卡券接口是微信卡券的基础接口,用于创建一类新的卡券,获取card_id,创建成功并通过审核后,
|
||||
* 商家可以通过文档提供的其他接口将卡券下发给用户,每次成功领取,库存数量相应扣除。
|
||||
*
|
||||
* <li>1.需自定义Code码的商家必须在创建卡券时候,设定use_custom_code为true,且在调用投放卡券接口时填入指定的Code码。
|
||||
* 指定OpenID同理。特别注意:在公众平台创建的卡券均为非自定义Code类型。 <li>
|
||||
* 2.can_share字段指领取卡券原生页面是否可分享,建议指定Code码、指定OpenID等强限制条件的卡券填写false。 <li>
|
||||
* 3.创建成功后该卡券会自动提交审核
|
||||
* ,审核结果将通过事件通知商户。开发者可调用设置白名单接口设置用户白名单,领取未通过审核的卡券,测试整个卡券的使用流程。
|
||||
*
|
||||
* @param cardCoupon
|
||||
* 卡券对象
|
||||
* @see <a
|
||||
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025056&token=&lang=zh_CN">创建卡券</a>
|
||||
* @see CardCoupons
|
||||
* @see MediaApi#uploadImage(java.io.InputStream, String)
|
||||
* @return 卡券ID
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public String createCardCoupon(CardCoupon cardCoupon)
|
||||
throws WeixinException {
|
||||
JSONObject content = new JSONObject();
|
||||
String cardType = cardCoupon.getCardType().name();
|
||||
content.put("card_type", cardType);
|
||||
content.put(cardType.toLowerCase(), cardCoupon);
|
||||
JSONObject card = new JSONObject();
|
||||
card.put("card", content);
|
||||
System.err.println(card);
|
||||
Token token = tokenManager.getCache();
|
||||
String card_create_uri = getRequestUri("card_create_uri");
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
String.format(card_create_uri, token.getAccessToken()),
|
||||
card.toJSONString());
|
||||
return response.getAsJson().getString("card_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置卡券买单:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持微信买单功能。值得开发者注意的是,
|
||||
* 设置买单的card_id必须已经配置了门店,否则会报错。
|
||||
*
|
||||
* @param cardId
|
||||
* 卡券ID
|
||||
* @param isOpen
|
||||
* 是否开启买单功能,填true/false
|
||||
* @see #createCardCoupon(CardCoupon)
|
||||
* @return 操作结果
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public ApiResult setCardPayCell(String cardId, boolean isOpen)
|
||||
throws WeixinException {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("card_id", cardId);
|
||||
params.put("is_open", isOpen);
|
||||
Token token = tokenManager.getCache();
|
||||
String card_paycell_uri = getRequestUri("card_paycell_uri");
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
String.format(card_paycell_uri, token.getAccessToken()),
|
||||
params.toJSONString());
|
||||
return response.getAsResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自助核销:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持自助核销功能。值得开发者注意的是,
|
||||
* 设置自助核销的card_id必须已经配置了门店,否则会报错。
|
||||
*
|
||||
* @param cardId
|
||||
* 卡券ID
|
||||
* @param isOpen
|
||||
* 是否开启买单功能,填true/false
|
||||
* @see #createCardCoupon(CardCoupon)
|
||||
* @return 操作结果
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public ApiResult setCardSelfConsumeCell(String cardId, boolean isOpen)
|
||||
throws WeixinException {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("card_id", cardId);
|
||||
params.put("is_open", isOpen);
|
||||
Token token = tokenManager.getCache();
|
||||
String card_selfconsumecell_uri = getRequestUri("card_selfconsumecell_uri");
|
||||
WeixinResponse response = weixinExecutor
|
||||
.post(String.format(card_selfconsumecell_uri,
|
||||
token.getAccessToken()), params.toJSONString());
|
||||
return response.getAsResult();
|
||||
}
|
||||
}
|
||||
@@ -28,18 +28,18 @@ import com.foxinmy.weixin4j.http.entity.StringEntity;
|
||||
import com.foxinmy.weixin4j.http.message.JsonMessageConverter;
|
||||
import com.foxinmy.weixin4j.http.weixin.ApiResult;
|
||||
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||
import com.foxinmy.weixin4j.model.Consts;
|
||||
import com.foxinmy.weixin4j.model.MediaCounter;
|
||||
import com.foxinmy.weixin4j.model.MediaDownloadResult;
|
||||
import com.foxinmy.weixin4j.model.MediaItem;
|
||||
import com.foxinmy.weixin4j.model.MediaRecord;
|
||||
import com.foxinmy.weixin4j.model.MediaUploadResult;
|
||||
import com.foxinmy.weixin4j.model.Pageable;
|
||||
import com.foxinmy.weixin4j.model.Token;
|
||||
import com.foxinmy.weixin4j.model.media.MediaCounter;
|
||||
import com.foxinmy.weixin4j.model.media.MediaDownloadResult;
|
||||
import com.foxinmy.weixin4j.model.media.MediaItem;
|
||||
import com.foxinmy.weixin4j.model.media.MediaRecord;
|
||||
import com.foxinmy.weixin4j.model.media.MediaUploadResult;
|
||||
import com.foxinmy.weixin4j.model.paging.Pageable;
|
||||
import com.foxinmy.weixin4j.token.TokenManager;
|
||||
import com.foxinmy.weixin4j.tuple.MpArticle;
|
||||
import com.foxinmy.weixin4j.tuple.MpVideo;
|
||||
import com.foxinmy.weixin4j.type.MediaType;
|
||||
import com.foxinmy.weixin4j.util.Consts;
|
||||
import com.foxinmy.weixin4j.util.FileUtil;
|
||||
import com.foxinmy.weixin4j.util.IOUtil;
|
||||
import com.foxinmy.weixin4j.util.ObjectId;
|
||||
@@ -140,7 +140,7 @@ public class MediaApi extends MpApi {
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738726&token=&lang=zh_CN">上传临时素材</a>
|
||||
* @see <a href=
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">上传永久素材</a>
|
||||
* @see com.foxinmy.weixin4j.model.MediaUploadResult
|
||||
* @see com.foxinmy.weixin4j.model.media.MediaUploadResult
|
||||
* @see com.foxinmy.weixin4j.type.MediaType
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@@ -214,7 +214,7 @@ public class MediaApi extends MpApi {
|
||||
* @return 媒体下载结果
|
||||
*
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.model.MediaDownloadResult
|
||||
* @see com.foxinmy.weixin4j.model.media.MediaDownloadResult
|
||||
* @see <a href=
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738727&token=&lang=zh_CN">下载临时媒体素材</a>
|
||||
* @see <a href=
|
||||
@@ -407,7 +407,7 @@ public class MediaApi extends MpApi {
|
||||
*
|
||||
* @return 总数对象
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.model.MediaCounter
|
||||
* @see com.foxinmy.weixin4j.model.media.MediaCounter
|
||||
* @see <a href=
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738733&token=&lang=zh_CN">获取素材总数</a>
|
||||
*/
|
||||
@@ -429,11 +429,11 @@ public class MediaApi extends MpApi {
|
||||
* 分页数据
|
||||
* @return 媒体素材的记录对象
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.model.MediaRecord
|
||||
* @see com.foxinmy.weixin4j.model.media.MediaRecord
|
||||
* @see com.foxinmy.weixin4j.type.MediaType
|
||||
* @see com.foxinmy.weixin4j.model.MediaItem
|
||||
* @see com.foxinmy.weixin4j.model.Pageable
|
||||
* @see com.foxinmy.weixin4j.model.Pagedata
|
||||
* @see com.foxinmy.weixin4j.model.media.MediaItem
|
||||
* @see com.foxinmy.weixin4j.model.paging.Pageable
|
||||
* @see com.foxinmy.weixin4j.model.paging.Pagedata
|
||||
* @see <a href=
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738734&token=&lang=zh_CN">获取素材列表</a>
|
||||
*/
|
||||
|
||||
@@ -7,11 +7,11 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||
import com.foxinmy.weixin4j.model.Consts;
|
||||
import com.foxinmy.weixin4j.model.WeixinAccount;
|
||||
import com.foxinmy.weixin4j.mp.model.OauthToken;
|
||||
import com.foxinmy.weixin4j.mp.model.User;
|
||||
import com.foxinmy.weixin4j.mp.type.Lang;
|
||||
import com.foxinmy.weixin4j.util.Consts;
|
||||
import com.foxinmy.weixin4j.util.Weixin4jConfigUtil;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.http.entity.FormUrlEntity;
|
||||
import com.foxinmy.weixin4j.http.weixin.ApiResult;
|
||||
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||
import com.foxinmy.weixin4j.model.Consts;
|
||||
import com.foxinmy.weixin4j.model.Token;
|
||||
import com.foxinmy.weixin4j.mp.oldpayment.OrderV2;
|
||||
import com.foxinmy.weixin4j.mp.oldpayment.PayPackageV2;
|
||||
@@ -43,10 +42,11 @@ import com.foxinmy.weixin4j.setting.Weixin4jSettings;
|
||||
import com.foxinmy.weixin4j.sign.WeixinPaymentSignature;
|
||||
import com.foxinmy.weixin4j.sign.WeixinSignature;
|
||||
import com.foxinmy.weixin4j.token.TokenManager;
|
||||
import com.foxinmy.weixin4j.type.BillType;
|
||||
import com.foxinmy.weixin4j.type.IdQuery;
|
||||
import com.foxinmy.weixin4j.type.RefundType;
|
||||
import com.foxinmy.weixin4j.type.SignType;
|
||||
import com.foxinmy.weixin4j.type.mch.BillType;
|
||||
import com.foxinmy.weixin4j.type.mch.RefundType;
|
||||
import com.foxinmy.weixin4j.util.Consts;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
import com.foxinmy.weixin4j.util.DigestUtil;
|
||||
import com.foxinmy.weixin4j.util.MapUtil;
|
||||
@@ -261,8 +261,10 @@ public class PayOldApi extends MpApi {
|
||||
map.put("service_version", "1.1");
|
||||
map.put("partner", weixinAccount.getPartnerId());
|
||||
map.put("out_refund_no", outRefundNo);
|
||||
map.put("total_fee", DateUtil.formatFee2Fen(totalFee));
|
||||
map.put("refund_fee", DateUtil.formatFee2Fen(refundFee));
|
||||
map.put("total_fee",
|
||||
Integer.toString(DateUtil.formatYuan2Fen(totalFee)));
|
||||
map.put("refund_fee",
|
||||
Integer.toString(DateUtil.formatYuan2Fen(refundFee)));
|
||||
map.put(idQuery.getType().getName(), idQuery.getId());
|
||||
if (StringUtil.isBlank(opUserId)) {
|
||||
opUserId = weixinAccount.getPartnerId();
|
||||
@@ -465,7 +467,7 @@ public class PayOldApi extends MpApi {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(file), Consts.GBK));
|
||||
reader = new BufferedReader(new InputStreamReader(
|
||||
response.getBody(), com.foxinmy.weixin4j.model.Consts.GBK));
|
||||
response.getBody(), com.foxinmy.weixin4j.util.Consts.GBK));
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
writer.write(line);
|
||||
|
||||
@@ -180,6 +180,13 @@ tag_userids_uri={api_cgi_url}/tags/getidlist?access_token=%s
|
||||
# \u83b7\u53d6\u6807\u7b7e\u4e0b\u7c89\u4e1d\u5217\u8868
|
||||
tag_user_uri={api_cgi_url}/user/tag/get?access_token=%s
|
||||
|
||||
# \u521b\u5efa\u5361\u5238
|
||||
card_create_uri={api_base_url}/card/create?access_token=%s
|
||||
# \u8bbe\u7f6e\u4e70\u5355\u63a5\u53e3
|
||||
card_paycell_uri={api_base_url}/card/paycell/set?access_token=%s
|
||||
# \u8bbe\u7f6e\u81ea\u52a9\u6838\u9500\u63a5\u53e3
|
||||
card_selfconsumecell_uri={api_base_url}/card/selfconsumecell/set?access_token=%s
|
||||
|
||||
# \u4f7f\u7528\u6388\u6743\u7801\u6362\u53d6\u516c\u4f17\u53f7\u7684\u63a5\u53e3\u8c03\u7528\u51ed\u636e\u548c\u6388\u6743\u4fe1\u606f
|
||||
component_exchange_authorizer_uri={api_cgi_url}/component/api_query_auth?component_access_token=%s
|
||||
# \u83b7\u53d6\u6388\u6743\u65b9\u7684\u516c\u4f17\u53f7\u5e10\u53f7\u57fa\u672c\u4fe1\u606f
|
||||
|
||||
@@ -4,9 +4,9 @@ import java.io.Serializable;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.model.Gender;
|
||||
import com.foxinmy.weixin4j.mp.type.ClientPlatformType;
|
||||
import com.foxinmy.weixin4j.mp.type.Lang;
|
||||
import com.foxinmy.weixin4j.type.Gender;
|
||||
|
||||
/**
|
||||
* 个性化菜单匹配规则
|
||||
|
||||
@@ -5,9 +5,9 @@ import java.util.Date;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.model.Gender;
|
||||
import com.foxinmy.weixin4j.mp.type.FaceSize;
|
||||
import com.foxinmy.weixin4j.mp.type.Lang;
|
||||
import com.foxinmy.weixin4j.type.Gender;
|
||||
import com.foxinmy.weixin4j.util.StringUtil;
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,13 +47,13 @@ public class PayPackageV2 extends PayPackage {
|
||||
*/
|
||||
@XmlElement(name = "transport_fee")
|
||||
@JSONField(name = "transport_fee")
|
||||
private String transportFee;
|
||||
private Integer transportFee;
|
||||
/**
|
||||
* 商品费用 可为空 商品费用,单位为分。如果有值,必须保 证 transport_fee +product_fee=total_fee;
|
||||
*/
|
||||
@XmlElement(name = "product_fee")
|
||||
@JSONField(name = "product_fee")
|
||||
private String productFee;
|
||||
private Integer productFee;
|
||||
/**
|
||||
* 传入参数字符编码 取值范围:"GBK"、"UTF-8",默认:"GBK" 可为空
|
||||
*/
|
||||
@@ -133,8 +133,8 @@ public class PayPackageV2 extends PayPackage {
|
||||
this.inputCharset = "UTF-8";
|
||||
this.partner = partner;
|
||||
this.transportFee = transportFee > 0d ? DateUtil
|
||||
.formatFee2Fen(transportFee) : null;
|
||||
this.productFee = productFee > 0 ? DateUtil.formatFee2Fen(productFee)
|
||||
.formatYuan2Fen(transportFee) : null;
|
||||
this.productFee = productFee > 0 ? DateUtil.formatYuan2Fen(productFee)
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -154,9 +154,19 @@ public class PayPackageV2 extends PayPackage {
|
||||
return feeType;
|
||||
}
|
||||
|
||||
public String getTransportFee() {
|
||||
public Integer getTransportFee() {
|
||||
return transportFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
* @return 元单位
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
public double getFormatTransportFee() {
|
||||
return transportFee != null ? transportFee / 100d : 0d;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">单位为元,自动格式化为分</font>
|
||||
@@ -165,12 +175,22 @@ public class PayPackageV2 extends PayPackage {
|
||||
* 物流费用 单位为元
|
||||
*/
|
||||
public void setTransportFee(double transportFee) {
|
||||
this.transportFee = DateUtil.formatFee2Fen(transportFee);
|
||||
this.transportFee = DateUtil.formatYuan2Fen(transportFee);
|
||||
}
|
||||
|
||||
public String getProductFee() {
|
||||
public Integer getProductFee() {
|
||||
return productFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
* @return 元单位
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
public double getFormatProductFee() {
|
||||
return productFee != null ? productFee / 100d : 0d;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">单位为元,自动格式化为分</font>
|
||||
@@ -179,7 +199,7 @@ public class PayPackageV2 extends PayPackage {
|
||||
* 商品 单位为元
|
||||
*/
|
||||
public void setProductFee(double productFee) {
|
||||
this.productFee = DateUtil.formatFee2Fen(productFee);
|
||||
this.productFee = DateUtil.formatYuan2Fen(productFee);
|
||||
}
|
||||
|
||||
public String getInputCharset() {
|
||||
|
||||
@@ -6,8 +6,8 @@ import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.RefundChannel;
|
||||
import com.foxinmy.weixin4j.type.RefundStatus;
|
||||
import com.foxinmy.weixin4j.type.mch.RefundChannel;
|
||||
import com.foxinmy.weixin4j.type.mch.RefundStatus;
|
||||
|
||||
/**
|
||||
* V2退款详细
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.foxinmy.weixin4j.mp.type;
|
||||
|
||||
/**
|
||||
* 卡券颜色
|
||||
*
|
||||
* @className CardColor
|
||||
* @author jinyu(foxinmy@gmail.com)
|
||||
* @date 2016年4月4日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
*/
|
||||
public enum CardColor {
|
||||
COLOR010(99, 179, 89, "#63b359"), COLOR020(44, 159, 103, "#2c9f67"), COLOR030(
|
||||
80, 159, 201, "#509fc9"), COLOR040(88, 133, 207, "#5885cf"), COLOR050(
|
||||
144, 98, 192, "#9062c0"), COLOR060(208, 154, 69, "#d09a45"), COLOR070(
|
||||
228, 117, 56, "#e4b138"), COLOR080(238, 144, 60, "#ee903c"), COLOR081(
|
||||
240, 133, 0, "#f08500"), COLOR082(169, 217, 45, "#a9d92d"), COLOR090(
|
||||
221, 101, 73, "#dd6549"), COLOR0100(204, 70, 61, "#cc463d"), COLOR0101(
|
||||
207, 62, 54, "#cf3e36"), COLOR0102(94, 102, 113, "#5E6671");
|
||||
private int r;
|
||||
private int g;
|
||||
private int b;
|
||||
private String hex;
|
||||
|
||||
CardColor(int r, int g, int b, String hex) {
|
||||
this.r = r;
|
||||
this.g = g;
|
||||
this.b = b;
|
||||
this.hex = hex;
|
||||
}
|
||||
|
||||
public int getR() {
|
||||
return r;
|
||||
}
|
||||
|
||||
public int getG() {
|
||||
return g;
|
||||
}
|
||||
|
||||
public int getB() {
|
||||
return b;
|
||||
}
|
||||
|
||||
public String getHex() {
|
||||
return hex;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.foxinmy.weixin4j.mp.type;
|
||||
|
||||
/**
|
||||
* 卡券类型
|
||||
*
|
||||
* @className CardType
|
||||
* @author jinyu(foxinmy@gmail.com)
|
||||
* @date 2016年4月4日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
*/
|
||||
public enum CardType {
|
||||
/**
|
||||
* 团购券
|
||||
*/
|
||||
GROUPON,
|
||||
/**
|
||||
* 代金券
|
||||
*/
|
||||
CASH,
|
||||
/**
|
||||
* 折扣券
|
||||
*/
|
||||
DISCOUNT,
|
||||
/**
|
||||
* 兑换券
|
||||
*/
|
||||
GIFT,
|
||||
/**
|
||||
* 优惠券
|
||||
*/
|
||||
GENERAL_COUPON;
|
||||
}
|
||||
Reference in New Issue
Block a user