修复备注链接不正确
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,16 +108,13 @@ 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;
|
||||
@ -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>
|
||||
*/
|
||||
|
||||
@ -7,7 +7,12 @@ package com.foxinmy.weixin4j.jssdk;
|
||||
* @author jy
|
||||
* @date 2015年12月23日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
* @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 {
|
||||
/***
|
||||
@ -258,20 +263,17 @@ public enum JSSDKAPI {
|
||||
/**
|
||||
* 分享接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] SHARE_APIS = { onMenuShareTimeline,
|
||||
onMenuShareAppMessage, onMenuShareQQ, onMenuShareWeibo,
|
||||
onMenuShareQZone };
|
||||
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[] 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[] RECORD_APIS = { startRecord, stopRecord, onVoiceRecordEnd, playVoice, pauseVoice,
|
||||
stopVoice, onVoicePlayEnd, uploadVoice, downloadVoice };
|
||||
/**
|
||||
* 智能接口集合
|
||||
*/
|
||||
@ -287,14 +289,12 @@ public enum JSSDKAPI {
|
||||
/**
|
||||
* 摇一摇周边接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] BEACON_APIS = { startSearchBeacons,
|
||||
stopSearchBeacons, onSearchBeacons };
|
||||
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[] UI_APIS = { hideOptionMenu, showOptionMenu, closeWindow, hideMenuItems,
|
||||
showMenuItems, hideAllNonBaseMenuItem, showAllNonBaseMenuItem };
|
||||
/**
|
||||
* 微信扫一扫接口集合
|
||||
*/
|
||||
@ -306,8 +306,7 @@ public enum JSSDKAPI {
|
||||
/**
|
||||
* 微信卡券接口集合
|
||||
*/
|
||||
public final static JSSDKAPI[] CARD_APIS = { chooseCard, addCard, openCard,
|
||||
consumeAndShareCard };
|
||||
public final static JSSDKAPI[] CARD_APIS = { chooseCard, addCard, openCard, consumeAndShareCard };
|
||||
/**
|
||||
* 微信支付接口集合
|
||||
*/
|
||||
@ -320,29 +319,20 @@ public enum JSSDKAPI {
|
||||
/**
|
||||
* 公众平台全部接口集合
|
||||
*/
|
||||
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[] 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 };
|
||||
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 };
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import com.alibaba.fastjson.annotation.JSONField;
|
||||
* @date 2014年4月5日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/11/0e4b294685f817b95cbed85ba5e82b8f.html">微信公众平台获取token</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>
|
||||
*/
|
||||
|
||||
@ -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 {
|
||||
/**
|
||||
|
||||
@ -12,7 +12,7 @@ package com.foxinmy.weixin4j.type;
|
||||
* @date 2014年9月30日
|
||||
* @since JDK 1.6
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html">按钮类型</a>
|
||||
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141013&token=&lang=zh_CN">按钮类型</a>
|
||||
*/
|
||||
public enum ButtonType {
|
||||
/**
|
||||
|
||||
@ -3,13 +3,13 @@ package com.foxinmy.weixin4j.type;
|
||||
/**
|
||||
* 企业付款检查收款人姓名的策略
|
||||
*
|
||||
* @className MPPaymentCheckType
|
||||
* @className CorpPaymentCheckNameType
|
||||
* @author jy
|
||||
* @date 2015年4月1日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
*/
|
||||
public enum MPPaymentCheckNameType {
|
||||
public enum CorpPaymentCheckNameType {
|
||||
/**
|
||||
* 不校验真实姓名
|
||||
*/
|
||||
@ -2,8 +2,8 @@ package com.foxinmy.weixin4j.util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
@ -27,7 +27,7 @@ public final class WeixinErrorUtil {
|
||||
private static byte[] errorXmlByteArray;
|
||||
private final static Map<String, String> errorCacheMap;
|
||||
static {
|
||||
errorCacheMap = new HashMap<String, String>();
|
||||
errorCacheMap = new ConcurrentHashMap<String, String>();
|
||||
try {
|
||||
errorXmlByteArray = IOUtil.toByteArray(WeixinResponse.class
|
||||
.getResourceAsStream("error.xml"));
|
||||
|
||||
@ -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