示例#1
0
        public void MissingTokenTest()
        {
            LibLogic.Helpers.SslSecurity.Callback();
            var pay = new LibLogic.Payments.StripePayment(userid, new LibLogic.Email.FakeEmail());

            pay.MakePayment("", "");
        }
示例#2
0
        public void HappyPathNoCouponTest()
        {
            LibLogic.Helpers.SslSecurity.Callback();
            var pay = new LibLogic.Payments.StripePayment(userid, new LibLogic.Email.FakeEmail());

            pay.MakePayment(this.token, "");
        }
示例#3
0
        public void Charge()
        {
            if (Helpers.SessionVariables.Instance.LoggedIn == false)
            {
                return;
            }

            // Test credit card number: 4242 4242 4242 4242

            string message = "";

            try
            {
                string stripeToken    = Helpers.GlobalHelper.RequestParam("stripeToken");
                string couponDiscount = Helpers.GlobalHelper.RequestEncodedParam("discount");

                var pay = new LibLogic.Payments.StripePayment(Helpers.SessionVariables.Instance.UserId,
                                                              new LibLogic.Email.LiveEmail());
                pay.MakePayment(stripeToken, couponDiscount);

                LibLogic.ActionLog.Log_BackgroundThread("Payment made", Helpers.SessionVariables.Instance.UserId);


                Task.Run(() => SetDefaultVpnServer());
            }
            catch (Exception ex)
            {
                LibLogic.Helpers.Logging.Log(ex);
                message = "fail";
            }

            this.HttpContext.Response.Redirect("/charge?status=" + message, false);
        }