mitao
2024-08-14 07057a9a0c8624ec1876670e69b0631b1213793f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
package com.ruoyi.order.util.tencent.common;
 
 
import com.ruoyi.order.util.ParamUtil;
 
/**
 * User: TZJ
 * Date: 2017/08/29
 * Time: 14:40
 * 这里放置微信支付的各种配置数据
 */
public class Configure {
//这个就是自己要保管好的私有Key了(切记只能放在自己的后台代码里,不能放在任何可能被看到源代码的客户端程序中)
    // 每次自己Post数据给API的时候都要用这个key来对所有字段进行签名,生成的签名会放在Sign这个字段,API收到Post数据的时候也会用同样的签名算法对Post过来的数据进行签名和验证
    // 收到API的返回的时候也要用这个key来对返回的数据算下签名,跟API的Sign数据进行比较,如果值不一致,有可能数据被第三方给篡改
 
    private static String key = ParamUtil.getValue("key");
 
    //用户端开发者平台的appid
    private static String appID = ParamUtil.getValue("appID");
    //公众号的appid
    private static String GappID = ParamUtil.getValue("GappID");
    //小程序的appid
    private static String XappID = ParamUtil.getValue("XappID");
    
    //公众号的appSecret
    private static String appSecret = ParamUtil.getValue("appSecret");
 
    //微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到)
    private static String mchID = ParamUtil.getValue("mchID");
    
    private static String GmchID = ParamUtil.getValue("GmchID");
    
    private static String XmchID = ParamUtil.getValue("XmchID");
    
    //微信回调地址
    public static String wx_notify_url = ParamUtil.getValue("wx_notify_url");
 
    //受理模式下给子商户分配的子商户号
    private static String subMchID = "";
 
    //HTTPS证书的本地路径
    private static String certLocalPath;
    static{//从服务器相对路径中获取
        // certLocalPath = Configure.class.getClassLoader().getResource("").getPath() + "com/ruoyi/order/util/tencent/common/cert/apiclient_cert.p12";
        certLocalPath = Configure.class.getClassLoader().getResource("").getPath()
                + "cert/apiclient_cert.p12";
    }
    
    //HTTPS证书密码,默认密码等于商户号MCHID
        private static String certPassword = mchID;
 
    //HTTPS证书的本地路径
    private static String certLocalPath_2;
    static{//从服务器相对路径中获取
        // certLocalPath_2 = Configure.class.getClassLoader().getResource("").getPath() + "com/ruoyi/order/util/tencent/common/cert_2/apiclient_cert.p12";
        // certLocalPath_2 = Configure.class.getClassLoader().getResource("").getPath()
        //         + "cert_2/apiclient_cert.p12";
        certLocalPath_2 = "/opt/lzlj/cert/wechat/apiclient_cert.p12";
    }    
    
    //HTTPS证书密码,默认密码等于商户号MCHID
    private static String certPassword_2 = mchID;
    
    //是否使用异步线程的方式来上报API测速,默认为异步模式
    private static boolean useThreadToDoReport = true;
 
    //机器IP
    private static String ip = "";
 
    //以下是几个API的路径:
    //1)被扫支付API
    public static String PAY_API = "https://api.mch.weixin.qq.com/pay/micropay";
 
    //2)被扫支付查询API
    public static String PAY_QUERY_API = "https://api.mch.weixin.qq.com/pay/orderquery";
 
    //3)退款API
    public static String REFUND_API = "https://api.mch.weixin.qq.com/secapi/pay/refund";
 
    //4)退款查询API
    public static String REFUND_QUERY_API = "https://api.mch.weixin.qq.com/pay/refundquery";
 
    //5)撤销API
    public static String REVERSE_API = "https://api.mch.weixin.qq.com/secapi/pay/reverse";
 
    //6)下载对账单API
    public static String DOWNLOAD_BILL_API = "https://api.mch.weixin.qq.com/pay/downloadbill";
 
    //7) 统计上报API
    public static String REPORT_API = "https://api.mch.weixin.qq.com/payitil/report";
    
    //商家支付用户(提现)API
    public static String PayToTheUser_API = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers";
 
    //统一下单API(预支付生成接口)
    public static String UNIFIEDORDER_API = "https://api.mch.weixin.qq.com/pay/unifiedorder";
    
    public static boolean isUseThreadToDoReport() {
        return useThreadToDoReport;
    }
 
    public static void setUseThreadToDoReport(boolean useThreadToDoReport) {
        Configure.useThreadToDoReport = useThreadToDoReport;
    }
 
    public static String HttpsRequestClassName = "com.ruoyi.order.util.tencent.common.HttpsRequest";
    
    public static String HttpsRequestClassName_2 = "com.ruoyi.order.util.tencent.common.HttpsRequest_2";
 
    public static void setKey(String key) {
        Configure.key = key;
    }
 
    public static void setAppID(String appID) {
        Configure.appID = appID;
    }
 
    public static void setMchID(String mchID) {
        Configure.mchID = mchID;
    }
 
    public static void setSubMchID(String subMchID) {
        Configure.subMchID = subMchID;
    }
 
    public static void setCertLocalPath(String certLocalPath) {
        Configure.certLocalPath = certLocalPath;
    }
 
    public static void setCertPassword(String certPassword) {
        Configure.certPassword = certPassword;
    }
 
    public static void setIp(String ip) {
        Configure.ip = ip;
    }
 
    public static String getKey(){
        return key;
    }
    
    public static String getAppid(){
        return appID;
    }
    public static String getGappid(){
        return GappID;
    }
    public static String getXappid(){
        return XappID;
    }    
    public static String getMchid(){
        return mchID;
    }
    
    public static String getGmchid(){
        return GmchID;
    }
    public static String getXmchid(){
        return XmchID;
    }
 
    public static String getCertPassword_2() {
        return certPassword_2;
    }
 
    public static void setCertPassword_2(String certPassword_2) {
        Configure.certPassword_2 = certPassword_2;
    }
 
    public static String getSubMchid(){
        return subMchID;
    }
    
    public static String getCertLocalPath(){
        return certLocalPath;
    }
    
    public static String getCertLocalPath_2() {
        return certLocalPath_2;
    }
 
    public static void setCertLocalPath_2(String certLocalPath_2) {
        Configure.certLocalPath_2 = certLocalPath_2;
    }
 
    public static String getCertPassword(){
        return certPassword;
    }
 
    public static String getIP(){
        return ip;
    }
 
    public static String getAppSecret() {
        return appSecret;
    }
 
    public static void setAppSecret(String appSecret) {
        Configure.appSecret = appSecret;
    }
 
    public static void setHttpsRequestClassName(String name){
        HttpsRequestClassName = name;
    }
 
}