Exemple #1
0
        private OperationResult UpdatingScoreCard(string scoreCardEncrypt)
        {
            var messageBuilder   = new StringBuilder();
            var scoreCardDecrypt = _rsaEncryption.DecryptData(scoreCardEncrypt);
            var scoreCard        = JsonConvert.DeserializeObject <ScoreCard>(scoreCardDecrypt);
            var extractors       = GetExtractors();

            foreach (var feature in scoreCard.Features)
            {
                var ifExistsExtractor = extractors.Any(extractor => string.Equals(feature.ExtractorId, extractor.Identifier));
                if (ifExistsExtractor)
                {
                    messageBuilder.AppendLine($"Not found extractor for score card feature - {feature.ExtractorId}");
                }
            }
            _initializeProcessScoreCard.Set();
            var messages = messageBuilder.ToString();

            if (string.IsNullOrEmpty(messages))
            {
                //todo: do need refresh keys?
                _scoreCard = scoreCardDecrypt;
                _rsaEncryption.RefreshKeys();
                return(new OperationResult(OperationStatus.SuccessInitializedScoreCard));
            }
            _scoreCard = null;
            return(new OperationResult(OperationStatus.FailedInitializeScoreCard, messages));
        }