public void Can_load_taxProviders()
        {
            var providers = _taxPluginManager.LoadAllPlugins();

            providers.ShouldNotBeNull();
            providers.Any().ShouldBeTrue();
        }
        /// <summary>
        /// Prepare paged tax provider list model
        /// </summary>
        /// <param name="searchModel">Tax provider search model</param>
        /// <returns>Tax provider list model</returns>
        public virtual TaxProviderListModel PrepareTaxProviderListModel(TaxProviderSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get tax providers
            var taxProviders = _taxPluginManager.LoadAllPlugins().ToPagedList(searchModel);

            //prepare grid model
            var model = new TaxProviderListModel().PrepareToGrid(searchModel, taxProviders, () =>
            {
                return(taxProviders.Select(provider =>
                {
                    //fill in model values from the entity
                    var taxProviderModel = provider.ToPluginModel <TaxProviderModel>();

                    //fill in additional values (not existing in the entity)
                    taxProviderModel.ConfigurationUrl = provider.GetConfigurationPageUrl();
                    taxProviderModel.IsPrimaryTaxProvider = _taxPluginManager.IsPluginActive(provider);

                    return taxProviderModel;
                }));
            });

            return(model);
        }
示例#3
0
 public void Can_load_taxProviders()
 {
     RunWithTestServiceProvider(() =>
     {
         var providers = _taxPluginManager.LoadAllPlugins();
         providers.Should().NotBeNull();
         providers.Any().Should().BeTrue();
     });
 }
示例#4
0
        /// <summary>
        /// Uninstall the plugin
        /// </summary>
        public override void Uninstall()
        {
            //generic attributes
            _avalaraTaxManager.DeleteAttributes();

            //settings
            _taxSettings.ActiveTaxProviderSystemName = _taxPluginManager.LoadAllPlugins()
                                                       .FirstOrDefault(taxProvider => !taxProvider.PluginDescriptor.SystemName.Equals(AvalaraTaxDefaults.SystemName))
                                                       ?.PluginDescriptor.SystemName;
            _settingService.SaveSetting(_taxSettings);
            _widgetSettings.ActiveWidgetSystemNames.Remove(AvalaraTaxDefaults.SystemName);
            _settingService.SaveSetting(_widgetSettings);
            _settingService.DeleteSetting <AvalaraTaxSettings>();

            //locales
            _localizationService.DeletePluginLocaleResources("Enums.Smi.Plugin.Tax.Avalara.Domain");
            _localizationService.DeletePluginLocaleResources("Plugins.Tax.Avalara");

            base.Uninstall();
        }