Ejemplo n.º 1
0
        public void Bonus_issued_by_Cs_ignores_bonus_claim_duration_qualification()
        {
            MakeDeposit(PlayerId);
            var transaction = BonusRepository.Players.Single(p => p.Id == PlayerId).Wallets.SelectMany(t => t.Transactions).First();
            var bonus       = CreateFirstDepositBonus(mode: IssuanceMode.ManualByPlayer);

            bonus.DaysToClaim = 1;

            BonusCommands.IssueBonusByCs(new IssueBonusByCs
            {
                BonusId       = bonus.Id,
                PlayerId      = PlayerId,
                TransactionId = transaction.Id
            });

            var bonusRedemption = BonusRedemptions.Single();

            //expiring the bonus
            bonus.ActiveTo = bonus.ActiveTo.AddDays(-2);
            BonusCommands.ClaimBonusRedemption(new ClaimBonusRedemption
            {
                PlayerId     = PlayerId,
                RedemptionId = bonusRedemption.Id
            });

            bonusRedemption.ActivationState.Should().Be(ActivationStatus.Activated);
        }
Ejemplo n.º 2
0
        public void Can_issue_fundin_bonus()
        {
            var brandWalletId = BonusRepository.Brands.First().WalletTemplates.First().Id;
            var bonus         = CreateFirstDepositBonus(mode: IssuanceMode.ManualByCs);

            bonus.Template.Info.TemplateType   = BonusType.FundIn;
            bonus.Template.Rules.FundInWallets = new List <BonusFundInWallet>
            {
                new BonusFundInWallet {
                    WalletId = brandWalletId
                }
            };

            MakeDeposit(PlayerId);
            MakeFundIn(PlayerId, brandWalletId, 100);

            var transaction = BonusRepository.Players.Single(p => p.Id == PlayerId).Wallets.SelectMany(t => t.Transactions).Single(t => t.Type == TransactionType.FundIn);

            BonusCommands.IssueBonusByCs(new IssueBonusByCs
            {
                BonusId       = bonus.Id,
                PlayerId      = PlayerId,
                TransactionId = transaction.Id
            });

            var bonusRedemption = BonusRedemptions.Single();

            bonusRedemption.ActivationState.Should().Be(ActivationStatus.Activated);
        }
Ejemplo n.º 3
0
        public IssueBonusResponse IssueBonus(IssueBonusByCs model)
        {
            var validationResult = _bonusQueries.GetValidationResult(model);

            if (!validationResult.IsValid)
            {
                return(ValidationErrorResponse <IssueBonusResponse>(validationResult));
            }

            _bonusCommands.IssueBonusByCs(model);
            return(new IssueBonusResponse {
                Success = true
            });
        }
Ejemplo n.º 4
0
        public void System_does_not_claim_ManualByPlayer_bonus_issued_by_CS()
        {
            MakeDeposit(PlayerId);
            var transaction = BonusRepository.Players.Single(p => p.Id == PlayerId).Wallets.SelectMany(t => t.Transactions).First();
            var bonus       = CreateFirstDepositBonus(mode: IssuanceMode.ManualByPlayer);

            BonusCommands.IssueBonusByCs(new IssueBonusByCs
            {
                BonusId       = bonus.Id,
                PlayerId      = PlayerId,
                TransactionId = transaction.Id
            });

            var bonusRedemption = BonusRedemptions.Single();

            bonusRedemption.ActivationState.Should().Be(ActivationStatus.Claimable);
        }
Ejemplo n.º 5
0
        public void Can_issue_first_deposit_bonus()
        {
            MakeDeposit(PlayerId);
            var transaction = BonusRepository.Players.Single(p => p.Id == PlayerId).Wallets.SelectMany(t => t.Transactions).First();
            var bonus       = CreateFirstDepositBonus();

            BonusCommands.IssueBonusByCs(new IssueBonusByCs
            {
                BonusId       = bonus.Id,
                PlayerId      = PlayerId,
                TransactionId = transaction.Id
            });

            var bonusRedemption = BonusRedemptions.Single();

            bonusRedemption.ActivationState.Should().Be(ActivationStatus.Activated);
        }
Ejemplo n.º 6
0
        public void Qualification_ignores_fraudulent_status_for_Manual_by_CS_issuance()
        {
            MakeDeposit(PlayerId);
            var transaction = BonusRepository.Players.Single(p => p.Id == PlayerId).Wallets.SelectMany(t => t.Transactions).First();
            var bonus       = CreateFirstDepositBonus();

            DisableBonusesForPlayer(PlayerId);

            BonusCommands.IssueBonusByCs(new IssueBonusByCs
            {
                BonusId       = bonus.Id,
                PlayerId      = PlayerId,
                TransactionId = transaction.Id
            });

            BonusRedemptions.Single().ActivationState.Should().Be(ActivationStatus.Activated);
        }
Ejemplo n.º 7
0
        public void Before_wager_bonus_isnot_issued_before_wagering_requirement_is_fulfilled()
        {
            MakeDeposit(PlayerId);
            var transaction = BonusRepository.Players.Single(p => p.Id == PlayerId).Wallets.SelectMany(t => t.Transactions).First();
            var bonus       = CreateFirstDepositBonus(mode: IssuanceMode.ManualByCs);

            bonus.Template.Wagering.HasWagering  = true;
            bonus.Template.Wagering.Multiplier   = 2;
            bonus.Template.Wagering.IsAfterWager = true;

            BonusCommands.IssueBonusByCs(new IssueBonusByCs
            {
                BonusId       = bonus.Id,
                PlayerId      = PlayerId,
                TransactionId = transaction.Id
            });

            var bonusRedemption = BonusRedemptions.Single();

            bonusRedemption.ActivationState.Should().Be(ActivationStatus.Pending);
            bonusRedemption.RolloverState.Should().Be(RolloverStatus.Active);
        }
Ejemplo n.º 8
0
        public void BonusRedeemedByCs_is_saved_in_event_store()
        {
            _bonus.Template.Info.Mode = IssuanceMode.ManualByCs;
            MakeDeposit(PlayerId);
            var transaction = BonusRepository.Players.Single(p => p.Id == PlayerId).Wallets.SelectMany(t => t.Transactions).First();

            BonusCommands.IssueBonusByCs(new IssueBonusByCs
            {
                BonusId       = _bonus.Id,
                PlayerId      = PlayerId,
                TransactionId = transaction.Id
            });

            var bonusRedemption = BonusRedemptions.Single();

            var theEvent = _eventRepository.Events.Single(e => e.DataType == typeof(BonusRedeemed).Name);
            var data     = JsonConvert.DeserializeObject <BonusRedeemed>(theEvent.Data);

            data.AggregateId.Should().Be(bonusRedemption.Id);
            data.PlayerId.Should().Be(PlayerId);
            data.BonusId.Should().Be(_bonus.Id);
            data.Amount.Should().Be(bonusRedemption.Amount);
            data.IssuedByCs.Should().BeTrue();
        }