Example #1
0
        public void IsExpiredInvalidUserIdTest()
        {
            // Beta account should never be expired except for invalid user accounts
            var pay = new LibLogic.Payments.Payment(-1);

            Assert.That(pay.IsExpired(), Is.True);
        }
Example #2
0
        public void IsAdminExpiredTest()
        {
            // Beta account should never be expired
            var pay = new LibLogic.Payments.Payment(this.userid);

            Assert.That(pay.IsExpired(), Is.False);
        }
Example #3
0
        public void IsExpiredTest()
        {
            // Beta account should never be expired
            var pay = new LibLogic.Payments.Payment(this.nonAdminUserId);

            Assert.That(pay.IsExpired(), Is.True);
        }
Example #4
0
        public Setup()
        {
            var details = new LibLogic.Accounts.ServerDetails();

            this.ServerInfo = details.Info;

            var pay = new LibLogic.Payments.Payment(Helpers.SessionVariables.Instance.UserId);

            ActiveAccount = !pay.IsExpired();


            var userServerDetails = new LibLogic.Accounts.UserServerDetails(Helpers.SessionVariables.Instance.UserId);

            if (userServerDetails.Info == null)
            {
                CurrentServer = "none";
                PptpIP        = "none";
                PptpPassword  = "******";
            }
            else
            {
                CurrentServer = userServerDetails.Info.VpnServerName + " - Region: " + userServerDetails.Info.RegionName;
                PptpIP        = userServerDetails.Info.Address;
                PptpPassword  = userServerDetails.Info.PptpPassword;
            }

            Username = Helpers.SessionVariables.Instance.Username;
        }
Example #5
0
        public void IsAdminExpiredOldPaymentsTest()
        {
            var createDate = DateTime.UtcNow.AddMonths(-3);
            var payment    = 56.76m;
            var paycode    = LibLogic.Helpers.SiteInfo.MonthlyPaymentId;

            var pay = new LibLogic.Payments.Payment(this.userid);

            pay.SaveUserPayment(payment, createDate, paycode);


            Assert.That(pay.IsExpired(), Is.False);
        }
Example #6
0
        public void IsExpiredNewPaymentsTest()
        {
            // Beta account should never be expired
            var createDate = DateTime.UtcNow;
            var payment    = 56.76m;
            var paycode    = LibLogic.Helpers.SiteInfo.MonthlyPaymentId;

            var pay = new LibLogic.Payments.Payment(this.userid);

            pay.SaveUserPayment(payment, createDate, paycode);


            Assert.That(pay.IsExpired(), Is.False);
        }
Example #7
0
        public Account()
        {
            var profileInfo = new LibLogic.Accounts.UserInfo(Helpers.SessionVariables.Instance.UserId).GetProfile();

            FirstName  = profileInfo.FirstName;
            LastName   = profileInfo.LastName;
            UsersEmail = profileInfo.Email;

            ChargeAmount           = LibLogic.Helpers.SiteInfo.CurrentMonthlyRate.ToString("G29");
            ChargeAmountStripCents = LibLogic.Helpers.SiteInfo.CurrentMonthlyRateInCents;
            var payInfo = new LibLogic.Payments.Payment(Helpers.SessionVariables.Instance.UserId);

            AccountExpired = payInfo.IsExpired();
            PaymentHistory = payInfo.History();
        }
Example #8
0
        public void ProcessRequest(HttpContext context)
        {
            string password = Helpers.GlobalHelper.RequestEncodedParam("password");
            string username = Helpers.GlobalHelper.RequestEncodedParam("username");


            var login = new LibLogic.Login(username, password);

            try
            {
                login.Execute();
            }
            catch (LibLogic.Exceptions.InvalidDataException ex)
            {
                context.Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
                return;
            }

            Helpers.SessionVariables.Instance.LoggedIn = login.LoggedIn;
            Helpers.SessionVariables.Instance.Username = username;
            Helpers.SessionVariables.Instance.UserId   = login.UserId;
            Helpers.SessionVariables.Instance.IsAdmin  = login.IsAdmin;

            if (Helpers.SessionVariables.Instance.LoggedIn)
            {
                // if payments have expired or were never setup prompt the user
                // to setup payments
                var paymets = new LibLogic.Payments.Payment(Helpers.SessionVariables.Instance.UserId);
                if (paymets.IsExpired())
                {
                    context.Response.StatusCode = 250;
                }
                else
                {
                    context.Response.StatusCode = (int)System.Net.HttpStatusCode.OK;
                }
            }
            else
            {
                context.Response.StatusCode = (int)System.Net.HttpStatusCode.Forbidden;
            }
        }
        private bool IsActiveAccount()
        {
            var pay = new LibLogic.Payments.Payment(userData.Id);

            return(!pay.IsExpired());
        }