public ActionResult Index(DibsPaymentPage currentPage)
        {
            CartHelper ch = new CartHelper(Cart.DefaultName);

            ch.Cart.AcceptChanges();

            var orderInfo = new OrderInfo()
            {
                // Dibs expect the order to be without decimals
                Amount   = Convert.ToInt32(ch.Cart.Total * 100),
                Currency = ch.Cart.BillingCurrency,
                OrderId  = ch.Cart.GeneratePredictableOrderNumber(),
                IsTest   = Tools.IsAppSettingTrue("DIBS.TestMode"),
                ExpandOrderInformation = true
            };

            DibsPaymentViewModel model = new DibsPaymentViewModel(_contentRepository, currentPage, orderInfo, ch.Cart);

            // Get cart and track it
            Api.CartController cartApiController = new Api.CartController();
            cartApiController.Language = currentPage.LanguageBranch;
            List <Core.Objects.LineItem> lineItems = cartApiController.GetItems(Cart.DefaultName);

            TrackBeforePayment(lineItems);

            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult Index(GenericPaymentPage currentPage)
        {
            CartHelper ch = new CartHelper(Cart.DefaultName);

            ch.Cart.AcceptChanges();

            var orderInfo = new OrderInfo()
            {
                // Dibs expect the order to be without decimals
                Amount   = Convert.ToInt32(ch.Cart.Total * 100),
                Currency = ch.Cart.BillingCurrency,
                OrderId  = ch.Cart.GeneratePredictableOrderNumber(),
                ExpandOrderInformation = true
            };

            Guid paymentMethod = Guid.Empty; // When not set (creating a page), this is null

            if (string.IsNullOrEmpty(currentPage.PaymentMethod) == false)
            {
                paymentMethod = new Guid(currentPage.PaymentMethod);
            }

            GenericPaymentViewModel <GenericPaymentPage> model = new GenericPaymentViewModel <GenericPaymentPage>(paymentMethod, currentPage, orderInfo, ch.Cart);

            // Get cart and track it
            Api.CartController cartApiController = new Api.CartController();
            cartApiController.Language = currentPage.LanguageBranch;
            List <Core.Objects.LineItem> lineItems = cartApiController.GetItems(Cart.DefaultName);

            TrackBeforePayment(lineItems);

            return(View(model));
        }
        public ActionResult Index(CheckoutPage currentPage)
        {
            CheckoutViewModel model = new CheckoutViewModel(currentPage);

            model.BillingAddress  = _customerAddressRepository.GetDefaultBillingAddress();
            model.ShippingAddress = _customerAddressRepository.GetDefaultShippingAddress();
            var contact = _contactRepository.Get();

            model.Email = contact.Email;
            model.Phone = contact.PhoneNumber;

            model.PaymentInfo         = GetPaymentInfo();
            model.AvailableCategories = GetAvailableCategories();

            model.TermsArticle = currentPage.TermsArticle;

            // Get cart and track it
            Api.CartController cartApiController = new Api.CartController();
            cartApiController.Language = currentPage.LanguageBranch;
            List <Core.Objects.LineItem> lineItems = cartApiController.GetItems(Cart.DefaultName);

            Track(lineItems);

            return(View(model));
        }