public async Task Can_withhold_withdrawal_money() { var player = _playerQueries.GetPlayers().ToList().First(); _paymentTestHelper.MakeDeposit(player.Id, 1000); await _gamesTestHelper.PlaceAndWinBet(1000, 1100, player.Id); var offlineWithdrawalRequest = new OfflineWithdrawRequest { Amount = 1000, NotificationType = NotificationType.None, BankAccountTime = _paymentRepository.PlayerBankAccounts.First().Created.ToString(), BankTime = _paymentRepository.Banks.First().Created.ToString(), PlayerBankAccountId = _paymentRepository .PlayerBankAccounts .Include(x => x.Player) .First(x => x.Player.Id == player.Id) .Id, Remarks = "asd", RequestedBy = _actorInfoProvider.Actor.UserName }; _withdrawalService.Request(offlineWithdrawalRequest); var playerBalance = await _walletQueries.GetPlayerBalance(player.Id); Assert.AreEqual(100, playerBalance.Free); Assert.AreEqual(1000, playerBalance.WithdrawalLock); }
public void Wagering_amount_setted_sucessfully() { var player = _playerQueries.GetPlayers().ToList().First(); _paymentTestHelper.MakeDeposit(player.Id, 1000); var deposit = _paymentRepository.OfflineDeposits.FirstOrDefault(x => x.PlayerId == player.Id); Assert.NotNull(deposit); Assert.AreEqual(deposit.DepositWagering, 1000); }
public override void BeforeEach() { base.BeforeEach(); Balance = new BonusBalance(); var bonusApiMock = new Mock <IBonusApiProxy>(); bonusApiMock.Setup(proxy => proxy.GetPlayerBalanceAsync(It.IsAny <Guid>(), It.IsAny <Guid?>())).ReturnsAsync(Balance); bonusApiMock.Setup(proxy => proxy.GetWageringBalancesAsync(It.IsAny <Guid>(), It.IsAny <Guid?>())).ReturnsAsync(new PlayerWagering()); Container.RegisterInstance(bonusApiMock.Object); _withdrawalService = Container.Resolve <IWithdrawalService>(); _playerQueries = Container.Resolve <PlayerQueries>(); _paymentRepository = Container.Resolve <FakePaymentRepository>(); _paymentTestHelper = Container.Resolve <PaymentTestHelper>(); Container.Resolve <PaymentWorker>().Start(); var securityTestHelper = Container.Resolve <SecurityTestHelper>(); securityTestHelper.PopulatePermissions(); securityTestHelper.CreateAndSignInSuperAdmin(); var brandHelper = Container.Resolve <BrandTestHelper>(); var brand = brandHelper.CreateActiveBrandWithProducts(); var player = Container.Resolve <PlayerTestHelper>().CreatePlayer(); _paymentTestHelper.CreatePlayerBankAccount(player.Id, brand.Id, true); _player = _playerQueries.GetPlayers().ToList().First(); _observedWithdrawalId = Guid.NewGuid(); }
protected object SearchData(SearchPackage searchPackage) { var vipLevels = _queries.VipLevels.ToArray(); var playerPaymentLevels = _paymentQueries.GetPlayerPaymentLevels(); var brands = CurrentBrands; var brandFilterSelections = _adminQueries.GetBrandFilterSelections(); var query = _queries.GetPlayers().Where(p => brands.Contains(p.BrandId) && brandFilterSelections.Contains(p.BrandId)); var dataBuilder = new SearchPackageDataBuilder <Core.Common.Data.Player.Player>(searchPackage, query); dataBuilder .SetFilterRule(x => x.BrandId, (value) => p => p.BrandId == new Guid(value)) .Map(player => player.Id, player => new[] { player.Username, player.FirstName, player.LastName, string.Empty, //affilaite code player.Gender.ToString(), player.Email, player.PhoneNumber, Format.FormatDate(player.DateRegistered, true), player.IpAddress, (Format.FormatDate(player.DateOfBirth, false) == "0001-01-01" ? null : Format.FormatDate(player.DateOfBirth, false)), string.Empty, //language player.CurrencyCode ?? string.Empty, player.CountryCode ?? string.Empty, (!player.IsInactive).ToString(), _brandQueries.GetBrandOrNull(player.BrandId).Name, string.Empty, //licensee player.VipLevel != null && vipLevels.SingleOrDefault(x => x.Id == player.VipLevel.Id) != null ? vipLevels.Single(x => x.Id == player.VipLevel.Id).Name : string.Empty, playerPaymentLevels.FirstOrDefault(x => x.PlayerId == player.Id) == null ? string.Empty : playerPaymentLevels.FirstOrDefault(x => x.PlayerId == player.Id).PaymentLevel.Name, string.Empty, //fraud risk level player.MailingAddressLine1, player.MailingAddressCity, player.MailingAddressPostalCode, string.Empty, //province player.VipLevel != null && vipLevels.SingleOrDefault(x => x.Id == player.VipLevel.Id) != null ? vipLevels.Single(x => x.Id == player.VipLevel.Id).ColorCode : string.Empty, } ); return(dataBuilder.GetPageData(player => player.Username)); }
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()); }
private Guid PickAPlayer(Guid playerId) { var playersAffectedByAvc = _playerQueries.GetPlayers() .Where(player => player.BrandId == _observedBrand.Id && player.Brand.LicenseeId == _observedBrand.Licensee.Id && player.CurrencyCode == _observedBrand.DefaultCurrency && player.VipLevelId == _observedBrand.DefaultVipLevelId); if (playersAffectedByAvc.Any()) { playerId = playersAffectedByAvc.FirstOrDefault().Id; } return(playerId); }
public override void BeforeEach() { base.BeforeEach(); mockAwcChec = new Mock <IAWCValidationService>(); Container.RegisterInstance(mockAwcChec.Object); mockBonusWageringCheck = new Mock <IBonusWageringWithdrawalValidationService>(); Container.RegisterInstance(mockBonusWageringCheck.Object); mockPaymentSettingsCheck = new Mock <IPaymentSettingsValidationService>(); Container.RegisterInstance(mockPaymentSettingsCheck.Object); mockManualAdjWageringCheck = new Mock <IManualAdjustmentWageringValidationService>(); Container.RegisterInstance(mockManualAdjWageringCheck.Object); mockRebateValidationCheck = new Mock <IRebateWageringValidationService>(); Container.RegisterInstance(mockRebateValidationCheck.Object); mockFundsValidationCheck = new Mock <IFundsValidationService>(); Container.RegisterInstance(mockFundsValidationCheck.Object); _withdrawalService = Container.Resolve <IWithdrawalService>(); _playerQueries = Container.Resolve <PlayerQueries>(); _paymentRepository = Container.Resolve <FakePaymentRepository>(); _actorInfoProvider = Container.Resolve <IActorInfoProvider>(); _paymentTestHelper = Container.Resolve <PaymentTestHelper>(); _gamesTestHelper = Container.Resolve <GamesTestHelper>(); Container.Resolve <PaymentWorker>().Start(); var securityTestHelper = Container.Resolve <SecurityTestHelper>(); securityTestHelper.PopulatePermissions(); securityTestHelper.CreateAndSignInSuperAdmin(); var brandHelper = Container.Resolve <BrandTestHelper>(); var brand = brandHelper.CreateActiveBrandWithProducts(); var player = Container.Resolve <PlayerTestHelper>().CreatePlayer(); _paymentTestHelper.CreatePlayerBankAccount(player.Id, brand.Id, true); _player = _playerQueries.GetPlayers().ToList().First(); }
public void Withdrawal_goes_directly_to_acceptance_queue_after_exemption_applied() { var brandId = _brandQueries.GetBrands().First().Id; var licenseeId = _brandQueries.GetBrands().First().Licensee.Id; var currency = _brandQueries.GetBrands().First().DefaultCurrency; var vipLevelId = (Guid)_brandQueries.GetBrands().First().DefaultVipLevelId; var playerId = new Guid(); var playersAffectedByAvc = _playerQueries.GetPlayers() .Where(player => player.BrandId == brandId && player.Brand.LicenseeId == licenseeId && player.CurrencyCode == currency && player.VipLevelId == vipLevelId); if (playersAffectedByAvc.Any()) { playerId = playersAffectedByAvc.FirstOrDefault().Id; } //Create a new avc that has a withdrawal exemption CreateAvcConfiguration(new AVCConfigurationDTO { Licensee = licenseeId, Brand = brandId, Currency = currency, VipLevels = new[] { vipLevelId }, HasWithdrawalExemption = true, HasWithdrawalCount = true, TotalWithdrawalCountAmount = 85, TotalWithdrawalCountOperator = ComparisonEnum.Greater, Status = AutoVerificationCheckStatus.Active }); _paymentTestHelper.MakeDeposit(playerId, 1000); Balance.Main = 1000; //Setup an exemption for a particular player that will make a withdrawal request later in the test case. var playerExemption = new Exemption { Exempt = true, ExemptFrom = DateTime.UtcNow.AddDays(-2).ToString(CultureInfo.InvariantCulture), ExemptTo = DateTime.UtcNow.AddDays(2).ToString(CultureInfo.InvariantCulture), ExemptLimit = 1, PlayerId = playerId }; _withdrawalService.SaveExemption(playerExemption); //Create the offline withdrawal request MakeWithdrawalRequest(playerId, playersAffectedByAvc); var numberOfVerifiedWithdrawals = _withdrawalService .GetWithdrawalsVerified().Count(wd => wd.PlayerBankAccount.Player.Id == playerId); Assert.AreEqual(1, numberOfVerifiedWithdrawals); //Since we are allowed to only one exemption, this means that on the next withdrawal //we must have our withdrawal request in the verification queue but not in the acceptance queue MakeWithdrawalRequest(playerId, playersAffectedByAvc); Assert.AreEqual(1, numberOfVerifiedWithdrawals); }