private void ValidatePlayersFraudRiskLevel(Guid withdrawalId, Guid playerId)
        {
            if (!_configuration.HasFraudRiskLevel)
            {
                return;
            }

            var isSuccess = true;

            var allPlayerRiskLevels = _riskLevelQueries
                                      .GetPlayerRiskLevels(playerId)
                                      .Where(x => x.RiskLevel.Status == RiskLevelStatus.Active)
                                      .ToList();

            var activeFraudlentRiskLevels = _configuration.AllowedRiskLevels
                                            .Where(frl => frl.Status == RiskLevelStatus.Active)
                                            .ToList();

            if (activeFraudlentRiskLevels.Any())
            {
                isSuccess = !allPlayerRiskLevels.Any(x => activeFraudlentRiskLevels.Any(fRl => fRl.Id == x.RiskLevel.Id));
            }

            var ruleValue = activeFraudlentRiskLevels.Any()
                ? string.Join(",", activeFraudlentRiskLevels.Select(rl => rl.Name))
                : "n/a";

            var actualValue = allPlayerRiskLevels.Any()
                ? string.Join(",", allPlayerRiskLevels.Select(prl => prl.RiskLevel.Name))
                : "n/a";

            var metadataForRule = GenerateFullRuleDescriptionAndValue(
                VerificationStep.FraudRiskLevel,
                ComparisonEnum.Of,
                ruleValue,
                actualValue);

            OnRuleFinish(isSuccess, withdrawalId, VerificationStep.FraudRiskLevel, metadataForRule);
        }
Ejemplo n.º 2
0
        public ActionResult Evaluation(SearchPackage searchPackage, Guid playerId)
        {
            var dataBuilder = new SearchPackageDataBuilder <PlayerRiskLevel>(searchPackage, _queries.GetPlayerRiskLevels(playerId));

            dataBuilder.SetFilterRule(x => x.PlayerId, (value) => x => x.PlayerId == new Guid(value))
            .Map(x => x.Id, x => new object[]
            {
                x.RiskLevel.Level,
                x.RiskLevel.Name,
                Format.FormatDate(x.DateCreated, true),
                x.CreatedBy,
                x.Description,
                x.PlayerId
            });

            var data = dataBuilder.GetPageData(x => x.Id);

            return(new JsonResult {
                Data = data, MaxJsonLength = int.MaxValue, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }