1 package com.foxinmy.weixin4j.payment.mch;
2
3 import java.io.UnsupportedEncodingException;
4 import java.net.URLEncoder;
5 import java.util.HashMap;
6 import java.util.Map;
7
8 import com.foxinmy.weixin4j.util.Consts;
9 import com.foxinmy.weixin4j.util.DateUtil;
10 import com.foxinmy.weixin4j.util.MapUtil;
11
12
13
14
15
16
17
18
19
20
21
22 @Deprecated
23 public class RedpacketRisk {
24 private Map<String, String> risk;
25
26 public RedpacketRisk() {
27 this.risk = new HashMap<String, String>();
28 }
29
30
31
32
33
34
35 public RedpacketRisk postTimestamp() {
36 risk.put("posttime", DateUtil.timestamp2string());
37 return this;
38 }
39
40
41
42
43
44
45
46 public RedpacketRisk mobile(String mobile) {
47 risk.put("mobile", mobile);
48 return this;
49 }
50
51
52
53
54
55
56
57 public RedpacketRisk clientVersion(String clientVersion) {
58 risk.put("clientversion", clientVersion);
59 return this;
60 }
61
62
63
64
65
66
67
68 public RedpacketRisk deviceid(String deviceid) {
69 risk.put("deviceid", deviceid);
70 return this;
71 }
72
73 public Map<String, String> getRisk() {
74 return risk;
75 }
76
77 public String toContent() {
78 if (risk.isEmpty())
79 return null;
80 try {
81 return URLEncoder.encode(MapUtil.toJoinString(risk, false, false),
82 Consts.UTF_8.name());
83 } catch (UnsupportedEncodingException e) {
84 return null;
85 }
86 }
87 }