Пример #1
0
        private void LoadOrder()
        {
            if (Request.Params["id"] != null)
            {
                Order o = MTApp.OrderServices.Orders.FindForCurrentStore(Request.Params["id"]);
                if (o == null)
                {
                    FlashFailure("Order could not be found. Please contact store for assistance.");
                    return;
                }

                if (o.CustomProperties.Where(y => (y.DeveloperId == "bvsoftware") &&
                                             (y.Key == "allowpasswordreset") &&
                                             (y.Value == "1")
                                             ).Count() > 0)
                {
                    ViewBag.AllowPasswordReset = true;
                    ViewBag.Email           = o.UserEmail;
                    ViewBag.OrderBvin       = o.bvin;
                    ViewBag.SubmitButtonUrl = MTApp.ThemeManager().ButtonUrl("Submit", Request.IsSecureConnection);
                }
                else
                {
                    ViewBag.AllowPasswordReset = false;
                }


                ViewBag.Order          = o;
                ViewBag.AcumaticaOrder = null;

                OrderPaymentSummary paySummary = MTApp.OrderServices.PaymentSummary(o);
                ViewBag.OrderPaymentSummary = paySummary;

                // File Downloads
                List <ProductFile> fileDownloads = new List <ProductFile>();
                if ((o.PaymentStatus == OrderPaymentStatus.Paid) && (o.StatusCode != OrderStatusCode.OnHold))
                {
                    foreach (LineItem item in o.Items)
                    {
                        if (item.ProductId != string.Empty)
                        {
                            List <ProductFile> productFiles = MTApp.CatalogServices.ProductFiles.FindByProductId(item.ProductId);
                            foreach (ProductFile file in productFiles)
                            {
                                fileDownloads.Add(file);
                            }
                        }
                    }
                }
                ViewBag.FileDownloads          = fileDownloads;
                ViewBag.FileDownloadsButtonUrl = MTApp.ThemeManager().ButtonUrl("download", Request.IsSecureConnection);

                RenderAnalytics(o);
            }
            else
            {
                FlashFailure("Order Number missing. Please contact an administrator.");
                return;
            }
        }
        private void PrepBVOrder(string bvin)
        {
            Order o = MTApp.OrderServices.Orders.FindForCurrentStore(bvin);

            ViewBag.Order          = o;
            ViewBag.AcumaticaOrder = null;

            OrderPaymentSummary paySummary = MTApp.OrderServices.PaymentSummary(o);

            ViewBag.OrderPaymentSummary = paySummary;

            // File Downloads
            List <ProductFile> fileDownloads = new List <ProductFile>();

            if ((o.PaymentStatus == OrderPaymentStatus.Paid) && (o.StatusCode != OrderStatusCode.OnHold))
            {
                foreach (LineItem item in o.Items)
                {
                    if (item.ProductId != string.Empty)
                    {
                        List <ProductFile> productFiles = MTApp.CatalogServices.ProductFiles.FindByProductId(item.ProductId);
                        foreach (ProductFile file in productFiles)
                        {
                            fileDownloads.Add(file);
                        }
                    }
                }
            }
            ViewBag.FileDownloads          = fileDownloads;
            ViewBag.FileDownloadsButtonUrl = MTApp.ThemeManager().ButtonUrl("download", Request.IsSecureConnection);
        }
Пример #3
0
        public void Rebind()
        {
            if (CurrentOrder != null)
            {
                currentOrderTransactions = HccApp.OrderServices.Transactions.FindForOrder(CurrentOrder.bvin);
                paySummary        = HccApp.OrderServices.PaymentSummary(CurrentOrder);
                isPaymentRefunded = CheckOrderHasRefunded();
            }

            divUpdateQuantities.Visible = EditMode & AllowUpdateQuantities;

            lblSubTotal.Text            = CurrentOrder.TotalOrderBeforeDiscounts.ToString("C");
            btnUpdateQuantities.Visible = CurrentOrder.Items.Any();

            gvItems.Visible         = !CurrentOrder.IsRecurring;
            gvSubscriptions.Visible = CurrentOrder.IsRecurring;

            if (!CurrentOrder.IsRecurring)
            {
                gvItems.DataSource = CurrentOrder.Items;
                gvItems.DataBind();
            }
            else
            {
                gvSubscriptions.DataSource = CurrentOrder.Items;
                gvSubscriptions.DataBind();
            }
        }
Пример #4
0
        private void PopulateFromOrder(Order o)
        {
            // Header
            this.OrderNumberField.Text = o.OrderNumber;
            this.TimeOfOrderField.Text = TimeZoneInfo.ConvertTimeFromUtc(o.TimeOfOrderUtc, MTApp.CurrentStore.Settings.TimeZone).ToString();

            // Billing
            this.BillingAddressEditor.LoadFromAddress(o.BillingAddress);

            //Email
            this.UserPicker1.UserName = o.UserEmail;

            // Shipping (hide if the same as billing address)
            this.ShippingAddressEditor.LoadFromAddress(o.ShippingAddress);


            // Payment
            OrderPaymentSummary paySummary = MTApp.OrderServices.PaymentSummary(o);

            this.lblPaymentSummary.Text      = paySummary.PaymentsSummary;
            this.PaymentAuthorizedField.Text = string.Format("{0:C}", paySummary.AmountAuthorized);
            this.PaymentChargedField.Text    = string.Format("{0:C}", paySummary.AmountCharged);
            this.PaymentDueField.Text        = string.Format("{0:C}", paySummary.AmountDue);
            this.PaymentRefundedField.Text   = string.Format("{0:C}", paySummary.AmountRefunded);

            //Items
            this.ItemsGridView.DataSource = o.Items;
            this.ItemsGridView.DataBind();

            // Instructions
            this.pnlInstructions.Visible = true;
            this.InstructionsField.Text  = o.Instructions.Replace("\r\n", "<br />").Replace("\r", "<br />").Replace("\n", "<br />");

            // Totals
            this.litTotals.Text = o.TotalsAsTable();

            if (o.TotalShippingBeforeDiscountsOverride >= 0)
            {
                this.ShippingOverride.Text = o.TotalShippingBeforeDiscountsOverride.ToString("C");
            }
            else
            {
                this.ShippingOverride.Text = string.Empty;
            }
            // Coupons
            this.lstCoupons.DataSource = o.Coupons;
            this.lstCoupons.DataBind();

            LoadShippingMethods(o);
        }
Пример #5
0
        private void PopulateFromOrder(Order o)
        {
            // Header
            this.OrderNumberField.Text = o.OrderNumber;

            // Payment
            OrderPaymentSummary paySummary = MTApp.OrderServices.PaymentSummary(o);

            //Me.lblPaymentSummary.Text = paySummary.PaymentsSummary
            this.PaymentAuthorizedField.Text = string.Format("{0:C}", paySummary.AmountAuthorized);
            this.PaymentChargedField.Text    = string.Format("{0:C}", paySummary.AmountCharged);
            this.PaymentDueField.Text        = string.Format("{0:C}", paySummary.AmountDue);
            this.PaymentRefundedField.Text   = string.Format("{0:C}", paySummary.AmountRefunded);
        }
Пример #6
0
        public OrderPaymentSummary PlaceOrder(OrderDto orderDto, Guid customerId)
        {
            var customerOrders = customerOrdersRepository.GetByCustomerId(customerId);

            if (customerOrders == null)
            {
                return(OrderPaymentSummary.NoCustoemrFound);
            }

            customerOrders.PlaceOrder(orderFactory.CreateOrder(orderDto), pointsCalculator, discountCalculator);

            customerOrdersRepository.Save(customerOrders);
            unitOfWork.Commit();

            return(OrderPaymentSummary.FromCustomerOrders(customerOrders));
        }
Пример #7
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            PayManager = new OrderPaymentManager(CurrentOrder, HccApp);
            if (CurrentOrder != null)
            {
                currentOrderTransactions = HccApp.OrderServices.Transactions.FindForOrder(CurrentOrder.bvin);
                paySummary = HccApp.OrderServices.PaymentSummary(CurrentOrder);
            }

            if (!Page.IsPostBack)
            {
                mvPayments.SetActiveView(viewCreditCards);
                LoadCreditCardLists();
            }
        }
Пример #8
0
        private void PopulateFromOrder(Order o)
        {
            // Header
            this.OrderNumberField.Text = o.OrderNumber;
            this.TimeOfOrderField.Text = TimeZoneInfo.ConvertTimeFromUtc(o.TimeOfOrderUtc, MTApp.CurrentStore.Settings.TimeZone).ToString();

            // Fraud Score Display
            if (o.FraudScore < 0)
            {
                this.lblFraudScore.Text = "No Fraud Score Data";
            }
            if (o.FraudScore >= 0 && o.FraudScore < 3)
            {
                this.lblFraudScore.Text = o.FraudScore.ToString() + "<span class=\"fraud-low\"><b>low risk</b></span>";
            }
            if (o.FraudScore >= 3 && o.FraudScore <= 5)
            {
                this.lblFraudScore.Text = "<span class=\"fraud-medium\"><b>medium risk</b></span>";
            }
            if (o.FraudScore > 5)
            {
                this.lblFraudScore.Text = "<span class=\"fraud-high\"><b>high risk</b></span>";
            }

            // Billing
            this.BillingAddressField.Text = o.BillingAddress.ToHtmlString();

            //Email
            this.EmailAddressField.Text = MerchantTribe.Commerce.Utilities.MailServices.MailToLink(o.UserEmail, "Order " + o.OrderNumber, o.BillingAddress.FirstName + ",");

            // Shipping (hide if the same as billing address)
            this.pnlShipTo.Visible         = true;
            this.ShippingAddressField.Text = o.ShippingAddress.ToHtmlString();


            // Payment
            OrderPaymentSummary paySummary = MTApp.OrderServices.PaymentSummary(o);

            this.lblPaymentSummary.Text      = paySummary.PaymentsSummary;
            this.PaymentAuthorizedField.Text = string.Format("{0:C}", paySummary.AmountAuthorized);
            this.PaymentChargedField.Text    = string.Format("{0:C}", paySummary.AmountCharged);
            this.PaymentDueField.Text        = string.Format("{0:C}", paySummary.AmountDue);
            this.PaymentRefundedField.Text   = string.Format("{0:C}", paySummary.AmountRefunded);

            //Items
            this.ItemsGridView.DataSource = o.Items;
            this.ItemsGridView.DataBind();

            // Instructions
            if (o.Instructions.Trim().Length > 0)
            {
                this.pnlInstructions.Visible = true;
                this.InstructionsField.Text  = o.Instructions.Replace("\r\n", "<br />").Replace("\r", "<br />").Replace("\n", "<br />");
            }

            // Totals
            this.litTotals.Text = o.TotalsAsTable();

            // Coupons
            this.CouponField.Text = string.Empty;
            for (int i = 0; i <= o.Coupons.Count - 1; i++)
            {
                this.CouponField.Text += o.Coupons[i].CouponCode.Trim().ToUpper() + "<br />";
            }

            // Notes
            Collection <OrderNote> publicNotes  = new Collection <OrderNote>();
            Collection <OrderNote> privateNotes = new Collection <OrderNote>();

            for (int i = 0; i <= o.Notes.Count - 1; i++)
            {
                if (o.Notes[i].IsPublic)
                {
                    publicNotes.Add(o.Notes[i]);
                }
                else
                {
                    privateNotes.Add(o.Notes[i]);
                }
            }
            this.PublicNotesField.DataSource = publicNotes;
            this.PublicNotesField.DataBind();
            this.PrivateNotesField.DataSource = privateNotes;
            this.PrivateNotesField.DataBind();
        }