forked from kidgrow-microservices-platform

houruijun
2020-11-04 1e228c1191996a8e704cf36dc8042b1c6ca81ef1
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
package com.kidgrow.oprationcenter.weixin;
 
import java.io.ByteArrayInputStream;
import java.io.InputStream;
 
public class MyConfig extends WXPayConfig{
 
    public MyConfig(WeiXinOfficPayProperties weiXinOfficPayProperties) {
        this.weiXinOfficPayProperties = weiXinOfficPayProperties;
    }
 
    private WeiXinOfficPayProperties weiXinOfficPayProperties;
 
    private byte[] certData;
 
    public  MyConfig() {
 
    }
//    public MyConfig() throws Exception {
//        String certPath = "D:\\develop\\chengxu\\houtai\\3cc.txt";
//        File file = new File(certPath);
//        InputStream certStream = new FileInputStream(file);
//        this.certData = new byte[(int) file.length()];
//        certStream.read(this.certData);
//        certStream.close();
//    }
    //wx84c77dcda51c612c
    @Override
    public String getAppID() {
        return weiXinOfficPayProperties.getAppID();
//        return "wx84c77dcda51c612c";
    }
    @Override
    //"1386873502"
    public String getMchID() {
        return weiXinOfficPayProperties.getMchID();
//        return "1386873502";
    }
    @Override
    //"GSFcX6WdgRTAS6154EW14WE3SGBSER49"
    public String getKey() {
        return weiXinOfficPayProperties.getKey();
//        return "GSFcX6WdgRTAS6154EW14WE3SGBSER49";
    }
    @Override
    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }
    @Override
    public int getHttpConnectTimeoutMs() {
        return 8000;
    }
    @Override
    public int getHttpReadTimeoutMs() {
        return 10000;
    }
 
    @Override
    IWXPayDomain getWXPayDomain() throws Exception {
        MyIWXPayDomain myIWXPayDomain=new MyIWXPayDomain();
        MyConfig myConfig = new MyConfig();
        System.out.println(myConfig.getDomain());
        myIWXPayDomain.getDomain(myConfig);
        return myIWXPayDomain;
    }
 
    @Override
    public String getDomain() {
        return "api.mch.weixin.qq.com";
    }
 
    public String getPayNotifyUrl() {return weiXinOfficPayProperties.getPayNotifyUrl();}
}