fixed something
This commit is contained in:
parent
6326ee1c03
commit
309022b44b
@ -14,103 +14,101 @@ import com.foxinmy.weixin4j.xml.XmlStream;
|
||||
|
||||
/**
|
||||
* 代金券API
|
||||
*
|
||||
*
|
||||
* @className CouponApi
|
||||
* @author jinyu(foxinmy@gmail.com)
|
||||
* @date 2015年3月25日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_1">代金券</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_1">代金券</a>
|
||||
*/
|
||||
public class CouponApi extends MchApi {
|
||||
|
||||
public CouponApi(WeixinPayAccount weixinAccount) {
|
||||
super(weixinAccount);
|
||||
}
|
||||
public CouponApi(WeixinPayAccount weixinAccount) {
|
||||
super(weixinAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发放代金券(需要证书)
|
||||
*
|
||||
* @param couponStockId
|
||||
* 代金券批次id
|
||||
* @param partnerTradeNo
|
||||
* 商户发放凭据号(格式:商户id+日期+流水号),商户侧需保持唯一性
|
||||
* @param openId
|
||||
* 用户的openid
|
||||
* @param opUserId
|
||||
* 操作员帐号, 默认为商户号 可在商户平台配置操作员对应的api权限 可为空
|
||||
* @return 发放结果
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponResult
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_3">发放代金券接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CouponResult sendCoupon(String couponStockId, String partnerTradeNo,
|
||||
String openId, String opUserId) throws WeixinException {
|
||||
Map<String, String> map = createBaseRequestMap(null);
|
||||
map.put("coupon_stock_id", couponStockId);
|
||||
map.put("partner_trade_no", partnerTradeNo);
|
||||
map.put("openid", openId);
|
||||
// openid记录数(目前支持num=1)
|
||||
map.put("openid_count", "1");
|
||||
// 操作员帐号, 默认为商户号 可在商户平台配置操作员对应的api权限
|
||||
if (StringUtil.isBlank(opUserId)) {
|
||||
opUserId = weixinAccount.getMchId();
|
||||
}
|
||||
map.put("op_user_id", opUserId);
|
||||
map.put("version", "1.0");
|
||||
map.put("type", "XML");
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = getWeixinSSLExecutor().post(
|
||||
getRequestUri("coupon_send_uri"), param);
|
||||
return response.getAsObject(new TypeReference<CouponResult>() {
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 发放代金券(需要证书)
|
||||
*
|
||||
* @param couponStockId
|
||||
* 代金券批次id
|
||||
* @param partnerTradeNo
|
||||
* 商户发放凭据号(格式:商户id+日期+流水号),商户侧需保持唯一性
|
||||
* @param openId
|
||||
* 用户的openid
|
||||
* @param opUserId
|
||||
* 操作员帐号, 默认为商户号 可在商户平台配置操作员对应的api权限 可为空
|
||||
* @return 发放结果
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponResult
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_3">发放代金券接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CouponResult sendCoupon(String couponStockId, String partnerTradeNo, String openId, String opUserId)
|
||||
throws WeixinException {
|
||||
Map<String, String> map = createBaseRequestMap(null);
|
||||
map.put("coupon_stock_id", couponStockId);
|
||||
map.put("partner_trade_no", partnerTradeNo);
|
||||
map.put("openid", openId);
|
||||
// openid记录数(目前支持num=1)
|
||||
map.put("openid_count", "1");
|
||||
// 操作员帐号, 默认为商户号 可在商户平台配置操作员对应的api权限
|
||||
if (StringUtil.isBlank(opUserId)) {
|
||||
opUserId = weixinAccount.getMchId();
|
||||
}
|
||||
map.put("op_user_id", opUserId);
|
||||
map.put("version", "1.0");
|
||||
map.put("type", "XML");
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = getWeixinSSLExecutor().post(getRequestUri("coupon_send_uri"), param);
|
||||
return response.getAsObject(new TypeReference<CouponResult>() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询代金券批次
|
||||
*
|
||||
* @param couponStockId
|
||||
* 代金券批次ID
|
||||
* @return 代金券批次信息
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponStock
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_4">查询代金券批次信息接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CouponStock queryCouponStock(String couponStockId)
|
||||
throws WeixinException {
|
||||
Map<String, String> map = createBaseRequestMap(null);
|
||||
map.put("coupon_stock_id", couponStockId);
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("couponstock_query_uri"), param);
|
||||
return response.getAsObject(new TypeReference<CouponStock>() {
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 查询代金券批次
|
||||
*
|
||||
* @param couponStockId
|
||||
* 代金券批次ID
|
||||
* @return 代金券批次信息
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponStock
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_4">查询代金券批次信息接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CouponStock queryCouponStock(String couponStockId) throws WeixinException {
|
||||
Map<String, String> map = createBaseRequestMap(null);
|
||||
map.put("coupon_stock_id", couponStockId);
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("couponstock_query_uri"), param);
|
||||
return response.getAsObject(new TypeReference<CouponStock>() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询代金券详细
|
||||
*
|
||||
* @param couponId
|
||||
* 代金券ID
|
||||
* @return 代金券详细信息
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponDetail
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_5">查询代金券详细信息接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CouponDetail queryCouponDetail(String couponId)
|
||||
throws WeixinException {
|
||||
Map<String, String> map = createBaseRequestMap(null);
|
||||
map.put("coupon_id", couponId);
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("coupondetail_query_uri"), param);
|
||||
return response.getAsObject(new TypeReference<CouponDetail>() {
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 查询代金券详细
|
||||
*
|
||||
* @param openId
|
||||
* 用户ID
|
||||
* @param couponId
|
||||
* 代金券ID
|
||||
* @return 代金券详细信息
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponDetail
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_5">查询代金券详细信息接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CouponDetail queryCouponDetail(String openId, String couponId) throws WeixinException {
|
||||
Map<String, String> map = createBaseRequestMap(null);
|
||||
map.put("openid", openId);
|
||||
map.put("coupon_id", couponId);
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("coupondetail_query_uri"), param);
|
||||
return response.getAsObject(new TypeReference<CouponDetail>() {
|
||||
});
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ public class WeixinComponentProxy {
|
||||
|
||||
/**
|
||||
* 微信第三方组件接口实现(使用weixin4j.properties配置的account#components账号信息)
|
||||
*
|
||||
*
|
||||
* @param cacheStorager
|
||||
* token管理
|
||||
*/
|
||||
@ -63,7 +63,7 @@ public class WeixinComponentProxy {
|
||||
|
||||
/**
|
||||
* 微信第三方组件接口实现
|
||||
*
|
||||
*
|
||||
* @param weixinMpAccount
|
||||
* 账号信息
|
||||
* @param cacheStorager
|
||||
@ -124,7 +124,7 @@ public class WeixinComponentProxy {
|
||||
|
||||
/**
|
||||
* 获取组件的预授权码 <font color="red">需先缓存ticket</font>
|
||||
*
|
||||
*
|
||||
* @param componentId
|
||||
* 组件ID
|
||||
* @return 预授权码
|
||||
@ -163,7 +163,7 @@ public class WeixinComponentProxy {
|
||||
* 应用组件授权 <font color="red">需先缓存ticket</font> <li>
|
||||
* redirectUri默认填写weixin4j.properties#component.oauth.redirect.uri <li>
|
||||
* state默认填写state
|
||||
*
|
||||
*
|
||||
* @param componentId
|
||||
* 组件ID
|
||||
* @see {@link #getComponentAuthorizationURL(String, String,String)}
|
||||
@ -225,5 +225,5 @@ public class WeixinComponentProxy {
|
||||
authAppId), component(componentId).getTokenManager());
|
||||
}
|
||||
|
||||
public final static String VERSION = "1.7.5";
|
||||
public final static String VERSION = "1.7.6";
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ public class WeixinSuiteProxy {
|
||||
|
||||
/**
|
||||
* 微信第三方套件接口实现(使用weixin4j.properties配置的account账号信息)
|
||||
*
|
||||
*
|
||||
* @param cacheStorager
|
||||
* token管理
|
||||
*/
|
||||
@ -73,7 +73,7 @@ public class WeixinSuiteProxy {
|
||||
|
||||
/**
|
||||
* 微信第三方套件接口实现
|
||||
*
|
||||
*
|
||||
* @param weixinQyAccount
|
||||
* 账号信息
|
||||
* @param cacheStorager
|
||||
@ -143,7 +143,7 @@ public class WeixinSuiteProxy {
|
||||
|
||||
/**
|
||||
* 获取套件的预授权码 <font color="red">需先缓存ticket</font>
|
||||
*
|
||||
*
|
||||
* @param suiteId
|
||||
* 套件ID
|
||||
* @return 预授权码
|
||||
@ -183,7 +183,7 @@ public class WeixinSuiteProxy {
|
||||
* 应用套件授权 <font color="red">需先缓存ticket</font> <li>
|
||||
* redirectUri默认填写weixin4j.properties#suite.oauth.redirect.uri <li>
|
||||
* state默认填写state
|
||||
*
|
||||
*
|
||||
* @param suiteId
|
||||
* 套件ID
|
||||
* @see {@link #getSuiteAuthorizationURL(String, String,String)}
|
||||
@ -285,5 +285,5 @@ public class WeixinSuiteProxy {
|
||||
suite(suiteId).getTokenManager());
|
||||
}
|
||||
|
||||
public final static String VERSION = "1.7.5";
|
||||
public final static String VERSION = "1.7.6";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user