Ejemplo n.º 1
0
        private ValidateTokenResponse ValidateToken(string token)
        {
            if (String.IsNullOrWhiteSpace(token))
            {
                throw new WebServiceException("Access denied (missing token)");
            }

            EnsureAccessToken();

            var response = GameApiUtil.CallGameApiPost <ValidateToken, ValidateTokenResponse>(
                FormatEndpointPath("token/validate"),
                new ValidateToken()
            {
                AuthToken       = token,
                PlayerIpAddress = Request.UserHostAddress
            }, OAuthHeaderDecoration);

            if (response.ErrorCode != 0)
            {
                throw new WebServiceException(
                          $"Access denied (invalid token), Error Code: {response.ErrorCode}, description: {response.ErrorDescription}");
            }

            return(response);
        }
Ejemplo n.º 2
0
        List <RoundHistoryData> GetBets(string token)
        {
            var betsHistoryResponse =
                GameApiUtil.CallGameApiGet <BetsHistoryResponse>("api/secure/bets/history?authtoken=" + token, OAuthHeaderDecoration);

            return(betsHistoryResponse.Rounds.OrderByDescending(a => a.CreatedOn).ToList());
        }
Ejemplo n.º 3
0
 private ValidateTokenResponse ValidateToken(string token)
 {
     return(GameApiUtil.CallGameApiPost <ValidateToken, ValidateTokenResponse>(
                "api/secure/token/validate",
                new ValidateToken()
     {
         AuthToken = token,
         PlayerIpAddress = Request.UserHostAddress
     }, OAuthHeaderDecoration));
 }
Ejemplo n.º 4
0
 private CancelTransactionResponse CallCancelTransaction(string token, List <BetCommandTransactionRequest> txList)
 {
     return(GameApiUtil.CallGameApiPost <CancelTransaction, CancelTransactionResponse>(
                FormatEndpointPath("transactions/cancel"),
                new CancelTransaction
     {
         AuthToken = token,
         PlayerIpAddress = Request.UserHostAddress,
         Transactions = txList
     }, OAuthHeaderDecoration));
 }
Ejemplo n.º 5
0
 private FreeBetResponse CallFreeBet(string token, string betLimitId, List <BetCommandTransactionRequest> txList)
 {
     return(GameApiUtil.CallGameApiPost <FreeBet, FreeBetResponse>(
                FormatEndpointPath("bets/freebet"),
                new FreeBet
     {
         AuthToken = token,
         PlayerIpAddress = Request.UserHostAddress,
         Transactions = txList
     }, OAuthHeaderDecoration));
 }
Ejemplo n.º 6
0
 private LoseBetResponse CallLoseBet(string token, List <BetCommandTransactionRequest> txList)
 {
     return(GameApiUtil.CallGameApiPost <LoseBet, LoseBetResponse>(
                FormatEndpointPath("bets/lose"),
                new LoseBet
     {
         AuthToken = token,
         PlayerIpAddress = Request.UserHostAddress,
         Transactions = txList
     }, OAuthHeaderDecoration));
 }
Ejemplo n.º 7
0
        private PlaceBetResponse CallPlaceBet(string token, string betLimitId, List <BetCommandTransactionRequest> txList)
        {
            ValidateBetLimits(betLimitId, txList);

            return(GameApiUtil.CallGameApiPost <PlaceBet, PlaceBetResponse>(
                       FormatEndpointPath("bets/place"),
                       new PlaceBet
            {
                AuthToken = token,
                PlayerIpAddress = Request.UserHostAddress,
                Transactions = txList
            }, OAuthHeaderDecoration));
        }
Ejemplo n.º 8
0
        List <RoundHistoryData> GetRounds(string token)
        {
            EnsureAccessToken();

            var roundsHistoryResponse =
                GameApiUtil.CallGameApiGet <BetsHistoryResponse>(
                    FormatEndpointPath("bets/history?authtoken=" + token + "&ipaddress = " + Request.UserHostAddress + " &gameid=" + GameId),
                    OAuthHeaderDecoration);

            if (roundsHistoryResponse.ErrorCode != GameApiErrorCode.NoError)
            {
                throw new GameApiException(roundsHistoryResponse.ErrorDescription);
            }

            return(roundsHistoryResponse.Rounds.OrderByDescending(a => a.CreatedOn).ToList());
        }