public void Cannot_execute_PlayerQueries_without_permissions()
        {
            // Arrange
            LogWithNewAdmin(Modules.PlayerManager, Permissions.Update);

            // Act
            Assert.Throws <InsufficientPermissionsException>(() => _playerQueries.GetPlayer(new Guid()));
            Assert.Throws <InsufficientPermissionsException>(async() => await _playerQueries.GetPlayerAsync(new Guid()));
            Assert.Throws <InsufficientPermissionsException>(() => _playerQueries.GetPlayerForWithdraw(new Guid()));
            Assert.Throws <InsufficientPermissionsException>(() => _playerQueries.GetPlayers());
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetIdentificationDocumentEditData(Guid id)
        {
            var player = _playerQueries.GetPlayer(id);

            return(Ok(new
            {
                Username = player.Username,
                BrandName = player.Brand.Name,
                LicenseeName = _brandQueries.GetLicensee(player.Brand.LicenseeId).Name,
                DocumentTypes = Enum.GetNames(typeof(DocumentType))
            }));
        }
        public async Task <ActionResult> GetForView(Guid id)
        {
            var response       = GetAdminApiProxy(Request).GetOfflineDepositById(id);
            var offlineDeposit = response.OfflineDeposit;

            var viewModel = new OfflineDepositViewModel(offlineDeposit);

            if (offlineDeposit.BonusRedemptionId.HasValue)
            {
                var player = _playerQueries.GetPlayer(offlineDeposit.PlayerId);
                if (!_adminQueries.IsBrandAllowed(CurrentUser.Id, player.BrandId))
                {
                    throw new HttpException(403, "Access forbidden");
                }

                var redemption = await _bonusApiProxy.GetBonusRedemptionAsync(offlineDeposit.PlayerId, offlineDeposit.BonusRedemptionId.Value);

                viewModel.BonusName = redemption.Bonus.Name;
            }

            return(this.Success(viewModel));
        }
Ejemplo n.º 4
0
        public PlayerData CreatePlayer(bool isActive = true)
        {
            var isMale   = new Random().Next(2) == 1;
            var brand    = _brandRepository.Brands.First();
            var password = TestDataGenerator.GetRandomString(12);


            var playerId = _playerCommands.Register(new RegistrationData
            {
                FirstName                 = TestDataGenerator.GetRandomString(),
                LastName                  = TestDataGenerator.GetRandomString(10),
                Email                     = TestDataGenerator.GetRandomEmail(),
                PhoneNumber               = TestDataGenerator.GetRandomString(12, TestDataGenerator.NumericChars),
                MailingAddressLine1       = "Address Line 1",
                MailingAddressLine2       = "Address Line 2",
                MailingAddressLine3       = "Address Line 3",
                MailingAddressLine4       = "Address Line 4",
                MailingAddressCity        = "Test City",
                MailingAddressPostalCode  = TestDataGenerator.GetRandomString(5, TestDataGenerator.NumericChars),
                PhysicalAddressLine1      = "Physical Address Line 1",
                PhysicalAddressLine2      = "Physical Address Line 2",
                PhysicalAddressLine3      = "Physical Address Line 3",
                PhysicalAddressLine4      = "Physical Address Line 4",
                PhysicalAddressCity       = "Physical Test City",
                PhysicalAddressPostalCode = TestDataGenerator.GetRandomString(5, TestDataGenerator.NumericChars),
                CountryCode               = brand.Countries.First().Code,
                CurrencyCode              = brand.DefaultCurrency,
                CultureCode               = brand.DefaultCulture.Code,
                Username                  = TestDataGenerator.GetRandomString(12),
                Password                  = password,
                PasswordConfirm           = password,
                DateOfBirth               = TestDataGenerator.GetDateOfBirthOver18().ToString("yyyy-MM-dd"),
                BrandId                   = brand.Id.ToString(),
                Gender                    = isMale ? Gender.Male.ToString() : Gender.Female.ToString(),
                Title                     = isMale ? Title.Mr.ToString() : Title.Mrs.ToString(),
                ContactPreference         = ContactMethod.Phone.ToString(),
                SecurityQuestionId        = TestDataGenerator.GetRandomSecurityQuestion(),
                SecurityAnswer            = "Security Answer " + TestDataGenerator.GetRandomString(),
                AccountStatus             = isActive ? AccountStatus.Active.ToString() : AccountStatus.Inactive.ToString(),
                IdStatus                  = "Verified"
            });


            return(_playerQueries.GetPlayer(playerId));
        }
Ejemplo n.º 5
0
        public Player CreatePlayer(bool isActive = true, Guid?brandId = null)
        {
            var playerRegData    = TestDataGenerator.CreateRandomRegistrationRequestData();
            var registrationData = Mapper.DynamicMap <RegistrationData>(playerRegData);

            brandId = brandId ?? _brandRepository.Brands.First().Id;
            var brand = _brandQueries.GetBrandOrNull(brandId.Value);

            registrationData.BrandId           = brand.Id.ToString();
            registrationData.CountryCode       = brand.BrandCountries.First().Country.Code;
            registrationData.CurrencyCode      = brand.BrandCurrencies.First().CurrencyCode;
            registrationData.CultureCode       = brand.BrandCultures.First().CultureCode;
            registrationData.IsInactive        = !isActive;
            registrationData.AccountAlertEmail = true;
            registrationData.AccountAlertSms   = true;

            var playerId = _playerCommands.Register(registrationData);

            return(_playerQueries.GetPlayer(playerId));
        }