public async Task <SearchPackageResult> Data([FromUri] SearchPackage searchPackage, [FromUri] Guid playerId)
        {
            var player = _playerQueries.GetPlayer(playerId);

            CheckBrand(player.BrandId);

            var request         = Mapper.Map <FilteredDataRequest>(searchPackage);
            var filteredBonuses = await _bonusApiProxy.GetFilteredIssueBonusesAsync(new PlayerFilteredDataRequest
            {
                DataRequest = request,
                PlayerId    = playerId
            });

            var searchPackageResult = new SearchPackageResult
            {
                page    = filteredBonuses.Page,
                total   = filteredBonuses.Total,
                records = filteredBonuses.Records,
                rows    = filteredBonuses.Rows.Select(b => new SearchPackageResultRow
                {
                    id   = b.Id,
                    cell = new object[]
                    {
                        b.Name,
                        b.Code,
                        b.Type,
                        b.Status,
                        b.Description
                    }
                }).ToList()
            };

            return(searchPackageResult);
        }
Beispiel #2
0
        public bool IsDepositorsFullNameValid([FromUri] IsDepositorsFullNameValidRequest request)
        {
            var player = _playerQueries.GetPlayer(PlayerId);

            if (player == null)
            {
                throw new RegoException(ErrorMessagesEnum.ServiceUnavailable.ToString());
            }

            return(OfflineDepositConfirmValidator.IsAccountNameValid(request.Name, player));
        }
Beispiel #3
0
        public async Task <SearchPackageResult> Data([FromUri] SearchPackage searchPackage, [FromUri] Guid playerId)
        {
            var player = _playerQueries.GetPlayer(playerId);

            CheckBrand(player.BrandId);

            var brand = _brandQueries.GetBrand(player.BrandId);
            var rules = searchPackage.AdvancedFilter.Rules.Where(r => r.Field == "CreatedOn");

            foreach (var rule in rules)
            {
                var dateInBrandsTimezone = DateTime.Parse(rule.Data).ToBrandDateTimeOffset(brand.TimezoneId).ToString("O");
                rule.Data = dateInBrandsTimezone;
            }

            var request = Mapper.Map <FilteredDataRequest>(searchPackage);

            request.Filters.Where(f => f.Field == "BonusType").ForEach(f => f.Field = "Bonus.Type");
            var filteredBonuses = await _bonusApiProxy.GetFilteredBonusRedemptionAsync(new PlayerFilteredDataRequest
            {
                DataRequest = request,
                PlayerId    = playerId
            });

            var searchPackageResult = new SearchPackageResult
            {
                page    = filteredBonuses.Page,
                total   = filteredBonuses.Total,
                records = filteredBonuses.Records,
                rows    = filteredBonuses.Rows.Select(redemption => new SearchPackageResultRow
                {
                    id   = redemption.Id,
                    cell = new object[]
                    {
                        redemption.Bonus.Name,
                        redemption.Bonus.Type.ToString(),
                        Format.FormatDate(redemption.CreatedOn),
                        redemption.ActivationState.ToString(),
                        redemption.Amount.Format(),
                        redemption.Rollover.Format(),
                        (redemption.Rollover - redemption.RolloverLeft).Format(),
                        redemption.RolloverLeft.Format(),
                        redemption.RolloverState == RolloverStatus.Active //can be canceled
                    }
                }).ToList()
            };

            return(searchPackageResult);
        }
Beispiel #4
0
        public SecurityCheckRequestAbstractValidator(IPlayerQueries playerQueries)
        {
            RuleFor(o => o.Answer)
            .NotEmpty()
            .WithMessage("FieldIsRequired");

            RuleFor(o => o.PlayerId)
            .Must(id => playerQueries.GetPlayer(id) != null)
            .WithMessage(PlayerAccountResponseCode.PlayerDoesNotExist.ToString())
            .WithName("Answer");

            RuleFor(p => p)
            .Must(data => string.Compare(playerQueries.GetPlayer(data.PlayerId).SecurityAnswer, data.Answer, StringComparison.OrdinalIgnoreCase) == 0)
            .WithMessage(PlayerAccountResponseCode.IncorrectSecurityAnswer.ToString())
            .WithName("Answer");
        }
        public async Task <string> GetPlayerAuthTokenAsync(Guid playerId, string playerIpAddress, PlatformType platformType)
        {
            var player = _playerQueries.GetPlayer(playerId);

            var brandToken = await GetBrandTokenAsync(player.BrandId);

            var betLimitGroup = _gameQueries.GetBetLimitGroupByVipLevel(player.VipLevelId);

            var token = await GetApiClient().AuthorizePlayerAsync(new AuthorizePlayerRequest
            {
                userid    = player.Id.ToString(),
                ipaddress = playerIpAddress,
                username  = player.Username,
                //tag = , // need to know more to implement
                lang         = player.CultureCode,
                cur          = player.CurrencyCode,
                betlimitid   = betLimitGroup == null ? 0 : betLimitGroup.ExternalId, // this need to be refactored after UGS will implement separation of betlimitgroups by gameproviders
                platformtype = platformType,
                istestplayer = player.InternalAccount,
            }, brandToken);

            return(token.authtoken);
        }
Beispiel #6
0
            public ValidationResult Validate(ConfirmResetPasswordRequest request)
            {
                var player = _playerQueries.GetPlayer(request.PlayerId);
                var loginValidationResult = _playerQueries.GetValidationFailures(player.Username, null);

                if (!loginValidationResult.IsValid)
                {
                    return new ValidationResult
                           {
                               Errors = loginValidationResult.Errors
                                        .GroupBy(o => o.PropertyName)
                                        .Select(o => o.First())
                                        .ToDictionary(k => k.PropertyName, v => v.ErrorMessage)
                           }
                }
                ;

                var data    = Mapper.DynamicMap <ConfirmResetPasswordRequest, ConfirmResetPasswordData>(request);
                var result2 = _validator.Validate(data);

                if (!result2.IsValid)
                {
                    return new ValidationResult
                           {
                               Errors = result2.Errors
                                        .GroupBy(o => o.PropertyName)
                                        .Select(o => o.First())
                                        .ToDictionary(k => k.PropertyName, v => v.ErrorMessage)
                           }
                }
                ;


                var result = _authQueries.GetValidationResult(new ChangePassword
                {
                    ActorId     = request.PlayerId,
                    NewPassword = request.NewPassword
                });

                return(new ValidationResult
                {
                    Errors = result.Errors
                             .GroupBy(o => o.PropertyName)
                             .Select(o => o.First())
                             .ToDictionary(k => k.PropertyName, v => v.ErrorMessage)
                });
            }
        }
Beispiel #7
0
        public IEnumerable <BankAccount> GetBankAccountsForOfflineDeposit(Guid playerId)
        {
            var player = _playerQueries.GetPlayer(playerId);

            if (player == null)
            {
                throw new ArgumentException(@"Player was not found", "playerId");
            }

            var paymentLevel = _repository.PlayerPaymentLevels
                               .Include(x => x.PaymentLevel.BankAccounts.Select(s => s.Bank))
                               .Single(l => l.PlayerId == playerId)
                               .PaymentLevel;

            if (!paymentLevel.EnableOfflineDeposit)
            {
                return(new BankAccount[] { });
            }

            var bankAccounts = paymentLevel.BankAccounts.Where(x => x.Status == BankAccountStatus.Active);

            return(Mapper.Map <IEnumerable <BankAccount> >(bankAccounts));
        }
Beispiel #8
0
        public void ValidateOnlineDepositAmount(ValidateOnlineDepositAmountRequest request)
        {
            var player = _playerQueries.GetPlayer(request.PlayerId);

            new OnlineDepositValidator(_paymentQueries, _repository).ValidatePaymentSetting(player.Id, _paymentQueries.GetPaymentLevel(player.PaymentLevelId).PaymentGatewaySettings.First().OnlinePaymentMethodName, request.Amount, player.CurrencyCode);
        }