Exemplo n.º 1
0
        public DefaultAopClient(AlipayConfig config)
        {
            this.serverUrl       = config.ServerUrl;
            this.appId           = config.AppId;
            this.format          = config.Format;
            this.charset         = config.Charset;
            this.signType        = config.SignType;
            this.keyFromFile     = false;
            this.privateKeyPem   = config.PrivateKey;
            this.alipayPublicKey = config.AlipayPublicKey;

            //设置了支付宝公钥证书相关参数才初始化证书模式的运行环境
            if (!string.IsNullOrEmpty(config.AlipayPublicCertPath) ||
                !string.IsNullOrEmpty(config.AlipayPublicCertContent))
            {
                CertParams certParams = new CertParams();
                certParams.AppCertPath             = config.AppCertPath;
                certParams.AlipayPublicCertPath    = config.AlipayPublicCertPath;
                certParams.RootCertPath            = config.RootCertPath;
                certParams.AppCertContent          = config.AppCertContent;
                certParams.AlipayPublicCertContent = config.AlipayPublicCertContent;
                certParams.RootCertContent         = config.RootCertContent;
                this.certEnvironment = new CertEnvironment(certParams, this.signType);
            }


            this.encyptType = config.EncryptType;
            this.encyptKey  = config.EncryptKey;

            this.webUtils                  = new WebUtils();
            this.webUtils.Timeout          = config.ConnectTimeout;
            this.webUtils.ReadWriteTimeout = config.ReadTimeout;
            this.webUtils.CustomHeaders    = config.CustomHeaders;
            if (!string.IsNullOrEmpty(config.ProxyHost))
            {
                this.webUtils.Proxy = new WebProxy(config.ProxyHost, config.ProxyPort);
            }
        }
Exemplo n.º 2
0
 public DefaultAopClient(string serverUrl, string appId, string privateKeyPem, string format, string version, string signType, string charset, string encyptKey, CertParams certParams)
     : this(serverUrl, appId, privateKeyPem, format, version, signType, null, charset, encyptKey)
 {
     this.certEnvironment = new CertEnvironment(certParams, signType);
 }