Ejemplo n.º 1
0
        public async Task <Template> CreateTemplate(
            CreateUpdateTemplateInfo info = null,
            CreateUpdateTemplateAvailability availability = null,
            CreateUpdateTemplateRules rules               = null,
            CreateUpdateTemplateWagering wagering         = null,
            CreateUpdateTemplateNotification notification = null
            )
        {
            var brand = _brandQueries.GetBrands().First();
            var model = new CreateUpdateTemplate
            {
                Id   = Guid.Empty,
                Info = info ?? new CreateUpdateTemplateInfo
                {
                    Name             = TestDataGenerator.GetRandomString(),
                    TemplateType     = BonusType.FirstDeposit,
                    BrandId          = brand.Id,
                    WalletTemplateId = brand.WalletTemplates.First().Id,
                    Mode             = IssuanceMode.Automatic
                }
            };
            var response = await _bonusApiProxy.CreateUpdateBonusTemplateAsync(model);

            if (response.Success == false)
            {
                throw new Exception(response.Errors.First().ErrorMessage);
            }

            model = new CreateUpdateTemplate
            {
                Id           = response.Id.Value,
                Version      = response.Version.Value,
                Availability = availability ?? new CreateUpdateTemplateAvailability(),
                Rules        = rules ?? new CreateUpdateTemplateRules
                {
                    RewardTiers = new List <CreateUpdateRewardTier>
                    {
                        new CreateUpdateRewardTier
                        {
                            CurrencyCode = "CAD",
                            BonusTiers   = new List <CreateUpdateTemplateTier> {
                                new CreateUpdateTemplateTier {
                                    Reward = 29
                                }
                            }
                        }
                    }
                },
                Wagering     = wagering ?? new CreateUpdateTemplateWagering(),
                Notification = notification ?? new CreateUpdateTemplateNotification()
            };
            response = await _bonusApiProxy.CreateUpdateBonusTemplateAsync(model);

            if (response.Success == false)
            {
                throw new Exception(response.Errors.First().ErrorMessage);
            }

            return(await _bonusApiProxy.GetTemplateOrNull(response.Id.Value));
        }
Ejemplo n.º 2
0
        public Template CreateTemplate(
            CreateUpdateTemplateInfo info = null,
            CreateUpdateTemplateAvailability availability = null,
            CreateUpdateTemplateRules rules               = null,
            CreateUpdateTemplateWagering wagering         = null,
            CreateUpdateTemplateNotification notification = null
            )
        {
            var model = new CreateUpdateTemplate
            {
                Id   = Guid.Empty,
                Info = info ?? CreateTemplateInfo(BonusType.FirstDeposit)
            };
            var identifier = BonusManagementCommands.AddUpdateTemplate(model);

            model = new CreateUpdateTemplate
            {
                Id           = identifier.Id,
                Version      = identifier.Version,
                Availability = availability ?? new CreateUpdateTemplateAvailability(),
                Rules        = rules ?? new CreateUpdateTemplateRules
                {
                    RewardTiers = new List <CreateUpdateRewardTier>
                    {
                        new CreateUpdateRewardTier
                        {
                            CurrencyCode = "CAD",
                            BonusTiers   = new List <CreateUpdateTemplateTier> {
                                new CreateUpdateTemplateTier {
                                    Reward = 27
                                }
                            }
                        }
                    }
                },
                Wagering     = wagering ?? new CreateUpdateTemplateWagering(),
                Notification = notification ?? new CreateUpdateTemplateNotification()
            };
            identifier = BonusManagementCommands.AddUpdateTemplate(model);

            return(BonusRepository.Templates.Single(t => t.Id == identifier.Id && t.Version == identifier.Version));
        }
Ejemplo n.º 3
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            var brand = BonusRepository.Brands.First();

            _template = new Template
            {
                Status = TemplateStatus.Complete,
                Info   = new TemplateInfo
                {
                    TemplateType     = BonusType.FirstDeposit,
                    Name             = TestDataGenerator.GetRandomString(),
                    Brand            = brand,
                    WalletTemplateId = brand.WalletTemplates.First().Id
                },
                Availability = new TemplateAvailability(),
                Rules        = new TemplateRules
                {
                    RewardTiers = new List <RewardTier>
                    {
                        new RewardTier
                        {
                            CurrencyCode = brand.Currencies.First().Code,
                            BonusTiers   = new List <TierBase>
                            {
                                new TierBase {
                                    Reward = 100
                                }
                            }
                        }
                    }
                },
                Wagering     = new TemplateWagering(),
                Notification = new TemplateNotification()
            };

            BonusRepository.Templates.Add(_template);

            _model = new CreateUpdateTemplate
            {
                Id      = _template.Id,
                Version = _template.Version
            };
            _info = new CreateUpdateTemplateInfo
            {
                Name             = TestDataGenerator.GetRandomString(),
                BrandId          = _template.Info.Brand.Id,
                WalletTemplateId = _template.Info.Brand.WalletTemplates.First().Id,
                TemplateType     = BonusType.FirstDeposit,
                Mode             = IssuanceMode.Automatic
            };
            _rules = new CreateUpdateTemplateRules
            {
                RewardTiers = new List <CreateUpdateRewardTier>
                {
                    new CreateUpdateRewardTier
                    {
                        CurrencyCode = "CAD",
                        BonusTiers   = new List <CreateUpdateTemplateTier>
                        {
                            new CreateUpdateTemplateTier {
                                Reward = 25
                            }
                        }
                    }
                }
            };
        }
Ejemplo n.º 4
0
        public async Task Can_not_manually_issue_not_qualified_deposit_bonus_as_a_CS()
        {
            //Can_manually_clime_and_redeem_deposit_bonus_via_player_info_site_as_a_CS
            //create a bonus template and a bonus - Bonus type:Reload, Reward Type: Fixed
            var walletTemplateId = _brand.WalletTemplates.First().Id;
            var info             = new CreateUpdateTemplateInfo
            {
                Name             = TestDataGenerator.GetRandomString(),
                TemplateType     = BonusType.ReloadDeposit,
                BrandId          = _brand.Id,
                WalletTemplateId = walletTemplateId,
                Mode             = IssuanceMode.Automatic
            };
            var rules = new CreateUpdateTemplateRules
            {
                RewardTiers = new List <CreateUpdateRewardTier>
                {
                    new CreateUpdateRewardTier
                    {
                        CurrencyCode = "CAD",
                        BonusTiers   = new List <CreateUpdateTemplateTier> {
                            new CreateUpdateTemplateTier {
                                Reward = 14
                            }
                        }
                    }
                }
            };

            var bonusTemplate = await _bonusTestHelper.CreateTemplate(info : info, rules : rules);

            var bonus = await _bonusTestHelper.CreateBonus(bonusTemplate);

            _bonusName = bonus.Name;
            if (bonus.IsActive)
            {
                _activeBonusesNamesList.Add(_bonusName);
            }

            //create a player
            var player = _playerTestHelper.CreatePlayerForMemberWebsite(currencyCode: "CAD");

            //Thread.Sleep(5000); //wait for Player created event processing

            //make a first Deposit
            _paymentTestHelper.MakeDeposit(player.Username, 217);
            //Thread.Sleep(5000); //wait for Deposit created event processing

            //make a reload Deposit
            _paymentTestHelper.MakeDeposit(player.Username, 213);
            //Thread.Sleep(5000); //wait for Deposit created event processing

            //login to admin site
            _driver.Logout();
            _dashboardPage = _driver.LoginToAdminWebsiteAsSuperAdmin();
            var playerManagerPage = _dashboardPage.Menu.ClickPlayerManagerMenuItem();

            //open Player Info -> Bonus section
            playerManagerPage.SelectPlayer(player.Username);
            var playerInfoPage = playerManagerPage.OpenPlayerInfoPage();

            playerInfoPage.OpenBonusSection();

            //check the Bonus Qualification Record in grid
            playerInfoPage.FindAndSelectBonusQualificationRecord(_bonusName, "Reload deposit");
            //Assert.AreEqual(_bonusName, playerInfoPage.GetBonusQualificationName(_bonusName, "Reload deposit"));

            //check qualified bonus transaction for the Player
            playerInfoPage.OpenBonusToIssueSection();
            Assert.AreEqual(_bonusName, playerInfoPage.GetBonusQualificationName());
            Assert.AreEqual("CAD14", playerInfoPage.GetBonusQualificationAmount());

            //issue Bonus for transaction
            playerInfoPage.IssuedBonusForQualifiedTransaction();
            Assert.AreEqual("Bonus issued successfully.", playerInfoPage.GetConformationMessage());

            //check the bounus transaction
            playerInfoPage.OpenTransactionsSection();
            Assert.AreEqual(14, playerInfoPage.GetTransactionMainAmount("Bonus"));

            //check the Balance
            playerInfoPage.OpenBalanceInformationSection();
            Assert.AreEqual("430", playerInfoPage.GetMainBalance());
            Assert.AreEqual("28", playerInfoPage.GetTotalBonusBalance());


            //Can_not_manually_clime_deposit_bonus_for_no_qualified_deposit_via_player_info_site_as_a_CS

            //create a new Player
            var player2 = _playerTestHelper.CreatePlayerForMemberWebsite(currencyCode: "CAD");

            //Thread.Sleep(5000); //wait for Player created event processing

            //relogin to admin site
            _driver.Logout();
            _dashboardPage = _driver.LoginToAdminWebsiteAsSuperAdmin();
            var player2ManagerPage = _dashboardPage.Menu.ClickPlayerManagerMenuItem();

            // try to redeem not qualified bonus for new player

            //open Player Info -> Bonus section
            player2ManagerPage.SelectPlayer(player2.Username);
            var player2InfoPage = player2ManagerPage.OpenPlayerInfoPage();

            player2InfoPage.OpenBonusSection();

            //check the Bonus Qualification Record in grid
            player2InfoPage.FindAndSelectBonusQualificationRecord(_bonusName, "Reload deposit");

            //check qualified bonus transaction for the Player
            player2InfoPage.OpenBonusToIssueSection();
            Assert.AreEqual(_bonusName, player2InfoPage.GetBonusQualificationName());
            Assert.AreEqual("No qualified transactions found.", player2InfoPage.GetBonusQualificationMessage());

            //deactivate bonus
            DeactivateBonus();
        }
Ejemplo n.º 5
0
        public async Task Can_set_games_for_bonus_to_contribute_players_completion_of_wagering_requirement()
        {
            const decimal amount = 1000;

            //create a bonus - First Deposit, Automatic, Withdrawable, for main wallet
            var brand            = _container.Resolve <IBrandRepository>().Brands.Include(x => x.WalletTemplates).Single(b => b.Name == BrandName);
            var walletTemplateId = brand.WalletTemplates.First(x => x.IsMain).Id;

            var info = new CreateUpdateTemplateInfo
            {
                Name             = TestDataGenerator.GetRandomString(),
                TemplateType     = BonusType.FirstDeposit,
                BrandId          = brand.Id,
                WalletTemplateId = walletTemplateId,
                IsWithdrawable   = true,
                Mode             = IssuanceMode.Automatic
            };
            var rules = new CreateUpdateTemplateRules
            {
                RewardTiers = new List <CreateUpdateRewardTier>
                {
                    new CreateUpdateRewardTier
                    {
                        CurrencyCode = "CAD",
                        BonusTiers   = new List <CreateUpdateTemplateTier> {
                            new CreateUpdateTemplateTier {
                                Reward = 13
                            }
                        }
                    }
                }
            };
            var gameRepository = _container.Resolve <IGameRepository>();
            var wagering       = new CreateUpdateTemplateWagering
            {
                HasWagering       = true,
                Method            = WageringMethod.Bonus,
                Multiplier        = 1,
                GameContributions = new List <CreateUpdateGameContribution>
                {
                    new CreateUpdateGameContribution
                    {
                        GameId       = gameRepository.Games.Single(g => g.Name == "Football").Id,
                        Contribution = 50
                    },
                    new CreateUpdateGameContribution
                    {
                        GameId       = gameRepository.Games.Single(g => g.Name == "Hockey").Id,
                        Contribution = 100
                    }
                }
            };

            var bonusTemplate = await _bonusTestHelper.CreateTemplate(info : info, rules : rules, wagering : wagering);

            var bonus = await _bonusTestHelper.CreateBonus(bonusTemplate);

            _bonusName = bonus.Name;
            if (bonus.IsActive)
            {
                _activeBonusesNamesList.Add(_bonusName);
            }

            //create a player
            var player = _playerTestHelper.CreatePlayerForMemberWebsite(currencyCode: "CAD");

            //Thread.Sleep(5000); //wait for Player created event processing

            //make a Deposit
            _paymentTestHelper.MakeDeposit(player.Username, amount);
            Thread.Sleep(5000); //wait for Deposit created event processing

            //place and win first bet  - must deduct only 50% wagering contribution for now
            var playerId         = _playerQueries.GetPlayerByUsername(player.Username).Id;
            var gameId           = "FOOTBALL";
            var gameProviderCode = _gamesTestHelper.GetGameProviderCodeByGameExternalId(gameId);
            var placeBetTxId     = Guid.NewGuid().ToString();
            var actualBetId      = await _gamesTestHelper.PlaceBet(13, playerId, gameProviderCode, gameId, transactionId : placeBetTxId);

            //TODO: VladK.  - remove Sleep here
            Thread.Sleep(5000);// wait for Bet event processing
            await _gamesTestHelper.WinBet(actualBetId, 13, placeBetTxId, gameProviderCode);

            //TODO: VladK.  - remove Sleep here
            Thread.Sleep(5000); //wait for Bet event processing

            //make sure that bonus haven't been unlocked yet
            var memberWebsiteLoginPage = new MemberWebsiteLoginPage(_driver);

            memberWebsiteLoginPage.NavigateToMemberWebsite();
            var playerProfilePage            = memberWebsiteLoginPage.Login(player.Username, player.Password);
            var playerBalanceInformationPage = playerProfilePage.Menu.ClickBalanceInformationMenu();

            //TODO: Until Pavel's fixes for Balance Information on Member site AFTREGO-???? - 10-Feb-2016, Igor
            Assert.AreEqual("987.00", playerBalanceInformationPage.GetMainBalance(walletTemplateId.ToString()));
            Assert.AreEqual("26.00", playerBalanceInformationPage.GetBonusBalance(walletTemplateId.ToString()));

            //place and win second bet - must deduct 50%+50% = 100% wagering contribution
            var secondPlaceBetTxId = Guid.NewGuid().ToString();

            actualBetId = await _gamesTestHelper.PlaceBet(13, playerId, gameProviderCode, gameId, transactionId : secondPlaceBetTxId);

            //TODO: VladK.  - remove Sleep here
            Thread.Sleep(5000);// wait for Bet event processing
            await _gamesTestHelper.WinBet(actualBetId, 13, secondPlaceBetTxId, gameProviderCode);

            //TODO: VladK.  - remove Sleep here
            Thread.Sleep(5000); //wait for Bet event processing

            //make sure that we ve got bonus on Main Balance
            playerBalanceInformationPage = playerProfilePage.Menu.ClickBalanceInformationMenu();
            Assert.AreEqual("1013.00", playerBalanceInformationPage.GetMainBalance(walletTemplateId.ToString()));
            Assert.AreEqual("0.00", playerBalanceInformationPage.GetBonusBalance(walletTemplateId.ToString()));

            //deactivate bonus
            DeactivateBonus();
        }
Ejemplo n.º 6
0
        public async Task Can_get_FirstDeposit_bonus_with_code_issuance_mode_via_member_website()
        {
            //create a bonus template and a bonus - Bonus type:First, Reward Type: Fixed, Issuance:AutomaticWithCode
            var walletTemplateId = _brand.WalletTemplates.First().Id;
            var info             = new CreateUpdateTemplateInfo
            {
                Name             = TestDataGenerator.GetRandomString(),
                TemplateType     = BonusType.FirstDeposit,
                BrandId          = _brand.Id,
                WalletTemplateId = walletTemplateId,
                Mode             = IssuanceMode.AutomaticWithCode
            };
            var rules = new CreateUpdateTemplateRules
            {
                RewardTiers = new List <CreateUpdateRewardTier>
                {
                    new CreateUpdateRewardTier
                    {
                        CurrencyCode = "CAD",
                        BonusTiers   = new List <CreateUpdateTemplateTier> {
                            new CreateUpdateTemplateTier {
                                Reward = 21
                            }
                        }
                    }
                }
            };

            var bonusTemplate = await _bonusTestHelper.CreateTemplate(info : info, rules : rules);

            var bonus = await _bonusTestHelper.CreateBonus(bonusTemplate);

            _bonusName = bonus.Name;
            if (bonus.IsActive)
            {
                _activeBonusesNamesList.Add(_bonusName);
            }

            //create a player
            var player = _playerTestHelper.CreatePlayerForMemberWebsite(currencyCode: "CAD");

            Thread.Sleep(5000); //wait for Player created event processing

            //log in to brand website
            var brandWebsiteLoginPage = new MemberWebsiteLoginPage(_driver);

            brandWebsiteLoginPage.NavigateToMemberWebsite();
            var playerProfilePage         = brandWebsiteLoginPage.Login(player.Username, player.Password);
            var offlineDepositRequestPage = playerProfilePage.Menu.ClickOfflineDepositSubmenu();

            //create Deposit via member site
            offlineDepositRequestPage.Submit(amount: "112", playerRemark: "my deposit", bonusCode: bonus.Code);
            Assert.AreEqual("Offline deposit requested successfully.", offlineDepositRequestPage.ConfirmationMessage);
            Thread.Sleep(5000); //wait for Deposit created event processing
            var playerId = _playerQueries.GetPlayerByUsername(player.Username).Id;

            //Wait for record in DB
            WaitForOfflineDeposit(playerId, amount: 112, timeout: TimeSpan.FromSeconds(20));
            var deposit = GetLastDepositByPlayerId(playerId);

            _paymentTestHelper.ConfirmOfflineDeposit(deposit);
            _paymentTestHelper.VerifyOfflineDeposit(deposit, true);
            _paymentTestHelper.ApproveOfflineDeposit(deposit, true);
            Thread.Sleep(5000); //wait for deposit Approval event processing

            //log in to brand website
            brandWebsiteLoginPage.NavigateToMemberWebsite();
            _driver.Logout();
            playerProfilePage = brandWebsiteLoginPage.Login(player.Username, player.Password);
            var balanceDetailsPage = playerProfilePage.Menu.ClickBalanceInformationMenu();

            Assert.AreEqual("21.00", balanceDetailsPage.GetBonusBalance(walletTemplateId.ToString()));

            //deactivate bonus
            DeactivateBonus();
        }
Ejemplo n.º 7
0
        public async Task Can_get_ReloadDeposit_bonus_with_manual_issuance_mode()
        {
            //create a bonus template and a bonus - Bonus type:Reload, Reward Type: Fixed
            var walletTemplateId = _brand.WalletTemplates.First().Id;
            var info             = new CreateUpdateTemplateInfo
            {
                Name             = TestDataGenerator.GetRandomString(),
                TemplateType     = BonusType.ReloadDeposit,
                BrandId          = _brand.Id,
                WalletTemplateId = walletTemplateId,
                Mode             = IssuanceMode.ManualByPlayer
            };
            var rules = new CreateUpdateTemplateRules
            {
                RewardTiers = new List <CreateUpdateRewardTier>
                {
                    new CreateUpdateRewardTier
                    {
                        CurrencyCode = "CAD",
                        BonusTiers   = new List <CreateUpdateTemplateTier> {
                            new CreateUpdateTemplateTier {
                                Reward = 15
                            }
                        }
                    }
                }
            };

            var bonusTemplate = await _bonusTestHelper.CreateTemplate(info : info, rules : rules);

            var bonus = await _bonusTestHelper.CreateBonus(bonusTemplate);

            _bonusName = bonus.Name;
            if (bonus.IsActive)
            {
                _activeBonusesNamesList.Add(_bonusName);
            }

            //create a player
            var player   = _playerTestHelper.CreatePlayerForMemberWebsite(currencyCode: "CAD");
            var playerId = _playerQueries.GetPlayerByUsername(player.Username).Id;

            //make first deposit
            _paymentTestHelper.MakeDepositSelenium(playerId, 117);

            //make deposit again - to get reload bonus
            _driver.MakeOfflineDeposit(player.Username, 115, player.FullName, _bonusName);

            //login to member site
            var memberWebsiteLoginPage = new MemberWebsiteLoginPage(_driver);

            memberWebsiteLoginPage.NavigateToMemberWebsite();
            var playerProfilePage = memberWebsiteLoginPage.Login(player.Username, player.Password);

            await WaitForBonusRedemption(playerId, player.Username, TimeSpan.FromSeconds(20));

            //TODO: Until Pavel's fixes for Claim Bonuses on Member site AFTREGO-3806
            //can see Claim button
            var claimBonusPage = playerProfilePage.Menu.OpenClaimBonusPage();

            Assert.True(claimBonusPage.ClaimButton.Displayed);

            //claim the bonus
            claimBonusPage.ClaimBonus();
            Assert.AreEqual("Redemption claimed successfully.", claimBonusPage.MessageValue);

            //go to balance page
            var balanceDetailsPage = playerProfilePage.Menu.ClickBalanceInformationMenu();

            Assert.AreEqual("15.00", balanceDetailsPage.GetBonusBalance(walletTemplateId.ToString()));

            //deactivate bonus
            DeactivateBonus();
        }
Ejemplo n.º 8
0
        public async Task Can_get_FirstDeposit_bonus_with_automatic_issuance_mode_via_member_website()
        {
            //create a bonus template and a bonus - Bonus type:First, Reward Type: Fixed, Issuance:Automatic
            var walletTemplateId = _brand.WalletTemplates.First().Id;
            var info             = new CreateUpdateTemplateInfo
            {
                Name             = TestDataGenerator.GetRandomString(),
                TemplateType     = BonusType.FirstDeposit,
                BrandId          = _brand.Id,
                WalletTemplateId = walletTemplateId,
                Mode             = IssuanceMode.Automatic
            };
            var rules = new CreateUpdateTemplateRules
            {
                RewardTiers = new List <CreateUpdateRewardTier>
                {
                    new CreateUpdateRewardTier
                    {
                        CurrencyCode = "CAD",
                        BonusTiers   = new List <CreateUpdateTemplateTier> {
                            new CreateUpdateTemplateTier {
                                Reward = 19
                            }
                        }
                    }
                }
            };

            var bonusTemplate = await _bonusTestHelper.CreateTemplate(info : info, rules : rules);

            var bonus = await _bonusTestHelper.CreateBonus(bonusTemplate);

            _bonusName = bonus.Name;
            if (bonus.IsActive)
            {
                _activeBonusesNamesList.Add(_bonusName);
            }

            //create a player
            var player = _playerTestHelper.CreatePlayerForMemberWebsite(currencyCode: "CAD");

            //login to member site
            var memberWebsiteLoginPage = new MemberWebsiteLoginPage(_driver);

            memberWebsiteLoginPage.NavigateToMemberWebsite();
            var playerProfilePage = memberWebsiteLoginPage.Login(player.Username, player.Password);

            CashierPage cashierPage = playerProfilePage.Menu.OpenCashierPage();
            var         offlineDepositRequestPage = cashierPage.OpenOfflineDepositPage();

            offlineDepositRequestPage.Submit(amount: "113", playerRemark: "my deposit");
            Assert.AreEqual("Congratulation on your deposit!", offlineDepositRequestPage.GetConfirmationMessage());
            var playerId = _playerQueries.GetPlayerByUsername(player.Username).Id;

            //Wait for record in DB
            WaitForOfflineDeposit(playerId, amount: 113, timeout: TimeSpan.FromSeconds(20));
            var firstdeposit = GetLastDepositByPlayerId(playerId);

            _paymentTestHelper.ConfirmOfflineDeposit(firstdeposit);
            _paymentTestHelper.VerifyOfflineDeposit(firstdeposit, true);
            _paymentTestHelper.ApproveOfflineDeposit(firstdeposit, true);

            //re-login to member site
            memberWebsiteLoginPage.NavigateToMemberWebsite();
            _driver.Logout();

            //make sure that we've got a bonus
            playerProfilePage = memberWebsiteLoginPage.Login(player.Username, player.Password);
            playerProfilePage.Menu.OpenCashierPage();
            Assert.AreEqual("19", cashierPage.GetBonusBalance());

            //deactivate bonus
            DeactivateBonus();
        }