content: package com.cf.pay.service.config;
  
  import com.github.wxpay.sdk.WXPayConfig;
  import org.springframework.boot.context.properties.ConfigurationProperties;
  import org.springframework.context.annotation.Configuration;
  
  import java.io.InputStream;
  
  /**
   * 微信支付配置
   *
   * @ClassName WxPayAppConfig
   * @Author 隔壁小王子 981011512@qq.com
   * @Date 2020/5/4/004 8:31
   * @Version 1.0
   **/
  public class WxPayAppConfig implements WXPayConfig {
      /**
       * appID
       */
      private String appID;
  
      private String subAppID;
  
      /**
       * 商户号
       */
      private String mchID;
  
      private String subMchID;
  
      /**
       * API 密钥
       */
      private String key;
  
      /**
       * API证书绝对路径 (本项目放在了 resources/cert/wxpay/apiclient_cert.p12")
       */
      private String certPath;
  
      /**
       * HTTP(S) 连接超时时间，单位毫秒
       */
      private int httpConnectTimeoutMs = 8000;
  
      /**
       * HTTP(S) 读数据超时时间，单位毫秒
       */
      private int httpReadTimeoutMs = 10000;
  
      /**
       * 微信支付异步通知地址
       */
      private String payNotifyUrl;
  
      /**
       * 微信退款异步通知地址
       */
      private String refundNotifyUrl;
  
      /**
       * 获取商户证书内容（这里证书需要到微信商户平台进行下载）
       *
       * @return 商户证书内容
       */
      @Override
      public InputStream getCertStream() {
          InputStream certStream  =getClass().getClassLoader().getResourceAsStream(certPath);
          return certStream;
      }
  
      public String getAppID() {
          return appID;
      }
  
      public void setAppID(String appID) {
          this.appID = appID;
      }
  
      public String getMchID() {
          return mchID;
      }
  
      public void setMchID(String mchID) {
          this.mchID = mchID;
      }
  
      public String getKey() {
          return key;
      }
  
      public void setKey(String key) {
          this.key = key;
      }
  
      public String getCertPath() {
          return certPath;
      }
  
      public void setCertPath(String certPath) {
          this.certPath = certPath;
      }
  
      public int getHttpConnectTimeoutMs() {
          return httpConnectTimeoutMs;
      }
  
      public void setHttpConnectTimeoutMs(int httpConnectTimeoutMs) {
          this.httpConnectTimeoutMs = httpConnectTimeoutMs;
      }
  
      public int getHttpReadTimeoutMs() {
          return httpReadTimeoutMs;
      }
  
      public void setHttpReadTimeoutMs(int httpReadTimeoutMs) {
          this.httpReadTimeoutMs = httpReadTimeoutMs;
      }
  
      public String getPayNotifyUrl() {
          return payNotifyUrl;
      }
  
      public void setPayNotifyUrl(String payNotifyUrl) {
          this.payNotifyUrl = payNotifyUrl;
      }
  
      public String getRefundNotifyUrl() {
          return refundNotifyUrl;
      }
  
      public void setRefundNotifyUrl(String refundNotifyUrl) {
          this.refundNotifyUrl = refundNotifyUrl;
      }
  
      public String getSubAppID() {
          return subAppID;
      }
  
      public void setSubAppID(String subAppID) {
          this.subAppID = subAppID;
      }
  
      public String getSubMchID() {
          return subMchID;
      }
  
      public void setSubMchID(String subMchID) {
          this.subMchID = subMchID;
      }
  }
  