Esempio n. 1
0
        private void SendHighDepositBonusSmsNotifications(Player player)
        {
            var highDepositBonuses = _bonusQueries.GetCurrentVersionBonuses(player.Data.Brand.Id)
                                     .Where(x => x.Template.Info.TemplateType == BonusType.HighDeposit)
                                     .ToList()
                                     .Select(b => new Entities.Bonus(b));

            foreach (var bonus in highDepositBonuses)
            {
                var bonusRewardThreshold = bonus.CalculateRewardThreshold(player);

                if (bonusRewardThreshold == null)
                {
                    continue;
                }

                var model = new HighDepositReminderModel
                {
                    Currency              = player.Data.CurrencyCode,
                    BonusAmount           = bonusRewardThreshold.BonusAmount,
                    RemainingAmount       = bonusRewardThreshold.RemainingAmount,
                    DepositAmountRequired = bonusRewardThreshold.DepositAmountRequired
                };

                _serviceBus.PublishMessage(new SendPlayerAMessage
                {
                    PlayerId              = player.Data.Id,
                    MessageType           = MessageType.HighDepositReminder,
                    MessageDeliveryMethod = MessageDeliveryMethod.Sms,
                    Model = model
                });
            }
        }
Esempio n. 2
0
 internal void ProcessHighDepositBonus(Player player)
 {
     SendHighDepositBonusSmsNotifications(player);
     while (_bonusQueries.GetQualifiedBonuses(player, BonusType.HighDeposit).Any())
     {
         var bonusData  = _bonusQueries.GetQualifiedBonuses(player, BonusType.HighDeposit).First();
         var redemption = RedeemBonus(player.Data.Id, bonusData.Id);
         ProcessBonusRedemptionLifecycle(redemption);
         redemption.Events.ForEach(_eventBus.Publish);
     }
 }
Esempio n. 3
0
        internal void ProcessFirstBonusRedemptionOfType(Player player, BonusType type)
        {
            var redemptionData =
                player.BonusesRedeemed
                .OrderBy(r => r.CreatedOn)
                .FirstOrDefault(r =>
                                r.Bonus.Template.Info.TemplateType == type &&
                                r.ActivationState == ActivationStatus.Pending);

            if (redemptionData != null)
            {
                var redemption = new Entities.BonusRedemption(redemptionData);
                ProcessBonusRedemptionLifecycle(redemption);
                redemption.Events.ForEach(_eventBus.Publish);
            }
        }