Example #1
0
    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();
    }
Example #2
0
    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);
    }