MyPayConfig.java 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package com.lightinit.hsdataportal.WXsdk;
  2. import com.lightinit.hsdataportal.common.ConfigUtils;
  3. import com.lightinit.hsdataportal.common.SysContants;
  4. import java.io.ByteArrayInputStream;
  5. import java.io.InputStream;
  6. public class MyPayConfig extends WXPayConfig {
  7. private byte[] certData;
  8. public MyPayConfig() throws Exception {
  9. // String certPath = "/path/to/apiclient_cert.p12";
  10. //File file = new File(certPath);
  11. // InputStream certStream = new FileInputStream(file);
  12. // this.certData = new byte[(int) file.length()];
  13. // certStream.read(this.certData);
  14. // certStream.close();
  15. }
  16. public String getAppID() {
  17. return ConfigUtils.getConfiguration(SysContants.PropertyFilePath.CONFIG).getString(SysContants.PropertyKey.APPID);
  18. }
  19. public String getMchID() {
  20. return ConfigUtils.getConfiguration(SysContants.PropertyFilePath.CONFIG).getString(SysContants.PropertyKey.MCHID);
  21. }
  22. public String getKey() {
  23. return ConfigUtils.getConfiguration(SysContants.PropertyFilePath.CONFIG).getString(SysContants.PropertyKey.WXKEY);
  24. }
  25. public InputStream getCertStream() {
  26. ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
  27. return certBis;
  28. }
  29. public int getHttpConnectTimeoutMs() {
  30. return 8000;
  31. }
  32. public int getHttpReadTimeoutMs() {
  33. return 10000;
  34. }
  35. @Override
  36. IWXPayDomain getWXPayDomain() {
  37. return new WXPayDomain() ;
  38. }
  39. }