Skip to content

Commit 6945e7e

Browse files
committed
实现刷卡支付提交API #101
1 parent f63e934 commit 6945e7e

File tree

6 files changed

+761
-9
lines changed

6 files changed

+761
-9
lines changed
Lines changed: 375 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,375 @@
1+
package com.github.binarywang.wxpay.bean.request;
2+
3+
import com.thoughtworks.xstream.annotations.XStreamAlias;
4+
import me.chanjar.weixin.common.annotation.Required;
5+
6+
/**
7+
* <pre>
8+
* 提交刷卡支付请求对象类
9+
* Created by Binary Wang on 2017-3-23.
10+
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
11+
* </pre>
12+
*/
13+
@XStreamAlias("xml")
14+
public class WxPayMicropayRequest extends WxPayBaseRequest {
15+
/**
16+
* <pre>
17+
* 签名类型
18+
* sign_type
19+
* 否
20+
* String(32)
21+
* HMAC-SHA256
22+
* 签名类型,目前支持HMAC-SHA256和MD5,默认为MD5
23+
**/
24+
@XStreamAlias("sign_type")
25+
private String signType;
26+
27+
/**
28+
* <pre>
29+
* 商品描述
30+
* body
31+
* 是
32+
* String(128)
33+
* image形象店-深圳腾大- QQ公仔
34+
* 商品简单描述,该字段须严格按照规范传递,具体请见参数规定
35+
**/
36+
@Required
37+
@XStreamAlias("body")
38+
private String body;
39+
40+
/**
41+
* <pre>
42+
* 商品详情
43+
* detail
44+
* 否
45+
* String(6000)
46+
*
47+
* 单品优惠功能字段,需要接入请见详细说明
48+
**/
49+
@XStreamAlias("detail")
50+
private String detail;
51+
52+
/**
53+
* <pre>
54+
* 附加数据
55+
* attach
56+
* 否
57+
* String(127)
58+
* 说明
59+
* 附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
60+
**/
61+
@XStreamAlias("attach")
62+
private String attach;
63+
64+
/**
65+
* <pre>
66+
* 商户订单号
67+
* out_trade_no
68+
* 是
69+
* String(32)
70+
* 1217752501201407033233368018
71+
* 商户系统内部的订单号,32个字符内、可包含字母,其他说明见商户订单号
72+
**/
73+
@Required
74+
@XStreamAlias("out_trade_no")
75+
private String outTradeNo;
76+
77+
/**
78+
* <pre>
79+
* 订单金额
80+
* total_fee
81+
* 是
82+
* Int
83+
* 888
84+
* 订单总金额,单位为分,只能为整数,详见支付金额
85+
**/
86+
@Required
87+
@XStreamAlias("total_fee")
88+
private Integer totalFee;
89+
90+
/**
91+
* <pre>
92+
* 货币类型
93+
* fee_type
94+
* 否
95+
* String(16)
96+
* CNY
97+
* 符合ISO4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
98+
**/
99+
@XStreamAlias("fee_type")
100+
private String feeType;
101+
102+
/**
103+
* <pre>
104+
* 终端IP
105+
* spbill_create_ip
106+
* 是
107+
* String(16)
108+
* 8.8.8.8
109+
* 调用微信支付API的机器IP
110+
**/
111+
@Required
112+
@XStreamAlias("spbill_create_ip")
113+
private String spbillCreateIp;
114+
115+
/**
116+
* <pre>
117+
* 商品标记
118+
* goods_tag
119+
* 否
120+
* String(32)
121+
* 1234
122+
* 商品标记,代金券或立减优惠功能的参数,说明详见代金券或立减优惠
123+
**/
124+
@XStreamAlias("goods_tag")
125+
private String goodsTag;
126+
127+
/**
128+
* <pre>
129+
* 指定支付方式
130+
* limit_pay
131+
* 否
132+
* String(32)
133+
* no_credit
134+
* no_credit--指定不能使用信用卡支付
135+
**/
136+
@XStreamAlias("limit_pay")
137+
private String limitPay;
138+
139+
/**
140+
* <pre>
141+
* 授权码
142+
* auth_code
143+
* 是
144+
* String(128)
145+
* 120061098828009406
146+
* 扫码支付授权码,设备读取用户微信中的条码或者二维码信息注:用户刷卡条形码规则:18位纯数字,以10、11、12、13、14、15开头)
147+
**/
148+
@Required
149+
@XStreamAlias("auth_code")
150+
private String authCode;
151+
152+
private WxPayMicropayRequest(Builder builder) {
153+
setSignType(builder.signType);
154+
setBody(builder.body);
155+
setAppid(builder.appid);
156+
setDetail(builder.detail);
157+
setMchId(builder.mchId);
158+
setAttach(builder.attach);
159+
setSubAppId(builder.subAppId);
160+
setOutTradeNo(builder.outTradeNo);
161+
setSubMchId(builder.subMchId);
162+
setTotalFee(builder.totalFee);
163+
setNonceStr(builder.nonceStr);
164+
setFeeType(builder.feeType);
165+
setSign(builder.sign);
166+
setSpbillCreateIp(builder.spbillCreateIp);
167+
setGoodsTag(builder.goodsTag);
168+
setLimitPay(builder.limitPay);
169+
setAuthCode(builder.authCode);
170+
}
171+
172+
public static Builder newBuilder() {
173+
return new Builder();
174+
}
175+
176+
public String getSignType() {
177+
return this.signType;
178+
}
179+
180+
public void setSignType(String signType) {
181+
this.signType = signType;
182+
}
183+
184+
public String getBody() {
185+
return this.body;
186+
}
187+
188+
public void setBody(String body) {
189+
this.body = body;
190+
}
191+
192+
public String getDetail() {
193+
return this.detail;
194+
}
195+
196+
public void setDetail(String detail) {
197+
this.detail = detail;
198+
}
199+
200+
public String getAttach() {
201+
return this.attach;
202+
}
203+
204+
public void setAttach(String attach) {
205+
this.attach = attach;
206+
}
207+
208+
public String getOutTradeNo() {
209+
return this.outTradeNo;
210+
}
211+
212+
public void setOutTradeNo(String outTradeNo) {
213+
this.outTradeNo = outTradeNo;
214+
}
215+
216+
public Integer getTotalFee() {
217+
return this.totalFee;
218+
}
219+
220+
public void setTotalFee(Integer totalFee) {
221+
this.totalFee = totalFee;
222+
}
223+
224+
public String getFeeType() {
225+
return this.feeType;
226+
}
227+
228+
public void setFeeType(String feeType) {
229+
this.feeType = feeType;
230+
}
231+
232+
public String getSpbillCreateIp() {
233+
return this.spbillCreateIp;
234+
}
235+
236+
public void setSpbillCreateIp(String spbillCreateIp) {
237+
this.spbillCreateIp = spbillCreateIp;
238+
}
239+
240+
public String getGoodsTag() {
241+
return this.goodsTag;
242+
}
243+
244+
public void setGoodsTag(String goodsTag) {
245+
this.goodsTag = goodsTag;
246+
}
247+
248+
public String getLimitPay() {
249+
return this.limitPay;
250+
}
251+
252+
public void setLimitPay(String limitPay) {
253+
this.limitPay = limitPay;
254+
}
255+
256+
public String getAuthCode() {
257+
return this.authCode;
258+
}
259+
260+
public void setAuthCode(String authCode) {
261+
this.authCode = authCode;
262+
}
263+
264+
public static final class Builder {
265+
private String signType;
266+
private String body;
267+
private String appid;
268+
private String detail;
269+
private String mchId;
270+
private String attach;
271+
private String subAppId;
272+
private String outTradeNo;
273+
private String subMchId;
274+
private Integer totalFee;
275+
private String nonceStr;
276+
private String feeType;
277+
private String sign;
278+
private String spbillCreateIp;
279+
private String goodsTag;
280+
private String limitPay;
281+
private String authCode;
282+
283+
private Builder() {
284+
}
285+
286+
public Builder signType(String signType) {
287+
this.signType = signType;
288+
return this;
289+
}
290+
291+
public Builder body(String body) {
292+
this.body = body;
293+
return this;
294+
}
295+
296+
public Builder appid(String appid) {
297+
this.appid = appid;
298+
return this;
299+
}
300+
301+
public Builder detail(String detail) {
302+
this.detail = detail;
303+
return this;
304+
}
305+
306+
public Builder mchId(String mchId) {
307+
this.mchId = mchId;
308+
return this;
309+
}
310+
311+
public Builder attach(String attach) {
312+
this.attach = attach;
313+
return this;
314+
}
315+
316+
public Builder subAppId(String subAppId) {
317+
this.subAppId = subAppId;
318+
return this;
319+
}
320+
321+
public Builder outTradeNo(String outTradeNo) {
322+
this.outTradeNo = outTradeNo;
323+
return this;
324+
}
325+
326+
public Builder subMchId(String subMchId) {
327+
this.subMchId = subMchId;
328+
return this;
329+
}
330+
331+
public Builder totalFee(Integer totalFee) {
332+
this.totalFee = totalFee;
333+
return this;
334+
}
335+
336+
public Builder nonceStr(String nonceStr) {
337+
this.nonceStr = nonceStr;
338+
return this;
339+
}
340+
341+
public Builder feeType(String feeType) {
342+
this.feeType = feeType;
343+
return this;
344+
}
345+
346+
public Builder sign(String sign) {
347+
this.sign = sign;
348+
return this;
349+
}
350+
351+
public Builder spbillCreateIp(String spbillCreateIp) {
352+
this.spbillCreateIp = spbillCreateIp;
353+
return this;
354+
}
355+
356+
public Builder goodsTag(String goodsTag) {
357+
this.goodsTag = goodsTag;
358+
return this;
359+
}
360+
361+
public Builder limitPay(String limitPay) {
362+
this.limitPay = limitPay;
363+
return this;
364+
}
365+
366+
public Builder authCode(String authCode) {
367+
this.authCode = authCode;
368+
return this;
369+
}
370+
371+
public WxPayMicropayRequest build() {
372+
return new WxPayMicropayRequest(this);
373+
}
374+
}
375+
}

0 commit comments

Comments
 (0)