Beispiel #1
0
        public Core.Data.Bonus CreateBonus(Template bonusTemplate, bool isActive = true)
        {
            var now   = DateTimeOffset.Now.ToBrandOffset(bonusTemplate.Info.Brand.TimezoneId).Date;
            var model = new CreateUpdateBonus
            {
                Id            = Guid.Empty,
                Name          = TestDataGenerator.GetRandomString(5),
                Code          = TestDataGenerator.GetRandomString(5),
                Description   = TestDataGenerator.GetRandomString(20),
                TemplateId    = bonusTemplate.Id,
                ActiveFrom    = now,
                ActiveTo      = now.AddDays(1),
                DurationStart = now,
                DurationEnd   = now.AddDays(1)
            };
            var bonusId = BonusManagementCommands.AddUpdateBonus(model);

            if (isActive)
            {
                BonusManagementCommands.ChangeBonusStatus(new ToggleBonusStatus
                {
                    Id       = bonusId,
                    IsActive = true
                });
            }

            return(BonusRepository.GetCurrentVersionBonuses().Single(b => b.Id == bonusId));
        }
        public override void BeforeEach()
        {
            base.BeforeEach();

            var brand    = BonusRepository.Brands.First();
            var template = new Template
            {
                Status = TemplateStatus.Complete,
                Info   = new TemplateInfo
                {
                    TemplateType     = BonusType.ReloadDeposit,
                    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);

            _brandTimezoneId = brand.TimezoneId;
            _model           = new CreateUpdateBonus
            {
                Name         = TestDataGenerator.GetRandomString(),
                Code         = TestDataGenerator.GetRandomString(),
                Description  = TestDataGenerator.GetRandomString(),
                TemplateId   = template.Id,
                ActiveFrom   = DateTimeOffset.Now.ToBrandOffset(_brandTimezoneId).Date,
                ActiveTo     = DateTimeOffset.Now.ToBrandOffset(_brandTimezoneId).AddDays(1).Date,
                DurationType = DurationType.None
            };
        }
Beispiel #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
                            }
                        }
                    }
                }
            };
        }
Beispiel #4
0
 internal IQueryable <Data.Bonus> GetBonusesUsingTemplate(Template template)
 {
     return(GetCurrentVersionBonuses(template.Info.Brand.Id)
            .Where(bonus => bonus.Template.Id == template.Id && bonus.Template.Version == template.Version));
 }