Пример #1
0
        public void Approve_offline_deposit()
        {
            // Arrange
            var offlineDeposit = _paymentTestHelper.CreateOfflineDeposit(_player.Id, 10000M);

            _paymentTestHelper.ConfirmOfflineDeposit(offlineDeposit);
            _paymentTestHelper.VerifyOfflineDeposit(offlineDeposit, true);

            var offlineDepositApprove = new OfflineDepositApprove
            {
                Id           = offlineDeposit.Id,
                ActualAmount = 9988.77M,
                Fee          = 10.50M,
                PlayerRemark = "Player remark",
                Remark       = "Approve remark"
            };


            // Act
            _commandsHandler.Approve(offlineDepositApprove);

            // Assert
            offlineDeposit.ActualAmount.ShouldBeEquivalentTo(9988.77M);
            offlineDeposit.Fee.ShouldBeEquivalentTo(10.50M);
            offlineDeposit.PlayerRemark.ShouldBeEquivalentTo("Player remark");
            offlineDeposit.Remark.ShouldBeEquivalentTo("Approve remark");
            offlineDeposit.Status.ShouldBeEquivalentTo(OfflineDepositStatus.Approved);
        }
        public void Approve(OfflineDepositApprove approveCommand)
        {
            using (var scope = CustomTransactionScope.GetTransactionScope())
            {
                var offlineDeposit = _repository.GetDepositById(approveCommand.Id);

                if (approveCommand.ActualAmount > offlineDeposit.Data.Amount)
                {
                    throw new RegoException("actualAmountGreaterThanVerified");
                }

                _validator.Validate(offlineDeposit.Data.PlayerId,
                                    offlineDeposit.Data.CurrencyCode,
                                    approveCommand.ActualAmount);

                var depositCommand = offlineDeposit.Approve(
                    approveCommand.ActualAmount,
                    approveCommand.Fee,
                    approveCommand.PlayerRemark,
                    _actorInfoProvider.Actor.UserName,
                    approveCommand.Remark);

                _repository.SaveChanges();

                _serviceBus.PublishMessage(depositCommand);

                scope.Complete();
            }
        }
Пример #3
0
        public void MyTest()
        {
            var offlineDeposit = _paymentTestHelper.CreateOfflineDeposit(_player.Id, 10000M);

            _paymentTestHelper.ConfirmOfflineDeposit(offlineDeposit);
            _paymentTestHelper.VerifyOfflineDeposit(offlineDeposit, true);

            var offlineDepositApprove = new OfflineDepositApprove
            {
                Id           = offlineDeposit.Id,
                ActualAmount = 9988.77M,
                Fee          = 10.50M,
                PlayerRemark = "Player remark",
                Remark       = "Approve remark"
            };

            // Act
            _commandsHandler.Approve(offlineDepositApprove);

            var gameRepository = Container.Resolve <IGameRepository>();

            Assert.AreEqual(gameRepository.Wallets.Single().Balance, 9999.27M);
        }