private void BuildActivatedProviderSettingsCache()
        {
            var settings = _gatewayProviderService.GetAllGatewayProviders().ToList();

            foreach (var setting in settings)
            {
                _activatedProviderSettingsCache.AddOrUpdate(setting.Key, setting, (x, y) => setting);
            }
        }
Esempio n. 2
0
        public void FixtureSetup()
        {
            SqlSyntaxProviderTestHelper.EstablishSqlSyntax();

            var cacheProvider = new Mock <IRuntimeCacheProvider>();

            GatewayProviderService = new GatewayProviderService();

            var providers =
                GatewayProviderService.GetAllGatewayProviders()
                .Where(x => x.GatewayProviderType == GatewayProviderType.Payment);

            GatewayProviderSettings = providers.FirstOrDefault(x => x.Key == new Guid("15C87B6F-7987-49D9-8444-A2B4406941A8"));

            if (GatewayProviderSettings != null)
            {
                GatewayProviderService.Delete(GatewayProviderSettings);
            }

            var petaPoco = new PetaPocoUnitOfWorkProvider();

            var xLogin   = ConfigurationManager.AppSettings["xlogin"];
            var xtrankey = ConfigurationManager.AppSettings["xtrankey"];

            var sql = new Sql();

            var dto = new GatewayProviderSettingsDto()
            {
                Key                 = new Guid("15C87B6F-7987-49D9-8444-A2B4406941A8"),
                Name                = "Stripe",
                Description         = "Stripe",
                ExtendedData        = "<extendedData />",
                EncryptExtendedData = false,
                ProviderTfKey       = Constants.TypeFieldKeys.GatewayProvider.PaymentProviderKey,
                CreateDate          = DateTime.Now,
                UpdateDate          = DateTime.Now
            };


            petaPoco.GetUnitOfWork().Database.Insert(dto);

            GatewayProviderSettings =
                GatewayProviderService.GetGatewayProviderByKey(new Guid("15C87B6F-7987-49D9-8444-A2B4406941A8"));

            var providerSettings = new StripeProcessorSettings()
            {
                // TODO
                //LoginId = xLogin,
                //TransactionKey = xtrankey
            };

            GatewayProviderSettings.ExtendedData.SaveProcessorSettings(providerSettings);

            Provider = new StripePaymentGatewayProvider(GatewayProviderService, GatewayProviderSettings,
                                                        cacheProvider.Object);
        }
Esempio n. 3
0
        public void FixtureSetup()
        {
            SqlSyntaxProviderTestHelper.EstablishSqlSyntax();

            var cacheProvider = new Mock<IRuntimeCacheProvider>();

            GatewayProviderService = new GatewayProviderService();

            var providers =
                GatewayProviderService.GetAllGatewayProviders()
                    .Where(x => x.GatewayProviderType == GatewayProviderType.Payment);

            GatewayProvider = providers.FirstOrDefault(x => x.Key == new Guid("C6BF6743-3565-401F-911A-33B68CACB11B"));

            if (GatewayProvider != null)
            {
                GatewayProviderService.Delete(GatewayProvider);
            }

            var petaPoco = new PetaPocoUnitOfWorkProvider();

            var xLogin = ConfigurationManager.AppSettings["xlogin"];
            var xtrankey = ConfigurationManager.AppSettings["xtrankey"];

            var sql = new Sql();

            var dto = new GatewayProviderDto()
            {
                Key = new Guid("C6BF6743-3565-401F-911A-33B68CACB11B"),
                Name = "AuthorizeNet",
                Description = "AuthorizeNet",
                TypeFullName =
                    "Merchello.Plugin.Payments.AuthorizeNet.AuthorizeNetPaymentGatewayProvider, Merchello.Plugin.Payments.AuthorizeNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
                ExtendedData = "<extendedData />",
                EncryptExtendedData = false,
                ProviderTfKey = Constants.TypeFieldKeys.GatewayProvider.PaymentProviderKey,
                CreateDate = DateTime.Now,
                UpdateDate = DateTime.Now
            };

            petaPoco.GetUnitOfWork().Database.Insert(dto);

            GatewayProvider =
                GatewayProviderService.GetGatewayProviderByKey(new Guid("C6BF6743-3565-401F-911A-33B68CACB11B"));

            var providerSettings = new AuthorizeNetProcessorSettings()
            {
                LoginId = xLogin,
                TransactionKey = xtrankey
            };

            GatewayProvider.ExtendedData.SaveProcessorSettings(providerSettings);

            Provider = new AuthorizeNetPaymentGatewayProvider(GatewayProviderService, GatewayProvider,
                cacheProvider.Object);
        }
Esempio n. 4
0
        public void FixtureSetup()
        {
            SqlSyntaxProviderTestHelper.EstablishSqlSyntax();

            var cacheProvider = new Mock<IRuntimeCacheProvider>();

            GatewayProviderService = new GatewayProviderService();

            var providers =
                GatewayProviderService.GetAllGatewayProviders()
                    .Where(x => x.GatewayProviderType == GatewayProviderType.Payment);

            GatewayProviderSettings = providers.FirstOrDefault(x => x.Key == new Guid("15C87B6F-7987-49D9-8444-A2B4406941A8"));

            if (GatewayProviderSettings != null)
            {
                GatewayProviderService.Delete(GatewayProviderSettings);
            }

            var petaPoco = new PetaPocoUnitOfWorkProvider();

            var xLogin = ConfigurationManager.AppSettings["xlogin"];
            var xtrankey = ConfigurationManager.AppSettings["xtrankey"];

            var sql = new Sql();

            var dto = new GatewayProviderSettingsDto()
            {
                Key = new Guid("15C87B6F-7987-49D9-8444-A2B4406941A8"),
                Name = "Stripe",
                Description = "Stripe",
                ExtendedData = "<extendedData />",
                EncryptExtendedData = false,
                ProviderTfKey = Constants.TypeFieldKeys.GatewayProvider.PaymentProviderKey,
                CreateDate = DateTime.Now,
                UpdateDate = DateTime.Now
            };


            petaPoco.GetUnitOfWork().Database.Insert(dto);

            GatewayProviderSettings =
                GatewayProviderService.GetGatewayProviderByKey(new Guid("15C87B6F-7987-49D9-8444-A2B4406941A8"));

            var providerSettings = new StripeProcessorSettings()
            {
                // TODO
                //LoginId = xLogin,
                //TransactionKey = xtrankey
            };

            GatewayProviderSettings.ExtendedData.SaveProcessorSettings(providerSettings);

            Provider = new StripePaymentGatewayProvider(GatewayProviderService, GatewayProviderSettings,
                cacheProvider.Object);
        }
Esempio n. 5
0
 private void BuildActivatedGatewayProviderCache()
 {
     // this will cache the list of all providers that have been "Activated"
     foreach (var provider in _gatewayProviderService.GetAllGatewayProviders())
     {
         var attempt = CreateInstance(provider);
         if (attempt.Success)
         {
             AddOrUpdateCache(attempt.Result);
         }
         else
         {
             LogHelper.Error <GatewayProviderResolver>(string.Format("Failed to create instance of type {0}", provider.Name), attempt.Exception);
         }
     }
 }
Esempio n. 6
0
        public void TestFixtureSetup()
        {
            SqlSyntaxProviderTestHelper.EstablishSqlSyntax();
                   
            var cacheProvider = new Mock<IRuntimeCacheProvider>();

            GatewayProviderService = new GatewayProviderService();

            var providers =
                GatewayProviderService.GetAllGatewayProviders()
                    .Where(x => x.GatewayProviderType == GatewayProviderType.Payment);

            GatewayProviderSettings = providers.FirstOrDefault(x => x.Key == new Guid("D584F356-454B-4D14-BE44-13D9D25D6A74"));

            if (GatewayProviderSettings != null)
            {
                GatewayProviderService.Delete(GatewayProviderSettings);
            }

            var petaPoco = new PetaPocoUnitOfWorkProvider();

            var merchantId = ConfigurationManager.AppSettings["merchantId"];
            var bin = ConfigurationManager.AppSettings["bin"];
            var username = ConfigurationManager.AppSettings["username"];
            var password = ConfigurationManager.AppSettings["password"];
            var sql = new Sql();

            var dto = new GatewayProviderSettingsDto()
            {
                Key = new Guid("D584F356-454B-4D14-BE44-13D9D25D6A74"),
                Name = "Chase",
                Description = "Chase",
                ExtendedData = "<extendedData />",
                EncryptExtendedData = false,
                ProviderTfKey = Constants.TypeFieldKeys.GatewayProvider.PaymentProviderKey,
                CreateDate = DateTime.Now,
                UpdateDate = DateTime.Now
            };


            petaPoco.GetUnitOfWork().Database.Insert(dto);

            GatewayProviderSettings =
                GatewayProviderService.GetGatewayProviderByKey(new Guid("D584F356-454B-4D14-BE44-13D9D25D6A74"));

            var providerSettings = new ChaseProcessorSettings()
            {
                MerchantId = merchantId,
                Bin = bin,
                Username = username,
                Password = password
            };

            GatewayProviderSettings.ExtendedData.SaveProcessorSettings(providerSettings);

            Provider = new ChasePaymentGatewayProvider(GatewayProviderService, GatewayProviderSettings,
                cacheProvider.Object);

            //TestCustomer = MerchelloContext.Current.Services.CustomerService.CreateCustomerWithKey(
            //    Guid.NewGuid().ToString(),
            //    "debug",
            //    "debug",
            //    "*****@*****.**");
        }
Esempio n. 7
0
        public void TestFixtureSetup()
        {
            SqlSyntaxProviderTestHelper.EstablishSqlSyntax();

            var cacheProvider = new Mock <IRuntimeCacheProvider>();

            GatewayProviderService = new GatewayProviderService();

            var providers =
                GatewayProviderService.GetAllGatewayProviders()
                .Where(x => x.GatewayProviderType == GatewayProviderType.Payment);

            GatewayProviderSettings = providers.FirstOrDefault(x => x.Key == new Guid("D584F356-454B-4D14-BE44-13D9D25D6A74"));

            if (GatewayProviderSettings != null)
            {
                GatewayProviderService.Delete(GatewayProviderSettings);
            }

            var petaPoco = new PetaPocoUnitOfWorkProvider();

            var merchantId = ConfigurationManager.AppSettings["merchantId"];
            var bin        = ConfigurationManager.AppSettings["bin"];
            var username   = ConfigurationManager.AppSettings["username"];
            var password   = ConfigurationManager.AppSettings["password"];
            var sql        = new Sql();

            var dto = new GatewayProviderSettingsDto()
            {
                Key                 = new Guid("D584F356-454B-4D14-BE44-13D9D25D6A74"),
                Name                = "Chase",
                Description         = "Chase",
                ExtendedData        = "<extendedData />",
                EncryptExtendedData = false,
                ProviderTfKey       = Constants.TypeFieldKeys.GatewayProvider.PaymentProviderKey,
                CreateDate          = DateTime.Now,
                UpdateDate          = DateTime.Now
            };


            petaPoco.GetUnitOfWork().Database.Insert(dto);

            GatewayProviderSettings =
                GatewayProviderService.GetGatewayProviderByKey(new Guid("D584F356-454B-4D14-BE44-13D9D25D6A74"));

            var providerSettings = new ChaseProcessorSettings()
            {
                MerchantId = merchantId,
                Bin        = bin,
                Username   = username,
                Password   = password
            };

            GatewayProviderSettings.ExtendedData.SaveProcessorSettings(providerSettings);

            Provider = new ChasePaymentGatewayProvider(GatewayProviderService, GatewayProviderSettings,
                                                       cacheProvider.Object);

            //TestCustomer = MerchelloContext.Current.Services.CustomerService.CreateCustomerWithKey(
            //    Guid.NewGuid().ToString(),
            //    "debug",
            //    "debug",
            //    "*****@*****.**");
        }