Skip to content

Commit 74e3cc5

Browse files
committed
#178 实现查询代金券批次和信息的接口
1 parent f3752e5 commit 74e3cc5

File tree

7 files changed

+1201
-6
lines changed

7 files changed

+1201
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
package com.github.binarywang.wxpay.bean.coupon;
2+
3+
import com.github.binarywang.wxpay.bean.request.WxPayBaseRequest;
4+
import com.thoughtworks.xstream.annotations.XStreamAlias;
5+
import me.chanjar.weixin.common.annotation.Required;
6+
7+
/**
8+
* <pre>
9+
* 查询代金券信息请求对象类
10+
* Created by Binary Wang on 2017-7-15.
11+
* </pre>
12+
*
13+
* @author <a href="https://github.com/binarywang">Binary Wang</a>
14+
*/
15+
@XStreamAlias("xml")
16+
public class WxPayCouponInfoQueryRequest extends WxPayBaseRequest {
17+
/**
18+
* <pre>
19+
* 字段名:代金券id
20+
* 变量名:coupon_id
21+
* 是否必填:是
22+
* 示例值:1757
23+
* 类型:String
24+
* 说明:代金券id
25+
* </pre>
26+
*/
27+
@Required
28+
@XStreamAlias("coupon_id")
29+
private String couponId;
30+
31+
/**
32+
* <pre>
33+
* 字段名:代金券批次号
34+
* 变量名:stock_id
35+
* 是否必填:是
36+
* 示例值:58818
37+
* 类型:String
38+
* 说明:代金劵对应的批次号
39+
* </pre>
40+
*/
41+
@Required
42+
@XStreamAlias("stock_id")
43+
private String stockId;
44+
45+
/**
46+
* <pre>
47+
* 字段名:用户openid
48+
* 变量名:openid
49+
* 是否必填:是
50+
* 示例值:onqOjjrXT-776SpHnfexGm1_P7iE
51+
* 类型:String
52+
* 说明:Openid信息,用户在appid下的openid。
53+
* </pre>
54+
*/
55+
@Required
56+
@XStreamAlias("openid")
57+
private String openid;
58+
59+
/**
60+
* <pre>
61+
* 字段名:操作员
62+
* 变量名:op_user_id
63+
* 是否必填:否
64+
* 示例值:10000098
65+
* 类型:String(32)
66+
* 说明:操作员帐号, 默认为商户号,可在商户平台配置操作员对应的api权限
67+
* </pre>
68+
*/
69+
@XStreamAlias("op_user_id")
70+
private String opUserId;
71+
72+
/**
73+
* <pre>
74+
* 字段名:设备号
75+
* 变量名:device_info
76+
* 是否必填:否
77+
* 示例值:
78+
* 类型:String(32)
79+
* 说明:微信支付分配的终端设备号
80+
* </pre>
81+
*/
82+
@XStreamAlias("device_info")
83+
private String deviceInfo;
84+
85+
/**
86+
* <pre>
87+
* 字段名:协议版本
88+
* 变量名:version
89+
* 是否必填:否
90+
* 示例值:1.0
91+
* 类型:String(32)
92+
* 说明:默认1.0
93+
* </pre>
94+
*/
95+
@XStreamAlias("version")
96+
private String version;
97+
98+
/**
99+
* <pre>
100+
* 字段名:协议类型
101+
* 变量名:type
102+
* 是否必填:否
103+
* 示例值:XML
104+
* 类型:String(32)
105+
* 说明:XML【目前仅支持默认XML】
106+
* </pre>
107+
*/
108+
@XStreamAlias("type")
109+
private String type;
110+
111+
private WxPayCouponInfoQueryRequest(Builder builder) {
112+
setAppid(builder.appid);
113+
setMchId(builder.mchId);
114+
setSubAppId(builder.subAppId);
115+
setSubMchId(builder.subMchId);
116+
setNonceStr(builder.nonceStr);
117+
setSign(builder.sign);
118+
setCouponId(builder.couponId);
119+
setStockId(builder.stockId);
120+
setOpenid(builder.openid);
121+
setOpUserId(builder.opUserId);
122+
setDeviceInfo(builder.deviceInfo);
123+
setVersion(builder.version);
124+
setType(builder.type);
125+
}
126+
127+
public static Builder newBuilder() {
128+
return new Builder();
129+
}
130+
131+
public String getCouponId() {
132+
return this.couponId;
133+
}
134+
135+
public void setCouponId(String couponId) {
136+
this.couponId = couponId;
137+
}
138+
139+
public String getStockId() {
140+
return this.stockId;
141+
}
142+
143+
public void setStockId(String stockId) {
144+
this.stockId = stockId;
145+
}
146+
147+
public String getOpenid() {
148+
return this.openid;
149+
}
150+
151+
public void setOpenid(String openid) {
152+
this.openid = openid;
153+
}
154+
155+
public String getOpUserId() {
156+
return this.opUserId;
157+
}
158+
159+
public void setOpUserId(String opUserId) {
160+
this.opUserId = opUserId;
161+
}
162+
163+
public String getDeviceInfo() {
164+
return this.deviceInfo;
165+
}
166+
167+
public void setDeviceInfo(String deviceInfo) {
168+
this.deviceInfo = deviceInfo;
169+
}
170+
171+
public String getVersion() {
172+
return this.version;
173+
}
174+
175+
public void setVersion(String version) {
176+
this.version = version;
177+
}
178+
179+
public String getType() {
180+
return this.type;
181+
}
182+
183+
public void setType(String type) {
184+
this.type = type;
185+
}
186+
187+
@Override
188+
protected void checkConstraints() {
189+
//do nothing
190+
}
191+
192+
193+
public static final class Builder {
194+
private String appid;
195+
private String mchId;
196+
private String subAppId;
197+
private String subMchId;
198+
private String nonceStr;
199+
private String sign;
200+
private String couponId;
201+
private String stockId;
202+
private String openid;
203+
private String opUserId;
204+
private String deviceInfo;
205+
private String version;
206+
private String type;
207+
208+
private Builder() {
209+
}
210+
211+
public Builder appid(String appid) {
212+
this.appid = appid;
213+
return this;
214+
}
215+
216+
public Builder mchId(String mchId) {
217+
this.mchId = mchId;
218+
return this;
219+
}
220+
221+
public Builder subAppId(String subAppId) {
222+
this.subAppId = subAppId;
223+
return this;
224+
}
225+
226+
public Builder subMchId(String subMchId) {
227+
this.subMchId = subMchId;
228+
return this;
229+
}
230+
231+
public Builder nonceStr(String nonceStr) {
232+
this.nonceStr = nonceStr;
233+
return this;
234+
}
235+
236+
public Builder sign(String sign) {
237+
this.sign = sign;
238+
return this;
239+
}
240+
241+
public Builder couponId(String couponId) {
242+
this.couponId = couponId;
243+
return this;
244+
}
245+
246+
public Builder stockId(String stockId) {
247+
this.stockId = stockId;
248+
return this;
249+
}
250+
251+
public Builder openid(String openid) {
252+
this.openid = openid;
253+
return this;
254+
}
255+
256+
public Builder opUserId(String opUserId) {
257+
this.opUserId = opUserId;
258+
return this;
259+
}
260+
261+
public Builder deviceInfo(String deviceInfo) {
262+
this.deviceInfo = deviceInfo;
263+
return this;
264+
}
265+
266+
public Builder version(String version) {
267+
this.version = version;
268+
return this;
269+
}
270+
271+
public Builder type(String type) {
272+
this.type = type;
273+
return this;
274+
}
275+
276+
public WxPayCouponInfoQueryRequest build() {
277+
return new WxPayCouponInfoQueryRequest(this);
278+
}
279+
}
280+
}

0 commit comments

Comments
 (0)