protected void btnContinue_Click(object sender, EventArgs e) { if (!IsValid) { var tbCardNumber = BillingInfoWidget.FindControl("tbCardNumber") as TextBox; if (tbCardNumber != null) { tbCardNumber.Text = string.Empty; } return; } var payment = BillingInfoWidget.GetPaymentInfo(); targetPayment.PaymentMethod = payment.PaymentMethod; // MSIV-330 targetPayment.Total = targetPayment.LineItems.Sum(x => x.Total); processPayment(payment); MultiStepWizards.MakePayment.Clear(); // Clear any cached Membership checks since a payment could trigger a Membership Update. MembershipLogic.ClearMemberCaches(); QueueBannerMessage(string.Format("Your payment for {0:C} has been processed.", targetPayment.Total)); GoHome(); }
protected void btnUpdatePaymentInfo_Click(object sender, EventArgs e) { if (!IsValid) { return; } string orderID = Convert.ToString(targetSchedule["Order"]); string orderLocalID = GetSearchResult(targetSchedule, "Order.LocalID", null); var paymentManifest = BillingInfoWidget.GetPaymentInfo(); using (var api = GetServiceAPIProxy()) { api.UpdateBillingInfo(orderID, paymentManifest); QueueBannerMessage(string.Format("Order #{0} updated successfully.", orderLocalID)); } Response.Redirect("/financial/ViewInstallmentPlan.aspx?contextID=" + ContextID); }
protected void btnContinue_Click(object sender, EventArgs e) { if (!IsValid) { return; } var ePayment = BillingInfoWidget.GetPaymentInfo(); if (ePayment == null) { throw new ApplicationException("No payment type selected."); // this should be caught during validation } msSavedPaymentMethod spi; switch (ePayment.OrderPaymentMethod) { case OrderPaymentMethod.CreditCard: spi = CreateNewObject <msSavedCreditCard>(); ((msSavedCreditCard)spi).Card = (CreditCard)ePayment; break; case OrderPaymentMethod.ElectronicCheck: spi = CreateNewObject <msSavedElectronicCheck>(); ((msSavedElectronicCheck)spi).Check = (ElectronicCheck)ePayment; break; case OrderPaymentMethod.SavedPaymentMethod: string savedPaymentMethodID = ((SavedPaymentInfo)ePayment).SavedPaymentMethodID; msSavedPaymentMethod existingMethod = LoadObjectFromAPI <msSavedPaymentMethod>(savedPaymentMethodID); spi = existingMethod.Clone().ConvertTo <msSavedPaymentMethod>(); spi.ID = spi.SystemTimestamp = null; break; default: throw new NotSupportedException("Unable to deal with order payment method " + ePayment.OrderPaymentMethod); } bool shouldSaveTargetObject = false; switch (targetObject.ClassType) { case msGift.CLASS_NAME: spi.Type = SavedPaymentMethodType.Gift; targetObject[msGift.FIELDS.DateOfInstallmentSuspension] = null; // clear the suspension shouldSaveTargetObject = true; break; default: throw new NotSupportedException("Unable to update a record of type " + targetObject.ClassType); } spi.Owner = null; // always to this, so it's not linked to the entity using (var api = GetServiceAPIProxy()) { string id = api.Save(spi).ResultValue.SafeGetValue <string>("ID"); targetObject["SavedPaymentMethod"] = id; if (shouldSaveTargetObject) { api.Save(targetObject); } } QueueBannerMessage("Payment information has been updated successfully."); goBackToReturnUrl(); }
protected void btnContinue_Click(object sender, EventArgs e) { if (!IsValid) { var tbCardNumber = BillingInfoWidget.FindControl("tbCardNumber") as TextBox; if (tbCardNumber != null) { tbCardNumber.Text = string.Empty; } return; } var ePayment = BillingInfoWidget.GetPaymentInfo(); if (ePayment == null) { cvCustom.IsValid = false; cvCustom.ErrorMessage = "You have not selected a payment method."; return; } targetOrder.PaymentMethod = ePayment.OrderPaymentMethod; switch (targetOrder.PaymentMethod) { case OrderPaymentMethod.CreditCard: var cc = ePayment as CreditCard; if (cc == null) { throw new ApplicationException( "Payment is of type credit card, but no credit card manifest provided"); } targetOrder.CreditCardNumber = cc.CardNumber; targetOrder.CreditCardExpirationDate = cc.CardExpirationDate; targetOrder.CCVCode = cc.CCVCode; targetOrder["NameOnCreditCard"] = cc.NameOnCard; break; case OrderPaymentMethod.ElectronicCheck: var ec = ePayment as ElectronicCheck; if (ec == null) { throw new ApplicationException( "Payment is of type electronic check, but no check manifest provided"); } targetOrder.ACHAccountNumber = ec.BankAccountNumber; targetOrder.ACHRoutingNumber = ec.RoutingNumber; break; case OrderPaymentMethod.SavedPaymentMethod: var spi = ePayment as SavedPaymentInfo; if (spi == null) { throw new ApplicationException( "Payment is of type saved method, but not method manifest provided"); } targetOrder.SavedPaymentMethod = spi.SavedPaymentMethodID; break; } targetOrder["BillingMethodFriendlyName"] = ePayment.ToString(); targetOrder.SavePaymentMethod = ePayment.SavePaymentMethod; targetOrder.BillingAddress = BillingInfoWidget.GetBillingAddress(); targetOrder.PurchaseOrderNumber = BillingInfoWidget.GetReferenceNumber(); GoTo("ConfirmOrder.aspx?useTransient=" + IsTransient); }