示例#1
0
        public void TestInitialize()
        {
            var serviceProvider = new Mock <IServiceProvider>();

            serviceProvider.Setup(x => x.GetService(typeof(FixedRateTestTaxProvider))).Returns(new FixedRateTestTaxProvider());
            _serviceProvider = serviceProvider.Object;

            _taxProviderSettings = new TaxProviderSettings();
            _taxProviderSettings.ActiveTaxProviderSystemName = "test-provider";

            _taxSettings      = new TaxSettings();
            _workContext      = null;
            _geoLookupService = new Mock <IGeoLookupService>().Object;
            _countryService   = new Mock <ICountryService>().Object;
            _customerSettings = new CustomerSettings();
            _addressSettings  = new AddressSettings();
            _groupServiceMock = new Mock <IGroupService>();
            _loggerMock       = new Mock <ILogger>();
            var providers = new List <ITaxProvider>();

            providers.Add(new FixedRateTestTaxProvider());
            _taxService = new TaxService(_workContext, _groupServiceMock.Object,
                                         _geoLookupService, _countryService, providers, _loggerMock.Object,
                                         _taxSettings, _taxProviderSettings, _customerSettings, _addressSettings);

            _vatService = new VatService(_taxSettings);
        }
示例#2
0
        public void TaxProviderSettingsSet(string providerID, TaxProviderSettings settings)
        {
            var json      = Json.ObjectToJson(settings);
            var key       = KeyManager.GetKey(0);
            var encrypted = AesEncryption.Encode(json, key);

            SetProp("taxprovsetting" + providerID, encrypted);
        }
示例#3
0
        public void TaxProviderSettingsSet(string providerID, TaxProviderSettings settings)
        {
            var json      = Json.ObjectToJson(settings);
            var key       = KeyManager.GetKey(0);
            var encrypted = AesEncryption.Encode(json, key);

            SetProp(string.Concat(Constants.STORESETTING_TAXPROVIDERSETTING, providerID), encrypted);
        }
示例#4
0
        private void GetCustomSettings()
        {
            // Read in our Tax Api configuration
            var taxApiProviders = new ConfigurationBuilder().AddJsonFile("taxapiproviders.json").Build();

            _apiSettings = new TaxProviderSettings();
            taxApiProviders.Bind(_apiSettings);
            _configuration.Bind("TaxApiProviders", taxApiProviders);
        }
示例#5
0
        public void Setup()
        {
            var taxApiProviders = new ConfigurationBuilder().AddJsonFile("taxapiproviders.json").Build();

            _apiSettings = new TaxProviderSettings();
            taxApiProviders.Bind(_apiSettings);
            _configuration = new ConfigurationRoot(new List <IConfigurationProvider>());
            _configuration.Bind("TaxApiProviders", taxApiProviders);
            _taxServicecontroller = new TaxServiceController(_configuration)
            {
                ControllerContext = { HttpContext = new DefaultHttpContext() }
            };

            //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        }
示例#6
0
 public TaxService(
     IWorkContext workContext,
     IGroupService groupService,
     IGeoLookupService geoLookupService,
     ICountryService countryService,
     IEnumerable <ITaxProvider> taxProviders,
     ILogger logger,
     TaxSettings taxSettings,
     TaxProviderSettings taxProviderSettings,
     CustomerSettings customerSettings,
     AddressSettings addressSettings)
 {
     _workContext         = workContext;
     _groupService        = groupService;
     _taxSettings         = taxSettings;
     _taxProviderSettings = taxProviderSettings;
     _taxProviders        = taxProviders;
     _geoLookupService    = geoLookupService;
     _logger           = logger;
     _countryService   = countryService;
     _customerSettings = customerSettings;
     _addressSettings  = addressSettings;
 }