public WeChatPayCertificateClient(WeChatPayOptions options)
        {
            Options = options;

            if (string.IsNullOrEmpty(Options.Certificate) || string.IsNullOrEmpty(Options.MchId))
            {
                throw new Exception("Error Certificate or MchId is Empty!");
            }

            var clientHandler = new HttpClientHandler();

            clientHandler.ClientCertificates.Add(new X509Certificate2(Convert.FromBase64String(Options.Certificate), Options.MchId, X509KeyStorageFlags.MachineKeySet));
            Client = new HttpClientEx(clientHandler);
        }
示例#2
0
 public WeChatPayNotifyClient(IOptions <WeChatPayOptions> optionsAccessor)
 {
     Options = optionsAccessor?.Value ?? new WeChatPayOptions();
 }
示例#3
0
 public WeChatPayNotifyClient(WeChatPayOptions options)
 {
     Options = options;
 }
示例#4
0
 public WeChatPayClient(WeChatPayOptions options)
 {
     Options = options;
     Client  = new HttpClientEx();
 }