internal static void DeleteRow(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider cache, IUPSShippingRateTable rateTable, IShipRateTier shipRateTier) { //var row = Rows.FirstOrDefault(x => x.Key == shipRateTier.Key); //if (!Rows.Any() || row == null) return; //if (Rows.IndexOf(Rows.Last()) != Rows.IndexOf(row)) //{ // _shipRateTiers[Rows.IndexOf(row) + 1].RangeLow = row.RangeLow; //} //_shipRateTiers.Remove(row); var row = rateTable.Rows.FirstOrDefault(x => x.Key == shipRateTier.Key); if (!rateTable.Rows.Any() || row == null) { return; } if (rateTable.Rows.IndexOf(rateTable.Rows.Last()) != rateTable.Rows.IndexOf(row)) { rateTable.Rows.First(x => x.RangeLow == row.RangeHigh).RangeLow = row.RangeLow; } gatewayProviderService.Save(rateTable.Rows); gatewayProviderService.Delete(shipRateTier); }
internal static void DeleteRow(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider cache, IShippingFixedRateTable rateTable, IShipRateTier shipRateTier) { //var row = Rows.FirstOrDefault(x => x.Key == shipRateTier.Key); //if (!Rows.Any() || row == null) return; //if (Rows.IndexOf(Rows.Last()) != Rows.IndexOf(row)) //{ // _shipRateTiers[Rows.IndexOf(row) + 1].RangeLow = row.RangeLow; //} //_shipRateTiers.Remove(row); var row = rateTable.Rows.FirstOrDefault(x => x.Key == shipRateTier.Key); if (!rateTable.Rows.Any() || row == null) { return; } if (rateTable.Rows.IndexOf(rateTable.Rows.Last()) != rateTable.Rows.IndexOf(row)) { rateTable.Rows.First(x => x.RangeLow == row.RangeHigh).RangeLow = row.RangeLow; } // clear the current cached item // TODO : This should use the distributed cache referesher cache.ClearCacheItem(CacheKeys.GatewayShipMethodCacheKey(rateTable.ShipMethodKey)); gatewayProviderService.Save(rateTable.Rows); gatewayProviderService.Delete(shipRateTier); cache.GetCacheItem(CacheKeys.GatewayShipMethodCacheKey(rateTable.ShipMethodKey), () => rateTable); }
/// <summary> /// For testing /// </summary> internal void DeactivateProvider(GatewayProviderBase provider) { if (!provider.Activated) { return; } _gatewayProviderService.Delete(provider.GatewayProviderSettings); GatewayProviderResolver.Current.RefreshCache(); }
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); }
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); }
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); }
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", // "*****@*****.**"); }
internal static void DeleteRow(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider cache, IUPSShippingRateTable rateTable, IShipRateTier shipRateTier) { //var row = Rows.FirstOrDefault(x => x.Key == shipRateTier.Key); //if (!Rows.Any() || row == null) return; //if (Rows.IndexOf(Rows.Last()) != Rows.IndexOf(row)) //{ // _shipRateTiers[Rows.IndexOf(row) + 1].RangeLow = row.RangeLow; //} //_shipRateTiers.Remove(row); var row = rateTable.Rows.FirstOrDefault(x => x.Key == shipRateTier.Key); if (!rateTable.Rows.Any() || row == null) return; if (rateTable.Rows.IndexOf(rateTable.Rows.Last()) != rateTable.Rows.IndexOf(row)) { rateTable.Rows.First(x => x.RangeLow == row.RangeHigh).RangeLow = row.RangeLow; } gatewayProviderService.Save(rateTable.Rows); gatewayProviderService.Delete(shipRateTier); }
/// <summary> /// The delete row. /// </summary> /// <param name="gatewayProviderService"> /// The gateway provider service. /// </param> /// <param name="cache"> /// The cache. /// </param> /// <param name="rateTable"> /// The rate table. /// </param> /// <param name="shipRateTier"> /// The ship rate tier. /// </param> internal static void DeleteRow(IGatewayProviderService gatewayProviderService, IRuntimeCacheProvider cache, IShippingFixedRateTable rateTable, IShipRateTier shipRateTier) { var row = rateTable.Rows.FirstOrDefault(x => x.Key == shipRateTier.Key); if (!rateTable.Rows.Any() || row == null) return; if (rateTable.Rows.IndexOf(rateTable.Rows.Last()) != rateTable.Rows.IndexOf(row)) { rateTable.Rows.First(x => x.RangeLow == row.RangeHigh).RangeLow = row.RangeLow; } // clear the current cached item // TODO : This should use the distributed cache referesher cache.ClearCacheItem(CacheKeys.GatewayShipMethodCacheKey(rateTable.ShipMethodKey)); gatewayProviderService.Save(rateTable.Rows); gatewayProviderService.Delete(shipRateTier); cache.GetCacheItem(CacheKeys.GatewayShipMethodCacheKey(rateTable.ShipMethodKey), () => rateTable); }
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", // "*****@*****.**"); }