예제 #1
0
        public void Test_DeletePayment()
        {
            var sut = new PaymentViewModel
            {
                PaymentId = 13
            };
            var test = sut.AddOrDeletePayments(sut);

            Assert.True(test);
        }
예제 #2
0
        public void Test_ValidateNewPayment()
        {
            var sut = new PaymentViewModel
            {
                CCNumber = 1111222233334444
            };
            var test = sut.AddOrDeletePayments(sut);

            Assert.True(test);
        }
예제 #3
0
        public void Test_AddPayment()
        {
            var sut = new PaymentViewModel
            {
                CCNumber   = 4444333322221111,
                CCUserName = "******",
                Month      = 01,
                Year       = 22,
                CVV        = 123,
                UserId     = 1,
                HelperType = "add",
            };
            var test = sut.AddOrDeletePayments(sut);

            Assert.True(test);
        }
예제 #4
0
        public IActionResult CompletePayment(PaymentViewModel payment)
        {
            var sessionHelper    = HttpContext.Session.GetString("HelperType");
            var sessionAddressId = HttpContext.Session.GetString("PaymentId");
            var sessionUserId    = HttpContext.Session.GetInt32("UserId");
            int userId           = (int)sessionUserId;

            var newModel = new PaymentViewModel
            {
                HelperType = sessionHelper,
                UserId     = userId,
                CCNumber   = payment.CCNumber,
                CCUserName = payment.CCUserName,
                Month      = payment.Month,
                Year       = payment.Year,
                CVV        = payment.CVV
            };

            newModel.AddOrDeletePayments(newModel);

            return(RedirectToAction("ChangePayment", "Home"));
        }