package com.lightinit.hsdataportal.WXsdk; import com.lightinit.hsdataportal.common.ConfigUtils; import com.lightinit.hsdataportal.common.SysContants; import java.io.ByteArrayInputStream; import java.io.InputStream; public class MyPayConfig extends WXPayConfig { private byte[] certData; public MyPayConfig() throws Exception { // String certPath = "/path/to/apiclient_cert.p12"; //File file = new File(certPath); // InputStream certStream = new FileInputStream(file); // this.certData = new byte[(int) file.length()]; // certStream.read(this.certData); // certStream.close(); } public String getAppID() { return ConfigUtils.getConfiguration(SysContants.PropertyFilePath.CONFIG).getString(SysContants.PropertyKey.APPID); } public String getMchID() { return ConfigUtils.getConfiguration(SysContants.PropertyFilePath.CONFIG).getString(SysContants.PropertyKey.MCHID); } public String getKey() { return ConfigUtils.getConfiguration(SysContants.PropertyFilePath.CONFIG).getString(SysContants.PropertyKey.WXKEY); } public InputStream getCertStream() { ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData); return certBis; } public int getHttpConnectTimeoutMs() { return 8000; } public int getHttpReadTimeoutMs() { return 10000; } @Override IWXPayDomain getWXPayDomain() { return new WXPayDomain() ; } }