修复备注链接不正确
This commit is contained in:
parent
7f2c1ddaab
commit
9290eb2436
@ -32,10 +32,12 @@ import com.foxinmy.weixin4j.xml.XmlStream;
|
||||
* @author jy
|
||||
* @date 2015年3月28日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/cash_coupon.php?chapter=13_1">现金红包</a>
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/mch_pay.php?chapter=14_1">企业付款</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_1">
|
||||
* 现金红包</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_1">
|
||||
* 企业付款</a>
|
||||
*/
|
||||
public class CashApi extends MchApi {
|
||||
|
||||
@ -53,12 +55,15 @@ public class CashApi extends MchApi {
|
||||
* @return 发放结果
|
||||
* @see com.foxinmy.weixin4j.payment.mch.Redpacket
|
||||
* @see com.foxinmy.weixin4j.payment.mch.RedpacketSendResult
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5">发放红包接口说明</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5">
|
||||
* 发放现金红包接口</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=16_5">
|
||||
* 发放裂变红包接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public RedpacketSendResult sendRedpack(InputStream certificate,
|
||||
Redpacket redpacket) throws WeixinException {
|
||||
public RedpacketSendResult sendRedpack(InputStream certificate, Redpacket redpacket) throws WeixinException {
|
||||
redpacket.declareWeixinPayAccount(weixinAccount);
|
||||
JSONObject obj = (JSONObject) JSON.toJSON(redpacket);
|
||||
obj.put("wxappid", obj.remove("appid"));
|
||||
@ -66,9 +71,8 @@ public class CashApi extends MchApi {
|
||||
String param = XmlStream.map2xml(obj);
|
||||
WeixinResponse response = null;
|
||||
try {
|
||||
response = createSSLRequestExecutor(certificate)
|
||||
.post(redpacket.getTotalNum() > 1 ? getRequestUri("groupredpack_send_uri")
|
||||
: getRequestUri("redpack_send_uri"), param);
|
||||
response = createSSLRequestExecutor(certificate).post(redpacket.getTotalNum() > 1
|
||||
? getRequestUri("groupredpack_send_uri") : getRequestUri("redpack_send_uri"), param);
|
||||
} finally {
|
||||
if (certificate != null) {
|
||||
try {
|
||||
@ -78,9 +82,8 @@ public class CashApi extends MchApi {
|
||||
}
|
||||
}
|
||||
}
|
||||
String text = response.getAsString()
|
||||
.replaceFirst("<wxappid>", "<appid>")
|
||||
.replaceFirst("</wxappid>", "</appid>");
|
||||
String text = response.getAsString().replaceFirst("<wxappid>", "<appid>").replaceFirst("</wxappid>",
|
||||
"</appid>");
|
||||
return XmlStream.fromXML(text, RedpacketSendResult.class);
|
||||
}
|
||||
|
||||
@ -93,12 +96,15 @@ public class CashApi extends MchApi {
|
||||
* 商户发放红包的商户订单号
|
||||
* @return 红包记录
|
||||
* @see com.foxinmy.weixin4j.payment.mch.RedpacketRecord
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/cash_coupon.php?chapter=13_6">查询红包接口说明</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_7&index=6">
|
||||
* 查询现金红包接口</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=16_6">
|
||||
* 查询裂变红包接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public RedpacketRecord queryRedpack(InputStream certificate,
|
||||
String outTradeNo) throws WeixinException {
|
||||
public RedpacketRecord queryRedpack(InputStream certificate, String outTradeNo) throws WeixinException {
|
||||
Map<String, String> para = createBaseRequestMap(null);
|
||||
para.put("bill_type", "MCHT");
|
||||
para.put("mch_billno", outTradeNo);
|
||||
@ -106,8 +112,7 @@ public class CashApi extends MchApi {
|
||||
String param = XmlStream.map2xml(para);
|
||||
WeixinResponse response = null;
|
||||
try {
|
||||
response = createSSLRequestExecutor(certificate).post(
|
||||
getRequestUri("redpack_query_uri"), param);
|
||||
response = createSSLRequestExecutor(certificate).post(getRequestUri("redpack_query_uri"), param);
|
||||
} finally {
|
||||
if (certificate != null) {
|
||||
try {
|
||||
@ -131,12 +136,12 @@ public class CashApi extends MchApi {
|
||||
* @return 付款结果
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CorpPayment
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CorpPaymentResult
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/mch_pay.php?chapter=14_1">企业付款</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2">
|
||||
* 企业付款接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CorpPaymentResult sendCorpPayment(InputStream certificate,
|
||||
CorpPayment payment) throws WeixinException {
|
||||
public CorpPaymentResult sendCorpPayment(InputStream certificate, CorpPayment payment) throws WeixinException {
|
||||
payment.declareWeixinPayAccount(weixinAccount);
|
||||
JSONObject obj = (JSONObject) JSON.toJSON(payment);
|
||||
obj.put("mchid", obj.remove("mch_id"));
|
||||
@ -145,8 +150,7 @@ public class CashApi extends MchApi {
|
||||
String param = XmlStream.map2xml(obj);
|
||||
WeixinResponse response = null;
|
||||
try {
|
||||
response = createSSLRequestExecutor(certificate).post(
|
||||
getRequestUri("corppayment_send_uri"), param);
|
||||
response = createSSLRequestExecutor(certificate).post(getRequestUri("corppayment_send_uri"), param);
|
||||
} finally {
|
||||
if (certificate != null) {
|
||||
try {
|
||||
@ -156,10 +160,8 @@ public class CashApi extends MchApi {
|
||||
}
|
||||
}
|
||||
}
|
||||
String text = response.getAsString()
|
||||
.replaceFirst("<mch_appid>", "<appid>")
|
||||
.replaceFirst("</mch_appid>", "</appid>")
|
||||
.replaceFirst("<mchid>", "<mch_id>")
|
||||
String text = response.getAsString().replaceFirst("<mch_appid>", "<appid>")
|
||||
.replaceFirst("</mch_appid>", "</appid>").replaceFirst("<mchid>", "<mch_id>")
|
||||
.replaceFirst("</mchid>", "</mch_id>");
|
||||
return XmlStream.fromXML(text, CorpPaymentResult.class);
|
||||
}
|
||||
@ -173,12 +175,12 @@ public class CashApi extends MchApi {
|
||||
* 商户调用企业付款API时使用的商户订单号
|
||||
* @return 付款记录
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CorpPaymentRecord
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/mch_pay.php?chapter=14_3">企业付款查询</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_3">
|
||||
* 企业付款查询接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CorpPaymentRecord queryCorpPayment(InputStream certificate,
|
||||
String outTradeNo) throws WeixinException {
|
||||
public CorpPaymentRecord queryCorpPayment(InputStream certificate, String outTradeNo) throws WeixinException {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("nonce_str", RandomUtil.generateString(16));
|
||||
obj.put("mch_id", weixinAccount.getMchId());
|
||||
@ -188,8 +190,7 @@ public class CashApi extends MchApi {
|
||||
String param = XmlStream.map2xml(obj);
|
||||
WeixinResponse response = null;
|
||||
try {
|
||||
response = createSSLRequestExecutor(certificate).post(
|
||||
getRequestUri("corppayment_query_uri"), param);
|
||||
response = createSSLRequestExecutor(certificate).post(getRequestUri("corppayment_query_uri"), param);
|
||||
} finally {
|
||||
if (certificate != null) {
|
||||
try {
|
||||
@ -217,11 +218,12 @@ public class CashApi extends MchApi {
|
||||
* @return 结算金额记录
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.payment.mch.SettlementRecord
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/micropay.php?chapter=9_14&index=7">查询结算资金</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/external/micropay.php?chapter=9_14&index=7">
|
||||
* 查询结算资金接口</a>
|
||||
*/
|
||||
public SettlementRecord querySettlement(boolean status, Pageable pageable,
|
||||
Date start, Date end) throws WeixinException {
|
||||
public SettlementRecord querySettlement(boolean status, Pageable pageable, Date start, Date end)
|
||||
throws WeixinException {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("nonce_str", RandomUtil.generateString(16));
|
||||
obj.put("mch_id", weixinAccount.getMchId());
|
||||
@ -237,8 +239,7 @@ public class CashApi extends MchApi {
|
||||
}
|
||||
obj.put("sign", weixinSignature.sign(obj));
|
||||
String param = XmlStream.map2xml(obj);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("settlement_query_uri"), param);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("settlement_query_uri"), param);
|
||||
return response.getAsObject(new TypeReference<SettlementRecord>() {
|
||||
});
|
||||
}
|
||||
@ -252,11 +253,11 @@ public class CashApi extends MchApi {
|
||||
* 日期 不填则默认当天
|
||||
* @return 汇率 例如美元兑换人民币的比例为6.5
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/micropay.php?chapter=9_15&index=8">查询汇率</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/external/micropay.php?chapter=9_15&index=8">
|
||||
* 查询汇率接口</a>
|
||||
*/
|
||||
public double queryExchageRate(CurrencyType currencyType, Date date)
|
||||
throws WeixinException {
|
||||
public double queryExchageRate(CurrencyType currencyType, Date date) throws WeixinException {
|
||||
if (date == null) {
|
||||
date = new Date();
|
||||
}
|
||||
@ -268,10 +269,8 @@ public class CashApi extends MchApi {
|
||||
obj.put("date", DateUtil.fortmat2yyyyMMdd(date));
|
||||
obj.put("sign", weixinSignature.sign(obj));
|
||||
String param = XmlStream.map2xml(obj);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("exchagerate_query_uri"), param);
|
||||
BigDecimal rate = new BigDecimal(XmlStream.xml2map(
|
||||
response.getAsString()).get("rate"));
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("exchagerate_query_uri"), param);
|
||||
BigDecimal rate = new BigDecimal(XmlStream.xml2map(response.getAsString()).get("rate"));
|
||||
return rate.divide(new BigDecimal(100000000d)).doubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ import com.foxinmy.weixin4j.xml.XmlStream;
|
||||
* @author jy
|
||||
* @date 2015年3月25日
|
||||
* @since JDK 1.6
|
||||
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/sp_coupon.php">代金券文档</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 {
|
||||
|
||||
@ -45,7 +45,7 @@ public class CouponApi extends MchApi {
|
||||
* @return 发放结果
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponResult
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/sp_coupon.php?chapter=12_3">发放代金券接口</a>
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_3">发放代金券接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CouponResult sendCoupon(InputStream certificate,
|
||||
@ -91,7 +91,7 @@ public class CouponApi extends MchApi {
|
||||
* @return 代金券批次信息
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponStock
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/sp_coupon.php?chapter=12_4">查询代金券批次信息</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)
|
||||
@ -114,7 +114,7 @@ public class CouponApi extends MchApi {
|
||||
* @return 代金券详细信息
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponDetail
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/sp_coupon.php?chapter=12_5">查询代金券详细信息</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)
|
||||
|
||||
@ -38,7 +38,7 @@ public class CustomsApi extends MchApi {
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CustomsOrder
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CustomsOrderResult
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_1">附加订单信息</a>
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_1">附加订单信息提交接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CustomsOrderResult declareCustomsOrder(CustomsOrder customsOrder)
|
||||
@ -64,7 +64,7 @@ public class CustomsApi extends MchApi {
|
||||
* @return 报关记录
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CustomsOrderRecord
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_1">附加订单信息</a>
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_1">附加订单信息查询接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CustomsOrderRecord queryCustomsOrder(IdQuery idQuery,
|
||||
|
||||
@ -51,13 +51,12 @@ import com.foxinmy.weixin4j.xml.ListsuffixResultDeserializer;
|
||||
import com.foxinmy.weixin4j.xml.XmlStream;
|
||||
|
||||
/**
|
||||
* (商户平台版)支付API
|
||||
* 支付API
|
||||
*
|
||||
* @className Pay3Api
|
||||
* @className PayApi
|
||||
* @author jy
|
||||
* @date 2014年10月28日
|
||||
* @since JDK 1.6
|
||||
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/index.html">商户平台API</a>
|
||||
*/
|
||||
public class PayApi extends MchApi {
|
||||
|
||||
@ -74,16 +73,16 @@ public class PayApi extends MchApi {
|
||||
* 包含订单信息的对象
|
||||
* @see com.foxinmy.weixin4j.payment.mch.MchPayPackage
|
||||
* @see com.foxinmy.weixin4j.payment.mch.PrePay
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1">统一下单接口</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1">统一下单接口
|
||||
* </a>
|
||||
* @return 预支付对象
|
||||
*/
|
||||
public PrePay createPrePay(MchPayPackage payPackage) throws WeixinException {
|
||||
payPackage.declareWeixinPayAccount(weixinAccount);
|
||||
payPackage.setSign(weixinSignature.sign(payPackage));
|
||||
String payJsRequestXml = XmlStream.toXML(payPackage);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("order_create_uri"), payJsRequestXml);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("order_create_uri"), payJsRequestXml);
|
||||
return response.getAsObject(new TypeReference<PrePay>() {
|
||||
});
|
||||
}
|
||||
@ -101,8 +100,7 @@ public class PayApi extends MchApi {
|
||||
* @see com.foxinmy.weixin4j.payment.mch.WAPPayRequest WAP支付
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createPayRequest(MchPayPackage payPackage)
|
||||
throws WeixinException {
|
||||
public MchPayRequest createPayRequest(MchPayPackage payPackage) throws WeixinException {
|
||||
PrePay prePay = createPrePay(payPackage);
|
||||
String tradeType = payPackage.getTradeType();
|
||||
if (TradeType.APP.name().equalsIgnoreCase(tradeType)) {
|
||||
@ -110,17 +108,14 @@ public class PayApi extends MchApi {
|
||||
} else if (TradeType.JSAPI.name().equalsIgnoreCase(tradeType)) {
|
||||
return new JSAPIPayRequest(prePay.getPrepayId(), weixinAccount);
|
||||
} else if (TradeType.NATIVE.name().equalsIgnoreCase(tradeType)) {
|
||||
return new NATIVEPayRequest(prePay.getPrepayId(),
|
||||
prePay.getCodeUrl(), weixinAccount);
|
||||
return new NATIVEPayRequest(prePay.getPrepayId(), prePay.getCodeUrl(), weixinAccount);
|
||||
} else if (TradeType.WAP.name().equalsIgnoreCase(tradeType)) {
|
||||
return new WAPPayRequest(prePay.getPrepayId(), weixinAccount);
|
||||
} else if (TradeType.MICROPAY.name().equalsIgnoreCase(tradeType)) {
|
||||
String para = XmlStream.toXML(payPackage);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("micropay_uri"), para);
|
||||
MICROPayRequest microPayRequest = response
|
||||
.getAsObject(new TypeReference<MICROPayRequest>() {
|
||||
});
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("micropay_uri"), para);
|
||||
MICROPayRequest microPayRequest = response.getAsObject(new TypeReference<MICROPayRequest>() {
|
||||
});
|
||||
microPayRequest.setPaymentAccount(weixinAccount);
|
||||
return microPayRequest;
|
||||
} else {
|
||||
@ -169,15 +164,12 @@ public class PayApi extends MchApi {
|
||||
* @see com.foxinmy.weixin4j.payment.mch.WAPPayRequest WAP支付
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createPayRequest(String body, String detail,
|
||||
String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, TradeType tradeType, String openId,
|
||||
String productId, String attach, Date timeStart, Date timeExpire,
|
||||
String goodsTag, String limitPay, String subOpenId)
|
||||
public MchPayRequest createPayRequest(String body, String detail, String outTradeNo, double totalFee,
|
||||
String notifyUrl, String createIp, TradeType tradeType, String openId, String productId, String attach,
|
||||
Date timeStart, Date timeExpire, String goodsTag, String limitPay, String subOpenId)
|
||||
throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, tradeType, openId, null,
|
||||
productId, attach);
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, tradeType, openId,
|
||||
null, productId, attach);
|
||||
payPackage.setTimeStart(timeStart);
|
||||
payPackage.setTimeExpire(timeExpire);
|
||||
payPackage.setGoodsTag(goodsTag);
|
||||
@ -208,12 +200,10 @@ public class PayApi extends MchApi {
|
||||
* @return JSAPI支付对象
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createJSPayRequest(String openId, String body,
|
||||
String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, TradeType.JSAPI, openId, null,
|
||||
null, attach);
|
||||
public MchPayRequest createJSPayRequest(String openId, String body, String outTradeNo, double totalFee,
|
||||
String notifyUrl, String createIp, String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.JSAPI,
|
||||
openId, null, null, attach);
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
|
||||
@ -222,18 +212,24 @@ public class PayApi extends MchApi {
|
||||
* 生成编辑地址请求
|
||||
* </p>
|
||||
*
|
||||
* err_msg edit_address:ok获取编辑收货地址成功</br> edit_address:fail获取编辑收货地址失败</br>
|
||||
* userName 收货人姓名</br> telNumber 收货人电话</br> addressPostalCode 邮编</br>
|
||||
* proviceFirstStageName 国标收货地址第一级地址</br> addressCitySecondStageName
|
||||
* 国标收货地址第二级地址</br> addressCountiesThirdStageName 国标收货地址第三级地址</br>
|
||||
* addressDetailInfo 详细收货地址信息</br> nationalCode 收货地址国家码</br>
|
||||
* err_msg edit_address:ok获取编辑收货地址成功</br>
|
||||
* edit_address:fail获取编辑收货地址失败</br>
|
||||
* userName 收货人姓名</br>
|
||||
* telNumber 收货人电话</br>
|
||||
* addressPostalCode 邮编</br>
|
||||
* proviceFirstStageName 国标收货地址第一级地址</br>
|
||||
* addressCitySecondStageName 国标收货地址第二级地址</br>
|
||||
* addressCountiesThirdStageName 国标收货地址第三级地址</br>
|
||||
* addressDetailInfo 详细收货地址信息</br>
|
||||
* nationalCode 收货地址国家码</br>
|
||||
*
|
||||
* @param url
|
||||
* 当前访问页的URL
|
||||
* @param oauthToken
|
||||
* oauth授权时产生的token
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_8&index=7">收货地址共享</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_8&index=7">
|
||||
* 收货地址共享</a>
|
||||
* @return 编辑地址请求JSON串
|
||||
*/
|
||||
public String createAddressRequestJSON(String url, String oauthToken) {
|
||||
@ -258,9 +254,12 @@ public class PayApi extends MchApi {
|
||||
* @param productId
|
||||
* 与订单ID等价
|
||||
* @return 支付链接
|
||||
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/native.php">扫码支付</a>
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1">扫码支付
|
||||
* </a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一
|
||||
* </a>
|
||||
*/
|
||||
public String createNativePayRequestURL(String productId) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
@ -272,9 +271,8 @@ public class PayApi extends MchApi {
|
||||
map.put("nonce_str", noncestr);
|
||||
map.put("product_id", productId);
|
||||
String sign = weixinSignature.sign(map);
|
||||
return String.format(getRequestUri("native_pay_uri"), sign,
|
||||
weixinAccount.getId(), weixinAccount.getMchId(), productId,
|
||||
timestamp, noncestr);
|
||||
return String.format(getRequestUri("native_pay_uri"), sign, weixinAccount.getId(), weixinAccount.getMchId(),
|
||||
productId, timestamp, noncestr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -296,17 +294,18 @@ public class PayApi extends MchApi {
|
||||
* 附加数据 非必填
|
||||
* @return Native回调对象
|
||||
* @see com.foxinmy.weixin4j.payment.mch.NativePayResponse
|
||||
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/native.php">扫码支付</a>
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1">扫码支付
|
||||
* </a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一
|
||||
* </a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public NativePayResponse createNativePayResponse(String productId,
|
||||
String body, String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, TradeType.NATIVE, null, null,
|
||||
productId, attach);
|
||||
public NativePayResponse createNativePayResponse(String productId, String body, String outTradeNo, double totalFee,
|
||||
String notifyUrl, String createIp, String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.NATIVE,
|
||||
null, null, productId, attach);
|
||||
PrePay prePay = createPrePay(payPackage);
|
||||
return new NativePayResponse(weixinAccount, prePay.getPrepayId());
|
||||
}
|
||||
@ -330,17 +329,18 @@ public class PayApi extends MchApi {
|
||||
* 附加数据 非必填
|
||||
* @return Native支付对象
|
||||
* @see com.foxinmy.weixin4j.payment.mch.NATIVEPayRequest
|
||||
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/native.php">扫码支付</a>
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_5">模式二</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1">扫码支付
|
||||
* </a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_5">模式二
|
||||
* </a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createNativePayRequest(String productId, String body,
|
||||
String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, TradeType.NATIVE, null, null,
|
||||
productId, attach);
|
||||
public MchPayRequest createNativePayRequest(String productId, String body, String outTradeNo, double totalFee,
|
||||
String notifyUrl, String createIp, String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.NATIVE,
|
||||
null, null, productId, attach);
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
|
||||
@ -361,16 +361,15 @@ public class PayApi extends MchApi {
|
||||
* 附加数据 非必填
|
||||
* @return APP支付对象
|
||||
* @see com.foxinmy.weixin4j.payment.mch.APPPayRequest
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/app.php?chapter=8_1">APP支付</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=8_1">
|
||||
* APP支付</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createAppPayRequest(String body, String outTradeNo,
|
||||
double totalFee, String notifyUrl, String createIp, String attach)
|
||||
throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, TradeType.APP, null, null, null,
|
||||
attach);
|
||||
public MchPayRequest createAppPayRequest(String body, String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.APP,
|
||||
null, null, null, attach);
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
|
||||
@ -391,16 +390,15 @@ public class PayApi extends MchApi {
|
||||
* 附加数据 非必填
|
||||
* @return WAP支付对象
|
||||
* @see com.foxinmy.weixin4j.payment.mch.WAPPayRequest
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/wap.php?chapter=15_1">WAP支付</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/wap.php?chapter=15_1">WAP支付
|
||||
* </a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createWAPPayRequest(String body, String outTradeNo,
|
||||
double totalFee, String notifyUrl, String createIp, String attach)
|
||||
throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, TradeType.WAP, null, null, null,
|
||||
attach);
|
||||
public MchPayRequest createWAPPayRequest(String body, String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.WAP,
|
||||
null, null, null, attach);
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
|
||||
@ -422,24 +420,25 @@ public class PayApi extends MchApi {
|
||||
* @return 支付的订单信息
|
||||
* @see com.foxinmy.weixin4j.payment.mch.MICROPayRequest
|
||||
* @see com.foxinmy.weixin4j.payment.mch.Order
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10">提交被扫支付API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10">
|
||||
* 提交被扫支付API</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createMICROPayRequest(String authCode, String body,
|
||||
String outTradeNo, double totalFee, String createIp, String attach)
|
||||
throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||
totalFee, null, createIp, TradeType.MICROPAY, null, null, null,
|
||||
attach);
|
||||
public MchPayRequest createMICROPayRequest(String authCode, String body, String outTradeNo, double totalFee,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo, totalFee, null, createIp, TradeType.MICROPAY,
|
||||
null, null, null, attach);
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单查询
|
||||
* <p>
|
||||
* 当商户后台、网络、服务器等出现异常,商户系统最终未接收到支付通知;</br> 调用支付接口后,返回系统错误或未知交易状态情况;</br>
|
||||
* 调用被扫支付API,返回USERPAYING的状态;</br> 调用关单或撤销接口API之前,需确认支付状态;
|
||||
* 当商户后台、网络、服务器等出现异常,商户系统最终未接收到支付通知;</br>
|
||||
* 调用支付接口后,返回系统错误或未知交易状态情况;</br>
|
||||
* 调用被扫支付API,返回USERPAYING的状态;</br>
|
||||
* 调用关单或撤销接口API之前,需确认支付状态;
|
||||
* </P>
|
||||
*
|
||||
* @param idQuery
|
||||
@ -447,8 +446,9 @@ public class PayApi extends MchApi {
|
||||
* transaction_id> out_trade_no
|
||||
* @return 订单信息
|
||||
* @see com.foxinmy.weixin4j.payment.mch.Order
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2">订单查询API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2">
|
||||
* 订单查询API</a>
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@ -456,10 +456,8 @@ public class PayApi extends MchApi {
|
||||
Map<String, String> map = createBaseRequestMap(idQuery);
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("order_query_uri"), param);
|
||||
return ListsuffixResultDeserializer.deserialize(response.getAsString(),
|
||||
Order.class);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("order_query_uri"), param);
|
||||
return ListsuffixResultDeserializer.deserialize(response.getAsString(), Order.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -491,14 +489,14 @@ public class PayApi extends MchApi {
|
||||
* 操作员帐号, 默认为商户号
|
||||
* @return 退款申请结果
|
||||
* @see com.foxinmy.weixin4j.payment.mch.RefundResult
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4">申请退款API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4">
|
||||
* 申请退款API</a>
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public RefundResult applyRefund(InputStream certificate, IdQuery idQuery,
|
||||
String outRefundNo, double totalFee, double refundFee,
|
||||
CurrencyType refundFeeType, String opUserId) throws WeixinException {
|
||||
public RefundResult applyRefund(InputStream certificate, IdQuery idQuery, String outRefundNo, double totalFee,
|
||||
double refundFee, CurrencyType refundFeeType, String opUserId) throws WeixinException {
|
||||
WeixinResponse response = null;
|
||||
try {
|
||||
Map<String, String> map = createBaseRequestMap(idQuery);
|
||||
@ -515,8 +513,7 @@ public class PayApi extends MchApi {
|
||||
map.put("refund_fee_type", refundFeeType.name());
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
response = createSSLRequestExecutor(certificate).post(
|
||||
getRequestUri("refund_apply_uri"), param);
|
||||
response = createSSLRequestExecutor(certificate).post(getRequestUri("refund_apply_uri"), param);
|
||||
} finally {
|
||||
if (certificate != null) {
|
||||
try {
|
||||
@ -544,17 +541,18 @@ public class PayApi extends MchApi {
|
||||
* 订单总金额,单位为元
|
||||
* @see {@link #applyRefund(InputStream, IdQuery, String, double, double,CurrencyType, String)}
|
||||
*/
|
||||
public RefundResult applyRefund(InputStream certificate, IdQuery idQuery,
|
||||
String outRefundNo, double totalFee) throws WeixinException {
|
||||
return applyRefund(certificate, idQuery, outRefundNo, totalFee,
|
||||
totalFee, null, null);
|
||||
public RefundResult applyRefund(InputStream certificate, IdQuery idQuery, String outRefundNo, double totalFee)
|
||||
throws WeixinException {
|
||||
return applyRefund(certificate, idQuery, outRefundNo, totalFee, totalFee, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 冲正订单(需要证书)</br> 当支付返回失败,或收银系统超时需要取消交易,可以调用该接口</br> 接口逻辑:支
|
||||
* 付失败的关单,支付成功的撤销支付</br> <font color="red">7天以内的单可撤销,其他正常支付的单
|
||||
* 如需实现相同功能请调用退款接口</font></br> <font
|
||||
* color="red">调用扣款接口后请勿立即调用撤销,需要等待5秒以上。先调用查单接口,如果没有确切的返回,再调用撤销</font></br>
|
||||
* 冲正订单(需要证书)</br>
|
||||
* 当支付返回失败,或收银系统超时需要取消交易,可以调用该接口</br>
|
||||
* 接口逻辑:支 付失败的关单,支付成功的撤销支付</br>
|
||||
* <font color="red">7天以内的单可撤销,其他正常支付的单 如需实现相同功能请调用退款接口</font></br>
|
||||
* <font color="red">调用扣款接口后请勿立即调用撤销,需要等待5秒以上。先调用查单接口,如果没有确切的返回,再调用撤销</font>
|
||||
* </br>
|
||||
*
|
||||
* @param certificate
|
||||
* 后缀为*.p12的证书文件
|
||||
@ -565,14 +563,13 @@ public class PayApi extends MchApi {
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MerchantResult reverseOrder(InputStream certificate, IdQuery idQuery)
|
||||
throws WeixinException {
|
||||
public MerchantResult reverseOrder(InputStream certificate, IdQuery idQuery) throws WeixinException {
|
||||
try {
|
||||
Map<String, String> map = createBaseRequestMap(idQuery);
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = createSSLRequestExecutor(certificate)
|
||||
.post(getRequestUri("order_reverse_uri"), param);
|
||||
WeixinResponse response = createSSLRequestExecutor(certificate).post(getRequestUri("order_reverse_uri"),
|
||||
param);
|
||||
return response.getAsObject(new TypeReference<MerchantResult>() {
|
||||
});
|
||||
} finally {
|
||||
@ -594,8 +591,9 @@ public class PayApi extends MchApi {
|
||||
* 具有native标识的支付URL
|
||||
* @return 转换后的短链接
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_9">转换短链接API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_9">
|
||||
* 转换短链接API</a>
|
||||
*/
|
||||
public String getShorturl(String url) throws WeixinException {
|
||||
Map<String, String> map = createBaseRequestMap(null);
|
||||
@ -606,8 +604,7 @@ public class PayApi extends MchApi {
|
||||
}
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("longurl_convert_uri"), param);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("longurl_convert_uri"), param);
|
||||
map = XmlStream.xml2map(response.getAsString());
|
||||
return map.get("short_url");
|
||||
}
|
||||
@ -624,16 +621,15 @@ public class PayApi extends MchApi {
|
||||
* @return 处理结果
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_3">关闭订单API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_3">
|
||||
* 关闭订单API</a>
|
||||
*/
|
||||
public MerchantResult closeOrder(String outTradeNo) throws WeixinException {
|
||||
Map<String, String> map = createBaseRequestMap(new IdQuery(outTradeNo,
|
||||
IdType.TRADENO));
|
||||
Map<String, String> map = createBaseRequestMap(new IdQuery(outTradeNo, IdType.TRADENO));
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("order_close_uri"), param);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("order_close_uri"), param);
|
||||
return response.getAsObject(new TypeReference<MerchantResult>() {
|
||||
});
|
||||
}
|
||||
@ -654,12 +650,12 @@ public class PayApi extends MchApi {
|
||||
* 对账单保存路径
|
||||
* @return excel表格
|
||||
* @since V3
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_6">下载对账单API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_6">
|
||||
* 下载对账单API</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public File downloadBill(Date billDate, BillType billType, String billPath)
|
||||
throws WeixinException {
|
||||
public File downloadBill(Date billDate, BillType billType, String billPath) throws WeixinException {
|
||||
if (billDate == null) {
|
||||
Calendar now = Calendar.getInstance();
|
||||
now.add(Calendar.DAY_OF_MONTH, -1);
|
||||
@ -669,8 +665,8 @@ public class PayApi extends MchApi {
|
||||
billType = BillType.ALL;
|
||||
}
|
||||
String formatBillDate = DateUtil.fortmat2yyyyMMdd(billDate);
|
||||
String fileName = String.format("%s_%s_%s.txt", formatBillDate,
|
||||
billType.name().toLowerCase(), weixinAccount.getId());
|
||||
String fileName = String.format("%s_%s_%s.txt", formatBillDate, billType.name().toLowerCase(),
|
||||
weixinAccount.getId());
|
||||
File file = new File(String.format("%s/%s", billPath, fileName));
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
@ -680,16 +676,14 @@ public class PayApi extends MchApi {
|
||||
map.put("bill_type", billType.name());
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("downloadbill_uri"), param);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("downloadbill_uri"), param);
|
||||
|
||||
BufferedReader reader = null;
|
||||
BufferedWriter writer = null;
|
||||
try {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(file), Consts.GBK));
|
||||
reader = new BufferedReader(new InputStreamReader(
|
||||
response.getBody(), com.foxinmy.weixin4j.model.Consts.GBK));
|
||||
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), Consts.GBK));
|
||||
reader = new BufferedReader(
|
||||
new InputStreamReader(response.getBody(), com.foxinmy.weixin4j.model.Consts.GBK));
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
writer.write(line);
|
||||
@ -726,8 +720,9 @@ public class PayApi extends MchApi {
|
||||
* @return 退款记录
|
||||
* @see com.foxinmy.weixin4j.payment.mch.RefundRecord
|
||||
* @see com.foxinmy.weixin4j.payment.mch.RefundDetail
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_5">退款查询API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_5">
|
||||
* 退款查询API</a>
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@ -735,10 +730,8 @@ public class PayApi extends MchApi {
|
||||
Map<String, String> map = createBaseRequestMap(idQuery);
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("refund_query_uri"), param);
|
||||
return ListsuffixResultDeserializer.deserialize(response.getAsString(),
|
||||
RefundRecord.class);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("refund_query_uri"), param);
|
||||
return ListsuffixResultDeserializer.deserialize(response.getAsString(), RefundRecord.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -759,13 +752,13 @@ public class PayApi extends MchApi {
|
||||
* 调用接口返回的基本数据
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_8">接口测试上报API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_8">
|
||||
* 接口测试上报API</a>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public XmlResult interfaceReport(String interfaceUrl, int executeTime,
|
||||
String outTradeNo, String ip, Date time, XmlResult returnXml)
|
||||
throws WeixinException {
|
||||
public XmlResult interfaceReport(String interfaceUrl, int executeTime, String outTradeNo, String ip, Date time,
|
||||
XmlResult returnXml) throws WeixinException {
|
||||
Map<String, String> map = createBaseRequestMap(null);
|
||||
map.put("interface_url", interfaceUrl);
|
||||
map.put("execute_time_", Integer.toString(executeTime));
|
||||
@ -775,8 +768,7 @@ public class PayApi extends MchApi {
|
||||
map.putAll((Map<String, String>) JSON.toJSON(returnXml));
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("interface_report_uri"), param);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("interface_report_uri"), param);
|
||||
return response.getAsXmlResult();
|
||||
}
|
||||
|
||||
@ -787,8 +779,9 @@ public class PayApi extends MchApi {
|
||||
* 扫码支付授权码,设备读取用户微信中的条码或者二维码信息
|
||||
* @return 查询结果
|
||||
* @see com.foxinmy.weixin4j.payment.mch.OpenIdResult
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_13&index=9">授权码查询OPENID</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_13&index=9">
|
||||
* 授权码查询OPENID</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public OpenIdResult authCode2openId(String authCode) throws WeixinException {
|
||||
@ -796,8 +789,7 @@ public class PayApi extends MchApi {
|
||||
map.put("auth_code", authCode);
|
||||
map.put("sign", weixinSignature.sign(map));
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("authcode_openid_uri"), param);
|
||||
WeixinResponse response = weixinExecutor.post(getRequestUri("authcode_openid_uri"), param);
|
||||
return response.getAsObject(new TypeReference<OpenIdResult>() {
|
||||
});
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import com.alibaba.fastjson.annotation.JSONField;
|
||||
* @date 2014年9月24日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/17/fa4e1434e57290788bde25603fa2fcbd.html">公众平台全局返回码说明</a>
|
||||
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433747234&token=&lang=zh_CN">公众平台全局返回码说明</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%85%A8%E5%B1%80%E8%BF%94%E5%9B%9E%E7%A0%81%E8%AF%B4%E6%98%8E">企业号全局返回码说明</a>
|
||||
*/
|
||||
|
||||
@ -1,348 +1,338 @@
|
||||
package com.foxinmy.weixin4j.jssdk;
|
||||
|
||||
/**
|
||||
* JSSDK接口列表
|
||||
*
|
||||
* @className JSSDKAPI
|
||||
* @author jy
|
||||
* @date 2015年12月23日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
*/
|
||||
public enum JSSDKAPI {
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0.E6.9C.8B.E5.8F.8B.E5.9C.88.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到朋友圈”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareTimeline,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E7.BB.99.E6.9C.8B.E5.8F.8B.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享给朋友”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareAppMessage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0QQ.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到QQ”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareQQ,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0.E8.85.BE.E8.AE.AF.E5.BE.AE.E5.8D.9A.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareWeibo,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0QQ.E7.A9.BA.E9.97.B4.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到QQ空间”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareQZone,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.8B.8D.E7.85.A7.E6.88.96.E4.BB.8E.E6.89.8B.E6.9C.BA.E7.9B.B8.E5.86.8C.E4.B8.AD.E9.80.89.E5.9B.BE.E6.8E.A5.E5.8F.A3"
|
||||
* >图像接口-拍照或从手机相册中选图接口</a>
|
||||
*/
|
||||
chooseImage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E9.A2.84.E8.A7.88.E5.9B.BE.E7.89.87.E6.8E.A5.E5.8F.A3"
|
||||
* >图像接口-预览图片接口</a>
|
||||
*/
|
||||
previewImage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.B8.8A.E4.BC.A0.E5.9B.BE.E7.89.87.E6.8E.A5.E5.8F.A3"
|
||||
* >图像接口-上传图片接口</a>
|
||||
*/
|
||||
uploadImage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.B8.8B.E8.BD.BD.E5.9B.BE.E7.89.87.E6.8E.A5.E5.8F.A3"
|
||||
* >图像接口-下载图片接口</a>
|
||||
*/
|
||||
downloadImage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.BC.80.E5.A7.8B.E5.BD.95.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-开始录音接口</a>
|
||||
*/
|
||||
startRecord,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.81.9C.E6.AD.A2.E5.BD.95.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-停止录音接口</a>
|
||||
*/
|
||||
stopRecord,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E7.9B.91.E5.90.AC.E5.BD.95.E9.9F.B3.E8.87.AA.E5.8A.A8.E5.81.9C.E6.AD.A2.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-监听录音自动停止接口</a>
|
||||
*/
|
||||
onVoiceRecordEnd,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.92.AD.E6.94.BE.E8.AF.AD.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-播放语音接口</a>
|
||||
*/
|
||||
playVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.9A.82.E5.81.9C.E6.92.AD.E6.94.BE.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-暂停播放接口</a>
|
||||
*/
|
||||
pauseVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.81.9C.E6.AD.A2.E6.92.AD.E6.94.BE.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-停止播放接口</a>
|
||||
*/
|
||||
stopVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E7.9B.91.E5.90.AC.E8.AF.AD.E9.9F.B3.E6.92.AD.E6.94.BE.E5.AE.8C.E6.AF.95.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-监听语音播放完毕接口</a>
|
||||
*/
|
||||
onVoicePlayEnd,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.B8.8A.E4.BC.A0.E8.AF.AD.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-上传语音接口</a>
|
||||
*/
|
||||
uploadVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.B8.8B.E8.BD.BD.E8.AF.AD.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-下载语音接口</a>
|
||||
*/
|
||||
downloadVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.AF.86.E5.88.AB.E9.9F.B3.E9.A2.91.E5.B9.B6.E8.BF.94.E5.9B.9E.E8.AF.86.E5.88.AB.E7.BB.93.E6.9E.9C.E6.8E.A5.E5.8F.A3"
|
||||
* >智能接口-识别音频并返回识别结果接口</a>
|
||||
*/
|
||||
translateVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E7.BD.91.E7.BB.9C.E7.8A.B6.E6.80.81.E6.8E.A5.E5.8F.A3"
|
||||
* >设备信息-获取网络状态接口</a>
|
||||
*/
|
||||
getNetworkType,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.BD.BF.E7.94.A8.E5.BE.AE.E4.BF.A1.E5.86.85.E7.BD.AE.E5.9C.B0.E5.9B.BE.E6.9F.A5.E7.9C.8B.E4.BD.8D.E7.BD.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >地理位置-使用微信内置地图查看位置接口</a>
|
||||
*/
|
||||
openLocation,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E5.9C.B0.E7.90.86.E4.BD.8D.E7.BD.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >地理位置-获取地理位置接口</a>
|
||||
*/
|
||||
getLocation,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.BC.80.E5.90.AF.E6.9F.A5.E6.89.BE.E5.91.A8.E8.BE.B9ibeacon.E8.AE.BE.E5.A4.87.E6.8E.A5.E5.8F.A3"
|
||||
* >摇一摇周边-开启查找周边ibeacon设备接口</a>
|
||||
*/
|
||||
startSearchBeacons,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.85.B3.E9.97.AD.E6.9F.A5.E6.89.BE.E5.91.A8.E8.BE.B9ibeacon.E8.AE.BE.E5.A4.87.E6.8E.A5.E5.8F.A3"
|
||||
* >摇一摇周边-关闭查找周边ibeacon设备接口</a>
|
||||
*/
|
||||
stopSearchBeacons,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E7.9B.91.E5.90.AC.E5.91.A8.E8.BE.B9ibeacon.E8.AE.BE.E5.A4.87.E6.8E.A5.E5.8F.A3"
|
||||
* >摇一摇周边-监听周边ibeacon设备接口</a>
|
||||
*/
|
||||
onSearchBeacons,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E9.9A.90.E8.97.8F.E5.8F.B3.E4.B8.8A.E8.A7.92.E8.8F.9C.E5.8D.95.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-隐藏右上角菜单接口</a>
|
||||
*/
|
||||
hideOptionMenu,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.98.BE.E7.A4.BA.E5.8F.B3.E4.B8.8A.E8.A7.92.E8.8F.9C.E5.8D.95.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-显示右上角菜单接口</a>
|
||||
*/
|
||||
showOptionMenu,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.85.B3.E9.97.AD.E5.BD.93.E5.89.8D.E7.BD.91.E9.A1.B5.E7.AA.97.E5.8F.A3.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-关闭当前网页窗口接口</a>
|
||||
*/
|
||||
closeWindow,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.89.B9.E9.87.8F.E9.9A.90.E8.97.8F.E5.8A.9F.E8.83.BD.E6.8C.89.E9.92.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-批量隐藏功能按钮接口</a>
|
||||
*/
|
||||
hideMenuItems,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.89.B9.E9.87.8F.E6.98.BE.E7.A4.BA.E5.8A.9F.E8.83.BD.E6.8C.89.E9.92.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-批量显示功能按钮接口</a>
|
||||
*/
|
||||
showMenuItems,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E9.9A.90.E8.97.8F.E6.89.80.E6.9C.89.E9.9D.9E.E5.9F.BA.E7.A1.80.E6.8C.89.E9.92.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-隐藏所有非基础按钮接口</a>
|
||||
*/
|
||||
hideAllNonBaseMenuItem,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.98.BE.E7.A4.BA.E6.89.80.E6.9C.89.E5.8A.9F.E8.83.BD.E6.8C.89.E9.92.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-显示所有功能按钮接口</a>
|
||||
*/
|
||||
showAllNonBaseMenuItem,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.B0.83.E8.B5.B7.E5.BE.AE.E4.BF.A1.E6.89.AB.E4.B8.80.E6.89.AB.E6.8E.A5.E5.8F.A3"
|
||||
* >微信扫一扫-调起微信扫一扫接口</a>
|
||||
*/
|
||||
scanQRCode,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.B7.B3.E8.BD.AC.E5.BE.AE.E4.BF.A1.E5.95.86.E5.93.81.E9.A1.B5.E6.8E.A5.E5.8F.A3"
|
||||
* >微信小店-跳转微信商品页接口</a>
|
||||
*/
|
||||
openProductSpecificView,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.8B.89.E5.8F.96.E9.80.82.E7.94.A8.E5.8D.A1.E5.88.B8.E5.88.97.E8.A1.A8.E5.B9.B6.E8.8E.B7.E5.8F.96.E7.94.A8.E6.88.B7.E9.80.89.E6.8B.A9.E4.BF.A1.E6.81.AF"
|
||||
* >微信卡券-拉取适用卡券列表并获取用户选择信息</a>
|
||||
*/
|
||||
chooseCard,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.89.B9.E9.87.8F.E6.B7.BB.E5.8A.A0.E5.8D.A1.E5.88.B8.E6.8E.A5.E5.8F.A3"
|
||||
* >微信卡券-批量添加卡券接口</a>
|
||||
*/
|
||||
addCard,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.9F.A5.E7.9C.8B.E5.BE.AE.E4.BF.A1.E5.8D.A1.E5.8C.85.E4.B8.AD.E7.9A.84.E5.8D.A1.E5.88.B8.E6.8E.A5.E5.8F.A3"
|
||||
* >微信卡券-查看微信卡包中的卡券接口</a>
|
||||
*/
|
||||
openCard,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.A0.B8.E9.94.80.E5.90.8E.E5.86.8D.E6.AC.A1.E8.B5.A0.E9.80.81.E5.8D.A1.E5.88.B8.E6.8E.A5.E5.8F.A3"
|
||||
* >微信卡券-核销后再次赠送卡券接口</a>
|
||||
*/
|
||||
consumeAndShareCard,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.8F.91.E8.B5.B7.E4.B8.80.E4.B8.AA.E5.BE.AE.E4.BF.A1.E6.94.AF.E4.BB.98.E8.AF.B7.E6.B1.82"
|
||||
* >微信支付-发起一个微信支付请求</a>
|
||||
*/
|
||||
chooseWXPay,
|
||||
/**
|
||||
* <a href=
|
||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BE%AE%E4%BF%A1JS-SDK%E6%8E%A5%E5%8F%A3#.E5.88.9B.E5.BB.BA.E4.BC.81.E4.B8.9A.E5.8F.B7.E4.BC.9A.E8.AF.9D"
|
||||
* >企业号会话-创建企业号会话</a>
|
||||
*/
|
||||
openEnterpriseChat,
|
||||
/**
|
||||
* 企业号-选取联系人(内测)
|
||||
*/
|
||||
openEnterpriseContact;
|
||||
|
||||
/**
|
||||
* 分享接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] SHARE_APIS = { onMenuShareTimeline,
|
||||
onMenuShareAppMessage, onMenuShareQQ, onMenuShareWeibo,
|
||||
onMenuShareQZone };
|
||||
/**
|
||||
* 图像接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] IMAGE_APIS = { chooseImage, previewImage,
|
||||
uploadImage, downloadImage };
|
||||
/**
|
||||
* 音频接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] RECORD_APIS = { startRecord, stopRecord,
|
||||
onVoiceRecordEnd, playVoice, pauseVoice, stopVoice, onVoicePlayEnd,
|
||||
uploadVoice, downloadVoice };
|
||||
/**
|
||||
* 智能接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] SEM_APIS = { translateVoice };
|
||||
/**
|
||||
* 设备信息接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] DEVICE_APIS = { getNetworkType };
|
||||
/**
|
||||
* 地理位置接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] LOCATION_APIS = { openLocation, getLocation };
|
||||
/**
|
||||
* 摇一摇周边接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] BEACON_APIS = { startSearchBeacons,
|
||||
stopSearchBeacons, onSearchBeacons };
|
||||
/**
|
||||
* 界面操作接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] UI_APIS = { hideOptionMenu, showOptionMenu,
|
||||
closeWindow, hideMenuItems, showMenuItems, hideAllNonBaseMenuItem,
|
||||
showAllNonBaseMenuItem };
|
||||
/**
|
||||
* 微信扫一扫接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] SCAN_APIS = { scanQRCode };
|
||||
/**
|
||||
* 微信小店接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] SHOP_APIS = { openProductSpecificView };
|
||||
/**
|
||||
* 微信卡券接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] CARD_APIS = { chooseCard, addCard, openCard,
|
||||
consumeAndShareCard };
|
||||
/**
|
||||
* 微信支付接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] PAY_APIS = { chooseWXPay };
|
||||
/**
|
||||
* 企业号会话接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] CHAT_APIS = { openEnterpriseChat };
|
||||
|
||||
/**
|
||||
* 公众平台全部接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] MP_ALL_APIS = { onMenuShareTimeline,
|
||||
onMenuShareAppMessage, onMenuShareQQ, onMenuShareWeibo,
|
||||
onMenuShareQZone, chooseImage, previewImage, uploadImage,
|
||||
downloadImage, startRecord, stopRecord, onVoiceRecordEnd,
|
||||
playVoice, pauseVoice, stopVoice, onVoicePlayEnd, uploadVoice,
|
||||
downloadVoice, translateVoice, getNetworkType, openLocation,
|
||||
getLocation, startSearchBeacons, stopSearchBeacons,
|
||||
onSearchBeacons, hideOptionMenu, showOptionMenu, closeWindow,
|
||||
hideMenuItems, showMenuItems, hideAllNonBaseMenuItem,
|
||||
showAllNonBaseMenuItem, scanQRCode, openProductSpecificView,
|
||||
chooseCard, addCard, openCard, consumeAndShareCard, chooseWXPay };
|
||||
/**
|
||||
* 企业号全部接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] QY_ALL_APIS = { onMenuShareTimeline,
|
||||
onMenuShareAppMessage, onMenuShareQQ, onMenuShareWeibo,
|
||||
onMenuShareQZone, chooseImage, previewImage, uploadImage,
|
||||
downloadImage, startRecord, stopRecord, onVoiceRecordEnd,
|
||||
playVoice, pauseVoice, stopVoice, onVoicePlayEnd, uploadVoice,
|
||||
downloadVoice, translateVoice, getNetworkType, openLocation,
|
||||
getLocation, startSearchBeacons, stopSearchBeacons,
|
||||
onSearchBeacons, hideOptionMenu, showOptionMenu, closeWindow,
|
||||
hideMenuItems, showMenuItems, hideAllNonBaseMenuItem,
|
||||
showAllNonBaseMenuItem, scanQRCode, openEnterpriseChat,
|
||||
openEnterpriseContact };
|
||||
}
|
||||
package com.foxinmy.weixin4j.jssdk;
|
||||
|
||||
/**
|
||||
* JSSDK接口列表
|
||||
*
|
||||
* @className JSSDKAPI
|
||||
* @author jy
|
||||
* @date 2015年12月23日
|
||||
* @since JDK 1.6
|
||||
* @see <a href=
|
||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN">
|
||||
* 公众平台JSSDK</a>
|
||||
* @see <a href=
|
||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BE%AE%E4%BF%A1JS-SDK%E6%8E%A5%E5%8F%A3">
|
||||
* 企业号JSSDK</a>
|
||||
*/
|
||||
public enum JSSDKAPI {
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0.E6.9C.8B.E5.8F.8B.E5.9C.88.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到朋友圈”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareTimeline,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E7.BB.99.E6.9C.8B.E5.8F.8B.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享给朋友”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareAppMessage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0QQ.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到QQ”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareQQ,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0.E8.85.BE.E8.AE.AF.E5.BE.AE.E5.8D.9A.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareWeibo,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0QQ.E7.A9.BA.E9.97.B4.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到QQ空间”按钮点击状态及自定义分享内容接口</a>
|
||||
*/
|
||||
onMenuShareQZone,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.8B.8D.E7.85.A7.E6.88.96.E4.BB.8E.E6.89.8B.E6.9C.BA.E7.9B.B8.E5.86.8C.E4.B8.AD.E9.80.89.E5.9B.BE.E6.8E.A5.E5.8F.A3"
|
||||
* >图像接口-拍照或从手机相册中选图接口</a>
|
||||
*/
|
||||
chooseImage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E9.A2.84.E8.A7.88.E5.9B.BE.E7.89.87.E6.8E.A5.E5.8F.A3"
|
||||
* >图像接口-预览图片接口</a>
|
||||
*/
|
||||
previewImage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.B8.8A.E4.BC.A0.E5.9B.BE.E7.89.87.E6.8E.A5.E5.8F.A3"
|
||||
* >图像接口-上传图片接口</a>
|
||||
*/
|
||||
uploadImage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.B8.8B.E8.BD.BD.E5.9B.BE.E7.89.87.E6.8E.A5.E5.8F.A3"
|
||||
* >图像接口-下载图片接口</a>
|
||||
*/
|
||||
downloadImage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.BC.80.E5.A7.8B.E5.BD.95.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-开始录音接口</a>
|
||||
*/
|
||||
startRecord,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.81.9C.E6.AD.A2.E5.BD.95.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-停止录音接口</a>
|
||||
*/
|
||||
stopRecord,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E7.9B.91.E5.90.AC.E5.BD.95.E9.9F.B3.E8.87.AA.E5.8A.A8.E5.81.9C.E6.AD.A2.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-监听录音自动停止接口</a>
|
||||
*/
|
||||
onVoiceRecordEnd,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.92.AD.E6.94.BE.E8.AF.AD.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-播放语音接口</a>
|
||||
*/
|
||||
playVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.9A.82.E5.81.9C.E6.92.AD.E6.94.BE.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-暂停播放接口</a>
|
||||
*/
|
||||
pauseVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.81.9C.E6.AD.A2.E6.92.AD.E6.94.BE.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-停止播放接口</a>
|
||||
*/
|
||||
stopVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E7.9B.91.E5.90.AC.E8.AF.AD.E9.9F.B3.E6.92.AD.E6.94.BE.E5.AE.8C.E6.AF.95.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-监听语音播放完毕接口</a>
|
||||
*/
|
||||
onVoicePlayEnd,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.B8.8A.E4.BC.A0.E8.AF.AD.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-上传语音接口</a>
|
||||
*/
|
||||
uploadVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.B8.8B.E8.BD.BD.E8.AF.AD.E9.9F.B3.E6.8E.A5.E5.8F.A3"
|
||||
* >音频接口-下载语音接口</a>
|
||||
*/
|
||||
downloadVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.AF.86.E5.88.AB.E9.9F.B3.E9.A2.91.E5.B9.B6.E8.BF.94.E5.9B.9E.E8.AF.86.E5.88.AB.E7.BB.93.E6.9E.9C.E6.8E.A5.E5.8F.A3"
|
||||
* >智能接口-识别音频并返回识别结果接口</a>
|
||||
*/
|
||||
translateVoice,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E7.BD.91.E7.BB.9C.E7.8A.B6.E6.80.81.E6.8E.A5.E5.8F.A3"
|
||||
* >设备信息-获取网络状态接口</a>
|
||||
*/
|
||||
getNetworkType,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E4.BD.BF.E7.94.A8.E5.BE.AE.E4.BF.A1.E5.86.85.E7.BD.AE.E5.9C.B0.E5.9B.BE.E6.9F.A5.E7.9C.8B.E4.BD.8D.E7.BD.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >地理位置-使用微信内置地图查看位置接口</a>
|
||||
*/
|
||||
openLocation,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E5.9C.B0.E7.90.86.E4.BD.8D.E7.BD.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >地理位置-获取地理位置接口</a>
|
||||
*/
|
||||
getLocation,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.BC.80.E5.90.AF.E6.9F.A5.E6.89.BE.E5.91.A8.E8.BE.B9ibeacon.E8.AE.BE.E5.A4.87.E6.8E.A5.E5.8F.A3"
|
||||
* >摇一摇周边-开启查找周边ibeacon设备接口</a>
|
||||
*/
|
||||
startSearchBeacons,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.85.B3.E9.97.AD.E6.9F.A5.E6.89.BE.E5.91.A8.E8.BE.B9ibeacon.E8.AE.BE.E5.A4.87.E6.8E.A5.E5.8F.A3"
|
||||
* >摇一摇周边-关闭查找周边ibeacon设备接口</a>
|
||||
*/
|
||||
stopSearchBeacons,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E7.9B.91.E5.90.AC.E5.91.A8.E8.BE.B9ibeacon.E8.AE.BE.E5.A4.87.E6.8E.A5.E5.8F.A3"
|
||||
* >摇一摇周边-监听周边ibeacon设备接口</a>
|
||||
*/
|
||||
onSearchBeacons,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E9.9A.90.E8.97.8F.E5.8F.B3.E4.B8.8A.E8.A7.92.E8.8F.9C.E5.8D.95.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-隐藏右上角菜单接口</a>
|
||||
*/
|
||||
hideOptionMenu,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.98.BE.E7.A4.BA.E5.8F.B3.E4.B8.8A.E8.A7.92.E8.8F.9C.E5.8D.95.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-显示右上角菜单接口</a>
|
||||
*/
|
||||
showOptionMenu,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.85.B3.E9.97.AD.E5.BD.93.E5.89.8D.E7.BD.91.E9.A1.B5.E7.AA.97.E5.8F.A3.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-关闭当前网页窗口接口</a>
|
||||
*/
|
||||
closeWindow,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.89.B9.E9.87.8F.E9.9A.90.E8.97.8F.E5.8A.9F.E8.83.BD.E6.8C.89.E9.92.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-批量隐藏功能按钮接口</a>
|
||||
*/
|
||||
hideMenuItems,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.89.B9.E9.87.8F.E6.98.BE.E7.A4.BA.E5.8A.9F.E8.83.BD.E6.8C.89.E9.92.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-批量显示功能按钮接口</a>
|
||||
*/
|
||||
showMenuItems,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E9.9A.90.E8.97.8F.E6.89.80.E6.9C.89.E9.9D.9E.E5.9F.BA.E7.A1.80.E6.8C.89.E9.92.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-隐藏所有非基础按钮接口</a>
|
||||
*/
|
||||
hideAllNonBaseMenuItem,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.98.BE.E7.A4.BA.E6.89.80.E6.9C.89.E5.8A.9F.E8.83.BD.E6.8C.89.E9.92.AE.E6.8E.A5.E5.8F.A3"
|
||||
* >界面操作-显示所有功能按钮接口</a>
|
||||
*/
|
||||
showAllNonBaseMenuItem,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.B0.83.E8.B5.B7.E5.BE.AE.E4.BF.A1.E6.89.AB.E4.B8.80.E6.89.AB.E6.8E.A5.E5.8F.A3"
|
||||
* >微信扫一扫-调起微信扫一扫接口</a>
|
||||
*/
|
||||
scanQRCode,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.B7.B3.E8.BD.AC.E5.BE.AE.E4.BF.A1.E5.95.86.E5.93.81.E9.A1.B5.E6.8E.A5.E5.8F.A3"
|
||||
* >微信小店-跳转微信商品页接口</a>
|
||||
*/
|
||||
openProductSpecificView,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.8B.89.E5.8F.96.E9.80.82.E7.94.A8.E5.8D.A1.E5.88.B8.E5.88.97.E8.A1.A8.E5.B9.B6.E8.8E.B7.E5.8F.96.E7.94.A8.E6.88.B7.E9.80.89.E6.8B.A9.E4.BF.A1.E6.81.AF"
|
||||
* >微信卡券-拉取适用卡券列表并获取用户选择信息</a>
|
||||
*/
|
||||
chooseCard,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.89.B9.E9.87.8F.E6.B7.BB.E5.8A.A0.E5.8D.A1.E5.88.B8.E6.8E.A5.E5.8F.A3"
|
||||
* >微信卡券-批量添加卡券接口</a>
|
||||
*/
|
||||
addCard,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.9F.A5.E7.9C.8B.E5.BE.AE.E4.BF.A1.E5.8D.A1.E5.8C.85.E4.B8.AD.E7.9A.84.E5.8D.A1.E5.88.B8.E6.8E.A5.E5.8F.A3"
|
||||
* >微信卡券-查看微信卡包中的卡券接口</a>
|
||||
*/
|
||||
openCard,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E6.A0.B8.E9.94.80.E5.90.8E.E5.86.8D.E6.AC.A1.E8.B5.A0.E9.80.81.E5.8D.A1.E5.88.B8.E6.8E.A5.E5.8F.A3"
|
||||
* >微信卡券-核销后再次赠送卡券接口</a>
|
||||
*/
|
||||
consumeAndShareCard,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.8F.91.E8.B5.B7.E4.B8.80.E4.B8.AA.E5.BE.AE.E4.BF.A1.E6.94.AF.E4.BB.98.E8.AF.B7.E6.B1.82"
|
||||
* >微信支付-发起一个微信支付请求</a>
|
||||
*/
|
||||
chooseWXPay,
|
||||
/**
|
||||
* <a href=
|
||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BE%AE%E4%BF%A1JS-SDK%E6%8E%A5%E5%8F%A3#.E5.88.9B.E5.BB.BA.E4.BC.81.E4.B8.9A.E5.8F.B7.E4.BC.9A.E8.AF.9D"
|
||||
* >企业号会话-创建企业号会话</a>
|
||||
*/
|
||||
openEnterpriseChat,
|
||||
/**
|
||||
* 企业号-选取联系人(内测)
|
||||
*/
|
||||
openEnterpriseContact;
|
||||
|
||||
/**
|
||||
* 分享接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] SHARE_APIS = { onMenuShareTimeline, onMenuShareAppMessage, onMenuShareQQ,
|
||||
onMenuShareWeibo, onMenuShareQZone };
|
||||
/**
|
||||
* 图像接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] IMAGE_APIS = { chooseImage, previewImage, uploadImage, downloadImage };
|
||||
/**
|
||||
* 音频接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] RECORD_APIS = { startRecord, stopRecord, onVoiceRecordEnd, playVoice, pauseVoice,
|
||||
stopVoice, onVoicePlayEnd, uploadVoice, downloadVoice };
|
||||
/**
|
||||
* 智能接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] SEM_APIS = { translateVoice };
|
||||
/**
|
||||
* 设备信息接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] DEVICE_APIS = { getNetworkType };
|
||||
/**
|
||||
* 地理位置接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] LOCATION_APIS = { openLocation, getLocation };
|
||||
/**
|
||||
* 摇一摇周边接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] BEACON_APIS = { startSearchBeacons, stopSearchBeacons, onSearchBeacons };
|
||||
/**
|
||||
* 界面操作接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] UI_APIS = { hideOptionMenu, showOptionMenu, closeWindow, hideMenuItems,
|
||||
showMenuItems, hideAllNonBaseMenuItem, showAllNonBaseMenuItem };
|
||||
/**
|
||||
* 微信扫一扫接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] SCAN_APIS = { scanQRCode };
|
||||
/**
|
||||
* 微信小店接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] SHOP_APIS = { openProductSpecificView };
|
||||
/**
|
||||
* 微信卡券接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] CARD_APIS = { chooseCard, addCard, openCard, consumeAndShareCard };
|
||||
/**
|
||||
* 微信支付接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] PAY_APIS = { chooseWXPay };
|
||||
/**
|
||||
* 企业号会话接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] CHAT_APIS = { openEnterpriseChat };
|
||||
|
||||
/**
|
||||
* 公众平台全部接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] MP_ALL_APIS = { onMenuShareTimeline, onMenuShareAppMessage, onMenuShareQQ,
|
||||
onMenuShareWeibo, onMenuShareQZone, chooseImage, previewImage, uploadImage, downloadImage, startRecord,
|
||||
stopRecord, onVoiceRecordEnd, playVoice, pauseVoice, stopVoice, onVoicePlayEnd, uploadVoice, downloadVoice,
|
||||
translateVoice, getNetworkType, openLocation, getLocation, startSearchBeacons, stopSearchBeacons,
|
||||
onSearchBeacons, hideOptionMenu, showOptionMenu, closeWindow, hideMenuItems, showMenuItems,
|
||||
hideAllNonBaseMenuItem, showAllNonBaseMenuItem, scanQRCode, openProductSpecificView, chooseCard, addCard,
|
||||
openCard, consumeAndShareCard, chooseWXPay };
|
||||
/**
|
||||
* 企业号全部接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] QY_ALL_APIS = { onMenuShareTimeline, onMenuShareAppMessage, onMenuShareQQ,
|
||||
onMenuShareWeibo, onMenuShareQZone, chooseImage, previewImage, uploadImage, downloadImage, startRecord,
|
||||
stopRecord, onVoiceRecordEnd, playVoice, pauseVoice, stopVoice, onVoicePlayEnd, uploadVoice, downloadVoice,
|
||||
translateVoice, getNetworkType, openLocation, getLocation, startSearchBeacons, stopSearchBeacons,
|
||||
onSearchBeacons, hideOptionMenu, showOptionMenu, closeWindow, hideMenuItems, showMenuItems,
|
||||
hideAllNonBaseMenuItem, showAllNonBaseMenuItem, scanQRCode, openEnterpriseChat, openEnterpriseContact };
|
||||
}
|
||||
|
||||
@ -1,88 +1,88 @@
|
||||
package com.foxinmy.weixin4j.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* access_token是公众号的全局唯一票据,公众号调用各接口时都需使用access_token,正常情况下access_token有效期为7200秒,
|
||||
* 重复获取将导致上次获取的access_token失效
|
||||
*
|
||||
* @className Token
|
||||
* @author jy.hu
|
||||
* @date 2014年4月5日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/11/0e4b294685f817b95cbed85ba5e82b8f.html">微信公众平台获取token</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%BB%E5%8A%A8%E8%B0%83%E7%94%A8">微信企业号的主动模式</a>
|
||||
*/
|
||||
public class Token implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7564855472419104084L;
|
||||
|
||||
/**
|
||||
* 获取到的凭证
|
||||
*/
|
||||
@JSONField(name = "access_token")
|
||||
private String accessToken;
|
||||
/**
|
||||
* 凭证有效时间,单位:秒
|
||||
*/
|
||||
@JSONField(name = "expires_in")
|
||||
private int expiresIn;
|
||||
/**
|
||||
* token创建的时间
|
||||
*/
|
||||
private long createTime;
|
||||
/**
|
||||
* 请求返回的原始结果
|
||||
*/
|
||||
private String originalResult;
|
||||
|
||||
public Token() {
|
||||
this.createTime = System.currentTimeMillis() / 1000l;
|
||||
}
|
||||
|
||||
public Token(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public int getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(int expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getOriginalResult() {
|
||||
return originalResult;
|
||||
}
|
||||
|
||||
public void setOriginalResult(String originalResult) {
|
||||
this.originalResult = originalResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Token [accessToken=" + accessToken + ", expiresIn=" + expiresIn
|
||||
+ ", createTime=" + createTime + "]";
|
||||
}
|
||||
}
|
||||
package com.foxinmy.weixin4j.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* access_token是公众号的全局唯一票据,公众号调用各接口时都需使用access_token,正常情况下access_token有效期为7200秒,
|
||||
* 重复获取将导致上次获取的access_token失效
|
||||
*
|
||||
* @className Token
|
||||
* @author jy.hu
|
||||
* @date 2014年4月5日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140183&token=&lang=zh_CN">微信公众平台获取token</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%BB%E5%8A%A8%E8%B0%83%E7%94%A8">微信企业号的主动模式</a>
|
||||
*/
|
||||
public class Token implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7564855472419104084L;
|
||||
|
||||
/**
|
||||
* 获取到的凭证
|
||||
*/
|
||||
@JSONField(name = "access_token")
|
||||
private String accessToken;
|
||||
/**
|
||||
* 凭证有效时间,单位:秒
|
||||
*/
|
||||
@JSONField(name = "expires_in")
|
||||
private int expiresIn;
|
||||
/**
|
||||
* token创建的时间
|
||||
*/
|
||||
private long createTime;
|
||||
/**
|
||||
* 请求返回的原始结果
|
||||
*/
|
||||
private String originalResult;
|
||||
|
||||
public Token() {
|
||||
this.createTime = System.currentTimeMillis() / 1000l;
|
||||
}
|
||||
|
||||
public Token(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public int getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(int expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getOriginalResult() {
|
||||
return originalResult;
|
||||
}
|
||||
|
||||
public void setOriginalResult(String originalResult) {
|
||||
this.originalResult = originalResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Token [accessToken=" + accessToken + ", expiresIn=" + expiresIn
|
||||
+ ", createTime=" + createTime + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,8 +115,9 @@ public class WeixinPayProxy {
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.MchPayPackage
|
||||
* @see com.foxinmy.weixin4j.payment.mch.PrePay
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1">统一下单接口</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1">统一下单接口
|
||||
* </a>
|
||||
* @return 预支付对象
|
||||
*/
|
||||
public PrePay createPrePay(MchPayPackage payPackage) throws WeixinException {
|
||||
@ -137,8 +138,7 @@ public class WeixinPayProxy {
|
||||
* @see com.foxinmy.weixin4j.payment.mch.WAPPayRequest WAP支付
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createPayRequest(MchPayPackage payPackage)
|
||||
throws WeixinException {
|
||||
public MchPayRequest createPayRequest(MchPayPackage payPackage) throws WeixinException {
|
||||
return payApi.createPayRequest(payPackage);
|
||||
}
|
||||
|
||||
@ -184,15 +184,12 @@ public class WeixinPayProxy {
|
||||
* @see com.foxinmy.weixin4j.payment.mch.WAPPayRequest WAP支付
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createPayRequest(String body, String detail,
|
||||
String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, TradeType tradeType, String openId,
|
||||
String productId, String attach, Date timeStart, Date timeExpire,
|
||||
String goodsTag, String limitPay, String subOpenId)
|
||||
public MchPayRequest createPayRequest(String body, String detail, String outTradeNo, double totalFee,
|
||||
String notifyUrl, String createIp, TradeType tradeType, String openId, String productId, String attach,
|
||||
Date timeStart, Date timeExpire, String goodsTag, String limitPay, String subOpenId)
|
||||
throws WeixinException {
|
||||
return payApi.createPayRequest(body, detail, outTradeNo, totalFee,
|
||||
notifyUrl, createIp, tradeType, openId, productId, attach,
|
||||
timeStart, timeExpire, goodsTag, limitPay, subOpenId);
|
||||
return payApi.createPayRequest(body, detail, outTradeNo, totalFee, notifyUrl, createIp, tradeType, openId,
|
||||
productId, attach, timeStart, timeExpire, goodsTag, limitPay, subOpenId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -217,11 +214,9 @@ public class WeixinPayProxy {
|
||||
* @return JSAPI支付对象
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createJSPayRequest(String openId, String body,
|
||||
String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
return payApi.createJSPayRequest(openId, body, outTradeNo, totalFee,
|
||||
notifyUrl, createIp, attach);
|
||||
public MchPayRequest createJSPayRequest(String openId, String body, String outTradeNo, double totalFee,
|
||||
String notifyUrl, String createIp, String attach) throws WeixinException {
|
||||
return payApi.createJSPayRequest(openId, body, outTradeNo, totalFee, notifyUrl, createIp, attach);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,19 +224,25 @@ public class WeixinPayProxy {
|
||||
* 生成编辑地址请求
|
||||
* </p>
|
||||
*
|
||||
* err_msg edit_address:ok获取编辑收货地址成功</br> edit_address:fail获取编辑收货地址失败</br>
|
||||
* userName 收货人姓名</br> telNumber 收货人电话</br> addressPostalCode 邮编</br>
|
||||
* proviceFirstStageName 国标收货地址第一级地址</br> addressCitySecondStageName
|
||||
* 国标收货地址第二级地址</br> addressCountiesThirdStageName 国标收货地址第三级地址</br>
|
||||
* addressDetailInfo 详细收货地址信息</br> nationalCode 收货地址国家码</br>
|
||||
* err_msg edit_address:ok获取编辑收货地址成功</br>
|
||||
* edit_address:fail获取编辑收货地址失败</br>
|
||||
* userName 收货人姓名</br>
|
||||
* telNumber 收货人电话</br>
|
||||
* addressPostalCode 邮编</br>
|
||||
* proviceFirstStageName 国标收货地址第一级地址</br>
|
||||
* addressCitySecondStageName 国标收货地址第二级地址</br>
|
||||
* addressCountiesThirdStageName 国标收货地址第三级地址</br>
|
||||
* addressDetailInfo 详细收货地址信息</br>
|
||||
* nationalCode 收货地址国家码</br>
|
||||
*
|
||||
* @param url
|
||||
* 当前访问页的URL
|
||||
* @param oauthToken
|
||||
* oauth授权时产生的token
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_8&index=7">收货地址共享</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_8&index=7">
|
||||
* 收货地址共享</a>
|
||||
* @return 编辑地址请求JSON串
|
||||
*/
|
||||
public String createAddressRequestJSON(String url, String oauthToken) {
|
||||
@ -255,9 +256,12 @@ public class WeixinPayProxy {
|
||||
* 与订单ID等价
|
||||
* @return 支付链接
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/native.php">扫码支付</a>
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1">扫码支付
|
||||
* </a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一
|
||||
* </a>
|
||||
*/
|
||||
public String createNativePayRequestURL(String productId) {
|
||||
return payApi.createNativePayRequestURL(productId);
|
||||
@ -283,16 +287,17 @@ public class WeixinPayProxy {
|
||||
* @return Native回调对象
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.NativePayResponse
|
||||
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/native.php">扫码支付</a>
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1">扫码支付
|
||||
* </a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一
|
||||
* </a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public NativePayResponse createNativePayResponse(String productId,
|
||||
String body, String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
return payApi.createNativePayResponse(productId, body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, attach);
|
||||
public NativePayResponse createNativePayResponse(String productId, String body, String outTradeNo, double totalFee,
|
||||
String notifyUrl, String createIp, String attach) throws WeixinException {
|
||||
return payApi.createNativePayResponse(productId, body, outTradeNo, totalFee, notifyUrl, createIp, attach);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -315,16 +320,17 @@ public class WeixinPayProxy {
|
||||
* @return Native支付对象
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.NATIVEPayRequest
|
||||
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/native.php">扫码支付</a>
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_5">模式二</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1">扫码支付
|
||||
* </a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_5">模式二
|
||||
* </a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createNativePayRequest(String productId, String body,
|
||||
String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
return payApi.createNativePayRequest(productId, body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, attach);
|
||||
public MchPayRequest createNativePayRequest(String productId, String body, String outTradeNo, double totalFee,
|
||||
String notifyUrl, String createIp, String attach) throws WeixinException {
|
||||
return payApi.createNativePayRequest(productId, body, outTradeNo, totalFee, notifyUrl, createIp, attach);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -345,15 +351,14 @@ public class WeixinPayProxy {
|
||||
* @return APP支付对象
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.APPPayRequest
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/app.php?chapter=8_1">APP支付</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=8_1">
|
||||
* APP支付</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createAppPayRequest(String body, String outTradeNo,
|
||||
double totalFee, String notifyUrl, String createIp, String attach)
|
||||
throws WeixinException {
|
||||
return payApi.createAppPayRequest(body, outTradeNo, totalFee,
|
||||
notifyUrl, createIp, attach);
|
||||
public MchPayRequest createAppPayRequest(String body, String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
return payApi.createAppPayRequest(body, outTradeNo, totalFee, notifyUrl, createIp, attach);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -374,15 +379,14 @@ public class WeixinPayProxy {
|
||||
* @return WAP支付对象
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.WAPPayRequest
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/wap.php?chapter=15_1">WAP支付</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/wap.php?chapter=15_1">WAP支付
|
||||
* </a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createWAPPayRequest(String body, String outTradeNo,
|
||||
double totalFee, String notifyUrl, String createIp, String attach)
|
||||
throws WeixinException {
|
||||
return payApi.createWAPPayRequest(body, outTradeNo, totalFee,
|
||||
notifyUrl, createIp, attach);
|
||||
public MchPayRequest createWAPPayRequest(String body, String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
return payApi.createWAPPayRequest(body, outTradeNo, totalFee, notifyUrl, createIp, attach);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -404,22 +408,23 @@ public class WeixinPayProxy {
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.MICROPayRequest
|
||||
* @see com.foxinmy.weixin4j.payment.mch.Order
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10">提交被扫支付API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10">
|
||||
* 提交被扫支付API</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MchPayRequest createMICROPayRequest(String authCode, String body,
|
||||
String outTradeNo, double totalFee, String createIp, String attach)
|
||||
throws WeixinException {
|
||||
return payApi.createMICROPayRequest(authCode, body, outTradeNo,
|
||||
totalFee, createIp, attach);
|
||||
public MchPayRequest createMICROPayRequest(String authCode, String body, String outTradeNo, double totalFee,
|
||||
String createIp, String attach) throws WeixinException {
|
||||
return payApi.createMICROPayRequest(authCode, body, outTradeNo, totalFee, createIp, attach);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单查询
|
||||
* <p>
|
||||
* 当商户后台、网络、服务器等出现异常,商户系统最终未接收到支付通知;</br> 调用支付接口后,返回系统错误或未知交易状态情况;</br>
|
||||
* 调用被扫支付API,返回USERPAYING的状态;</br> 调用关单或撤销接口API之前,需确认支付状态;
|
||||
* 当商户后台、网络、服务器等出现异常,商户系统最终未接收到支付通知;</br>
|
||||
* 调用支付接口后,返回系统错误或未知交易状态情况;</br>
|
||||
* 调用被扫支付API,返回USERPAYING的状态;</br>
|
||||
* 调用关单或撤销接口API之前,需确认支付状态;
|
||||
* </P>
|
||||
*
|
||||
* @param idQuery
|
||||
@ -428,8 +433,9 @@ public class WeixinPayProxy {
|
||||
* @since V3
|
||||
* @see com.foxinmy.weixin4j.payment.mch.Order
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2">订单查询API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2">
|
||||
* 订单查询API</a>
|
||||
* @return 订单详情
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@ -468,16 +474,15 @@ public class WeixinPayProxy {
|
||||
* @return 退款申请结果
|
||||
* @see com.foxinmy.weixin4j.payment.mch.RefundResult
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4">申请退款API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4">
|
||||
* 申请退款API</a>
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public RefundResult applyRefund(InputStream certificate, IdQuery idQuery,
|
||||
String outRefundNo, double totalFee, double refundFee,
|
||||
CurrencyType refundFeeType, String opUserId) throws WeixinException {
|
||||
return payApi.applyRefund(certificate, idQuery, outRefundNo, totalFee,
|
||||
refundFee, refundFeeType, opUserId);
|
||||
public RefundResult applyRefund(InputStream certificate, IdQuery idQuery, String outRefundNo, double totalFee,
|
||||
double refundFee, CurrencyType refundFeeType, String opUserId) throws WeixinException {
|
||||
return payApi.applyRefund(certificate, idQuery, outRefundNo, totalFee, refundFee, refundFeeType, opUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -487,11 +492,9 @@ public class WeixinPayProxy {
|
||||
*
|
||||
* @see {@link #applyRefund(InputStream, IdQuery, String, double, double, String,CurrencyType)}
|
||||
*/
|
||||
public RefundResult applyRefund(IdQuery idQuery, String outRefundNo,
|
||||
double totalFee) throws WeixinException, IOException {
|
||||
return payApi.applyRefund(
|
||||
new FileInputStream(settings.getCertificateFile0()), idQuery,
|
||||
outRefundNo, totalFee);
|
||||
public RefundResult applyRefund(IdQuery idQuery, String outRefundNo, double totalFee)
|
||||
throws WeixinException, IOException {
|
||||
return payApi.applyRefund(new FileInputStream(settings.getCertificateFile0()), idQuery, outRefundNo, totalFee);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -507,8 +510,9 @@ public class WeixinPayProxy {
|
||||
* @return 退款记录
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.RefundRecord
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_5">退款查询API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_5">
|
||||
* 退款查询API</a>
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@ -531,20 +535,22 @@ public class WeixinPayProxy {
|
||||
* @return excel表格
|
||||
* @since V2 & V3
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_6">下载对账单API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_6">
|
||||
* 下载对账单API</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public File downloadBill(Date billDate, BillType billType)
|
||||
throws WeixinException {
|
||||
public File downloadBill(Date billDate, BillType billType) throws WeixinException {
|
||||
return payApi.downloadBill(billDate, billType, settings.getTmpdir0());
|
||||
}
|
||||
|
||||
/**
|
||||
* 冲正订单(需要证书)</br> 当支付返回失败,或收银系统超时需要取消交易,可以调用该接口</br> 接口逻辑:支
|
||||
* 付失败的关单,支付成功的撤销支付</br> <font color="red">7天以内的单可撤销,其他正常支付的单
|
||||
* 如需实现相同功能请调用退款接口</font></br> <font
|
||||
* color="red">调用扣款接口后请勿立即调用撤销,需要等待5秒以上。先调用查单接口,如果没有确切的返回,再调用撤销</font></br>
|
||||
* 冲正订单(需要证书)</br>
|
||||
* 当支付返回失败,或收银系统超时需要取消交易,可以调用该接口</br>
|
||||
* 接口逻辑:支 付失败的关单,支付成功的撤销支付</br>
|
||||
* <font color="red">7天以内的单可撤销,其他正常支付的单 如需实现相同功能请调用退款接口</font></br>
|
||||
* <font color="red">调用扣款接口后请勿立即调用撤销,需要等待5秒以上。先调用查单接口,如果没有确切的返回,再调用撤销</font>
|
||||
* </br>
|
||||
*
|
||||
* @param certificate
|
||||
* 证书文件(V2版本后缀为*.pfx,V3版本后缀为*.p12)
|
||||
@ -556,8 +562,7 @@ public class WeixinPayProxy {
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public MerchantResult reverseOrder(InputStream certificate, IdQuery idQuery)
|
||||
throws WeixinException {
|
||||
public MerchantResult reverseOrder(InputStream certificate, IdQuery idQuery) throws WeixinException {
|
||||
return payApi.reverseOrder(certificate, idQuery);
|
||||
}
|
||||
|
||||
@ -571,10 +576,8 @@ public class WeixinPayProxy {
|
||||
* @throws WeixinException
|
||||
* @throws IOException
|
||||
*/
|
||||
public MerchantResult reverseOrder(IdQuery idQuery) throws WeixinException,
|
||||
IOException {
|
||||
return payApi.reverseOrder(
|
||||
new FileInputStream(settings.getCertificateFile0()), idQuery);
|
||||
public MerchantResult reverseOrder(IdQuery idQuery) throws WeixinException, IOException {
|
||||
return payApi.reverseOrder(new FileInputStream(settings.getCertificateFile0()), idQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -590,8 +593,9 @@ public class WeixinPayProxy {
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_3">关闭订单API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_3">
|
||||
* 关闭订单API</a>
|
||||
*/
|
||||
public MerchantResult closeOrder(String outTradeNo) throws WeixinException {
|
||||
return payApi.closeOrder(outTradeNo);
|
||||
@ -605,8 +609,9 @@ public class WeixinPayProxy {
|
||||
* 具有native标识的支付URL
|
||||
* @return 转换后的短链接
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_9">转换短链接API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_9">
|
||||
* 转换短链接API</a>
|
||||
* @since V3
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@ -632,15 +637,14 @@ public class WeixinPayProxy {
|
||||
* 调用接口返回的基本数据
|
||||
* @return 处理结果
|
||||
* @see com.foxinmy.weixin4j.api.PayApi
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_8">接口测试上报API</a>
|
||||
* @see <a href=
|
||||
* "http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_8">
|
||||
* 接口测试上报API</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public XmlResult interfaceReport(String interfaceUrl, int executeTime,
|
||||
String outTradeNo, String ip, Date time, XmlResult returnXml)
|
||||
throws WeixinException {
|
||||
return payApi.interfaceReport(interfaceUrl, executeTime, outTradeNo,
|
||||
ip, time, returnXml);
|
||||
public XmlResult interfaceReport(String interfaceUrl, int executeTime, String outTradeNo, String ip, Date time,
|
||||
XmlResult returnXml) throws WeixinException {
|
||||
return payApi.interfaceReport(interfaceUrl, executeTime, outTradeNo, ip, time, returnXml);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -659,15 +663,14 @@ public class WeixinPayProxy {
|
||||
* @return 发放结果
|
||||
* @see com.foxinmy.weixin4j.api.CouponApi
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponResult
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/sp_coupon.php?chapter=12_3">发放代金券接口</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_3">
|
||||
* 发放代金券接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CouponResult sendCoupon(InputStream certificate,
|
||||
String couponStockId, String partnerTradeNo, String openId,
|
||||
public CouponResult sendCoupon(InputStream certificate, String couponStockId, String partnerTradeNo, String openId,
|
||||
String opUserId) throws WeixinException {
|
||||
return couponApi.sendCoupon(certificate, couponStockId, partnerTradeNo,
|
||||
openId, opUserId);
|
||||
return couponApi.sendCoupon(certificate, couponStockId, partnerTradeNo, openId, opUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -675,11 +678,10 @@ public class WeixinPayProxy {
|
||||
*
|
||||
* @see {@link com.foxinmy.weixin4j.payment.WeixinPayProxy#sendCoupon(InputStream, String, String, String, String)}
|
||||
*/
|
||||
public CouponResult sendCoupon(String couponStockId, String partnerTradeNo,
|
||||
String openId) throws WeixinException, IOException {
|
||||
return couponApi.sendCoupon(
|
||||
new FileInputStream(settings.getCertificateFile0()),
|
||||
couponStockId, partnerTradeNo, openId, null);
|
||||
public CouponResult sendCoupon(String couponStockId, String partnerTradeNo, String openId)
|
||||
throws WeixinException, IOException {
|
||||
return couponApi.sendCoupon(new FileInputStream(settings.getCertificateFile0()), couponStockId, partnerTradeNo,
|
||||
openId, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -690,12 +692,12 @@ public class WeixinPayProxy {
|
||||
* @return 代金券批次信息
|
||||
* @see com.foxinmy.weixin4j.api.CouponApi
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponStock
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/sp_coupon.php?chapter=12_4">查询代金券信息</a>
|
||||
* @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 {
|
||||
public CouponStock queryCouponStock(String couponStockId) throws WeixinException {
|
||||
return couponApi.queryCouponStock(couponStockId);
|
||||
}
|
||||
|
||||
@ -707,12 +709,12 @@ public class WeixinPayProxy {
|
||||
* @return 代金券详细信息
|
||||
* @see com.foxinmy.weixin4j.api.CouponApi
|
||||
* @see com.foxinmy.weixin4j.payment.coupon.CouponDetail
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/sp_coupon.php?chapter=12_5">查询代金券详细信息</a>
|
||||
* @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 {
|
||||
public CouponDetail queryCouponDetail(String couponId) throws WeixinException {
|
||||
return couponApi.queryCouponDetail(couponId);
|
||||
}
|
||||
|
||||
@ -727,12 +729,15 @@ public class WeixinPayProxy {
|
||||
* @see com.foxinmy.weixin4j.api.CashApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.Redpacket
|
||||
* @see com.foxinmy.weixin4j.payment.mch.RedpacketSendResult
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/cash_coupon.php?chapter=13_5">红包接口说明</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5">
|
||||
* 发放现金红包接口</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=16_5">
|
||||
* 发放裂变红包接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public RedpacketSendResult sendRedpack(InputStream certificate,
|
||||
Redpacket redpacket) throws WeixinException {
|
||||
public RedpacketSendResult sendRedpack(InputStream certificate, Redpacket redpacket) throws WeixinException {
|
||||
return cashApi.sendRedpack(certificate, redpacket);
|
||||
}
|
||||
|
||||
@ -741,10 +746,8 @@ public class WeixinPayProxy {
|
||||
*
|
||||
* @see {@link com.foxinmy.weixin4j.payment.WeixinPayProxy#sendRedpack(InputStream, Redpacket)}
|
||||
*/
|
||||
public RedpacketSendResult sendRedpack(Redpacket redpacket)
|
||||
throws WeixinException, IOException {
|
||||
return cashApi.sendRedpack(
|
||||
new FileInputStream(settings.getCertificateFile0()), redpacket);
|
||||
public RedpacketSendResult sendRedpack(Redpacket redpacket) throws WeixinException, IOException {
|
||||
return cashApi.sendRedpack(new FileInputStream(settings.getCertificateFile0()), redpacket);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -757,12 +760,15 @@ public class WeixinPayProxy {
|
||||
* @return 红包记录
|
||||
* @see com.foxinmy.weixin4j.api.CashApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.RedpacketRecord
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/cash_coupon.php?chapter=13_6">查询红包接口说明</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_7&index=6">
|
||||
* 查询现金红包接口</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=16_6">
|
||||
* 查询裂变红包接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public RedpacketRecord queryRedpack(InputStream certificate,
|
||||
String outTradeNo) throws WeixinException {
|
||||
public RedpacketRecord queryRedpack(InputStream certificate, String outTradeNo) throws WeixinException {
|
||||
return cashApi.queryRedpack(certificate, outTradeNo);
|
||||
}
|
||||
|
||||
@ -771,12 +777,8 @@ public class WeixinPayProxy {
|
||||
*
|
||||
* @see {@link com.foxinmy.weixin4j.payment.WeixinPayProxy#queryRedpack(InputStream,String)}
|
||||
*/
|
||||
public RedpacketRecord queryRedpack(String outTradeNo)
|
||||
throws WeixinException, IOException {
|
||||
return cashApi
|
||||
.queryRedpack(
|
||||
new FileInputStream(settings.getCertificateFile0()),
|
||||
outTradeNo);
|
||||
public RedpacketRecord queryRedpack(String outTradeNo) throws WeixinException, IOException {
|
||||
return cashApi.queryRedpack(new FileInputStream(settings.getCertificateFile0()), outTradeNo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -790,12 +792,12 @@ public class WeixinPayProxy {
|
||||
* @see com.foxinmy.weixin4j.api.CashApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CorpPayment
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CorpPaymentResult
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/mch_pay.php?chapter=14_1">企业付款</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2">
|
||||
* 企业付款接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CorpPaymentResult sendCorpPayment(InputStream certificate,
|
||||
CorpPayment payment) throws WeixinException {
|
||||
public CorpPaymentResult sendCorpPayment(InputStream certificate, CorpPayment payment) throws WeixinException {
|
||||
return cashApi.sendCorpPayment(certificate, payment);
|
||||
}
|
||||
|
||||
@ -804,10 +806,8 @@ public class WeixinPayProxy {
|
||||
*
|
||||
* @see {@link com.foxinmy.weixin4j.payment.WeixinPayProxy#senCorpPayment(InputStream, CorpPayment)}
|
||||
*/
|
||||
public CorpPaymentResult sendCorpPayment(CorpPayment payment)
|
||||
throws WeixinException, IOException {
|
||||
return cashApi.sendCorpPayment(
|
||||
new FileInputStream(settings.getCertificateFile0()), payment);
|
||||
public CorpPaymentResult sendCorpPayment(CorpPayment payment) throws WeixinException, IOException {
|
||||
return cashApi.sendCorpPayment(new FileInputStream(settings.getCertificateFile0()), payment);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -820,12 +820,12 @@ public class WeixinPayProxy {
|
||||
* @return 付款记录
|
||||
* @see com.foxinmy.weixin4j.api.CashApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CorpPaymentRecord
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/mch_pay.php?chapter=14_3">企业付款查询</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_3">
|
||||
* 企业付款查询接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CorpPaymentRecord queryCorpPayment(InputStream certificate,
|
||||
String outTradeNo) throws WeixinException {
|
||||
public CorpPaymentRecord queryCorpPayment(InputStream certificate, String outTradeNo) throws WeixinException {
|
||||
return cashApi.queryCorpPayment(certificate, outTradeNo);
|
||||
}
|
||||
|
||||
@ -834,24 +834,21 @@ public class WeixinPayProxy {
|
||||
*
|
||||
* @see {@link com.foxinmy.weixin4j.payment.WeixinPayProxy#CorpPaymentRecord(InputStream, String)}
|
||||
*/
|
||||
public CorpPaymentRecord queryCorpPayment(String outTradeNo)
|
||||
throws WeixinException, IOException {
|
||||
return cashApi
|
||||
.queryCorpPayment(
|
||||
new FileInputStream(settings.getCertificateFile0()),
|
||||
outTradeNo);
|
||||
public CorpPaymentRecord queryCorpPayment(String outTradeNo) throws WeixinException, IOException {
|
||||
return cashApi.queryCorpPayment(new FileInputStream(settings.getCertificateFile0()), outTradeNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权码查询OPENID接口
|
||||
* 授权码查询OPENID
|
||||
*
|
||||
* @param authCode
|
||||
* 扫码支付授权码,设备读取用户微信中的条码或者二维码信息
|
||||
* @return 查询结果
|
||||
* @see com.foxinmy.weixin4j.api.CashApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.OpenIdResult
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_13&index=9">授权码查询OPENID</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_13&index=9">
|
||||
* 授权码查询OPENID</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public OpenIdResult authCode2openId(String authCode) throws WeixinException {
|
||||
@ -873,11 +870,12 @@ public class WeixinPayProxy {
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.api.CashApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.SettlementRecord
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/micropay.php?chapter=9_14&index=7">查询结算资金</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/external/micropay.php?chapter=9_14&index=7">
|
||||
* 查询结算资金接口</a>
|
||||
*/
|
||||
public SettlementRecord querySettlement(boolean status, Pageable pageable,
|
||||
Date start, Date end) throws WeixinException {
|
||||
public SettlementRecord querySettlement(boolean status, Pageable pageable, Date start, Date end)
|
||||
throws WeixinException {
|
||||
return cashApi.querySettlement(status, pageable, start, end);
|
||||
}
|
||||
|
||||
@ -891,11 +889,11 @@ public class WeixinPayProxy {
|
||||
* @return 汇率对象
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.api.CashApi
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/micropay.php?chapter=9_15&index=8">查询汇率</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/external/micropay.php?chapter=9_15&index=8">
|
||||
* 查询汇率接口</a>
|
||||
*/
|
||||
public double queryExchageRate(CurrencyType currencyType, Date date)
|
||||
throws WeixinException {
|
||||
public double queryExchageRate(CurrencyType currencyType, Date date) throws WeixinException {
|
||||
return cashApi.queryExchageRate(currencyType, date);
|
||||
}
|
||||
|
||||
@ -908,12 +906,12 @@ public class WeixinPayProxy {
|
||||
* @see com.foxinmy.weixin4j.api.CustomsApi
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CustomsOrder
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CustomsOrderResult
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_1">附加订单信息</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_1">
|
||||
* 附加订单信息提交接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CustomsOrderResult declareCustomsOrder(CustomsOrder customsOrder)
|
||||
throws WeixinException {
|
||||
public CustomsOrderResult declareCustomsOrder(CustomsOrder customsOrder) throws WeixinException {
|
||||
return customsApi.declareCustomsOrder(customsOrder);
|
||||
}
|
||||
|
||||
@ -927,12 +925,12 @@ public class WeixinPayProxy {
|
||||
* @return 报关记录
|
||||
* @see com.foxinmy.weixin4j.payment.mch.CustomsOrderRecord
|
||||
* @see com.foxinmy.weixin4j.api.CustomsApi
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_1">附加订单信息</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_1">
|
||||
* 附加订单信息查询接口</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public CustomsOrderRecord queryCustomsOrder(IdQuery idQuery,
|
||||
CustomsCity customsCity) throws WeixinException {
|
||||
public CustomsOrderRecord queryCustomsOrder(IdQuery idQuery, CustomsCity customsCity) throws WeixinException {
|
||||
return customsApi.queryCustomsOrder(idQuery, customsCity);
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ import com.foxinmy.weixin4j.util.MapUtil;
|
||||
* @see com.foxinmy.weixin4j.payment.mch.PrePay
|
||||
* @see com.foxinmy.weixin4j.payment.PayRequest
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/app.php?chapter=8_1">APP支付</a>
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=8_1">APP支付</a>
|
||||
*/
|
||||
public class APPPayRequest extends AbstractPayRequest {
|
||||
public APPPayRequest(String prePayId, WeixinPayAccount payAccount) {
|
||||
|
||||
@ -6,7 +6,7 @@ import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.MPPaymentCheckNameType;
|
||||
import com.foxinmy.weixin4j.type.CorpPaymentCheckNameType;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
|
||||
/**
|
||||
@ -38,11 +38,11 @@ public class CorpPayment extends MerchantResult {
|
||||
/**
|
||||
* 校验用户姓名选项
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.type.MPPaymentCheckNameType
|
||||
* @see com.foxinmy.weixin4j.CorpPaymentCheckNameType.type.MPPaymentCheckNameType
|
||||
*/
|
||||
@XmlElement(name = "check_name")
|
||||
@JSONField(name = "check_name")
|
||||
private MPPaymentCheckNameType checkNameType;
|
||||
private CorpPaymentCheckNameType checkNameType;
|
||||
/**
|
||||
* 收款用户真实姓名。 如果check_name设置为FORCE_CHECK或OPTION_CHECK,则必填用户真实姓名 可选
|
||||
*/
|
||||
@ -85,7 +85,7 @@ public class CorpPayment extends MerchantResult {
|
||||
* 调用接口IP
|
||||
*/
|
||||
public CorpPayment(String outTradeNo, String openId,
|
||||
MPPaymentCheckNameType checkNameType, String desc, double amount,
|
||||
CorpPaymentCheckNameType checkNameType, String desc, double amount,
|
||||
String clientIp) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
this.openId = openId;
|
||||
@ -103,7 +103,7 @@ public class CorpPayment extends MerchantResult {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public MPPaymentCheckNameType getCheckNameType() {
|
||||
public CorpPaymentCheckNameType getCheckNameType() {
|
||||
return checkNameType;
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.MPPaymentCheckNameType;
|
||||
import com.foxinmy.weixin4j.type.CorpPaymentCheckNameType;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
|
||||
/**
|
||||
@ -77,7 +77,7 @@ public class CorpPaymentRecord extends MerchantResult {
|
||||
/**
|
||||
* 校验用户姓名选项
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.type.MPPaymentCheckNameType
|
||||
* @see com.foxinmy.weixin4j.CorpPaymentCheckNameType.type.MPPaymentCheckNameType
|
||||
*/
|
||||
@XmlElement(name = "check_name")
|
||||
@JSONField(name = "check_name")
|
||||
@ -166,8 +166,8 @@ public class CorpPaymentRecord extends MerchantResult {
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public MPPaymentCheckNameType getFormatCheckNameType() {
|
||||
return checkNameType != null ? MPPaymentCheckNameType
|
||||
public CorpPaymentCheckNameType getFormatCheckNameType() {
|
||||
return checkNameType != null ? CorpPaymentCheckNameType
|
||||
.valueOf(checkNameType) : null;
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ import com.foxinmy.weixin4j.type.TradeType;
|
||||
* @see com.foxinmy.weixin4j.payment.mch.PrePay
|
||||
* @see com.foxinmy.weixin4j.payment.PayRequest
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6">网页端调起支付API</a>
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_1">网页端调起支付API</a>
|
||||
*/
|
||||
public class JSAPIPayRequest extends AbstractPayRequest {
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ import com.foxinmy.weixin4j.type.TradeType;
|
||||
* @see com.foxinmy.weixin4j.payment.mch.PrePay
|
||||
* @see com.foxinmy.weixin4j.payment.PayRequest
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10&index=1">刷卡支付</a>
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=5_1">刷卡支付</a>
|
||||
*/
|
||||
public class MICROPayRequest extends Order implements MchPayRequest {
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ import com.foxinmy.weixin4j.type.TradeType;
|
||||
* @see com.foxinmy.weixin4j.payment.mch.PrePay
|
||||
* @see com.foxinmy.weixin4j.payment.PayRequest
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_5">NATIVE扫码支付(模式二)</a>
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_1">NATIVE扫码支付(模式二)</a>
|
||||
*/
|
||||
public class NATIVEPayRequest extends AbstractPayRequest {
|
||||
|
||||
|
||||
@ -17,9 +17,9 @@ import com.foxinmy.weixin4j.util.DateUtil;
|
||||
* @date 2015年3月28日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/cash_coupon.php?chapter=13_1">普通红包</a>
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_1">普通红包</a>
|
||||
* @see <a
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/cash_coupon.php?chapter=16_1">裂变红包</a>
|
||||
* href="https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=16_1">裂变红包</a>
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
|
||||
@ -9,7 +9,7 @@ import com.foxinmy.weixin4j.util.DigestUtil;
|
||||
* @author jy
|
||||
* @date 2016年3月26日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/external/jsapi.php?chapter=4_3">支付签名说明</a>
|
||||
*/
|
||||
public class WeixinPaymentSignature extends AbstractWeixinSignature {
|
||||
/**
|
||||
|
||||
@ -1,66 +1,66 @@
|
||||
package com.foxinmy.weixin4j.type;
|
||||
|
||||
/**
|
||||
* 自定义菜单类型 </br> <font
|
||||
* color="red">请注意,scancode_push到location_select的所有事件,仅支持微信iPhone5.4.1以上版本,和Android5.4以上版本的微信用户
|
||||
* ,旧版本微信用户点击后将没有回应
|
||||
* ,开发者也不能正常接收到事件推送。media_id和view_limited,是专门给第三方平台旗下未微信认证(具体而言,是资质认证未通过)的订阅号准备的事件类型
|
||||
* ,它们是没有事件推送的,能力相对受限,其他类型的公众号不必使用。</font>
|
||||
*
|
||||
* @className ButtonType
|
||||
* @author jy
|
||||
* @date 2014年9月30日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html">按钮类型</a>
|
||||
*/
|
||||
public enum ButtonType {
|
||||
/**
|
||||
* 点击推事件 用户点击click类型按钮后,微信服务器会通过消息接口推送消息类型为event
|
||||
* 的结构给开发者(参考消息接口指南),并且带上按钮中开发者填写的key值,开发者可以通过自定义的key值与用户进行交互;
|
||||
*/
|
||||
click,
|
||||
/**
|
||||
* 跳转URL 用户点击view类型按钮后,微信客户端将会打开开发者在按钮中填写的网页URL,可与网页授权获取用户基本信息接口结合,获得用户基本信息。
|
||||
*/
|
||||
view,
|
||||
/**
|
||||
* 扫码推事件 用户点击按钮后,微信客户端将调起扫一扫工具,完成扫码操作后显示扫描结果(如果是URL,将进入URL),且会将扫码的结果传给开发者,
|
||||
* 开发者可以下发消息。
|
||||
*/
|
||||
scancode_push,
|
||||
/**
|
||||
* 扫码推事件且弹出“消息接收中”提示框用户点击按钮后,微信客户端将调起扫一扫工具,完成扫码操作后,将扫码的结果传给开发者,同时收起扫一扫工具,
|
||||
* 然后弹出“消息接收中”提示框,随后可能会收到开发者下发的消息。
|
||||
*/
|
||||
scancode_waitmsg,
|
||||
/**
|
||||
* 弹出系统拍照发图用户点击按钮后,微信客户端将调起系统相机,完成拍照操作后,会将拍摄的相片发送给开发者,并推送事件给开发者,同时收起系统相机,
|
||||
* 随后可能会收到开发者下发的消息。
|
||||
*/
|
||||
pic_sysphoto,
|
||||
/**
|
||||
* 弹出拍照或者相册发图用户点击按钮后,微信客户端将弹出选择器供用户选择“拍照”或者“从手机相册选择”。用户选择后即走其他两种流程。
|
||||
*/
|
||||
pic_photo_or_album,
|
||||
/**
|
||||
* 弹出微信相册发图器用户点击按钮后,微信客户端将调起微信相册,完成选择操作后,将选择的相片发送给开发者的服务器,并推送事件给开发者,同时收起相册,
|
||||
* 随后可能会收到开发者下发的消息。
|
||||
*/
|
||||
pic_weixin,
|
||||
/**
|
||||
* 弹出地理位置选择器用户点击按钮后,微信客户端将调起地理位置选择工具,完成选择操作后,将选择的地理位置发送给开发者的服务器,同时收起位置选择工具,
|
||||
* 随后可能会收到开发者下发的消息。
|
||||
*/
|
||||
location_select,
|
||||
/**
|
||||
* 下发消息(除文本消息):用户点击media_id类型按钮后,微信服务器会将开发者填写的永久素材id对应的素材下发给用户,永久素材类型可以是图片、
|
||||
* 音频、视频、图文消息。 请注意:永久素材id必须是在“素材管理/新增永久素材”接口上传后获得的合法id。
|
||||
*/
|
||||
media_id,
|
||||
/**
|
||||
* 跳转图文消息URL:用户点击view_limited类型按钮后,微信客户端将打开开发者在按钮中填写的永久素材id对应的图文消息URL,
|
||||
* 永久素材类型只支持图文消息。 请注意:永久素材id必须是在“素材管理/新增永久素材”接口上传后获得的合法id。
|
||||
*/
|
||||
view_limited;
|
||||
}
|
||||
package com.foxinmy.weixin4j.type;
|
||||
|
||||
/**
|
||||
* 自定义菜单类型 </br> <font
|
||||
* color="red">请注意,scancode_push到location_select的所有事件,仅支持微信iPhone5.4.1以上版本,和Android5.4以上版本的微信用户
|
||||
* ,旧版本微信用户点击后将没有回应
|
||||
* ,开发者也不能正常接收到事件推送。media_id和view_limited,是专门给第三方平台旗下未微信认证(具体而言,是资质认证未通过)的订阅号准备的事件类型
|
||||
* ,它们是没有事件推送的,能力相对受限,其他类型的公众号不必使用。</font>
|
||||
*
|
||||
* @className ButtonType
|
||||
* @author jy
|
||||
* @date 2014年9月30日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141013&token=&lang=zh_CN">按钮类型</a>
|
||||
*/
|
||||
public enum ButtonType {
|
||||
/**
|
||||
* 点击推事件 用户点击click类型按钮后,微信服务器会通过消息接口推送消息类型为event
|
||||
* 的结构给开发者(参考消息接口指南),并且带上按钮中开发者填写的key值,开发者可以通过自定义的key值与用户进行交互;
|
||||
*/
|
||||
click,
|
||||
/**
|
||||
* 跳转URL 用户点击view类型按钮后,微信客户端将会打开开发者在按钮中填写的网页URL,可与网页授权获取用户基本信息接口结合,获得用户基本信息。
|
||||
*/
|
||||
view,
|
||||
/**
|
||||
* 扫码推事件 用户点击按钮后,微信客户端将调起扫一扫工具,完成扫码操作后显示扫描结果(如果是URL,将进入URL),且会将扫码的结果传给开发者,
|
||||
* 开发者可以下发消息。
|
||||
*/
|
||||
scancode_push,
|
||||
/**
|
||||
* 扫码推事件且弹出“消息接收中”提示框用户点击按钮后,微信客户端将调起扫一扫工具,完成扫码操作后,将扫码的结果传给开发者,同时收起扫一扫工具,
|
||||
* 然后弹出“消息接收中”提示框,随后可能会收到开发者下发的消息。
|
||||
*/
|
||||
scancode_waitmsg,
|
||||
/**
|
||||
* 弹出系统拍照发图用户点击按钮后,微信客户端将调起系统相机,完成拍照操作后,会将拍摄的相片发送给开发者,并推送事件给开发者,同时收起系统相机,
|
||||
* 随后可能会收到开发者下发的消息。
|
||||
*/
|
||||
pic_sysphoto,
|
||||
/**
|
||||
* 弹出拍照或者相册发图用户点击按钮后,微信客户端将弹出选择器供用户选择“拍照”或者“从手机相册选择”。用户选择后即走其他两种流程。
|
||||
*/
|
||||
pic_photo_or_album,
|
||||
/**
|
||||
* 弹出微信相册发图器用户点击按钮后,微信客户端将调起微信相册,完成选择操作后,将选择的相片发送给开发者的服务器,并推送事件给开发者,同时收起相册,
|
||||
* 随后可能会收到开发者下发的消息。
|
||||
*/
|
||||
pic_weixin,
|
||||
/**
|
||||
* 弹出地理位置选择器用户点击按钮后,微信客户端将调起地理位置选择工具,完成选择操作后,将选择的地理位置发送给开发者的服务器,同时收起位置选择工具,
|
||||
* 随后可能会收到开发者下发的消息。
|
||||
*/
|
||||
location_select,
|
||||
/**
|
||||
* 下发消息(除文本消息):用户点击media_id类型按钮后,微信服务器会将开发者填写的永久素材id对应的素材下发给用户,永久素材类型可以是图片、
|
||||
* 音频、视频、图文消息。 请注意:永久素材id必须是在“素材管理/新增永久素材”接口上传后获得的合法id。
|
||||
*/
|
||||
media_id,
|
||||
/**
|
||||
* 跳转图文消息URL:用户点击view_limited类型按钮后,微信客户端将打开开发者在按钮中填写的永久素材id对应的图文消息URL,
|
||||
* 永久素材类型只支持图文消息。 请注意:永久素材id必须是在“素材管理/新增永久素材”接口上传后获得的合法id。
|
||||
*/
|
||||
view_limited;
|
||||
}
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
package com.foxinmy.weixin4j.type;
|
||||
|
||||
/**
|
||||
* 企业付款检查收款人姓名的策略
|
||||
*
|
||||
* @className MPPaymentCheckType
|
||||
* @author jy
|
||||
* @date 2015年4月1日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
*/
|
||||
public enum MPPaymentCheckNameType {
|
||||
/**
|
||||
* 不校验真实姓名
|
||||
*/
|
||||
NO_CHECK,
|
||||
/**
|
||||
* 强校验真实姓名(未实名认证的用户会校验失败,无法转账)
|
||||
*/
|
||||
FORCE_CHECK,
|
||||
/**
|
||||
* 针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功)
|
||||
*/
|
||||
OPTION_CHECK;
|
||||
}
|
||||
package com.foxinmy.weixin4j.type;
|
||||
|
||||
/**
|
||||
* 企业付款检查收款人姓名的策略
|
||||
*
|
||||
* @className CorpPaymentCheckNameType
|
||||
* @author jy
|
||||
* @date 2015年4月1日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
*/
|
||||
public enum CorpPaymentCheckNameType {
|
||||
/**
|
||||
* 不校验真实姓名
|
||||
*/
|
||||
NO_CHECK,
|
||||
/**
|
||||
* 强校验真实姓名(未实名认证的用户会校验失败,无法转账)
|
||||
*/
|
||||
FORCE_CHECK,
|
||||
/**
|
||||
* 针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功)
|
||||
*/
|
||||
OPTION_CHECK;
|
||||
}
|
||||
@ -1,107 +1,107 @@
|
||||
package com.foxinmy.weixin4j.util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||
|
||||
/**
|
||||
* 接口调用错误获取
|
||||
*
|
||||
* @className WeixinErrorUtil
|
||||
* @author jy
|
||||
* @date 2015年5月12日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
*/
|
||||
public final class WeixinErrorUtil {
|
||||
private static byte[] errorXmlByteArray;
|
||||
private final static Map<String, String> errorCacheMap;
|
||||
static {
|
||||
errorCacheMap = new HashMap<String, String>();
|
||||
try {
|
||||
errorXmlByteArray = IOUtil.toByteArray(WeixinResponse.class
|
||||
.getResourceAsStream("error.xml"));
|
||||
} catch (IOException e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ErrorTextHandler extends DefaultHandler {
|
||||
|
||||
private final String code;
|
||||
|
||||
public ErrorTextHandler(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
private String text;
|
||||
private boolean codeElement;
|
||||
private boolean textElement;
|
||||
private boolean findElement;
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName,
|
||||
Attributes attributes) throws SAXException {
|
||||
codeElement = qName.equalsIgnoreCase("code");
|
||||
textElement = qName.equalsIgnoreCase("text");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName)
|
||||
throws SAXException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length)
|
||||
throws SAXException {
|
||||
String _text = new String(ch, start, length);
|
||||
if (codeElement && _text.equalsIgnoreCase(code)) {
|
||||
findElement = true;
|
||||
} else if (textElement && findElement) {
|
||||
text = _text;
|
||||
throw new SAXException("ENOUGH");
|
||||
}
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return StringUtil.isBlank(text) ? "未知错误" : text;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getText(String code) throws RuntimeException {
|
||||
String text = errorCacheMap.get(code);
|
||||
if (StringUtil.isBlank(text)) {
|
||||
ErrorTextHandler textHandler = new ErrorTextHandler(code);
|
||||
try {
|
||||
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
|
||||
xmlReader.setContentHandler(textHandler);
|
||||
xmlReader.parse(new InputSource(new ByteArrayInputStream(
|
||||
errorXmlByteArray)));
|
||||
text = textHandler.getText();
|
||||
errorCacheMap.put(code, text);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (SAXException e) {
|
||||
text = textHandler.getText();
|
||||
errorCacheMap.put(code, text);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getText("40001"));
|
||||
System.out.println(getText("40001"));
|
||||
System.out.println(getText("1234"));
|
||||
}
|
||||
}
|
||||
package com.foxinmy.weixin4j.util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||
|
||||
/**
|
||||
* 接口调用错误获取
|
||||
*
|
||||
* @className WeixinErrorUtil
|
||||
* @author jy
|
||||
* @date 2015年5月12日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
*/
|
||||
public final class WeixinErrorUtil {
|
||||
private static byte[] errorXmlByteArray;
|
||||
private final static Map<String, String> errorCacheMap;
|
||||
static {
|
||||
errorCacheMap = new ConcurrentHashMap<String, String>();
|
||||
try {
|
||||
errorXmlByteArray = IOUtil.toByteArray(WeixinResponse.class
|
||||
.getResourceAsStream("error.xml"));
|
||||
} catch (IOException e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ErrorTextHandler extends DefaultHandler {
|
||||
|
||||
private final String code;
|
||||
|
||||
public ErrorTextHandler(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
private String text;
|
||||
private boolean codeElement;
|
||||
private boolean textElement;
|
||||
private boolean findElement;
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName,
|
||||
Attributes attributes) throws SAXException {
|
||||
codeElement = qName.equalsIgnoreCase("code");
|
||||
textElement = qName.equalsIgnoreCase("text");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName)
|
||||
throws SAXException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length)
|
||||
throws SAXException {
|
||||
String _text = new String(ch, start, length);
|
||||
if (codeElement && _text.equalsIgnoreCase(code)) {
|
||||
findElement = true;
|
||||
} else if (textElement && findElement) {
|
||||
text = _text;
|
||||
throw new SAXException("ENOUGH");
|
||||
}
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return StringUtil.isBlank(text) ? "未知错误" : text;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getText(String code) throws RuntimeException {
|
||||
String text = errorCacheMap.get(code);
|
||||
if (StringUtil.isBlank(text)) {
|
||||
ErrorTextHandler textHandler = new ErrorTextHandler(code);
|
||||
try {
|
||||
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
|
||||
xmlReader.setContentHandler(textHandler);
|
||||
xmlReader.parse(new InputSource(new ByteArrayInputStream(
|
||||
errorXmlByteArray)));
|
||||
text = textHandler.getText();
|
||||
errorCacheMap.put(code, text);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (SAXException e) {
|
||||
text = textHandler.getText();
|
||||
errorCacheMap.put(code, text);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getText("40001"));
|
||||
System.out.println(getText("40001"));
|
||||
System.out.println(getText("1234"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ import com.foxinmy.weixin4j.payment.mch.CorpPaymentResult;
|
||||
import com.foxinmy.weixin4j.payment.mch.Redpacket;
|
||||
import com.foxinmy.weixin4j.payment.mch.RedpacketRecord;
|
||||
import com.foxinmy.weixin4j.payment.mch.RedpacketSendResult;
|
||||
import com.foxinmy.weixin4j.type.MPPaymentCheckNameType;
|
||||
import com.foxinmy.weixin4j.type.CorpPaymentCheckNameType;
|
||||
|
||||
/**
|
||||
* 现金发放测试
|
||||
@ -46,7 +46,7 @@ public class CashTest extends PayTest {
|
||||
public void sendCorpPayment() throws WeixinException, IOException {
|
||||
CorpPayment payment = new CorpPayment("MP001",
|
||||
"ofW1gwok9vZIyle0YbA-eQe83Uk8",
|
||||
MPPaymentCheckNameType.NO_CHECK, "企业付款测试", 1d, "127.0.0.1");
|
||||
CorpPaymentCheckNameType.NO_CHECK, "企业付款测试", 1d, "127.0.0.1");
|
||||
CorpPaymentResult result = PAY.sendCorpPayment(new FileInputStream(
|
||||
caFile), payment);
|
||||
System.err.println(result);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user