コード例 #1
0
        protected void repGateways_DataBinding(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                RadioButton rb = e.Item.FindControl("rbGateway") as RadioButton;
                LinkButton  btnConfigureGateway = e.Item.FindControl("btnConfigureGateway") as LinkButton;
                Image       imgPayPal           = e.Item.FindControl("imgPayPal") as Image;

                GatewayData item = e.Item.DataItem as GatewayData;

                Control trGateway = e.Item.FindControl("trGateway");
                if (trGateway != null)
                {
                    trGateway.Visible = IsPaymentOptionAvailable(item.DisplayName, ddlCountries.SelectedValue);
                }

                if (item.DisplayName.Contains("PayPal"))
                {
                    imgPayPal.Visible = true;
                }

                if (item.DisplayName.ToUpper().Contains("PAYFLOW"))
                {
                    imgPayPal.ImageUrl = "images/PayPal_OnBoarding_PayFlow.png";
                }

                if (AppLogic.AppConfig("PaymentGateway", 0, false).EqualsIgnoreCase("PayFlowPro"))
                {
                    var payFlowProProduct = AppLogic.GetAppConfig(0, "PayFlowPro.Product");
                    rb.Checked = item.DisplayName == payFlowProProduct.ConfigValue;
                }
                else
                {
                    rb.Checked = AppLogic.AppConfig("PaymentGateway", 0, false).EqualsIgnoreCase(item.GatewayIdentifier);
                }

                if (item.IsInstalled)
                {
                    GatewayProcessor gp = GatewayLoader.GetProcessor(item.GatewayIdentifier);
                    if (gp != null)
                    {
                        IConfigurationAtom atom = gp.GetConfigurationAtom();
                        rb.Enabled = atom == null || atom.IsConfigured(0) || atom.IsConfigured(AppLogic.StoreID());
                    }
                }
                else
                {
                    rb.Enabled = false;
                    btnConfigureGateway.Visible = false;
                }
                if (item.GatewayIdentifier != null && item.GatewayIdentifier.EqualsIgnoreCase("manual"))
                {
                    btnConfigureGateway.Visible = false;
                }
            }
        }
コード例 #2
0
        private void SetGatewayRBEnabled()
        {
            foreach (RepeaterItem e in repGateways.Items)
            {
                RadioButton rb = e.FindControl("rbGateway") as RadioButton;
                LinkButton  btnConfigureGateway = e.FindControl("btnConfigureGateway") as LinkButton;
                HiddenField hfGatewayIdentifier = e.FindControl("hfGatewayIdentifier") as HiddenField;

                try
                {
                    GatewayProcessor gp = GatewayLoader.GetProcessor(hfGatewayIdentifier.Value);

                    IConfigurationAtom atom = gp.GetConfigurationAtom();
                    rb.Enabled = atom == null || atom.IsConfigured(0) || atom.IsConfigured(AppLogic.StoreID());
                }
                catch // the gateway doesn't exist.
                {
                    rb.Enabled = false;
                    btnConfigureGateway.Visible = false;
                }
            }
        }
コード例 #3
0
 private void LaunchGatewayConfiguration(GatewayProcessor gateway, String resourceName)
 {
     GatewayConfigurationAtom.AtomConfigurationDataSource = gateway.GetConfigurationAtom(resourceName);
     GatewayConfigurationAtom.DataBind();
     GatewayConfigurationAtom.Show();
 }