AdjustTransactionResponse ICommonGameActionsProvider.AdjustTransaction(AdjustTransaction request)
        {
            using (var scope = _transactionScope.GetTransactionScope())
            {
                var playerId = GetPlayerIdFromToken(request);

                var result = request.Transactions.Select(tx => AdjustTransaction(tx)).ToList();

                var balance = _gameQueries.GetPlayableBalance(playerId);

                scope.Complete();

                return(new AdjustTransactionResponse
                {
                    Balance = balance.Balance,
                    CurrencyCode = balance.CurrencyCode,
                    Transactions = result
                });
            }
        }
Пример #2
0
        public void Can_Get_Playable_Balance()
        {
            var wallets      = _repository.Wallets.ToList();
            var i            = random.Next(1, wallets.Count - 1);
            var randomWallet = wallets[i];

            var amount = random.Next(0, 1000);

            var bonusProxyMock = new Mock <IBonusApiProxy>();

            bonusProxyMock.Setup(m => m.GetPlayerBalanceAsync(It.IsAny <Guid>(), It.IsAny <Guid>())).ReturnsAsync(new BonusBalance
            {
                Main  = amount,
                Bonus = amount / 2
            });
            _queries = new GameQueries(_repository, new GameWalletQueries(_repository));

            var playerId = randomWallet.PlayerId;

            var pamount = _queries.GetPlayableBalance(playerId);

            Assert.AreEqual(randomWallet.Balance, pamount.Balance);
        }