1 package com.foxinmy.weixin4j.payment.mch;
2
3 import javax.xml.bind.annotation.XmlAccessType;
4 import javax.xml.bind.annotation.XmlAccessorType;
5 import javax.xml.bind.annotation.XmlElement;
6 import javax.xml.bind.annotation.XmlRootElement;
7
8 import com.alibaba.fastjson.annotation.JSONField;
9 import com.foxinmy.weixin4j.model.WeixinPayAccount;
10 import com.foxinmy.weixin4j.sign.WeixinPaymentSignature;
11 import com.foxinmy.weixin4j.util.Consts;
12 import com.foxinmy.weixin4j.util.RandomUtil;
13
14
15
16
17
18
19
20
21
22
23
24 @Deprecated
25 @XmlRootElement
26 @XmlAccessorType(XmlAccessType.FIELD)
27 public class NativePayResponse extends MerchantResult {
28
29 private static final long serialVersionUID = 6119895998783333012L;
30
31 @XmlElement(name = "prepay_id")
32 @JSONField(name = "prepay_id")
33 private String prepayId;
34
35 protected NativePayResponse() {
36
37 }
38
39
40
41
42
43
44
45
46
47
48 public NativePayResponse(String returnMsg, String resultMsg) {
49 super(Consts.FAIL, returnMsg);
50 super.setErrCodeDes(resultMsg);
51 super.setResultCode(Consts.FAIL);
52 }
53
54
55
56
57
58
59
60
61
62
63 public NativePayResponse(WeixinPayAccount weixinAccount, String prepayId) {
64 super(Consts.SUCCESS, "OK");
65 this.setResultCode(Consts.SUCCESS);
66 this.setMchId(weixinAccount.getMchId());
67 this.setAppId(weixinAccount.getId());
68 this.setNonceStr(RandomUtil.generateString(16));
69 this.prepayId = prepayId;
70 this.setSign(new WeixinPaymentSignature(weixinAccount.getPaySignKey())
71 .sign(this));
72 }
73
74 public String getPrepayId() {
75 return prepayId;
76 }
77
78 @Override
79 public String toString() {
80 return "NativePayResponse [prepayId=" + prepayId + ", "
81 + super.toString() + "]";
82 }
83 }