Esempio n. 1
0
        public void Validate(Guid withdrawalId)
        {
            var withdrawal = _paymentRepository
                             .OfflineWithdraws
                             .Include(x => x.PlayerBankAccount)
                             .Single(x => x.Id == withdrawalId);

            var bankAccount = _paymentRepository.PlayerBankAccounts
                              .Include(x => x.Player)
                              .Single(x => x.Id == withdrawal.PlayerBankAccount.Id);

            _configuration = _riskProfileCheckQueries
                             .GetConfigurations()
                             .Include(o => o.AllowedPaymentMethods)
                             .Include(o => o.AllowedBonuses)
                             .Include(o => o.AllowedRiskLevels)
                             .Include(o => o.VipLevels)
                             .ToList()
                             .SingleOrDefault(x =>
                                              x.BrandId == bankAccount.Player.BrandId &&
                                              x.VipLevels.Select(o => o.Id).Contains(bankAccount.Player.VipLevelId) &&
                                              x.Currency == bankAccount.Player.CurrencyCode);

            if (_configuration == null)
            {
                return;
            }

            base.Validate(_configuration, withdrawalId);

            ValidatePaymentMethod(withdrawal);
            ValidateBonus(withdrawal, bankAccount.Player);
            ValidateWithdrawalAveragePercentageChange(withdrawal, bankAccount.Player.Id);
            ValidateWinningsToDepositPercentageIncrease(withdrawal, bankAccount.Player.Id);
        }
        public object List(SearchPackage searchPackage)
        {
            var dataBuilder = new SearchPackageDataBuilder <RiskProfileConfiguration>(
                searchPackage,
                _riskProfileCheckQueries.GetConfigurations()
                .Include(o => o.Brand)
                .Include(o => o.VipLevels));

            dataBuilder.SetFilterRule(x => x.Brand, value => p => p.Brand.Id == Guid.Parse(value))
            .Map(configuration => configuration.Id,
                 obj => new[]
            {
                obj.Brand.LicenseeName,
                obj.Brand.Name,
                obj.Currency,
                string.Join("\r\n", obj.VipLevels.Select(o => o.Name)),
                GetCriteriasString(obj),
                _securityRepository.Admins.Single(x => x.Id == obj.CreatedBy).Username,
                Format.FormatDate(obj.DateCreated, false)
            });
            var data = dataBuilder.GetPageData(configuration => configuration.Brand.Name);

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