public void SetPaymentInfo(ElectronicPaymentManifest pm) { switch (pm.OrderPaymentMethod) { case OrderPaymentMethod.CreditCard: rbNewCard.Checked = true; CreditCard cc = pm as CreditCard; if (cc == null) { throw new ApplicationException("Payment method is credit card, but no card provided"); } tbCardNumber.Text = cc.CardNumber; tbCCV.Text = cc.CCVCode; tbNameOnCard.Text = cc.NameOnCard; myExpiration.Date = cc.CardExpirationDate; cbSaveCreditCard.Checked = cc.SavePaymentMethod; break; case OrderPaymentMethod.ElectronicCheck: rbNewChecking.Checked = true; ElectronicCheck ec = pm as ElectronicCheck; if (ec == null) { throw new ApplicationException("Payment method is electronic check, but no check provided"); } tbBankAccountNumber.Text = tbBankAccountNumberConfirm.Text = ec.BankAccountNumber; tbRoutingNumber.Text = ec.RoutingNumber; cbSaveCheckingAccount.Checked = ec.SavePaymentMethod; break; case OrderPaymentMethod.PayrollDeduction: rbPayrollDeduction.Checked = true; break; case OrderPaymentMethod.PurchaseOrder: rbBillMeLater.Checked = true; NonElectronicPayment nep = pm as NonElectronicPayment; if (nep == null) { throw new ApplicationException("Non electronic payment packet expected."); } tbReferenceNumber.Text = nep.ReferenceNumber; break; case OrderPaymentMethod.SavedPaymentMethod: SavedPaymentInfo spi = pm as SavedPaymentInfo; if (spi == null) { throw new ApplicationException("Payment method is saved info, but no info provided"); } currentSavedPaymentMethodID = spi.SavedPaymentMethodID; break; } }
public ElectronicPaymentManifest GetPaymentInfo() { var method = GetSelectedPaymentMethod(); if (method == null) { return(null); } switch (method.Value) { case OrderPaymentMethod.CreditCard: CreditCard cc = new CreditCard(); cc.CardNumber = tbCardNumber.Text; cc.CCVCode = tbCCV.Text; cc.NameOnCard = tbNameOnCard.Text; if (myExpiration.Date.HasValue) { cc.CardExpirationDate = myExpiration.Date.Value; } cc.SavePaymentMethod = cbSaveCreditCard.Checked; cc.BillingAddress = GetBillingAddress(); return(cc); case OrderPaymentMethod.ElectronicCheck: ElectronicCheck ec = new ElectronicCheck(); ec.BankAccountNumber = tbBankAccountNumber.Text; ec.RoutingNumber = tbRoutingNumber.Text; ec.SavePaymentMethod = cbSaveCheckingAccount.Checked; return(ec); case OrderPaymentMethod.SavedPaymentMethod: SavedPaymentInfo spi = new SavedPaymentInfo(); spi.SavedPaymentMethodID = getSavedPaymentID(); if (spi.SavedPaymentMethodID != null) { using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) spi.SavedPaymentMethodName = api.GetName(spi.SavedPaymentMethodID).ResultValue; } return(spi); default: NonElectronicPayment np = new NonElectronicPayment(); np._OrderPaymentMethod = method.Value; return(np); } }
/// <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); } }