public virtual GetEmeraldRoomUrlResponse GetEmeraldRoomUrl()
        {
            if (!UserCanUseProduct())
            {
                return(new GetEmeraldRoomUrlResponse {
                    Code = ResponseCode.ProductNotAvailable
                });
            }

            var url = _liveCasinoApiProxy.GetEmeraldRoomUrl(CultureCode, _userContext.UserId,
                                                            _networkUtility.GetClientIPAddress());

            if (url == null)
            {
                return(new GetEmeraldRoomUrlResponse {
                    Code = ResponseCode.UrlNotFound
                });
            }

            return(new GetEmeraldRoomUrlResponse
            {
                Code = ResponseCode.Success,
                Url = url
            });
        }
        public GetAmayaGamesUrlResponse GetAmayaGamesUrl(string category = null, string name = null)
        {
            var ipAddress = _networkUtility.GetClientIPAddress();

            var url = _userContext.LoggedIn
                ? _casinoApiProxy.GetAmayaGameUrl(CultureCode, _userContext.UserId, ipAddress, category, name)
                : _casinoApiProxy.GetAmayaGameUrl(CultureCode, ipAddress, category, name);

            return(new GetAmayaGamesUrlResponse
            {
                Code = ResponseCode.Success,
                FreeGameUrl = url.Free,
                RealGameUrl = url.Real
            });
        }
        public ActionResult WorldPay3DSecureCallback(string paRes, string md)
        {
            var mobile = RouteData.Values["mobile"];

            var depositUrl = GetDepositUrl(mobile);

            var casinoUrl = GetCasinoUrl(mobile);

            try
            {
                Log.InfoFormat("Getting PaRes [{0}] and MD [{1}] from [{2}]", paRes, md,
                               _networkUtility.GetClientIPAddress());


                var result = _paymentApiProxy.ConfirmDepositByWorldPay(_cultureUtility.GetCultureCode(),
                                                                       _userContext.UserId,
                                                                       new PaymentDto.WorldPay.Confirmation
                {
                    PaymentAuthenticationResponse = paRes,
                    TransactionId = md,
                    CasinoUrl     = casinoUrl,
                    DepositUrl    = depositUrl
                });

                return
                    (View(GetViewPath(mobile), result));
            }
            catch (DepositNotCompletedException ex)
            {
                Log.Error("Failed to process WorldPay 3DS callback", ex);
                return
                    (View(GetViewPath(mobile), null));
            }
            catch (Exception ex)
            {
                Log.Error("Failed to process WorldPay 3DS callback", ex);
                //return new FilePathResult(
                //    string.Format(_configurations.ErrorPagePath, (int)HttpStatusCode.InternalServerError,
                //        _cultureUtility.GetCultureCode()), MediaTypeNames.Text.Html);

                return
                    (View(GetViewPath(mobile), null));
            }
        }
        public virtual GetSpotOptionUrlResponse GetSpotOptionUrl()
        {
            if (!UserCanUseProduct())
            {
                return(new GetSpotOptionUrlResponse {
                    Code = ResponseCode.ProductNotAvailable
                });
            }

            var url = _financialBettingApiProxy.GetSpotOptionUrl(CultureCode, _networkUtility.GetClientIPAddress());

            if (url == null)
            {
                return(new GetSpotOptionUrlResponse {
                    Code = ResponseCode.UrlNotFound
                });
            }

            return(new GetSpotOptionUrlResponse
            {
                Code = ResponseCode.Success,
                Url = url
            });
        }
Exemple #5
0
        public virtual LogInResponse LogIn([FromBody] LogInRequest request)
        {
            string ipAddress = string.Empty;

            try
            {
                ipAddress = _networkUtility.GetClientIPAddress();

                Log.InfoFormat("User {0} logging in from {1}.", request.Username, ipAddress);

                LogInDto user = _accountApiProxy.LogIn(CultureCode, request.Username, request.Password, ipAddress, request.RememberMe,
                                                       request.Platform, request.IovationBlackBox, request.FirstPartyBlackBox);

                if (user == null)
                {
                    Log.InfoFormat("User {0} failed to log in.", request.Username);
                    return(new LogInResponse {
                        Code = ResponseCode.WrongCredential
                    });
                }

                var sportsbookUrl = request.IsMobile
                    ? _sportsbookApiProxy.GetSbTechMobileUrl(CultureCode, user.Username)
                    : _sportsbookApiProxy.GetSbTechUrl(CultureCode, user.Username);

                if (!String.IsNullOrEmpty(user.PlayerLoginToken))
                {
                    HttpCookie loginToken = new HttpCookie("lToken");
                    loginToken.Value   = user.PlayerLoginToken;
                    loginToken.Expires = DateTime.Today.AddDays(30);
                    _httponContextBase.Response.Cookies.Add(loginToken);
                }

                _userContext.Save(new LoggedInUser
                {
                    UserId        = user.UserId,
                    Username      = user.Username,
                    Currency      = user.Currency,
                    SportsbookUrl = sportsbookUrl
                });


                Log.InfoFormat("User {0} logged in.", request.Username);

                var hasReadTerms = _accountApiProxy.HasReadTheLatestTnC(CultureCode, user.UserId);

                HttpCookie hasReadTermsCookie = new HttpCookie("rTC");
                hasReadTermsCookie.Value   = hasReadTerms.ToString();
                hasReadTermsCookie.Expires = DateTime.Today.AddDays(1);
                _httponContextBase.Response.Cookies.Add(hasReadTermsCookie);

                return(new LogInResponse
                {
                    Code = ResponseCode.Success,
                    HasReadTerms = hasReadTerms,
                    SportsbookUrl = sportsbookUrl,
                    Token = user.PlayerLoginToken,
                    ExpirationMessageRG = String.IsNullOrEmpty(user.ExpirationMessageRG) ? string.Empty : user.ExpirationMessageRG
                });
            }
            catch (LoginFailedException ex)
            {
                return(GetLogInResponse(request, ipAddress, ResponseCode.LoginFailed, ex));
            }
            catch (LoginMaxAttemptsFailedException ex)
            {
                return(GetLogInResponse(request, ipAddress, ResponseCode.LoginMaxAttemptsFailed, ex));
            }
        }
        public virtual SignUpResponse SignUp([FromBody] SignUpRequest request)
        {
            try
            {
                string ipAddress = _networkUtility.GetClientIPAddress();

                Log.InfoFormat("User signing up an account {0} from {1}", request.Username, ipAddress);

                //var ipBlockedResult = _utilityApiProxy.IPBlocked(CultureCode, ipAddress, _networkUtility.GetServerHost(),
                //    IPBlockType.LoginOrRegister);

                //if (ipBlockedResult.Blocked)
                //{
                //    return new SignUpResponse
                //    {
                //        Code = ResponseCode.BlockedIP,
                //    };
                //}

                var currencies = _utilityApiProxy.GetCurrencies(CultureCode);

                if (string.IsNullOrWhiteSpace(request.Currency) || currencies.All(x => x.Code != request.Currency))
                {
                    return(new SignUpResponse
                    {
                        Code = ResponseCode.CurrencyNotFound,
                    });
                }

                var signUpDetails = new SignUpDetails
                {
                    Username         = request.Username,
                    Password         = request.Password,
                    SecurityQuestion =
                        Enum.IsDefined(typeof(SecurityQuestion), request.SecurityQuestion)
                            ? request.SecurityQuestion
                            : SecurityQuestion.None,
                    SecurityAnswer     = request.SecurityAnswer,
                    Title              = request.Title,
                    FirstName          = request.FirstName,
                    MiddleName         = request.MiddleName,
                    LastName           = request.LastName,
                    PostalCode         = request.PostalCode,
                    DateOfBirth        = request.DateOfBirth,
                    MobileNumber       = request.MobileNumber,
                    Email              = request.Email,
                    City               = request.City,
                    Country            = request.Country,
                    AddressLine1       = request.AddressLine1,
                    AddressLine2       = request.AddressLine2,
                    AddressLine3       = request.AddressLine3,
                    IPAddress          = ipAddress,
                    VerificationType   = VerificationType.Email,
                    Introducer         = request.Introducer,
                    BTag               = request.BTag,
                    Nationality        = request.Nationality,
                    Currency           = request.Currency,
                    Subscription       = request.Subscription,
                    DepositDayLimit    = request.DepositDayLimit,
                    DepositMonthLimit  = request.DepositMonthLimit,
                    DepositWeekLimit   = request.DepositWeekLimit,
                    Platform           = string.IsNullOrEmpty(request.Platform) ? string.Empty : request.Platform,
                    IovationBlackBox   = string.IsNullOrEmpty(request.IovationBlackBox) ? string.Empty : request.IovationBlackBox,
                    FirstPartyBlackBox = string.IsNullOrEmpty(request.FirstPartyBlackBox) ? string.Empty : request.FirstPartyBlackBox,
                    isHousePlayer      = string.IsNullOrEmpty(request.isHousePlayer) ? "N" : request.isHousePlayer
                };

                _accountApiProxy.SignUp(CultureCode, signUpDetails);

                Log.InfoFormat("User {0} signed up from {1}.", signUpDetails.Username, signUpDetails.IPAddress);

                return(new SignUpResponse {
                    Code = ResponseCode.Success
                });
            }
            catch (DuplicateUsernameException ex)
            {
                return(new SignUpResponse {
                    Code = ResponseCode.DuplicateUsername, ErrorMessage = ex.Message
                });
            }
            catch (DuplicateEmailException ex)
            {
                return(new SignUpResponse {
                    Code = ResponseCode.DuplicateEmail, ErrorMessage = ex.Message
                });
            }
            catch (IntroducerNotFoundException ex)
            {
                return(new SignUpResponse {
                    Code = ResponseCode.IntroducerNotFound, ErrorMessage = ex.Message
                });
            }
            catch (DuplicateMobileNumberException ex)
            {
                return(new SignUpResponse {
                    Code = ResponseCode.DuplicateMobileNumber, ErrorMessage = ex.Message
                });
            }
            catch (BadDataException ex)
            {
                return(new SignUpResponse {
                    Code = ResponseCode.BadData, ErrorMessage = ex.Message
                });
            }
            catch (IovationDeniedException ex)
            {
                return(new SignUpResponse {
                    Code = ResponseCode.IovationDenied, ErrorMessage = ex.Message
                });
            }
            catch (ApiProxyBrokenException ex)
            {
                return(new SignUpResponse {
                    Code = ResponseCode.BrokenApiProxy, ErrorMessage = ex.Message
                });
            }
        }