public IHttpActionResult UpdateLineItem(UpdateLineItemDTO model)
        {
            TransactionLibrary.UpdateLineItem(model.OrderlineId, model.NewQuantity);
            TransactionLibrary.ExecuteBasketPipeline();

            return(Json(this.GetBasketModel()));
        }
        public ActionResult Index(AddressDetailsViewModel addressDetails)
        {
            var billingDetails = addressDetails.BillingAddress;

            if (!string.IsNullOrEmpty(billingDetails.FirstName) || !string.IsNullOrEmpty(billingDetails.LastName) ||
                !string.IsNullOrEmpty(billingDetails.EmailAddress) || !string.IsNullOrEmpty(billingDetails.MobilePhoneNumber) || !string.IsNullOrEmpty(billingDetails.Line1))
            {
                if (addressDetails.IsShippingAddressDifferent)
                {
                    EditBillingInformation(billingDetails);
                    EditShippingInformation(addressDetails.ShippingAddress);
                }

                else
                {
                    EditBillingInformation(billingDetails);
                    EditShippingInformation(billingDetails);
                }

                TransactionLibrary.ExecuteBasketPipeline();

                var root     = UmbracoContext.PublishedContentRequest.PublishedContent.AncestorsOrSelf("homePage").FirstOrDefault();
                var shipping = root.Descendants("shipping").FirstOrDefault();
                return(Redirect(shipping.Url));
            }

            return(base.View("/Views/BillingShippingAddress.cshtml", addressDetails));
        }
        public ActionResult Index(ShippingViewModel shipping)
        {
            TransactionLibrary.CreateShipment(shipping.SelectedShippingMethodId, overwriteExisting: true);
            TransactionLibrary.ExecuteBasketPipeline();

            return(Redirect("/store/payment"));
        }
        public IHttpActionResult AddVoucher(AddVoucherDTO model)
        {
            var voucherAdded = MarketingLibrary.AddVoucher(model.VoucherCode);

            TransactionLibrary.ExecuteBasketPipeline();
            return(Json(this.GetBasketModel()));
        }
Exemple #5
0
        public IHttpActionResult UpdateLineItem([FromBody] UpdateLineItemRequest request)
        {
            TransactionLibrary.UpdateLineItem(request.OrderLineId, request.NewQuantity);
            TransactionLibrary.ExecuteBasketPipeline();

            var orderLine = TransactionLibrary.GetBasket().PurchaseOrder.OrderLines.First(l => l.OrderLineId == request.OrderLineId);

            var currency  = SiteContext.Current.CatalogContext.CurrentCatalog.PriceGroup.Currency;
            var lineTotal = new Money(orderLine.Total.GetValueOrDefault(), currency);

            var updatedLine = new LineItem()
            {
                OrderLineId    = orderLine.OrderLineId,
                Quantity       = orderLine.Quantity,
                Sku            = orderLine.Sku,
                VariantSku     = orderLine.VariantSku,
                Price          = orderLine.Price,
                ProductName    = orderLine.ProductName,
                Total          = orderLine.Total,
                FormattedTotal = lineTotal.ToString(),
                UnitDiscount   = orderLine.UnitDiscount,
                VAT            = orderLine.VAT,
                VATRate        = orderLine.VATRate
            };

            return(Json(updatedLine));
        }
Exemple #6
0
    protected void UseVoucher(object sender, EventArgs e)
    {
        MarketingLibrary.AddVoucher(txtVoucherCode.Value);
        TransactionLibrary.ExecuteBasketPipeline();

        Response.Redirect(Request.RawUrl);
    }
Exemple #7
0
        protected override object Run(UpdateLineItem request)
        {
            TransactionLibrary.UpdateLineItem(request.OrderLineId, request.NewQuantity);
            TransactionLibrary.ExecuteBasketPipeline();
            var newLine = TransactionLibrary.GetBasket().PurchaseOrder.OrderLines.FirstOrDefault(l => l.OrderLineId == request.OrderLineId);

            return(new UpdateLineItemResponse(newLine));
        }
Exemple #8
0
        public ActionResult Index(ShippingViewModel shipping)
        {
            TransactionLibrary.CreateShipment(shipping.SelectedShippingMethodId, overwriteExisting: true);
            TransactionLibrary.ExecuteBasketPipeline();

            var parent  = PublishedRequest.PublishedContent.AncestorOrSelf("basket");
            var payment = parent.Children(x => x.Name == "Payment").FirstOrDefault();

            return(Redirect(payment.Url));
        }
        public ActionResult Index(ShippingViewModel shipping)
        {
            TransactionLibrary.CreateShipment(shipping.SelectedShippingMethodId, overwriteExisting: true);
            TransactionLibrary.ExecuteBasketPipeline();

            var root    = UmbracoContext.PublishedContentRequest.PublishedContent.AncestorsOrSelf("home").FirstOrDefault();
            var payment = root.Descendants("payment").FirstOrDefault();

            return(Redirect(payment.Url));
        }
Exemple #10
0
        public ActionResult Index(PaymentViewModel payment)
        {
            TransactionLibrary.CreatePayment(
                paymentMethodId: payment.SelectedPaymentMethodId,
                requestPayment: false,
                amount: -1,
                overwriteExisting: true);

            TransactionLibrary.ExecuteBasketPipeline();

            return(Redirect("/preview"));
        }
Exemple #11
0
        protected void SavePaymentAndGoToPreviewBtn_OnClick(object sender, EventArgs e)
        {
            var selectedPaymentMethodId = Int32.Parse(AvailablePaymentMethods.SelectedValue);

            TransactionLibrary.CreatePayment(
                paymentMethodId: selectedPaymentMethodId,
                requestPayment: false,
                amount: -1,
                overwriteExisting: true);

            TransactionLibrary.ExecuteBasketPipeline();

            Response.Redirect("/preview");
        }
Exemple #12
0
        public ActionResult Index(PaymentViewModel payment)
        {
            TransactionLibrary.CreatePayment(
                paymentMethodId: payment.SelectedPaymentMethodId,
                requestPayment: false,
                amount: -1,
                overwriteExisting: true);

            TransactionLibrary.ExecuteBasketPipeline();

            var root    = UmbracoContext.PublishedContentRequest.PublishedContent.AncestorsOrSelf("homePage").FirstOrDefault();
            var preview = root.Descendants("previewItems").FirstOrDefault();

            return(Redirect(preview.Url));
        }
        public ActionResult Index(PaymentViewModel payment)
        {
            TransactionLibrary.CreatePayment(
                paymentMethodId: payment.SelectedPaymentMethodId,
                requestPayment: false,
                amount: -1,
                overwriteExisting: true);

            TransactionLibrary.ExecuteBasketPipeline();

            var parent  = PublishedRequest.PublishedContent.AncestorOrSelf("basket");
            var preview = parent.Children(x => x.Name == "Preview").FirstOrDefault();

            return(Redirect(preview.Url));
        }
Exemple #14
0
        public void btnUpdateShipment_Click(object sender, EventArgs e)
        {
            var shipping         = Page.FindWebPart <CMSWebParts_Ucommerce_Shipping>();
            int shippingMethodId = 0;

            if (shipping == null)
            {
                return;
            }

            if (!Int32.TryParse(shipping.SelectedValue, out shippingMethodId))
            {
                return;
            }

            TransactionLibrary.CreateShipment(shippingMethodId, Constants.DefaultShipmentAddressName, true);
            TransactionLibrary.ExecuteBasketPipeline();
            HttpContext.Current.Response.Redirect("~/basket/payment");
        }
    public static bool?UpdateCartLine(string lineNumberString, string quantityString)
    {
        var basket     = TransactionLibrary.GetBasket().PurchaseOrder;
        int lineNumber = 0;
        int quantity   = 0;

        if (!Int32.TryParse(lineNumberString, out lineNumber) || !Int32.TryParse(quantityString, out quantity))
        {
            //if we cant parse the input to ints, we cant go on
            return(false);
        }

        var listOfOrderLineIds = basket.OrderLines.Select(x => x.OrderLineId).ToList();
        var currentOrderLineId = listOfOrderLineIds[lineNumber];

        TransactionLibrary.UpdateLineItem(currentOrderLineId, quantity);

        TransactionLibrary.ExecuteBasketPipeline();
        return(true);
    }
Exemple #16
0
        public ActionResult Index(PurchaseOrderViewModel model)
        {
            foreach (var orderLine in model.OrderLines)
            {
                var newQuantity = orderLine.Quantity;

                if (model.RemoveOrderlineId == orderLine.OrderLineId)
                {
                    newQuantity = 0;
                }

                TransactionLibrary.UpdateLineItem(orderLine.OrderLineId, newQuantity);
            }

            TransactionLibrary.ExecuteBasketPipeline();

            var shop   = model.Content.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias.Equals("home"));
            var basket = shop.DescendantsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias.Equals("basket"));

            return(Redirect(basket.Url));
        }
        public ActionResult Index(AddressDetailsViewModel addressDetails)
        {
            if (addressDetails.IsShippingAddressDifferent)
            {
                EditBillingInformation(addressDetails.BillingAddress);
                EditShippingInformation(addressDetails.ShippingAddress);
            }

            else
            {
                EditBillingInformation(addressDetails.BillingAddress);
                EditShippingInformation(addressDetails.BillingAddress);
            }

            TransactionLibrary.ExecuteBasketPipeline();

            var parent   = PublishedRequest.PublishedContent.AncestorOrSelf("basket");
            var shipping = parent.Children(x => x.Name == "Shipping").FirstOrDefault();

            return(Redirect(shipping.Url));
        }
Exemple #18
0
        public ActionResult Index(AddressDetailsViewModel addressDetails)
        {
            if (addressDetails.IsShippingAddressDifferent)
            {
                EditBillingInformation(addressDetails.BillingAddress);
                EditShippingInformation(addressDetails.ShippingAddress);
            }

            else
            {
                EditBillingInformation(addressDetails.BillingAddress);
                EditShippingInformation(addressDetails.BillingAddress);
            }

            TransactionLibrary.ExecuteBasketPipeline();

            var root     = UmbracoContext.PublishedContentRequest.PublishedContent.AncestorsOrSelf("home").FirstOrDefault();
            var shipping = root.Descendants("shipping").FirstOrDefault();

            return(Redirect(shipping.Url));
        }
Exemple #19
0
        protected void SaveAndGoToShippingBtn_OnClick(object sender, EventArgs e)
        {
            TransactionLibrary.EditBillingInformation(
                BillingAddressFirstName.Text,
                BillingAddressLastName.Text,
                BillingAddressEmailAddress.Text,
                BillingAddressPhoneNumber.Text,
                BillingAddressMobilePhoneNumber.Text,
                BillingAddressCompanyName.Text,
                BillingAddressLine1.Text,
                BillingAddressLine2.Text,
                BillingAddressPostalCode.Text,
                BillingAddressCity.Text,
                string.Empty,
                BillingAddressAttention.Text,
                Int32.Parse(BillingAddressCountryDropDown.SelectedValue));

            TransactionLibrary.EditShippingInformation(
                ShippingAddressFirstName.Text,
                ShippingAddressLastName.Text,
                ShippingAddressEmailAddress.Text,
                ShippingAddressPhoneNumber.Text,
                ShippingAddressMobilePhoneNumber.Text,
                ShippingAddressCompanyName.Text,
                ShippingAddressLine1.Text,
                ShippingAddressLine2.Text,
                ShippingAddressPostalCode.Text,
                ShippingAddressCity.Text,
                string.Empty,
                ShippingAddressAttention.Text,
                Int32.Parse(ShippingAddressCountryDropDown.SelectedValue));

            TransactionLibrary.ExecuteBasketPipeline();

            Response.Redirect("/basket/shipment");
        }
        public ActionResult Index(AddressDetailsViewModel addressDetails)
        {
            TransactionLibrary.EditBillingInformation(
                addressDetails.BillingAddress.FirstName,
                addressDetails.BillingAddress.LastName,
                addressDetails.BillingAddress.EmailAddress,
                addressDetails.BillingAddress.PhoneNumber,
                addressDetails.BillingAddress.MobilePhoneNumber,
                addressDetails.BillingAddress.CompanyName,
                addressDetails.BillingAddress.Line1,
                addressDetails.BillingAddress.Line2,
                addressDetails.BillingAddress.PostalCode,
                addressDetails.BillingAddress.City,
                addressDetails.BillingAddress.State,
                addressDetails.BillingAddress.Attention,
                addressDetails.BillingAddress.CountryId);

            TransactionLibrary.EditShippingInformation(
                addressDetails.ShippingAddress.FirstName,
                addressDetails.ShippingAddress.LastName,
                addressDetails.ShippingAddress.EmailAddress,
                addressDetails.ShippingAddress.PhoneNumber,
                addressDetails.ShippingAddress.MobilePhoneNumber,
                addressDetails.ShippingAddress.CompanyName,
                addressDetails.ShippingAddress.Line1,
                addressDetails.ShippingAddress.Line2,
                addressDetails.ShippingAddress.PostalCode,
                addressDetails.ShippingAddress.City,
                addressDetails.ShippingAddress.State,
                addressDetails.ShippingAddress.Attention,
                addressDetails.ShippingAddress.CountryId);

            TransactionLibrary.ExecuteBasketPipeline();

            return(Redirect("/shipping"));
        }
 public ActionResult Index(PaymentViewModel payment)
 {
     TransactionLibrary.CreatePayment(payment.SelectedPaymentMethodId, requestPayment: false);
     TransactionLibrary.ExecuteBasketPipeline();
     return(Redirect("/store/preview"));
 }
 public ActionResult Index(String voucher)
 {
     MarketingLibrary.AddVoucher(voucher);
     TransactionLibrary.ExecuteBasketPipeline();
     return(Redirect(this.CurrentPage.Url));
 }