/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { base.InitializeTargetObject(); targetPayment = MultiStepWizards.MakePayment.Payment; hfOrderBillToId.Value = ConciergeAPI.CurrentEntity.ID; dvPriorityData.InnerHtml = GetPriorityPaymentsConfig(hfOrderBillToId.Value); if (!IsPostBack) { using (var api = GetServiceAPIProxy()) BillingInfoWidget.AllowableMethods = api.DetermineAllowableInvoicePaymentMethods(targetPayment).ResultValue; BillingInfoWidget.SetBillingAddress(new Address()); } }
/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { hfOrderBillToId.Value = ConciergeAPI.CurrentEntity.ID; dvPriorityData.InnerHtml = GetPriorityPaymentsConfig(hfOrderBillToId.Value); base.InitializeTargetObject(); if (IsTransient) { targetOrder = MultiStepWizards.PlaceAnOrder.TransientShoppingCart; } else { targetOrder = MultiStepWizards.PlaceAnOrder.ShoppingCart; } if (targetOrder == null) { QueueBannerError("Unable to checkout without an active shopping cart."); GoHome(); return; } //MS-2823 if (targetOrder.BillTo == null) { targetOrder.BillTo = hfOrderBillToId.Value; } if (targetOrder.ShipTo == null) { targetOrder.ShipTo = targetOrder.BillTo; } if (!IsPostBack) { // let's preprocess and figure out whether we need shipping information var completeOrder = targetOrder.Clone().ConvertTo <msOrder>(); var csi = MultiStepWizards.PlaceAnOrder.CrossSellItems; if (csi != null && csi.Count > 0) { completeOrder.LineItems.AddRange(csi.FindAll(x => x.Quantity != 0)); // add any cross sell items } if (completeOrder.Date == DateTime.MinValue) { completeOrder.Date = DateTime.Now; } using (var api = GetConciegeAPIProxy()) { preProcessedOrderPacket = api.PreProcessOrder(completeOrder).ResultValue; } // no billing, but we want to test Total, and not AmountDueNow // because even if nothing is due now we need to capture credit card info if (preProcessedOrderPacket.Total == 0) { GoTo("ConfirmOrder.aspx?useTransient=" + IsTransient); } lblAmountDue.Text = preProcessedOrderPacket.AmountDueNow.ToString("C"); using (var api = GetServiceAPIProxy()) BillingInfoWidget.AllowableMethods = api.DetermineAllowableOrderPaymentMethods(preProcessedOrderPacket.FinalizedOrder.ConvertTo <msOrder>()).ResultValue; // let's set default payment info switch (targetOrder.PaymentMethod) { case OrderPaymentMethod.None: break; // do nothing case OrderPaymentMethod.CreditCard: var cc = new CreditCard(); // Do NOT keep the credit card information on the page unpon refreshes cc.SavePaymentMethod = targetOrder.SavePaymentMethod; cc.NameOnCard = targetOrder.SafeGetValue <string>("NameOnCreditCard"); BillingInfoWidget.SetPaymentInfo(cc); break; case OrderPaymentMethod.ElectronicCheck: var ec = new ElectronicCheck(); ec.BankAccountNumber = targetOrder.ACHAccountNumber; ec.RoutingNumber = targetOrder.ACHRoutingNumber; ec.SavePaymentMethod = targetOrder.SavePaymentMethod; BillingInfoWidget.SetPaymentInfo(ec); break; case OrderPaymentMethod.SavedPaymentMethod: var spi = new SavedPaymentInfo(); spi.SavedPaymentMethodID = targetOrder.SavedPaymentMethod; BillingInfoWidget.SetPaymentInfo(spi); break; default: var nep = new NonElectronicPayment(); nep._OrderPaymentMethod = targetOrder.PaymentMethod; nep.ReferenceNumber = targetOrder.PaymentReferenceNumber; BillingInfoWidget.SetPaymentInfo(nep); break; } BillingInfoWidget.SetBillingAddress(targetOrder.BillingAddress); } }