Exemplo n.º 1
0
    public void Enable()
    {
        RadioCreditCard.Enabled                = true;
        RadioCheckByMail.Enabled               = true;
        RadioPayPal.Enabled                    = true;
        RadioPayPalExpress.Enabled             = true;
        RadioPurchaseOrder.Enabled             = true;
        RadioRequestQuote.Enabled              = true;
        RadioMicroPay.Enabled                  = true;
        RadioCod.Enabled                       = true;
        RadioCheckoutByAmazon.Enabled          = true;
        RadioPayPalEmbeddedCheckout.Enabled    = true;
        RadioMoneybookersQuickCheckout.Enabled = true;

        CreditCardPaymentViewForm.Enable();
        SecureNetPaymentView.Enable();
        CheckPaymentView.Enable();
        RequestQuoteView.Enable();
        PurchaseOrderPaymentView.Enable();
        PayPalPaymentView.Enable();
        PayPalExpressView.Enable();
        MicroPayPaymentView.Enable();
        CodPaymentView.Enable();
        CheckOutByAmazonPaymentView.Enable();
        MoneybookersQuickCheckoutPaymentView.Enable();

        if (this.PaymentModel.ActivePaymentMethod != null && this.PaymentModel.ActivePaymentMethod.PaymentType == PaymentType.PayPalEmbeddedCheckout)
        {
            PayPalEmbeddedCheckoutPaymentView.Enable();
        }
    }
Exemplo n.º 2
0
    public void Disable()
    {
        RadioCreditCard.Enabled                = false;
        RadioCheckByMail.Enabled               = false;
        RadioPayPal.Enabled                    = false;
        RadioPayPalExpress.Enabled             = false;
        RadioPurchaseOrder.Enabled             = false;
        RadioRequestQuote.Enabled              = false;
        RadioMicroPay.Enabled                  = false;
        RadioCod.Enabled                       = false;
        RadioCheckoutByAmazon.Enabled          = false;
        RadioPayPalEmbeddedCheckout.Enabled    = false;
        RadioMoneybookersQuickCheckout.Enabled = false;

        CreditCardPaymentViewForm.Disable();
        SecureNetPaymentView.Disable();
        CheckPaymentView.Disable();
        RequestQuoteView.Disable();
        PurchaseOrderPaymentView.Disable();
        PayPalPaymentView.Disable();
        PayPalExpressView.Disable();
        MicroPayPaymentView.Disable();
        CodPaymentView.Disable();
        CheckOutByAmazonPaymentView.Disable();
        PayPalEmbeddedCheckoutPaymentView.Disable();
        MoneybookersQuickCheckoutPaymentView.Disable();
    }
 public override void Enable()
 {
     this.BillingAddressChoice.Enable();
     if (this.PaymentMethodView != null)
     {
         CreditCardPaymentForm.Enable();
         SecureNetPaymentView.Enable();
         TwoCheckoutPaymentView.Enable();
         CheckPaymentView.Enable();
         RequestQuoteView.Enable();
         PayPalPaymentView.Enable();
         PurchaseOrderPaymentView.Enable();
         PayPalExpressView.Enable();
         MicroPayPaymentView.Enable();
         CheckOutByAmazonPaymentView.Enable();
         PayPalEmbeddedCheckoutPaymentView.Enable();
         MoneybookersQuickCheckoutPaymentView.Enable();
         ECheckPaymentView.Enable();
         WorldPayPaymentView.Enable();
         if (IsFirstPay)
         {
             this.FirstPayPaymentForm.Enable();
         }
     }
 }
    public override void SetModel(IPaymentModel model, IStringResourceProvider stringResourceProvider)
    {
        base.SetModel(model, stringResourceProvider);

        this.BillingAddressChoice.SetModel(model.AccountModel, this.StringResourceProvider);

        CodPaymentView.SetModel(null, this.StringResourceProvider);
        CreditCardPaymentForm.SetModel(null, this.StringResourceProvider);
        SecureNetPaymentView.SetModel(null, this.StringResourceProvider);
        TwoCheckoutPaymentView.SetModel(null, this.StringResourceProvider);
        CheckPaymentView.SetModel(null, this.StringResourceProvider);
        RequestQuoteView.SetModel(null, this.StringResourceProvider);
        PayPalPaymentView.SetModel(null, this.StringResourceProvider);
        PurchaseOrderPaymentView.SetModel(null, this.StringResourceProvider);
        PayPalExpressView.SetModel(null, this.StringResourceProvider);
        MicroPayPaymentView.SetModel(null, this.StringResourceProvider);
        CheckOutByAmazonPaymentView.SetModel(null, this.StringResourceProvider);
        PayPalEmbeddedCheckoutPaymentView.SetModel(null, this.StringResourceProvider);
        MoneybookersQuickCheckoutPaymentView.SetModel(null, this.StringResourceProvider);
        ECheckPaymentView.SetModel(null, this.StringResourceProvider);
        WorldPayPaymentView.SetModel(null, this.StringResourceProvider);

        foreach (var paymentModel in this.Model.PaymentMethods)
        {
            var paymentView = FindPaymentMethodView(paymentModel.Key);
            if (paymentView != null)
            {
                paymentView.SetModel(paymentModel.Value, this.StringResourceProvider);
                ((IPaymentMethodView)paymentView).PaymentFormSubmitted += OPCControls_PaymentFormAndBillingAddress_PaymentFormSubmitted;
            }

            if (paymentModel.Value.PaymentType == PaymentType.SecureNet)
            {
                SecureNetPaymentView.ExistingCreditCardSelected += (o, e) => CreditCardPaymentForm.Hide();
                SecureNetPaymentView.NewCreditCardSelected      += (o, e) =>
                {
                    CreditCardPaymentForm.Initialize();
                    CreditCardPaymentForm.Show();
                    CreditCardPaymentForm.BindView();
                };

                Model.ProcessingPayment += (o, e) =>
                {
                    if (!(e.PaymentMethod is CreditCardPaymentModel) && !(e.PaymentMethod is SecureNetPaymentModel))
                    {
                        return;
                    }

                    ((SecureNetPaymentModel)paymentModel.Value).SwitchPaymentMethod();
                };
            }
        }

        this.ActivatePaymentView();
    }
Exemplo n.º 5
0
    public void SaveViewToModel()
    {
        switch (this.PaymentModel.ActivePaymentMethod.PaymentType)
        {
        case PaymentType.CreditCard:
        {
            SecureNetPaymentView.SaveViewToModel();
            this.CreditCardPaymentViewForm.SaveViewToModel();
        }; break;

        case PaymentType.PayPal:
        {
            this.PayPalPaymentView.SaveViewToModel();
        }; break;

        case PaymentType.CheckByMail:
        {
            this.CheckPaymentView.SaveViewToModel();
        }; break;

        case PaymentType.RequestAQuote:
        {
            this.RequestQuoteView.SaveViewToModel();
        }; break;

        case PaymentType.PurchaseOrder:
        {
            this.PurchaseOrderPaymentView.SaveViewToModel();
        } break;

        case PaymentType.PayPalExpress:
        {
            this.PayPalExpressView.SaveViewToModel();
        } break;

        case PaymentType.MicroPay:
        {
            this.MicroPayPaymentView.SaveViewToModel();
        } break;

        case PaymentType.COD:
        {
            this.CodPaymentView.SaveViewToModel();
        } break;

        case PaymentType.CheckoutByAmazon:
        {
            this.CheckOutByAmazonPaymentView.SaveViewToModel();
        } break;

        case PaymentType.PayPalEmbeddedCheckout:
        {
            this.PayPalEmbeddedCheckoutPaymentView.SaveViewToModel();
        } break;

        case PaymentType.MoneybookersQuickCheckout:
        {
            MoneybookersQuickCheckoutPaymentView.SaveViewToModel();
        } break;
        }
    }
Exemplo n.º 6
0
    public void BindView()
    {
        bool hasPayPal = false;
        List <PaymentMethodBaseModel> payPalOptions = new List <PaymentMethodBaseModel>();

        PanelError.Visible = false;
        CreditCardPaymentViewForm.StringResourceProvider            = this.StringResourceProvider;
        SecureNetPaymentView.StringResourceProvider                 = this.StringResourceProvider;
        CheckPaymentView.StringResourceProvider                     = this.StringResourceProvider;
        RequestQuoteView.StringResourceProvider                     = this.StringResourceProvider;
        PayPalPaymentView.StringResourceProvider                    = this.StringResourceProvider;
        PurchaseOrderPaymentView.StringResourceProvider             = this.StringResourceProvider;
        PayPalExpressView.StringResourceProvider                    = this.StringResourceProvider;
        MicroPayPaymentView.StringResourceProvider                  = this.StringResourceProvider;
        CodPaymentView.StringResourceProvider                       = this.StringResourceProvider;
        CheckOutByAmazonPaymentView.StringResourceProvider          = this.StringResourceProvider;
        PayPalEmbeddedCheckoutPaymentView.StringResourceProvider    = this.StringResourceProvider;
        MoneybookersQuickCheckoutPaymentView.StringResourceProvider = this.StringResourceProvider;

        if (PaymentModel != null)
        {
            foreach (var kvp in this.PaymentModel.PaymentMethods)
            {
                PaymentMethodBaseModel method = kvp.Value;
                switch (method.PaymentType)
                {
                case PaymentType.CreditCard:
                {
                    PanelCreditCardMethod.Visible = true;
                    CreditCardPaymentViewForm.SetModel(method);
                    CreditCardPaymentViewForm.Initialize();
                    CreditCardPaymentViewForm.Hide();

                    IEnumerable <CreditCardType> cardTypes = ((CreditCardPaymentModel)method).AllowedCardTypes;

                    ImageCardTypeVisa.Visible       = cardTypes.Contains(CreditCardType.Visa);
                    ImageCardTypeMastercard.Visible = cardTypes.Contains(CreditCardType.MasterCard);
                    ImageCardTypeAmex.Visible       = cardTypes.Contains(CreditCardType.AmericanExpress);
                    ImageCardTypeDiscover.Visible   = cardTypes.Contains(CreditCardType.Discover);
                    ImageCardTypeSolo.Visible       = cardTypes.Contains(CreditCardType.Solo);
                    ImageCardTypeMaestro.Visible    = cardTypes.Contains(CreditCardType.Maestro);

                    RadioCreditCard.Visible = true;
                    RadioCreditCard.Enabled = true;
                    RadioCreditCard.Checked = false;
                }; break;

                case PaymentType.SecureNet:
                {
                    SecureNetPaymentView.SetModel(method);
                    SecureNetPaymentView.Initialize();
                    SecureNetPaymentView.Hide();
                } break;

                case PaymentType.CheckByMail:
                {
                    PanelCheckMoneyOrderMethod.Visible = true;
                    CheckPaymentView.SetModel(method);
                    CheckPaymentView.Initialize();
                    CheckPaymentView.Hide();

                    RadioCheckByMail.Visible = true;
                    RadioCheckByMail.Enabled = true;
                    RadioCheckByMail.Checked = false;
                }; break;

                case PaymentType.RequestAQuote:
                {
                    PanelRequestQuote.Visible = true;

                    RequestQuoteView.SetModel(method);
                    RequestQuoteView.Initialize();
                    RequestQuoteView.Hide();

                    RadioRequestQuote.Visible = true;
                    RadioRequestQuote.Enabled = true;
                    RadioRequestQuote.Checked = false;
                }; break;

                case PaymentType.PurchaseOrder:
                {
                    PanelPurchaseOrderMethod.Visible = true;
                    PurchaseOrderPaymentView.SetModel(method);
                    PurchaseOrderPaymentView.Initialize();
                    PurchaseOrderPaymentView.Hide();

                    RadioPurchaseOrder.Visible = true;
                    RadioPurchaseOrder.Enabled = true;
                    RadioPurchaseOrder.Checked = false;
                }; break;

                case PaymentType.PayPalEmbeddedCheckout:
                case PaymentType.PayPalExpress:
                case PaymentType.PayPal:
                    hasPayPal = true;
                    payPalOptions.Add(method);
                    break;

                case PaymentType.MicroPay:
                {
                    PanelMicroPayMethod.Visible = true;

                    MicroPayPaymentView.SetModel(method);
                    MicroPayPaymentView.Initialize();
                    MicroPayPaymentView.Hide();

                    RadioMicroPay.Visible = true;
                    RadioMicroPay.Enabled = true;
                    RadioMicroPay.Checked = false;
                }; break;

                case PaymentType.COD:
                {
                    PanelCodMethod.Visible = true;

                    CodPaymentView.SetModel(method);
                    CodPaymentView.Initialize();
                    CodPaymentView.Hide();

                    RadioCod.Visible = true;
                    RadioCod.Enabled = true;
                    RadioCod.Checked = false;
                }; break;

                case PaymentType.CheckoutByAmazon:
                {
                    CheckOutByAmazonPaymentView.SetModel(method);
                    CheckOutByAmazonPaymentView.Initialize();
                    CheckOutByAmazonPaymentView.Hide();

                    if (((CheckOutByAmazonPaymentModel)CheckOutByAmazonPaymentView.PaymentMethodModel).IsCheckingOut)
                    {
                        PanelCheckoutByAmazon.Visible = true;
                        RadioCheckoutByAmazon.Visible = true;
                        RadioCheckoutByAmazon.Enabled = true;
                        RadioCheckoutByAmazon.Checked = false;
                    }
                }; break;

                case PaymentType.MoneybookersQuickCheckout:
                {
                    MoneybookersQuickCheckoutPaymentView.SetModel(method);
                    MoneybookersQuickCheckoutPaymentView.Initialize();
                    MoneybookersQuickCheckoutPaymentView.Hide();

                    PanelMoneybookersQuickCheckout.Visible = true;
                    RadioMoneybookersQuickCheckout.Visible = true;
                    RadioMoneybookersQuickCheckout.Enabled = true;
                    RadioMoneybookersQuickCheckout.Checked = false;
                } break;
                }
            }
            //PayPal options are mutually exclusive so this will ensure only one shows
            if (hasPayPal)
            {
                HandlePayPalOptions(payPalOptions);
            }
        }

        SetSelectedPaymentMethod();
    }
Exemplo n.º 7
0
    public void SetModel(IPaymentModel model)
    {
        this.PaymentModel = (IPaymentModel)model;
        foreach (var kvp in this.PaymentModel.PaymentMethods)
        {
            PaymentMethodBaseModel method = kvp.Value;
            switch (method.PaymentType)
            {
            case PaymentType.CreditCard:
            {
                CreditCardPaymentViewForm.StringResourceProvider = this.StringResourceProvider;
                CreditCardPaymentViewForm.SetModel(method);
            }; break;

            case PaymentType.SecureNet:
            {
                SecureNetPaymentView.StringResourceProvider = this.StringResourceProvider;
                SecureNetPaymentView.SetModel(method);

                SecureNetPaymentView.ExistingCreditCardSelected += (o, e) => CreditCardPaymentViewForm.Hide();
                SecureNetPaymentView.NewCreditCardSelected      += (o, e) => CreditCardPaymentViewForm.Show();

                PaymentModel.ProcessingPayment += (o, e) =>
                {
                    if (!(e.PaymentMethod is CreditCardPaymentModel) && !(e.PaymentMethod is SecureNetPaymentModel))
                    {
                        return;
                    }

                    ((SecureNetPaymentModel)method).SwitchPaymentMethod();
                };
            } break;

            case PaymentType.CheckByMail:
            {
                CheckPaymentView.StringResourceProvider = this.StringResourceProvider;
                CheckPaymentView.SetModel(method);
            }; break;

            case PaymentType.RequestAQuote:
            {
                RequestQuoteView.StringResourceProvider = this.StringResourceProvider;
                RequestQuoteView.SetModel(method);
            }; break;

            case PaymentType.PurchaseOrder:
            {
                PurchaseOrderPaymentView.StringResourceProvider = this.StringResourceProvider;
                PurchaseOrderPaymentView.SetModel(method);
            }; break;

            case PaymentType.PayPal:
            {
                PayPalPaymentView.StringResourceProvider = this.StringResourceProvider;
                PayPalPaymentView.SetModel(method);
            }; break;

            case PaymentType.PayPalExpress:
            {
                PayPalExpressView.StringResourceProvider = this.StringResourceProvider;
                PayPalExpressView.SetModel(method);
            } break;

            case PaymentType.MicroPay:
            {
                MicroPayPaymentView.StringResourceProvider = this.StringResourceProvider;
                MicroPayPaymentView.SetModel(method);
            } break;

            case PaymentType.COD:
            {
                CodPaymentView.StringResourceProvider = this.StringResourceProvider;
                CodPaymentView.SetModel(method);
            } break;

            case PaymentType.CheckoutByAmazon:
            {
                CheckOutByAmazonPaymentView.StringResourceProvider = this.StringResourceProvider;
                CheckOutByAmazonPaymentView.SetModel(method);
            } break;

            case PaymentType.PayPalEmbeddedCheckout:
            {
                PayPalEmbeddedCheckoutPaymentView.StringResourceProvider = this.StringResourceProvider;
                PayPalEmbeddedCheckoutPaymentView.SetModel(method);
            } break;

            case PaymentType.MoneybookersQuickCheckout:
            {
                MoneybookersQuickCheckoutPaymentView.StringResourceProvider = this.StringResourceProvider;
                MoneybookersQuickCheckoutPaymentView.SetModel(method);
            } break;
            }
        }
    }
Exemplo n.º 8
0
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        OrderDetailsChanged += (o, ea) => MoneybookersQuickCheckoutPaymentView.ResetCheckout();
    }