private void LoadPaymentProviders()
        {
            DataModel.Store store = StoreContext.CurrentStore;

            // StoreContext.CurrentStore.GetOnsiteCreditCardPaymentProvider() == PaymentProviderName.OfflinePayment
            // StoreContext.CurrentStore.IsPaymentProviderEnabled(PaymentProviderName.AuthorizeNetAim)

            // ON-SITE
            chkPayLater.Checked        = store.IsPaymentProviderEnabled(PaymentProviderName.PayLater);
            chkCardCaptureOnly.Checked = store.IsPaymentProviderEnabled(PaymentProviderName.CardCaptureOnly);
            chkAuthorizeNetAim.Checked = store.IsPaymentProviderEnabled(PaymentProviderName.AuthorizeNetAim);
            chkPayPalDirect.Checked    = store.IsPaymentProviderEnabled(PaymentProviderName.PayPalDirectPayment);

            PayLaterPaymentProvider billMeLaterProvider = new PayLaterPaymentProvider(store.GetPaymentProviderConfig(PaymentProviderName.PayLater));

            txtPayLaterDisplayText.Text          = billMeLaterProvider.DisplayText;
            txtPayLaterCustomerInstructions.Text = billMeLaterProvider.CustomerInstructions;

            AuthorizeNetAimProvider authorizeNetAimProvider = new AuthorizeNetAimProvider(store.GetPaymentProviderConfig(PaymentProviderName.AuthorizeNetAim));

            chkAuthorizeNetAimTestGateway.Checked      = authorizeNetAimProvider.IsTestGateway;
            chkAuthorizeNetAimTestTransactions.Checked = authorizeNetAimProvider.IsTestTransactions;
            txtAuthorizeNetAimApiLoginId.Text          = authorizeNetAimProvider.ApiLoginId;
            txtAuthorizeNetAimTransactionKey.Text      = authorizeNetAimProvider.TransactionKey;

            PayPalDirectPaymentProvider payPalDirectPayment = new PayPalDirectPaymentProvider(store.GetPaymentProviderConfig(PaymentProviderName.PayPalDirectPayment));

            chkPayPalDirectPaymentIsSandbox.Checked = payPalDirectPayment.IsSandbox;
            txtPayPalDirectPaymentApiUsername.Text  = payPalDirectPayment.ApiUsername;
            txtPayPalDirectPaymentApiPassword.Text  = payPalDirectPayment.ApiPassword;
            txtPayPalDirectPaymentApiSignature.Text = payPalDirectPayment.ApiSignature;

            // OFF-SITE
            chkPayPalStandard.Checked = store.IsPaymentProviderEnabled(PaymentProviderName.PayPalStandard);
            chkPayPalExpress.Checked  = store.IsPaymentProviderEnabled(PaymentProviderName.PayPalExpressCheckout);

            PayPalStandardProvider payPalStandard = new PayPalStandardProvider(store.GetPaymentProviderConfig(PaymentProviderName.PayPalStandard));

            chkPayPalStandardIsSandbox.Checked           = payPalStandard.IsSandbox;
            rdoPayPalStandardShippingLogic.SelectedValue = payPalStandard.ShippingLogic;
            txtPayPalStandardEmail.Text = payPalStandard.EmailAddress;

            PayPalExpressCheckoutPaymentProvider payPalExpressCheckout = new PayPalExpressCheckoutPaymentProvider(store.GetPaymentProviderConfig(PaymentProviderName.PayPalExpressCheckout));

            chkPayPalExpressCheckoutIsSandbox.Checked = payPalExpressCheckout.IsSandbox;
            txtPayPalExpressCheckoutApiUsername.Text  = payPalExpressCheckout.ApiUsername;
            txtPayPalExpressCheckoutApiPassword.Text  = payPalExpressCheckout.ApiPassword;
            txtPayPalExpressCheckoutApiSignature.Text = payPalExpressCheckout.ApiSignature;
        }
        private void FillListControls()
        {
            DataModel.Store store = StoreContext.CurrentStore;
            checkoutOrderInfo.ReCalculateOrderTotals();

            //---- CC Types
            string creditCardsAccepted = store.GetSetting(StoreSettingNames.AcceptedCreditCards);

            if (!string.IsNullOrEmpty(creditCardsAccepted))
            {
                string[] cardTypes = creditCardsAccepted.Split(',');
                ddlCCType.Items.Clear();
                foreach (var card in cardTypes)
                {
                    string[] pair = card.Split('-');
                    if (pair.Length == 1)
                    {
                        ddlCCType.Items.Add(new ListItem()
                        {
                            Value = pair[0], Text = pair[0]
                        });
                    }
                    else if (pair.Length == 2)
                    {
                        ddlCCType.Items.Add(new ListItem()
                        {
                            Value = pair[0], Text = pair[1]
                        });
                    }
                }
                ddlCCType.Items.Insert(0, "");
            }
            else
            {
                //List<string> cardTypes = new List<string>(WA.Enum<CreditCardType>.GetNames());
                //cardTypes.Remove(CreditCardType.UNKNOWN.ToString());
                //cardTypes.Remove(CreditCardType.PayPal.ToString());
                //ddlCCType.Items.Clear();
                //ddlCCType.Items.AddRange(cardTypes.ConvertAll(s => new ListItem() { Text = s, Value = s }).ToArray());
                //ddlCCType.Items.Insert(0, "");
                msgFlash.InnerHtml = "<ul><li>No credit cards accepted. Please choose a different payment method.</li></ul>";
                msgFlash.Visible   = true;
            }

            //---- CC Expire Year
            ddlCCExpireYear.Items.Clear();
            ddlCCExpireYear.Items.Add("");
            int maxYear = DateTime.Now.Year + 12;

            for (int y = DateTime.Now.Year; y <= maxYear; y++)
            {
                ddlCCExpireYear.Items.Add(new ListItem()
                {
                    Text = y.ToString(), Value = y.ToString()
                });
            }

            //---- Payment Methods
            PayLaterPaymentProvider billMeLaterProvider = new PayLaterPaymentProvider(store.GetPaymentProviderConfig(PaymentProviderName.PayLater));

            liBillMeLater.Visible          = billMeLaterProvider.IsEnabled;
            lblPayLater.InnerHtml          = billMeLaterProvider.DisplayText;
            payLaterInstructions.InnerHtml = billMeLaterProvider.CustomerInstructions.NewlineToBr();
            liPayPalExpressCheckoutPaymentMethod.Visible = store.IsPaymentProviderEnabled(PaymentProviderName.PayPalExpressCheckout);
            liCreditCardCapture.Visible = store.IsPaymentProviderEnabled(PaymentProviderName.CardCaptureOnly) ||
                                          store.IsPaymentProviderEnabled(PaymentProviderName.AuthorizeNetAim) ||
                                          store.IsPaymentProviderEnabled(PaymentProviderName.PayPalDirectPayment);
        }