예제 #1
0
        public BluePayProcessor(HttpClient httpClient, IWebEnvironment environment, IRandomGenerator random, IOptions <BluePayConfig> config)
        {
            _httpClient  = httpClient.CheckNotNull(nameof(httpClient));
            _environment = environment.CheckNotNull(nameof(environment));
            _random      = random;
            _config      = config.CheckNotNull(nameof(config));

            _mode = _config.Value.TestMode ? "TEST" : "LIVE";
            SetCurrency(Currency.Usd);
        }
        public OntraportHttpClient(HttpClient httpClient, IOptions <OntraportConfig> config, ILogger <OntraportHttpClient>?logger)
        {
            _httpClient = httpClient.CheckNotNull(nameof(httpClient));
            _logger     = logger;

            var conf = config.CheckNotNull(nameof(config)).Value;

            if (string.IsNullOrEmpty(conf.ApiKey))
            {
                throw new ArgumentException(Properties.Resources.ConfigApiKeyRequired);
            }
            if (string.IsNullOrEmpty(conf.AppId))
            {
                throw new ArgumentException(Properties.Resources.ConfigAppIdRequired);
            }

            _httpClient.BaseAddress = new Uri("https://api.ontraport.com/1/");
            _httpClient.DefaultRequestHeaders.Add("Api-key", conf.ApiKey);
            _httpClient.DefaultRequestHeaders.Add("Api-Appid", conf.AppId);
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the EmailSendingService class.
 /// </summary>
 /// <param name="settings">The configuration class.</param>
 public EmailMessage(IOptions <EmailConfig> settings)
 {
     _settings = settings.CheckNotNull(nameof(settings));
 }
예제 #4
0
 public RssLatest(ISyndicationFeedService rss, IOptions <LatestArticlesConfig> config)
 {
     _rss    = rss.CheckNotNull(nameof(rss));
     _config = config.CheckNotNull(nameof(config));
 }