public TwiMLResult ProccessPayment(string ccInfo, string expDate, string code)
        {
            var response = new VoiceResponse();
            var total    = new ReviewRepository().GettotalAmountOwed((int)Session["orderId"]);
            var repo     = new CheckoutRepository(ccInfo, expDate, total, code, (int)Session["orderId"]);
            var record   = repo.SubmitPayment();

            if (record.Result == 0)
            {
                repo.RecordPayment((int)Session["orderId"], record.Amount.Value);
                response.Say("Thank you, your payment was successful. Thank you for placing your order. Goodbye", voice: "alice", language: "en-US");
                response.Hangup();
            }
            else if (record.Result == 1)
            {
                response.Say("The charge dit not go through. the response was, " + record.ResultMessage + ". Please try again.", voice: "alice", language: "en-US");
                response.Redirect("/checkout/EnterCCInfo");
            }
            else if (record.ErrorMessage != null)
            {
                response.Say(record.ErrorMessage + ". Please try again.", voice: "alice", language: "en-US");
                response.Redirect("/checkout/EnterCCInfo");
            }
            return(TwiML(response));
        }
Example #2
0
        public CheckoutLogic()
        {
            checkoutRepository = new CheckoutRepository();
            promotionLogic     = new PromotionLogic(checkoutRepository.GetDefaultPromotionPricingMapping());

            basketItems = new Dictionary <string, BasketItem>();
        }
Example #3
0
 public PaymentController(
     IPaymentsApi paymentsApi,
     CheckoutRepository checkoutRepository,
     PaymentRepository paymentRepository,
     IamportHttpClientOptions clientOptions)
 {
     if (paymentsApi == null)
     {
         throw new ArgumentNullException(nameof(paymentsApi));
     }
     if (checkoutRepository == null)
     {
         throw new ArgumentNullException(nameof(checkoutRepository));
     }
     if (paymentRepository == null)
     {
         throw new ArgumentNullException(nameof(paymentRepository));
     }
     if (clientOptions == null)
     {
         throw new ArgumentNullException(nameof(clientOptions));
     }
     this.paymentsApi        = paymentsApi;
     this.checkoutRepository = checkoutRepository;
     this.paymentRepository  = paymentRepository;
     iamportId = clientOptions.IamportId;
 }
 public CheckoutController(
     CheckoutRepository checkoutRepository,
     IamportHttpClientOptions clientOptions)
 {
     this.checkoutRepository = checkoutRepository ?? throw new ArgumentNullException(nameof(checkoutRepository));
     this.clientOptions      = clientOptions ?? throw new ArgumentNullException(nameof(clientOptions));
 }
 public RequestBillController()
 {
     db = DB.Entities;
     _checkoutRepository = new CheckoutRepository(db);
     _deptRepository = new DeptRepository(db);
     _checkoutDetailRepository = new CheckoutDetailsRepository(db);
     _ticketRepository = new TicketRepository(db);
 }
 public FacilityController(DatabaseContext context)
 {
     DbContext   = context;
     UserRep     = new UserRepository(context);
     PlaceRep    = new PlaceRepository(context);
     WorkRep     = new WorkRepository(context);
     FacilityRep = new FacilityRepository(context);
     DiseaseRep  = new DiseaseRepository(context);
     ScheduleRep = new ScheduleRepository(context);
     CheckoutRep = new CheckoutRepository(context);
 }
Example #7
0
 public DirectPaymentController(
     IPaymentsApi paymentsApi,
     ISubscribeApi subscribeApi,
     CheckoutRepository checkoutRepository,
     PaymentRepository paymentRepository,
     IamportHttpClientOptions clientOptions)
 {
     this.paymentsApi        = paymentsApi ?? throw new ArgumentNullException(nameof(paymentsApi));
     this.subscribeApi       = subscribeApi ?? throw new ArgumentNullException(nameof(subscribeApi));
     this.checkoutRepository = checkoutRepository ?? throw new ArgumentNullException(nameof(checkoutRepository));
     this.paymentRepository  = paymentRepository ?? throw new ArgumentNullException(nameof(paymentRepository));
     if (clientOptions == null)
     {
         throw new ArgumentNullException(nameof(clientOptions));
     }
     iamportId = clientOptions.IamportId;
 }
        public void AddCheckout(OrderDetailViewModel orderVM)
        {
            if (CheckoutRepository == null)
            {
                CheckoutRepository = new CheckoutRepository();
            }

            Order order = new Order()
            {
                OrderID        = orderVM.OrderID,
                OrderDate      = orderVM.OrderDate,
                DeliverAddress = orderVM.DeliverAddress,
                DeliverPhone   = orderVM.DeliverPhone,
                DeliverName    = orderVM.DeliverName
            };

            CheckoutRepository.Update(order);
        }
Example #9
0
        public ActionResult SubmitPayment(string ccInfo, string expDate, decimal amount, string code, int oId)
        {
            var repo   = new CheckoutRepository(ccInfo, expDate, amount, code, oId);
            var record = repo.SubmitPayment();

            if (record.Result == 0)
            {
                repo.RecordPayment(oId, record.Amount.Value);
                TempData["response"] = "payment was successful";
            }
            else if (record.Result == 1)
            {
                TempData["response"] = "The charge dit not go through. the response was, " + record.ResultMessage;
            }
            else if (record.ErrorMessage != null)
            {
                TempData["response"] = record.ErrorMessage;
            }
            return(Redirect("/Orders/OrderDetails?orderId=" + oId));
        }
Example #10
0
 public CheckoutService(CheckoutRepository checkoutRepository, CartRepository cartRepository)
 {
     this.cartRepository     = cartRepository;
     this.checkoutRepository = checkoutRepository;
 }
Example #11
0
 public CheckoutService(CheckoutRepository CheckoutRepository)
 {
     this.CheckoutRepository = CheckoutRepository;
 }