#178 实现查询代金券批次和信息的接口

This commit is contained in:
Binary Wang
2017-07-15 19:16:52 +08:00
parent 9368177d00
commit 9f669dff82
7 changed files with 1201 additions and 6 deletions

View File

@@ -1,7 +1,6 @@
package com.github.binarywang.wxpay.service;
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendRequest;
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendResult;
import com.github.binarywang.wxpay.bean.coupon.*;
import com.github.binarywang.wxpay.bean.request.*;
import com.github.binarywang.wxpay.bean.result.*;
import com.github.binarywang.wxpay.config.WxPayConfig;
@@ -351,4 +350,22 @@ public interface WxPayService {
* </pre>
*/
WxPayCouponSendResult sendCoupon(WxPayCouponSendRequest request) throws WxPayException;
/**
* <pre>
* 查询代金券批次
* 接口请求链接https://api.mch.weixin.qq.com/mmpaymkttransfers/query_coupon_stock
* 文档地址https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_4
* </pre>
*/
WxPayCouponStockQueryResult queryCouponStock(WxPayCouponStockQueryRequest request) throws WxPayException;
/**
* <pre>
* 查询代金券信息
* 接口请求链接https://api.mch.weixin.qq.com/mmpaymkttransfers/querycouponsinfo
* 文档地址https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_5
* </pre>
*/
WxPayCouponInfoQueryResult queryCouponInfo(WxPayCouponInfoQueryRequest request) throws WxPayException;
}

View File

@@ -1,8 +1,7 @@
package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.utils.qrcode.QrcodeUtils;
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendRequest;
import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendResult;
import com.github.binarywang.wxpay.bean.coupon.*;
import com.github.binarywang.wxpay.bean.request.*;
import com.github.binarywang.wxpay.bean.result.*;
import com.github.binarywang.wxpay.config.WxPayConfig;
@@ -476,4 +475,26 @@ public abstract class WxPayServiceAbstractImpl implements WxPayService {
result.checkResult(this);
return result;
}
@Override
public WxPayCouponStockQueryResult queryCouponStock(WxPayCouponStockQueryRequest request) throws WxPayException {
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/mmpaymkttransfers/query_coupon_stock";
String responseContent = this.post(url, request.toXML(), false);
WxPayCouponStockQueryResult result = WxPayBaseResult.fromXML(responseContent, WxPayCouponStockQueryResult.class);
result.checkResult(this);
return result;
}
@Override
public WxPayCouponInfoQueryResult queryCouponInfo(WxPayCouponInfoQueryRequest request) throws WxPayException {
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/mmpaymkttransfers/querycouponsinfo";
String responseContent = this.post(url, request.toXML(), false);
WxPayCouponInfoQueryResult result = WxPayBaseResult.fromXML(responseContent, WxPayCouponInfoQueryResult.class);
result.checkResult(this);
return result;
}
}