コード例 #1
0
        protected void repGateways_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            if (!e.CommandName.EqualsIgnoreCase("ShowConfiguration"))
            {
                return;
            }

            GatewayProcessor gp = GatewayLoader.GetProcessor(e.CommandArgument as string);

            if (gp == null)
            {
                return;
            }

            HiddenField hfGatewayIdentifier = e.Item.FindControl("hfGatewayIdentifier") as HiddenField;

            if (hfGatewayIdentifier != null && hfGatewayIdentifier.Value == "PayFlowPro")
            {
                HiddenField hfGatewayProductIdentifier = e.Item.FindControl("hfGatewayProductIdentifier") as HiddenField;
                LaunchGatewayConfiguration(gp, String.Format("Gateway.{0}.ConfigAtom.xml", hfGatewayProductIdentifier.Value.Replace(" ", "").Replace("�", "")));
            }
            else
            {
                LaunchGatewayConfiguration(gp);
            }
        }
コード例 #2
0
        /// <summary>
        /// Private method to call the gateway
        /// </summary>
        /// <param name="gateway">Payment gateway to call</param>
        /// <returns></returns>
        private string CallGateway(string gateway)
        {
            String           result    = String.Empty;
            GatewayProcessor processor = GatewayLoader.GetProcessor(gateway);

            result = processor.ProcessCard(this.OrderNumber,
                                           this.CustomerID,
                                           this.OrderTotal,
                                           this.UseLiveTransactions,
                                           this.TransactionMode,
                                           this.BillingAddress,
                                           this.CV2,
                                           this.ShippingAddress,
                                           this.CAVV,
                                           this.ECI,
                                           this.XID,
                                           out m_avsResult,
                                           out m_authorizationResult,
                                           out m_authorizationCode,
                                           out m_authorizationTransactionID,
                                           out m_transactionCommand,
                                           out m_transactionResponse);

            // set the gatewayused property so we know for sure which gateway was called!
            m_gatewayUsed = gateway;

            return(result);
        }
コード例 #3
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;
                }
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            dtLastRun = Localization.ParseDBDateTime(AppLogic.AppConfig("Recurring.GatewayLastImportedDate"));
            if (dtLastRun > System.DateTime.MinValue)
            {
                lblLastRun.Text = "Last import was from " + Localization.ToThreadCultureShortDateString(dtLastRun) + "&nbsp;&nbsp;";
            }

            m_GW = AppLogic.ActivePaymentGatewayCleaned();
            btnGetGatewayStatus.Text = String.Format(AppLogic.GetString("GetAutoBillStatusFile", SkinID, LocaleSetting), CommonLogic.IIF(dtLastRun > System.DateTime.MinValue, AppLogic.GetString("admin.recurringimport.Next", SkinID, LocaleSetting), AppLogic.GetString("admin.recurringimport.Todays", SkinID, LocaleSetting)), m_GW);
            if (!IsPostBack)
            {
                if (dtLastRun.AddDays((double)1.0) >= DateTime.Today)
                {
                    txtInputFile.Text           = AppLogic.GetString("admin.recurringimport.NothingToProcess", SkinID, LocaleSetting);
                    btnGetGatewayStatus.Enabled = false;
                }

                if (!AppLogic.ThereAreRecurringGatewayAutoBillOrders())
                {
                    pnlMain.Visible         = false;
                    pnlNotSupported.Visible = true;
                }
                else
                {
                    GatewayProcessor GWActual = GatewayLoader.GetProcessor(m_GW);
                    if (GWActual != null && GWActual.RecurringSupportType() == RecurringSupportType.Normal)
                    {
                        btnGetGatewayStatus.Visible = true;
                        pnlMain.Visible             = true;
                        pnlNotSupported.Visible     = false;
                    }
                    else if (GWActual != null && GWActual.RecurringSupportType() == RecurringSupportType.Extended)
                    {
                        btnGetGatewayStatus.Visible = false;
                        btnProcessFile.Visible      = true;
                        pnlMain.Visible             = true;
                        pnlNotSupported.Visible     = false;
                        PastePromptLabel.Text       = PastePromptLabel.Text + "<br />" + AppLogic.GetString("admin.recurringimport.RawTextContents", SkinID, LocaleSetting);
                    }
                    else
                    {
                        pnlMain.Visible         = false;
                        pnlNotSupported.Visible = true;
                    }
                }
            }
            else
            {
            }
        }
コード例 #5
0
ファイル: GatewayLoader.cs プロジェクト: giagiigi/WE
        /// <summary>
        /// Loads the gateway processor
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static GatewayProcessor GetProcessor(string name)
        {
            // lowercase it for caching later
            name = name.ToLowerInvariant();

            #region Paypal Recurring
            if (name.Equals(AppLogic.ro_PMPayPalEmbeddedCheckout.ToLower()))
            {
                name = Gateway.ro_GWPAYFLOWPRO.ToLower();
            }
            #endregion

            GatewayProcessor processor = null;

            try
            {
                // Iterate through all the available types in this assembly
                // checking for Types that inherit from GatewayProcessor
                var  processors    = GetGatewayProcessorTypes();                           // Get all the types that inherit from the GatewayProcessor
                Type processorType = processors
                                     .Where(type => type.Name.EqualsIgnoreCase(name))      // get only the one that has a name that starts with the name and perform case-insensitive matching
                                     .FirstOrDefault();

                if (processorType != null)
                {
                    // instantiate the class
                    processor = Activator.CreateInstance(processorType) as GatewayProcessor;
                }
            }
            catch (Exception ex)
            {
                // error finding the type whatever it is, log what happend through the exception message
                Exception logEx = new Exception("Error loading gateway processor: {0}".FormatWith(name), ex);
                SysLog.LogException(logEx, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
            }

            if (processor == null)
            {
                // no processor type found, log
                SysLog.LogMessage("Gateway Processor not found {0}".FormatWith(name), string.Empty, MessageTypeEnum.Informational, MessageSeverityEnum.Alert);
            }

            return(processor);
        }
コード例 #6
0
        private void SetupPageDisplay()
        {
            if (LastImportDate > System.DateTime.MinValue)
            {
                LastRunPanel.Visible = true;
                lblLastRun.Text      = String.Format(AppLogic.GetString("admin.recurringimport.LastImport", LocaleSetting), Localization.ToThreadCultureShortDateString(LastImportDate));
            }

            btnGetGatewayStatus.Text = String.Format(AppLogic.GetString("admin.recurringimport.GetAutoBillStatusFile", LocaleSetting),
                                                     LastImportDate > System.DateTime.MinValue
                                ? AppLogic.GetString("admin.recurringimport.Next", LocaleSetting)
                                : AppLogic.GetString("admin.recurringimport.Todays", SkinID, LocaleSetting),
                                                     RecurringGateway);

            if (LastImportDate.AddDays(1) >= DateTime.Today)
            {
                txtInputFile.Text           = AppLogic.GetString("admin.recurringimport.NothingToProcess", SkinID, LocaleSetting);
                btnGetGatewayStatus.Enabled = false;
            }

            GatewayProcessor GWActual = GatewayLoader.GetProcessor(RecurringGateway);

            if (GWActual != null && GWActual.RecurringSupportType() == RecurringSupportType.Normal)
            {
                btnGetGatewayStatus.Visible = true;
                pnlMain.Visible             = true;
            }
            else if (GWActual != null && GWActual.RecurringSupportType() == RecurringSupportType.Extended)
            {
                btnGetGatewayStatus.Visible = false;
                btnProcessFile.Visible      = true;
                pnlMain.Visible             = true;
                PastePromptLabel.Text       = PastePromptLabel.Text + "<br />" + AppLogic.GetString("admin.recurringimport.RawTextContents", SkinID, LocaleSetting);
            }
            else
            {
                DisablePageDisplay(AppLogic.GetString("admin.recurringimport.NotSupported", LocaleSetting));
                return;
            }
        }
コード例 #7
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;
                }
            }
        }
コード例 #8
0
        public void BuildGatewayList()
        {
            String GW = AppLogic.ActivePaymentGatewayCleaned();

            List <GatewayData> ds           = new List <GatewayData>();
            String             downloadLink = "<br /><a href=\"{1}\" onclick=\"showGatewayDirections('{2}');\">{0}</a>";

            if (repGateways.DataSource == null)
            {
                Dictionary <String, List <AssetServerAsset> > serverAssets = AssetServer.AssetServerAsset.GetAssetServerAssets();
                IEnumerable <string> availibleGateways = GatewayLoader.GetAvailableGatewayNames();

                foreach (String s in availibleGateways)
                {
                    GatewayProcessor GWActual = GatewayLoader.GetProcessor(s);
                    GatewayData      gd       = new GatewayData();
                    gd.DisplayName = GWActual.DisplayName(ThisCustomer.LocaleSetting);
                    gd.AdministratorSetupPrompt = GWActual.AdministratorSetupPrompt;
                    if (serverAssets.ContainsKey(GWActual.TypeName))
                    {
                        if (serverAssets[GWActual.TypeName].Count == 0)
                        {
                            return;
                        }

                        AssetServer.AssetVersion dllVersion       = new AssetVersion(GWActual.Version);
                        AssetServer.AssetVersion availibleVersion = new AssetVersion(serverAssets[GWActual.TypeName][0].Version);

                        if (availibleVersion.CompareTo(dllVersion) > 0)
                        {
                            gd.AdministratorSetupPrompt += "<b>Download Update</b>";
                            foreach (AssetServerAsset asa in serverAssets[GWActual.TypeName])
                            {
                                gd.AdministratorSetupPrompt += String.Format(downloadLink, asa.Title + " (" + asa.Version + ")", asa.Link, CommonLogic.IIF(String.IsNullOrEmpty(asa.DownloadInstructions), String.Empty, HttpContext.Current.Server.HtmlEncode(asa.DownloadInstructions)));
                            }
                        }

                        serverAssets.Remove(GWActual.TypeName);
                    }
                    gd.IsInstalled       = true;
                    gd.GatewayIdentifier = s;
                    ds.Add(gd);
                }
                //
                foreach (KeyValuePair <String, List <AssetServerAsset> > sa in serverAssets)
                {
                    if (sa.Value.Count == 0)
                    {
                        break;
                    }
                    GatewayData gd = new GatewayData();
                    gd.DisplayName = sa.Value[0].Title;
                    gd.IsInstalled = false;
                    StringBuilder setupPrompt = new StringBuilder();
                    setupPrompt.Append("<b>Download</b>");
                    foreach (AssetServerAsset asa in sa.Value)
                    {
                        setupPrompt.AppendFormat(downloadLink, asa.Title, asa.Link, CommonLogic.IIF(String.IsNullOrEmpty(asa.DownloadInstructions), String.Empty, HttpContext.Current.Server.HtmlEncode(asa.DownloadInstructions)));
                    }
                    gd.AdministratorSetupPrompt = setupPrompt.ToString();
                    ds.Add(gd);
                }

                ds.Add(CreateGatewayData("PayPal Payflow Link", "PayFlowPro", "(also enables PayPal Express Checkout) - See <a href=\"http://www.aspdotnetstorefront.com/linkmanager.aspx?topic=paypalpayflowlink&type=manual\" target=\"_blank\">Manual</a>."));
                ds.Add(CreateGatewayData("PayPal Payments Advanced", "PayFlowPro", "(also enables PayPal Express Checkout) - See <a href=\"http://www.aspdotnetstorefront.com/linkmanager.aspx?topic=paypalpaymentsadvanced&type=manual\" target=\"_blank\">Manual</a>."));

                ds = ds.Where(gd => IsPaymentOptionAvailable(gd.DisplayName, ddlCountries.SelectedValue)).ToList();

                ds = SortGatewayList(ds);

                repGateways.DataSource = ds;
                repGateways.DataBind();
            }
        }
コード例 #9
0
 private void LaunchGatewayConfiguration(GatewayProcessor gateway, String resourceName)
 {
     GatewayConfigurationAtom.AtomConfigurationDataSource = gateway.GetConfigurationAtom(resourceName);
     GatewayConfigurationAtom.DataBind();
     GatewayConfigurationAtom.Show();
 }
コード例 #10
0
 private void LaunchGatewayConfiguration(GatewayProcessor gateway)
 {
     LaunchGatewayConfiguration(gateway, String.Empty);
 }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            /****************************************************************************/
            // * WARNING TO DEVELOPERS
            // * The redirect below is a SAFETY feature.  Removing the redirect will not
            // * enable ML-only features on a lower version of AspDotNetStorefront.
            // * Attempting to do so can very easily result in a partially implemented
            // * feature, invalid or incomplete data in your DB, and other serious
            // * conditions that will cause your store to be non-functional.
            // *
            // * If you break your store attempting to enable ML-only features in PRO or
            // * Standard, our staff cannot help you fix it, and it will also invalidate
            // * your AspDotNetStorefront License.
            /***************************************************************************/

            if (!AppLogic.m_ProductIsML())
            {
                AppLogic.AdminLinkUrl("restrictedfeature.aspx");
            }

            dtLastRun = Localization.ParseDBDateTime(AppLogic.AppConfig("Recurring.GatewayLastImportedDate"));
            if (dtLastRun > System.DateTime.MinValue)
            {
                lblLastRun.Text = "Last import was from " + Localization.ToThreadCultureShortDateString(dtLastRun) + "&nbsp;&nbsp;";
            }

            m_GW = AppLogic.ActivePaymentGatewayCleaned();
            btnGetGatewayStatus.Text = String.Format(AppLogic.GetString("GetAutoBillStatusFile", SkinID, LocaleSetting), CommonLogic.IIF(dtLastRun > System.DateTime.MinValue, AppLogic.GetString("admin.recurringimport.Next", SkinID, LocaleSetting), AppLogic.GetString("admin.recurringimport.Todays", SkinID, LocaleSetting)), m_GW);
            if (!IsPostBack)
            {
                if (dtLastRun.AddDays((double)1.0) >= DateTime.Today)
                {
                    txtInputFile.Text           = AppLogic.GetString("admin.recurringimport.NothingToProcess", SkinID, LocaleSetting);
                    btnGetGatewayStatus.Enabled = false;
                }

                if (!AppLogic.ThereAreRecurringGatewayAutoBillOrders())
                {
                    pnlMain.Visible         = false;
                    pnlNotSupported.Visible = true;
                }
                else
                {
                    GatewayProcessor GWActual = GatewayLoader.GetProcessor(m_GW);
                    if (GWActual != null && GWActual.RecurringSupportType() == RecurringSupportType.Normal)
                    {
                        btnGetGatewayStatus.Visible = true;
                        pnlMain.Visible             = true;
                        pnlNotSupported.Visible     = false;
                    }
                    else if (GWActual != null && GWActual.RecurringSupportType() == RecurringSupportType.Extended)
                    {
                        btnGetGatewayStatus.Visible = false;
                        btnProcessFile.Visible      = true;
                        pnlMain.Visible             = true;
                        pnlNotSupported.Visible     = false;
                        PastePromptLabel.Text       = PastePromptLabel.Text + "<br />" + AppLogic.GetString("admin.recurringimport.RawTextContents", SkinID, LocaleSetting);
                    }
                    else
                    {
                        pnlMain.Visible         = false;
                        pnlNotSupported.Visible = true;
                    }
                }
            }
            else
            {
            }
        }