public WechatScanPayEndpoint(ILogger <WechatScanPayEndpoint> logger, IWeChatPayClient client, IScanPayValidator validator) { this._logger = logger; this._client = client; this._validator = validator; }
public WepayService(IWeChatPayClient client, IOptions <WeChatPayOptions> options, IOrderService orderService) { this.client = client; this.options = options; this.orderService = orderService; }
/// <summary> /// 构造函数 /// </summary> /// <param name="accessor"></param> /// <param name="client"></param> /// <param name="wechatPayOption"></param> public PaymentService(IHttpContextAccessor accessor, IWeChatPayClient client, IOptions <WeChatPayOptions> wechatPayOption) { _accessor = accessor; _client = client; _wechatPayOption = wechatPayOption.Value; }
public PaymentService( ILogger <PaymentService> logger, IWeChatPayClient client, IAppSettingService appSettingService) { _logger = logger; _client = client; _appSettingService = appSettingService; }
public async Task <WeChatPayPlatformCertificate> GetCertificateAsync(IWeChatPayClient client, WeChatPayOptions options) { // 如果证书序列号已缓存,则直接使用缓存的 var platformCert = _certDictionary.Values.Where(cert => cert.EffectiveTime <DateTime.Now && cert.ExpireTime> DateTime.Now).FirstOrDefault(); if (platformCert != null) { return(platformCert); } // 否则重新下载新的平台证书 var request = new WeChatPayCertificatesRequest(); var response = await client.ExecuteAsync(request, options); foreach (var certificate in response.Certificates) { // 若证书序列号未被缓存,解密证书并加入缓存 if (!_certDictionary.ContainsKey(certificate.SerialNo)) { switch (certificate.EncryptCertificate.Algorithm) { case nameof(AEAD_AES_256_GCM): { var certStr = AEAD_AES_256_GCM.Decrypt(certificate.EncryptCertificate.Nonce, certificate.EncryptCertificate.Ciphertext, certificate.EncryptCertificate.AssociatedData, options.V3Key); var cert = new WeChatPayPlatformCertificate { SerialNo = certificate.SerialNo, EffectiveTime = DateTime.Parse(certificate.EffectiveTime), ExpireTime = DateTime.Parse(certificate.ExpireTime), Certificate = new X509Certificate2(Encoding.ASCII.GetBytes(certStr)) }; _certDictionary.TryAdd(certificate.SerialNo, cert); } break; default: throw new WeChatPayException($"Unknown algorithm: {certificate.EncryptCertificate.Algorithm}"); } } } // 重新从缓存获取 platformCert = _certDictionary.Values.Where(cert => cert.EffectiveTime <DateTime.Now && cert.ExpireTime> DateTime.Now).FirstOrDefault(); if (platformCert != null) { return(platformCert); } else { throw new WeChatPayException("Download certificates failed!"); } }
public PaymentService( ILogger <PaymentService> logger, IWeChatPayClient client, IOptionsMonitor <MiniProgramOptions> options, IOptionsMonitor <ShopConfig> config) { _logger = logger; _client = client; _options = options; _apiHost = config.CurrentValue.ApiHost; }
private void init() { var someOptions = Options.Create(new WeChatPayOptions { AppId = "wxdace645e0bc2c424", AppSecret = "4693afc6b2084885ca9fbc2355b97827", BaseUrl = "https://api.mch.weixin.qq.com", Key = "1900009641" }); _client = new WeChatPayClient(someOptions, wechatpaylogger); _subject = new WechatAppletPayEndpoint(logger, _client); }
public WepayService(ILogger <WepayService> logger, IWeChatPayClient client, IWeChatPayNotifyClient notifyClient, IOptions <WeChatPayOptions> options, IOrderService orderService) { this.logger = logger; this.client = client; this.notifyClient = notifyClient; this.options = options; this.OrderService = orderService; }
/// <summary> /// 构造函数 /// </summary> /// <param name="client"></param> /// <param name="options"></param> /// <param name="withdrawalHistoryRepository"></param> /// <param name="custoemrRepository"></param> /// <param name="customerManager"></param> /// <param name="mapper"></param> public AdminWithdrawalController(IWeChatPayClient client, IOptions <WeChatPayOptions> options, IRepositoryByInt <WithdrawalHistory> withdrawalHistoryRepository, IRepositoryByInt <Customer> custoemrRepository, ICustomerManager customerManager, IMapper mapper) { _client = client; _weChatPayOptions = options.Value; _withdrawalHistoryRepository = withdrawalHistoryRepository; _custoemrRepository = custoemrRepository; _customerManager = customerManager; _mapper = mapper; }
public QueryResult(IWeChatPayClient client) { this._client = client; }
public WechatPublicPayEndpoint(ILogger <WechatPublicPayEndpoint> logger, IWeChatPayClient client) { this._logger = logger; this._client = client; }
public AppPayResult(IWeChatPayClient client) { this._client = client; }
public CloseResult(IWeChatPayClient client) { this._client = client; }
public WeChatPayController(IWeChatPayClient client) { _client = client; }
public WeChatPayController(IWeChatPayClient client, IOptions <WeChatPayOptions> optionsAccessor) { _client = client; _optionsAccessor = optionsAccessor; }
public WeChatPayController(ILogger <WeChatPayController> logger, IWeChatPayClient client, IOptions <WeChatPayOptions> optionsAccessor) { _logger = logger; _client = client; _optionsAccessor = optionsAccessor; }
public WeChatPayNotifyClient(IWeChatPayClient client, WeChatPayPlatformCertificateManager platformCertificateManager) { _client = client; _platformCertificateManager = platformCertificateManager; }