diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponInfoQueryRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponInfoQueryRequest.java new file mode 100644 index 000000000..3d83d0a6c --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponInfoQueryRequest.java @@ -0,0 +1,280 @@ +package com.github.binarywang.wxpay.bean.coupon; + +import com.github.binarywang.wxpay.bean.request.WxPayBaseRequest; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import me.chanjar.weixin.common.annotation.Required; + +/** + *
+ * 查询代金券信息请求对象类 + * Created by Binary Wang on 2017-7-15. + *+ * + * @author Binary Wang + */ +@XStreamAlias("xml") +public class WxPayCouponInfoQueryRequest extends WxPayBaseRequest { + /** + *
+ * 字段名:代金券id + * 变量名:coupon_id + * 是否必填:是 + * 示例值:1757 + * 类型:String + * 说明:代金券id + *+ */ + @Required + @XStreamAlias("coupon_id") + private String couponId; + + /** + *
+ * 字段名:代金券批次号 + * 变量名:stock_id + * 是否必填:是 + * 示例值:58818 + * 类型:String + * 说明:代金劵对应的批次号 + *+ */ + @Required + @XStreamAlias("stock_id") + private String stockId; + + /** + *
+ * 字段名:用户openid + * 变量名:openid + * 是否必填:是 + * 示例值:onqOjjrXT-776SpHnfexGm1_P7iE + * 类型:String + * 说明:Openid信息,用户在appid下的openid。 + *+ */ + @Required + @XStreamAlias("openid") + private String openid; + + /** + *
+ * 字段名:操作员 + * 变量名:op_user_id + * 是否必填:否 + * 示例值:10000098 + * 类型:String(32) + * 说明:操作员帐号, 默认为商户号,可在商户平台配置操作员对应的api权限 + *+ */ + @XStreamAlias("op_user_id") + private String opUserId; + + /** + *
+ * 字段名:设备号 + * 变量名:device_info + * 是否必填:否 + * 示例值: + * 类型:String(32) + * 说明:微信支付分配的终端设备号 + *+ */ + @XStreamAlias("device_info") + private String deviceInfo; + + /** + *
+ * 字段名:协议版本 + * 变量名:version + * 是否必填:否 + * 示例值:1.0 + * 类型:String(32) + * 说明:默认1.0 + *+ */ + @XStreamAlias("version") + private String version; + + /** + *
+ * 字段名:协议类型 + * 变量名:type + * 是否必填:否 + * 示例值:XML + * 类型:String(32) + * 说明:XML【目前仅支持默认XML】 + *+ */ + @XStreamAlias("type") + private String type; + + private WxPayCouponInfoQueryRequest(Builder builder) { + setAppid(builder.appid); + setMchId(builder.mchId); + setSubAppId(builder.subAppId); + setSubMchId(builder.subMchId); + setNonceStr(builder.nonceStr); + setSign(builder.sign); + setCouponId(builder.couponId); + setStockId(builder.stockId); + setOpenid(builder.openid); + setOpUserId(builder.opUserId); + setDeviceInfo(builder.deviceInfo); + setVersion(builder.version); + setType(builder.type); + } + + public static Builder newBuilder() { + return new Builder(); + } + + public String getCouponId() { + return this.couponId; + } + + public void setCouponId(String couponId) { + this.couponId = couponId; + } + + public String getStockId() { + return this.stockId; + } + + public void setStockId(String stockId) { + this.stockId = stockId; + } + + public String getOpenid() { + return this.openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public String getOpUserId() { + return this.opUserId; + } + + public void setOpUserId(String opUserId) { + this.opUserId = opUserId; + } + + public String getDeviceInfo() { + return this.deviceInfo; + } + + public void setDeviceInfo(String deviceInfo) { + this.deviceInfo = deviceInfo; + } + + public String getVersion() { + return this.version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + protected void checkConstraints() { + //do nothing + } + + + public static final class Builder { + private String appid; + private String mchId; + private String subAppId; + private String subMchId; + private String nonceStr; + private String sign; + private String couponId; + private String stockId; + private String openid; + private String opUserId; + private String deviceInfo; + private String version; + private String type; + + private Builder() { + } + + public Builder appid(String appid) { + this.appid = appid; + return this; + } + + public Builder mchId(String mchId) { + this.mchId = mchId; + return this; + } + + public Builder subAppId(String subAppId) { + this.subAppId = subAppId; + return this; + } + + public Builder subMchId(String subMchId) { + this.subMchId = subMchId; + return this; + } + + public Builder nonceStr(String nonceStr) { + this.nonceStr = nonceStr; + return this; + } + + public Builder sign(String sign) { + this.sign = sign; + return this; + } + + public Builder couponId(String couponId) { + this.couponId = couponId; + return this; + } + + public Builder stockId(String stockId) { + this.stockId = stockId; + return this; + } + + public Builder openid(String openid) { + this.openid = openid; + return this; + } + + public Builder opUserId(String opUserId) { + this.opUserId = opUserId; + return this; + } + + public Builder deviceInfo(String deviceInfo) { + this.deviceInfo = deviceInfo; + return this; + } + + public Builder version(String version) { + this.version = version; + return this; + } + + public Builder type(String type) { + this.type = type; + return this; + } + + public WxPayCouponInfoQueryRequest build() { + return new WxPayCouponInfoQueryRequest(this); + } + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponInfoQueryResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponInfoQueryResult.java new file mode 100644 index 000000000..bec1c9e10 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponInfoQueryResult.java @@ -0,0 +1,351 @@ +package com.github.binarywang.wxpay.bean.coupon; + +import com.github.binarywang.wxpay.bean.result.WxPayBaseResult; +import com.thoughtworks.xstream.annotations.XStreamAlias; + +/** + *
+ * 查询代金券信息响应结果类 + * Created by Binary Wang on 2017-7-15. + *+ * + * @author Binary Wang + */ +@XStreamAlias("xml") +public class WxPayCouponInfoQueryResult extends WxPayBaseResult { + /** + *
+ * 字段名:设备号 + * 变量名:device_info + * 是否必填:否 + * 示例值:123456sb + * 类型:String(32) + * 说明:微信支付分配的终端设备号, + *+ */ + @XStreamAlias("device_info") + private String deviceInfo; + + /** + *
+ * 字段名:批次ID + * 变量名:coupon_stock_id + * 是否必填:是 + * 示例值:1567 + * 类型:String + * 说明:代金券批次Id + *+ */ + @XStreamAlias("coupon_stock_id") + private String couponStockId; + + /** + *
+ * 字段名:代金券id + * 变量名:coupon_id + * 是否必填:是 + * 示例值:4242 + * 类型:String + * 说明:代金券id + *+ */ + @XStreamAlias("coupon_id") + private String couponId; + + /** + *
+ * 字段名:代金券面额 + * 变量名:coupon_value + * 是否必填:是 + * 示例值:4 + * 类型:Unsinged int + * 说明:代金券面值,单位是分 + *+ */ + @XStreamAlias("coupon_value") + private Integer couponValue; + + /** + *
+ * 字段名:代金券使用门槛 + * 变量名:coupon_mininum + * 是否必填:是 + * 示例值:10 + * 类型:Unsinged int + * 说明:代金券使用最低限额,单位是分 + *+ */ + @XStreamAlias("coupon_mininum") + private Integer couponMininum; + + /** + *
+ * 字段名:代金券名称 + * 变量名:coupon_name + * 是否必填:是 + * 示例值:测试代金券 + * 类型:String + * 说明:代金券名称 + *+ */ + @XStreamAlias("coupon_name") + private String couponName; + + /** + *
+ * 字段名:代金券状态 + * 变量名:coupon_state + * 是否必填:是 + * 示例值:SENDED + * 类型:int + * 说明:代金券状态:SENDED-可用,USED-已实扣,EXPIRED-已过期 + *+ */ + @XStreamAlias("coupon_state") + private Integer couponState; + + /** + *
+ * 字段名:代金券描述 + * 变量名:coupon_desc + * 是否必填:是 + * 示例值:微信支付-代金券 + * 类型:String + * 说明:代金券描述 + *+ */ + @XStreamAlias("coupon_desc") + private String couponDesc; + + /** + *
+ * 字段名:实际优惠金额 + * 变量名:coupon_use_value + * 是否必填:是 + * 示例值:0 + * 类型:Unsinged int + * 说明:代金券实际使用金额 + *+ */ + @XStreamAlias("coupon_use_value") + private Integer couponUseValue; + + /** + *
+ * 字段名:优惠剩余可用额 + * 变量名:coupon_remain_value + * 是否必填:是 + * 示例值:4 + * 类型:Unsinged int + * 说明:代金券剩余金额:部分使用情况下,可能会存在券剩余金额 + *+ */ + @XStreamAlias("coupon_remain_value") + private Integer couponRemainValue; + + /** + *
+ * 字段名:生效开始时间 + * 变量名:begin_time + * 是否必填:是 + * 示例值:1943787483 + * 类型:String + * 说明:格式为时间戳 + *+ */ + @XStreamAlias("begin_time") + private String beginTime; + + /** + *
+ * 字段名:生效结束时间 + * 变量名:end_time + * 是否必填:是 + * 示例值:1943787484 + * 类型:String + * 说明:格式为时间戳 + *+ */ + @XStreamAlias("end_time") + private String endTime; + + /** + *
+ * 字段名:发放时间 + * 变量名:send_time + * 是否必填:是 + * 示例值:1943787420 + * 类型:String + * 说明:格式为时间戳 + *+ */ + @XStreamAlias("send_time") + private String sendTime; + + /** + *
+ * 字段名:消耗方商户id + * 变量名:consumer_mch_id + * 是否必填:否 + * 示例值:10000098 + * 类型:String + * 说明:代金券使用后,消耗方商户id + *+ */ + @XStreamAlias("consumer_mch_id") + private String consumerMchId; + + /** + *
+ * 字段名:发放来源 + * 变量名:send_source + * 是否必填:是 + * 示例值:FULL_SEND + * 类型:String + * 说明:代金券发放来源:FULL_SEND-满送 NORMAL-普通发放场景 + *+ */ + @XStreamAlias("send_source") + private String sendSource; + + /** + *
+ * 字段名:是否允许部分使用 + * 变量名:is_partial_use + * 是否必填:否 + * 示例值:1 + * 类型:String + * 说明:该代金券是否允许部分使用标识:1-表示支持部分使用 + *+ */ + @XStreamAlias("is_partial_use") + private String isPartialUse; + + public String getDeviceInfo() { + return this.deviceInfo; + } + + public void setDeviceInfo(String deviceInfo) { + this.deviceInfo = deviceInfo; + } + + public String getCouponStockId() { + return this.couponStockId; + } + + public void setCouponStockId(String couponStockId) { + this.couponStockId = couponStockId; + } + + public String getCouponId() { + return this.couponId; + } + + public void setCouponId(String couponId) { + this.couponId = couponId; + } + + public Integer getCouponValue() { + return this.couponValue; + } + + public void setCouponValue(Integer couponValue) { + this.couponValue = couponValue; + } + + public Integer getCouponMininum() { + return this.couponMininum; + } + + public void setCouponMininum(Integer couponMininum) { + this.couponMininum = couponMininum; + } + + public String getCouponName() { + return this.couponName; + } + + public void setCouponName(String couponName) { + this.couponName = couponName; + } + + public Integer getCouponState() { + return this.couponState; + } + + public void setCouponState(Integer couponState) { + this.couponState = couponState; + } + + public String getCouponDesc() { + return this.couponDesc; + } + + public void setCouponDesc(String couponDesc) { + this.couponDesc = couponDesc; + } + + public Integer getCouponUseValue() { + return this.couponUseValue; + } + + public void setCouponUseValue(Integer couponUseValue) { + this.couponUseValue = couponUseValue; + } + + public Integer getCouponRemainValue() { + return this.couponRemainValue; + } + + public void setCouponRemainValue(Integer couponRemainValue) { + this.couponRemainValue = couponRemainValue; + } + + public String getBeginTime() { + return this.beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getSendTime() { + return this.sendTime; + } + + public void setSendTime(String sendTime) { + this.sendTime = sendTime; + } + + public String getConsumerMchId() { + return this.consumerMchId; + } + + public void setConsumerMchId(String consumerMchId) { + this.consumerMchId = consumerMchId; + } + + public String getSendSource() { + return this.sendSource; + } + + public void setSendSource(String sendSource) { + this.sendSource = sendSource; + } + + public String getIsPartialUse() { + return this.isPartialUse; + } + + public void setIsPartialUse(String isPartialUse) { + this.isPartialUse = isPartialUse; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponStockQueryRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponStockQueryRequest.java new file mode 100644 index 000000000..24cec5523 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponStockQueryRequest.java @@ -0,0 +1,221 @@ +package com.github.binarywang.wxpay.bean.coupon; + +import com.github.binarywang.wxpay.bean.request.WxPayBaseRequest; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import me.chanjar.weixin.common.annotation.Required; + +/** + *
+ * 查询代金券批次请求对象类 + * Created by Binary Wang on 2017-7-15. + *+ * + * @author Binary Wang + */ +@XStreamAlias("xml") +public class WxPayCouponStockQueryRequest extends WxPayBaseRequest { + /** + *
+ * 字段名:代金券批次id + * 变量名:coupon_stock_id + * 是否必填:是 + * 示例值:1757 + * 类型:String + * 说明:代金券批次id + *+ */ + @Required + @XStreamAlias("coupon_stock_id") + private String couponStockId; + + /** + *
+ * 字段名:操作员 + * 变量名:op_user_id + * 是否必填:否 + * 示例值:10000098 + * 类型:String(32) + * 说明:操作员帐号, 默认为商户号,可在商户平台配置操作员对应的api权限 + *+ */ + @XStreamAlias("op_user_id") + private String opUserId; + + /** + *
+ * 字段名:设备号 + * 变量名:device_info + * 是否必填:否 + * 示例值: + * 类型:String(32) + * 说明:微信支付分配的终端设备号 + *+ */ + @XStreamAlias("device_info") + private String deviceInfo; + + /** + *
+ * 字段名:协议版本 + * 变量名:version + * 是否必填:否 + * 示例值:1.0 + * 类型:String(32) + * 说明:默认1.0 + *+ */ + @XStreamAlias("version") + private String version; + + /** + *
+ * 字段名:协议类型 + * 变量名:type + * 是否必填:否 + * 示例值:XML + * 类型:String(32) + * 说明:XML【目前仅支持默认XML】 + *+ */ + @XStreamAlias("type") + private String type; + + private WxPayCouponStockQueryRequest(Builder builder) { + setAppid(builder.appid); + setMchId(builder.mchId); + setSubAppId(builder.subAppId); + setSubMchId(builder.subMchId); + setNonceStr(builder.nonceStr); + setSign(builder.sign); + setCouponStockId(builder.couponStockId); + setOpUserId(builder.opUserId); + setDeviceInfo(builder.deviceInfo); + setVersion(builder.version); + setType(builder.type); + } + + public static Builder newBuilder() { + return new Builder(); + } + + public String getCouponStockId() { + return this.couponStockId; + } + + public void setCouponStockId(String couponStockId) { + this.couponStockId = couponStockId; + } + + public String getOpUserId() { + return this.opUserId; + } + + public void setOpUserId(String opUserId) { + this.opUserId = opUserId; + } + + public String getDeviceInfo() { + return this.deviceInfo; + } + + public void setDeviceInfo(String deviceInfo) { + this.deviceInfo = deviceInfo; + } + + public String getVersion() { + return this.version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + protected void checkConstraints() { + //do nothing + } + + public static final class Builder { + private String appid; + private String mchId; + private String subAppId; + private String subMchId; + private String nonceStr; + private String sign; + private String couponStockId; + private String opUserId; + private String deviceInfo; + private String version; + private String type; + + private Builder() { + } + + public Builder appid(String appid) { + this.appid = appid; + return this; + } + + public Builder mchId(String mchId) { + this.mchId = mchId; + return this; + } + + public Builder subAppId(String subAppId) { + this.subAppId = subAppId; + return this; + } + + public Builder subMchId(String subMchId) { + this.subMchId = subMchId; + return this; + } + + public Builder nonceStr(String nonceStr) { + this.nonceStr = nonceStr; + return this; + } + + public Builder sign(String sign) { + this.sign = sign; + return this; + } + + public Builder couponStockId(String couponStockId) { + this.couponStockId = couponStockId; + return this; + } + + public Builder opUserId(String opUserId) { + this.opUserId = opUserId; + return this; + } + + public Builder deviceInfo(String deviceInfo) { + this.deviceInfo = deviceInfo; + return this; + } + + public Builder version(String version) { + this.version = version; + return this; + } + + public Builder type(String type) { + this.type = type; + return this; + } + + public WxPayCouponStockQueryRequest build() { + return new WxPayCouponStockQueryRequest(this); + } + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponStockQueryResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponStockQueryResult.java new file mode 100644 index 000000000..065c3f606 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/coupon/WxPayCouponStockQueryResult.java @@ -0,0 +1,288 @@ +package com.github.binarywang.wxpay.bean.coupon; + +import com.github.binarywang.wxpay.bean.result.WxPayBaseResult; +import com.thoughtworks.xstream.annotations.XStreamAlias; + +/** + *
+ * 查询代金券批次响应结果类 + * Created by Binary Wang on 2017-7-15. + *+ * + * @author Binary Wang + */ +@XStreamAlias("xml") +public class WxPayCouponStockQueryResult extends WxPayBaseResult { + /** + *
+ * 字段名:设备号 + * 变量名:device_info + * 是否必填:否 + * 示例值:123456sb + * 类型:String(32) + * 说明:微信支付分配的终端设备号 + *+ */ + @XStreamAlias("device_info") + private String deviceInfo; + + /** + *
+ * 字段名:代金券批次ID + * 变量名:coupon_stock_id + * 是否必填:是 + * 示例值:1757 + * 类型:String + * 说明:代金券批次Id + *+ */ + @XStreamAlias("coupon_stock_id") + private String couponStockId; + + /** + *
+ * 字段名:代金券名称 + * 变量名:coupon_name + * 是否必填:否 + * 示例值:测试代金券 + * 类型:String + * 说明:代金券名称 + *+ */ + @XStreamAlias("coupon_name") + private String couponName; + + /** + *
+ * 字段名:代金券面额 + * 变量名:coupon_value + * 是否必填:是 + * 示例值:5 + * 类型:Unsinged int + * 说明:代金券面值,单位是分 + *+ */ + @XStreamAlias("coupon_value") + private Integer couponValue; + + /** + *
+ * 字段名:代金券使用最低限额 + * 变量名:coupon_mininumn + * 是否必填:否 + * 示例值:10 + * 类型:Unsinged int + * 说明:代金券使用最低限额,单位是分 + *+ */ + @XStreamAlias("coupon_mininumn") + private Integer couponMininumn; + + /** + *
+ * 字段名:代金券批次状态 + * 变量名:coupon_stock_status + * 是否必填:是 + * 示例值:4 + * 类型:int + * 说明:批次状态: 1-未激活;2-审批中;4-已激活;8-已作废;16-中止发放; + *+ */ + @XStreamAlias("coupon_stock_status") + private Integer couponStockStatus; + + /** + *
+ * 字段名:代金券数量 + * 变量名:coupon_total + * 是否必填:是 + * 示例值:100 + * 类型:Unsigned int + * 说明:代金券数量 + *+ */ + @XStreamAlias("coupon_total") + private Integer couponTotal; + + /** + *
+ * 字段名:代金券最大领取数量 + * 变量名:max_quota + * 是否必填:否 + * 示例值:1 + * 类型:Unsigned int + * 说明:代金券每个人最多能领取的数量, 如果为0,则表示没有限制 + *+ */ + @XStreamAlias("max_quota") + private Integer maxQuota; + + /** + *
+ * 字段名:代金券已经发送的数量 + * 变量名:is_send_num + * 是否必填:否 + * 示例值:0 + * 类型:Unsigned int + * 说明:代金券已经发送的数量 + *+ */ + @XStreamAlias("is_send_num") + private Integer isSendNum; + + /** + *
+ * 字段名:生效开始时间 + * 变量名:begin_time + * 是否必填:是 + * 示例值:1943787483 + * 类型:String + * 说明:格式为时间戳 + *+ */ + @XStreamAlias("begin_time") + private String beginTime; + + /** + *
+ * 字段名:生效结束时间 + * 变量名:end_time + * 是否必填:是 + * 示例值:1943787490 + * 类型:String + * 说明:格式为时间戳 + *+ */ + @XStreamAlias("end_time") + private String endTime; + + /** + *
+ * 字段名:创建时间 + * 变量名:create_time + * 是否必填:是 + * 示例值:1943787420 + * 类型:String + * 说明:格式为时间戳 + *+ */ + @XStreamAlias("create_time") + private String createTime; + + /** + *
+ * 字段名:代金券预算额度 + * 变量名:coupon_budget + * 是否必填:否 + * 示例值:500 + * 类型:Unsigned int + * 说明:代金券预算额度 + *+ */ + @XStreamAlias("coupon_budget") + private Integer couponBudget; + + public String getDeviceInfo() { + return this.deviceInfo; + } + + public void setDeviceInfo(String deviceInfo) { + this.deviceInfo = deviceInfo; + } + + public String getCouponStockId() { + return this.couponStockId; + } + + public void setCouponStockId(String couponStockId) { + this.couponStockId = couponStockId; + } + + public String getCouponName() { + return this.couponName; + } + + public void setCouponName(String couponName) { + this.couponName = couponName; + } + + public Integer getCouponValue() { + return this.couponValue; + } + + public void setCouponValue(Integer couponValue) { + this.couponValue = couponValue; + } + + public Integer getCouponMininumn() { + return this.couponMininumn; + } + + public void setCouponMininumn(Integer couponMininumn) { + this.couponMininumn = couponMininumn; + } + + public Integer getCouponStockStatus() { + return this.couponStockStatus; + } + + public void setCouponStockStatus(Integer couponStockStatus) { + this.couponStockStatus = couponStockStatus; + } + + public Integer getCouponTotal() { + return this.couponTotal; + } + + public void setCouponTotal(Integer couponTotal) { + this.couponTotal = couponTotal; + } + + public Integer getMaxQuota() { + return this.maxQuota; + } + + public void setMaxQuota(Integer maxQuota) { + this.maxQuota = maxQuota; + } + + public Integer getIsSendNum() { + return this.isSendNum; + } + + public void setIsSendNum(Integer isSendNum) { + this.isSendNum = isSendNum; + } + + public String getBeginTime() { + return this.beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public Integer getCouponBudget() { + return this.couponBudget; + } + + public void setCouponBudget(Integer couponBudget) { + this.couponBudget = couponBudget; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java index f2106c726..2eef29b85 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java @@ -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 { * */ WxPayCouponSendResult sendCoupon(WxPayCouponSendRequest request) throws WxPayException; + + /** + *
+ * 查询代金券批次 + * 接口请求链接: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 + *+ */ + WxPayCouponStockQueryResult queryCouponStock(WxPayCouponStockQueryRequest request) throws WxPayException; + + /** + *
+ * 查询代金券信息 + * 接口请求链接:https://api.mch.weixin.qq.com/mmpaymkttransfers/querycouponsinfo + * 文档地址:https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_5 + *+ */ + WxPayCouponInfoQueryResult queryCouponInfo(WxPayCouponInfoQueryRequest request) throws WxPayException; } diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceAbstractImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceAbstractImpl.java index b1c31b867..8eef35043 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceAbstractImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceAbstractImpl.java @@ -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; + } } diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxPayServiceAbstractImplTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxPayServiceAbstractImplTest.java index cc6ab5a0b..bbf444d90 100644 --- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxPayServiceAbstractImplTest.java +++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxPayServiceAbstractImplTest.java @@ -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.exception.WxPayException; @@ -283,4 +282,22 @@ public class WxPayServiceAbstractImplTest { .build()); this.logger.info(result.toString()); } + + @Test + public void testQueryCouponStock() throws Exception { + WxPayCouponStockQueryResult result = this.payService.queryCouponStock(WxPayCouponStockQueryRequest.newBuilder() + .couponStockId("123") + .build()); + this.logger.info(result.toString()); + } + + @Test + public void testQueryCouponInfo() throws Exception { + WxPayCouponInfoQueryResult result = this.payService.queryCouponInfo(WxPayCouponInfoQueryRequest.newBuilder() + .openid("onqOjjrXT-776SpHnfexGm1_P7iE") + .couponId("11") + .stockId("1121") + .build()); + this.logger.info(result.toString()); + } }