コード例 #1
0
        public DepositService(IDepositRepository depositRepository, IMapper mapper, IPushpayService pushpayService, IConfigurationWrapper configurationWrapper, IRestClient restClient = null)
        {
            _depositRepository = depositRepository;
            _mapper            = mapper;
            _pushpayService    = pushpayService;
            _restClient        = restClient ?? new RestClient();

            _financePath = Environment.GetEnvironmentVariable("FINANCE_PATH") ??
                           configurationWrapper.GetMpConfigValue("CRDS-FINANCE", "FinanceMicroservicePath", true);

            _depositProcessingOffset = configurationWrapper.GetMpConfigIntValue("CRDS-FINANCE", "DepositProcessingOffset", true).GetValueOrDefault();
        }
コード例 #2
0
        public void SyncPosts()
        {
            var token   = _apiUserRepository.GetToken();
            var request = new RestRequest("corkboard/api/v1.0.0/syncposts", Method.POST);

            request.AddParameter("Authorization", $"Bearer {token}", ParameterType.HttpHeader);

            var serverApiKey = _configuration.GetMpConfigValue("CRDS-COMMON", "ServerApiKey");

            if (!string.IsNullOrWhiteSpace(serverApiKey))
            {
                request.AddHeader("Crds-Api-Key", serverApiKey);
            }

            var response = _servicesRestClient.Execute(request);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new ApplicationException($"Received {response.StatusCode} status code from corkboard api.");
            }
        }
コード例 #3
0
        public IObservable <string> GetUrlSegment()
        {
            string appCode   = _configWrapper.GetConfigValue("GroupLeaderAppCode");
            string paramName = _configWrapper.GetConfigValue("GroupLeaderApplicationUrlSegment");

            return(Observable.Create <string>(observer =>
            {
                try
                {
                    string urlSegment = _configWrapper.GetMpConfigValue(appCode, paramName, true);
                    observer.OnNext(urlSegment);
                }
                catch (Exception e)
                {
                    observer.OnError(new ApplicationException("Failed to get redirect url segment: ", e));
                }

                observer.OnCompleted();
                return Disposable.Empty;
            }));
        }
 public static string GetAppMpConfigValue(this IConfigurationWrapper configWrapper, string key)
 {
     return(configWrapper.GetMpConfigValue("CRDS-FINANCE", key));
 }