public void Can_log_TransferFundCreated()
        {
            // Arrange
            var @event = new TransferFundCreated
            {
                PlayerId          = new Guid(),
                Amount            = 1,
                TransactionNumber = "TF001",
                Remarks           = "remark"
            };

            //Act
            _serviceBus.PublishMessage(@event);

            //Assert
            Assert.AreEqual(1, _playerRepository.PlayerActivityLog.Count());
            var record = _playerRepository.PlayerActivityLog.Single();

            Assert.AreEqual("Player", record.Category);
            Assert.AreEqual(new Guid(), record.PlayerId);
            Assert.AreEqual(string.Empty, record.PerformedBy);
            Assert.AreEqual(@event.EventCreated.Date, record.DatePerformed.Date);
            Assert.AreEqual("Transfer Fund created. Amount: 1. Transaction Number: TF001", record.ActivityDone);
            Assert.AreEqual("remark", record.Remarks);
        }
예제 #2
0
        public void Handle(TransferFundCreated @event)
        {
            if (@event.Type == TransferFundType.FundOut || @event.Status == TransferFundStatus.Rejected)
            {
                return;
            }

            var bonusCommands    = _container.Resolve <BonusCommands>();
            var bonusQueries     = _container.Resolve <BonusQueries>();
            var redemptionParams = new RedemptionParams {
                TransferAmount = @event.Amount, TransferWalletTemplateId = @event.DestinationWalletStructureId
            };

            var repository = _container.Resolve <IBonusRepository>();

            using (var scope = CustomTransactionScope.GetTransactionScope())
            {
                bonusQueries
                .GetQualifiedAutomaticBonusIds(@event.PlayerId, BonusType.FundIn, redemptionParams)
                .ForEach(bonusId => bonusCommands.ActivateFundInBonus(@event.PlayerId, bonusId, redemptionParams));

                var wallet = repository.GetLockedWallet(@event.PlayerId);

                if (@event.Amount > 0)
                {
                    wallet.TransferFundCredit(@event.Amount);
                }
                else
                {
                    wallet.TransferFundDebit(@event.Amount);
                }

                repository.SaveChanges();
                scope.Complete();
            }
        }
예제 #3
0
 // Player Transfer Fund categry
 public void Consume(TransferFundCreated message)
 {
     _playerHandlers.Handle(message);
 }
예제 #4
0
 public void Consume(TransferFundCreated message)
 {
     _paymentSubscriber.Handle(message);
 }
예제 #5
0
 public void Handle(TransferFundCreated @event)
 {
     AddActivityLog(string.Format("Transfer Fund created. Amount: {0}. Transaction Number: {1}", @event.Amount, @event.TransactionNumber), @event, @event.PlayerId,
                    @event.Remarks);
 }