private void ToggleCreditCardForm(bool show) { if (show) { HidePaymentForms(); RadioCreditCard.Checked = true; if (!SecureNetPaymentView.IsVaultPaymentSelected) { CreditCardPaymentViewForm.Initialize(); CreditCardPaymentViewForm.Show(); CreditCardPaymentViewForm.BindView(); } SecureNetPaymentView.Initialize(); SecureNetPaymentView.Show(); SecureNetPaymentView.BindView(); } else { RadioCreditCard.Checked = false; CreditCardPaymentViewForm.Hide(); SecureNetPaymentView.Hide(); } }
protected void BindPaymentView() { if (this.PaymentMethodView == null) { return; } bool showPaymentView = true; if (this.Model.ActivePaymentMethod != null && this.Model.ActivePaymentMethod.PaymentType == PaymentType.CreditCard) { if (AspDotNetStorefrontCore.AppLogic.ActivePaymentGatewayCleaned() == AspDotNetStorefrontGateways.Gateway.ro_GWTWOCHECKOUT) { showPaymentView = false; TwoCheckoutPaymentView.Initialize(); TwoCheckoutPaymentView.Show(); TwoCheckoutPaymentView.BindView(); } else if (AspDotNetStorefrontCore.AppLogic.ActivePaymentGatewayCleaned() == (new AspDotNetStorefrontGateways.Processors.Worldpay()).GatewayIdentifier) { showPaymentView = false; WorldPayPaymentView.Initialize(); WorldPayPaymentView.Show(); WorldPayPaymentView.BindView(); } else { if (SecureNetPaymentView.IsVaultPaymentSelected) { showPaymentView = false; } SecureNetPaymentView.Initialize(); SecureNetPaymentView.Show(); SecureNetPaymentView.BindView(); } } if (showPaymentView) { this.PaymentMethodView.Initialize(); this.PaymentMethodView.Show(); this.PaymentMethodView.BindView(); } }
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(); }