コード例 #1
0
        BetsHistoryResponse ICommonGameActionsProvider.GetBetHistory(RoundsHistory request)
        {
            var playerId = GetPlayerIdFromToken(request);

            var game = _gameQueries.GetGameByExternalGameId(request.gameid);

            if (game == null)
            {
                throw new RegoException("Game not found");
            }

            var rounds = _gameQueries.GetRoundHistory(playerId, game.Id, request.count);

            var convertedRounds = rounds.Select(round => new RoundHistoryData
            {
                Id             = round.Data.ExternalRoundId,
                Status         = round.Data.Status.ToString(),
                Amount         = round.Amount,
                WonAmount      = round.WonAmount,
                AdjustedAmount = round.AdjustedAmount,
                CreatedOn      = round.Data.CreatedOn,
                ClosedOn       = round.Data.ClosedOn,
                GameActions    = round.Data.GameActions.Select(x => new GameActionHistoryData
                {
                    PlatformTxId    = x.Id,
                    Amount          = x.Amount,
                    Description     = x.Description,
                    TransactionType = x.GameActionType.ToString(),
                    CreatedOn       = x.Timestamp,
                    Id = x.ExternalTransactionId,
                }).ToList()
            }).ToList();

            return(new BetsHistoryResponse
            {
                Rounds = convertedRounds
            });
        }