Exemplo n.º 1
0
 public TaxService(ITaxRateService taxRateService,
                   IAddressService addressService,
                   IWorkContext workContext,
                   IStoreContext storeContext,
                   IGeoLookupService geoLookupService,
                   ICountryService countryService,
                   IStateProvinceService stateProvinceService,
                   ILogger logger,
                   IGenericAttributeService genericAttributeService,
                   ISettingService settingService
                   )
 {
     this._taxRateService       = taxRateService;
     this._addressService       = addressService;
     this._workContext          = workContext;
     this._storeContext         = storeContext;
     this._geoLookupService     = geoLookupService;
     this._countryService       = countryService;
     this._stateProvinceService = stateProvinceService;
     this._logger = logger;
     this._genericAttributeService = genericAttributeService;
     this._settingService          = settingService;
     this._taxSettings             = _settingService.LoadSetting <TaxSettings>();
     this._customerSettings        = _settingService.LoadSetting <CustomerSettings>();
     this._shippingSettings        = _settingService.LoadSetting <ShippingSettings>();
     this._addressSettings         = _settingService.LoadSetting <AddressSettings>();
 }
        public void BeforeEach()
        {
            _productRepo = Substitute.For<IProductRepository>();
            _orderFulfillmentService = Substitute.For<IOrderFulfillmentService>();
            _customerRepository = Substitute.For<ICustomerRepository>();
            _taxRateService = Substitute.For<ITaxRateService>();
            _emailService = Substitute.For<IEmailService>();

            _subject = new OrderService(_orderFulfillmentService,
                _customerRepository,
                _taxRateService,
                _emailService);

            _bestCustomer = new Customer
            {
                CustomerId = 42,
                PostalCode = "12345",
                Country = "Merica"
            };

            _listOfTaxEntries = new List<TaxEntry>
            {
                new TaxEntry {Description = "High Tax", Rate = (decimal) 0.60},
                new TaxEntry {Description = "Low Tax", Rate = (decimal) 0.10}
            };

            _orderConfirmation = new OrderConfirmation
            {
                OrderId = 1234,
                OrderNumber = "hello"
            };
            _customerRepository.Get(_bestCustomer.CustomerId.Value).Returns(_bestCustomer);
            _taxRateService.GetTaxEntries(_bestCustomer.PostalCode, _bestCustomer.Country).Returns(_listOfTaxEntries);
        }
Exemplo n.º 3
0
 public TaxZoneService(DataContext db, ITaxRateService taxRateService, ICountryService countryService, IRegionService  regionService)
 {
     this.db = db;
     this.taxRateService = taxRateService;
     this.countryService = countryService;
     this.regionService = regionService;
 }
Exemplo n.º 4
0
 public TaxZoneService(DataContext db, ITaxRateService taxRateService, ICountryService countryService, IRegionService regionService)
 {
     this.db             = db;
     this.taxRateService = taxRateService;
     this.countryService = countryService;
     this.regionService  = regionService;
 }
        public void Init()
        {
            _productRepository       = Substitute.For <IProductRepository>();
            _orderFulfillmentService = Substitute.For <IOrderFulfillmentService>();
            _taxRateService          = Substitute.For <ITaxRateService>();
            _customerRepository      = Substitute.For <ICustomerRepository>();
            _emailService            = Substitute.For <IEmailService>();

            _orderService = new OrderService(_productRepository, _orderFulfillmentService, _taxRateService,
                                             _customerRepository, _emailService);

            _orderConfirmation = new OrderConfirmation {
                CustomerId = 42, OrderId = 12, OrderNumber = "OneTwoThree"
            };
            _taxEntryList = new List <TaxEntry>
            {
                new TaxEntry {
                    Description = "Default", Rate = (decimal)0.2
                },
                new TaxEntry {
                    Description = "High", Rate = (decimal)0.5
                }
            };
            _customer = new Customer {
                CustomerId = 2, PostalCode = "12345", Country = "USA"
            };

            _taxRateService.GetTaxEntries(_customer.PostalCode, _customer.Country).Returns(_taxEntryList);
            _customerRepository.Get(_customer.CustomerId.Value).Returns(_customer);
        }
Exemplo n.º 6
0
        public ModelCacheEventConsumer(ITaxRateService taxRateService)
        {
            //TODO inject static cache manager using constructor
            this._cacheManager = EngineContext.Current.ContainerManager.Resolve <ICacheManager>("nop_cache_static");

            this._taxRateService = taxRateService;
        }
Exemplo n.º 7
0
 public TaxesController(ITaxService taxService, ITaxRateService taxRateService, IDataSerializer dataSerializer, IModelMapper modelMapper)
 {
     _taxService     = taxService;
     _taxRateService = taxRateService;
     _dataSerializer = dataSerializer;
     _modelMapper    = modelMapper;
 }
Exemplo n.º 8
0
 public TaxRateController(ITaxRateService taxRateService, ITaxZoneService taxZoneService,
                          ITaxClassService taxClassService, ISettingService settingService)
 {
     this.taxRateService  = taxRateService;
     this.taxZoneService  = taxZoneService;
     this.taxClassService = taxClassService;
     this.settingService  = settingService;
 }
 public CountryStateZipTaxProvider(ITaxRateService taxRateService,
     TaxRateObjectContext objectContext,
     ILocalizationService localizationService)
 {
     this._taxRateService = taxRateService;
     this._objectContext = objectContext;
     _localizationService = localizationService;
 }
Exemplo n.º 10
0
 public OrderService(IProductRepository productRepository, IOrderFulfillmentService orderFulfillment, ITaxRateService taxRateService, ICustomerRepository customerRepository, IEmailService emailService)
 {
     _productRepository  = productRepository;
     _orderFulfillment   = orderFulfillment;
     _taxRateService     = taxRateService;
     _customerRepository = customerRepository;
     _emailService       = emailService;
 }
		public ByRegionTaxProvider(ITaxRateService taxRateService,
            TaxRateObjectContext objectContext,
            ILocalizationService localizationService)
        {
            this._taxRateService = taxRateService;
            this._objectContext = objectContext;
            _localizationService = localizationService;
        }
Exemplo n.º 12
0
 public TaxRateController(ITaxRateService taxRateService, ITaxZoneService taxZoneService, 
     ITaxClassService taxClassService, ISettingService settingService)
 {
     this.taxRateService = taxRateService;
     this.taxZoneService = taxZoneService;
     this.taxClassService = taxClassService;
     this.settingService = settingService;
 }
 public CountryStateZipTaxProvider(ITaxRateService taxRateService,
                                   TaxRateObjectContext objectContext,
                                   ILocalizationService localizationService)
 {
     this._taxRateService = taxRateService;
     this._objectContext  = objectContext;
     _localizationService = localizationService;
 }
Exemplo n.º 14
0
 public ByRegionTaxProvider(ITaxRateService taxRateService,
                            TaxRateObjectContext objectContext,
                            ILocalizationService localizationService)
 {
     this._taxRateService = taxRateService;
     this._objectContext  = objectContext;
     _localizationService = localizationService;
 }
Exemplo n.º 15
0
 public TaxCountryStateZipController(ITaxCategoryService taxCategoryService,
                                     ICountryService countryService, IStateProvinceService stateProvinceService,
                                     ITaxRateService taxRateService)
 {
     this._taxCategoryService   = taxCategoryService;
     this._countryService       = countryService;
     this._stateProvinceService = stateProvinceService;
     this._taxRateService       = taxRateService;
 }
 public TaxCountryStateZipController(ITaxCategoryService taxCategoryService,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     ITaxRateService taxRateService)
 {
     this._taxCategoryService = taxCategoryService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._taxRateService = taxRateService;
 }
Exemplo n.º 17
0
 public OrderService(IOrderFulfillmentService orderFulfillment, IProductRepository productRepository, ICustomerRepository customerRepository, ITaxRateService taxRateService, IEmailService emailService)
 {
     _orderFulfillmentService = orderFulfillment;
     _productRepository       = productRepository;
     _customerRepository      = customerRepository;
     _taxRateService          = taxRateService;
     _emailService            = emailService;
     ExceptionReasons         = new List <string>();
 }
Exemplo n.º 18
0
 public OrderService(IOrderFulfillmentService orderFulfillmentService,
                     ICustomerRepository customerRepository, ITaxRateService taxRateService,
                     IEmailService emailService)
 {
     _orderFulfillmentService = orderFulfillmentService;
     _customerRepository      = customerRepository;
     _taxRateService          = taxRateService;
     _emailService            = emailService;
 }
 public OrderService(IProductRepository productRepository, IOrderFulfillmentService orderFulfillmentService, IEmailService emailService, ICustomerRepository customerRepository, ITaxRateService taxRateService)
 {
     _customerRepository = customerRepository;
     _productRepository = productRepository;
     _orderFulfillmentService = orderFulfillmentService;
     _emailService = emailService;
     _taxRateService = taxRateService;
     _reasonsForInvalidOrder = "";
 }
 public OrderService(IOrderFulfillmentService orderFulfillmentService,
     ICustomerRepository customerRepository, ITaxRateService taxRateService,
     IEmailService emailService)
 {
     _orderFulfillmentService = orderFulfillmentService;
     _customerRepository = customerRepository;
     _taxRateService = taxRateService;
     _emailService = emailService;
 }
Exemplo n.º 21
0
 public ByRegionTaxProvider(
     ITaxRateService taxRateService,
     ISettingService settingService,
     TaxSettings taxSettings)
 {
     _taxRateService = taxRateService;
     _settingService = settingService;
     _taxSettings    = taxSettings;
 }
 public ScheduleTaxRateController(IFileProcessService fileProcessService,
                                  ITaxAddService taxAddService,
                                  ITaxRateService taxRateService,
                                  ITaxRateRepository taxRateRepository)
 {
     _fileProcessService = fileProcessService;
     _taxAddService      = taxAddService;
     _taxRateService     = taxRateService;
     _taxRateRepository  = taxRateRepository;
 }
Exemplo n.º 23
0
        public void SetUp()
        {
            _customerRepository      = Substitute.For <ICustomerRepository>();
            _productRepository       = Substitute.For <IProductRepository>();
            _orderFulfillmentService = Substitute.For <IOrderFulfillmentService>();
            _taxRateService          = Substitute.For <ITaxRateService>();
            _emailService            = Substitute.For <IEmailService>();

            this.orderService = new OrderService(this._orderFulfillmentService, this._productRepository, this._customerRepository, this._taxRateService, this._emailService);
        }
Exemplo n.º 24
0
 public CountryStateZipTaxProvider(ITaxRateService taxRateService,
                                   IStoreContext storeContext,
                                   ICacheManager cacheManager,
                                   IWebHelper webHelper)
 {
     this._taxRateService = taxRateService;
     this._storeContext   = storeContext;
     this._cacheManager   = cacheManager;
     this._webHelper      = webHelper;
 }
 public TaxCountryStateZipController(ITaxCategoryService taxCategoryService,
                                     ICountryService countryService,
                                     ITaxRateService taxRateService,
                                     IStoreService storeService)
 {
     _taxCategoryService = taxCategoryService;
     _countryService     = countryService;
     _taxRateService     = taxRateService;
     _storeService       = storeService;
 }
Exemplo n.º 26
0
 public CountryStateZipTaxProvider(ITaxRateService taxRateService,
                                   IStoreContext storeContext,
                                   //TaxRateObjectContext objectContext,
                                   ICacheManager cacheManager)
 {
     this._taxRateService = taxRateService;
     this._storeContext   = storeContext;
     //this._objectContext = objectContext;
     this._cacheManager = cacheManager;
 }
Exemplo n.º 27
0
 public CountryStateZipTaxProvider(ITaxRateService taxRateService,
     IStoreContext storeContext,
     TaxRateObjectContext objectContext,
     ICacheManager cacheManager)
 {
     this._taxRateService = taxRateService;
     this._storeContext = storeContext;
     this._objectContext = objectContext;
     this._cacheManager = cacheManager;
 }
Exemplo n.º 28
0
 public TaxRateEditViewModelValidator(ITaxRateService taxRateService)
 {
     RuleFor(r => r.Amount).GreaterThanOrEqualTo(0);
     RuleFor(r => r.TaxZoneId).NotEmpty().WithMessage("Please select a tax zone".TA());
     RuleFor(r => r.Name).NotEmpty();
     RuleFor(r => r).Must(
         r => !taxRateService.FindAll().Any(d => d.Id != r.Id && d.Name == r.Name))
     .WithName("Name")
     .WithMessage("Name is already used".TA());
 }
Exemplo n.º 29
0
 public void BeforeEach()
 {
     _orderFulfillment = Substitute.For <IOrderFulfillmentService>();
     _taxRateService   = Substitute.For <ITaxRateService>();
     _taxRateService.SetTaxRateServiceReturn();
     _customerRepository = Substitute.For <ICustomerRepository>();
     _customerRepository.SetCustomerRepoReturn();
     _emailService = Substitute.For <IEmailService>();
     _productRepo  = Substitute.For <IProductRepository>();
     _sut          = new OrderService(_productRepo, _orderFulfillment, _taxRateService, _customerRepository, _emailService);
 }
Exemplo n.º 30
0
 public TaxByRegionController(
     ITaxRateService taxRateService,
     ITaxCategoryService taxCategoryService,
     ICountryService countryService,
     IStateProvinceService stateProvinceService)
 {
     _taxRateService       = taxRateService;
     _taxCategoryService   = taxCategoryService;
     _countryService       = countryService;
     _stateProvinceService = stateProvinceService;
 }
Exemplo n.º 31
0
 public SettingsController(ISettingsMapper mapper, IEstimateStatusService estimateStatusService, IInmateUnitService inmateUnitService, IInvoiceStatusService invoiceStatusService, IPaymentMethodService paymentMethodService, IProductCategoryService productCategoryService, IProductService productService, ITaxRateService taxRateService, IUserService userService)
 {
     _mapper = mapper;
     _estimateStatusService = estimateStatusService;
     _inmateUnitService = inmateUnitService;
     _invoiceStatusService = invoiceStatusService;
     _paymentMethodService = paymentMethodService;
     _productCategoryService = productCategoryService;
     _productService = productService;
     _taxRateService = taxRateService;
     _userService = userService;
 }
 public CountryStateZipTaxProvider(ITaxRateService taxRateService,
                                   IStoreContext storeContext,
                                   ICacheManager cacheManager,
                                   IWebHelper webHelper,
                                   IServiceProvider serviceProvider)
 {
     _taxRateService  = taxRateService;
     _storeContext    = storeContext;
     _cacheManager    = cacheManager;
     _webHelper       = webHelper;
     _serviceProvider = serviceProvider;
 }
Exemplo n.º 33
0
        public void BeforeEach()
        {
            _mockIProductRepository = MockRepository.GenerateMock <IProductRepository>();

            _mockICustomerRepository = MockRepository.GenerateMock <ICustomerRepository>();

            _mockIEmailService = MockRepository.GenerateMock <IEmailService>();

            _mockIOrderFulfillmentService = MockRepository.GenerateMock <IOrderFulfillmentService>();

            _mockITaxRateService = MockRepository.GenerateMock <ITaxRateService>();
        }
Exemplo n.º 34
0
 public ShoppingCartController(DataContext db, ICurrentUser currentUser, ISettingService settings,
                               ITaxZoneService taxZoneService, ICustomerService customerService, ITaxRateService taxRateService,
                               IShippingService shippingService, IProductSkuService productSkuService, IProductService productService) : base(db, currentUser)
 {
     this.settings          = settings;
     this.taxZoneService    = taxZoneService;
     this.customerService   = customerService;
     this.taxRateService    = taxRateService;
     this.shippingService   = shippingService;
     this.productSkuService = productSkuService;
     this.productService    = productService;
 }
Exemplo n.º 35
0
 public CountryStateZipTaxProvider(ITranslationService translationService,
                                   ICacheBase cacheBase,
                                   IWorkContext workContext,
                                   ITaxRateService taxRateService,
                                   CountryStateZipTaxSettings countryStateZipTaxSettings)
 {
     _translationService         = translationService;
     _cacheBase                  = cacheBase;
     _workContext                = workContext;
     _taxRateService             = taxRateService;
     _countryStateZipTaxSettings = countryStateZipTaxSettings;
 }
Exemplo n.º 36
0
 public ShoppingCartController(DataContext db, ICurrentUser currentUser, ISettingService settings,
     ITaxZoneService taxZoneService, ICustomerService customerService, ITaxRateService taxRateService,
     IShippingService shippingService, IProductSkuService productSkuService, IProductService productService) : base(db, currentUser)
 {
     this.settings = settings;
     this.taxZoneService = taxZoneService;
     this.customerService = customerService;
     this.taxRateService = taxRateService;
     this.shippingService = shippingService;
     this.productSkuService = productSkuService;
     this.productService = productService;
 }
 public OrderService(
     IProductRepository productRepo,
     IOrderFulfillmentService fulfillmentService,
     ICustomerRepository customerService,
     ITaxRateService taxService,
     IEmailService emailService)
 {
     _productRepo        = productRepo;
     _fulfillmentService = fulfillmentService;
     _customerService    = customerService;
     _taxService         = taxService;
     _emailService       = emailService;
 }
Exemplo n.º 38
0
 public OrderService(IProductRepository productRepository,
                     ITaxRateService taxRateService,
                     IOrderFulfillmentService orderFulfillmentService,
                     IEmailService emailService,
                     string postalCode, string country)
 {
     _productRepository       = productRepository;
     _orderFulfillmentService = orderFulfillmentService;
     _productRepository       = productRepository;
     _taxRateService          = taxRateService;
     _postalCode = postalCode;
     _country    = country;
 }
Exemplo n.º 39
0
 public CountryStateZipTaxProvider(ITaxRateService taxRateService,
                                   IStoreContext storeContext,
                                   ICacheBase cacheManager,
                                   IWebHelper webHelper,
                                   ILocalizationService localizationService,
                                   ILanguageService languageService)
 {
     _taxRateService      = taxRateService;
     _storeContext        = storeContext;
     _cacheBase           = cacheManager;
     _webHelper           = webHelper;
     _localizationService = localizationService;
     _languageService     = languageService;
 }
 public TaxCountryStateZipController(ITaxCategoryService taxCategoryService,
                                     ICountryService countryService,
                                     IStateProvinceService stateProvinceService,
                                     ITaxRateService taxRateService,
                                     IPermissionService permissionService,
                                     IStoreService storeService)
 {
     _taxCategoryService   = taxCategoryService;
     _countryService       = countryService;
     _stateProvinceService = stateProvinceService;
     _taxRateService       = taxRateService;
     _permissionService    = permissionService;
     _storeService         = storeService;
 }
 public static void SetTaxRateServiceReturn(this ITaxRateService taxRate)
 {
     taxRate.GetTaxEntries(Arg.Any <string>(), Arg.Any <string>()).Returns(new List <TaxEntry>
     {
         new TaxEntry
         {
             Description = "State Tax",
             Rate        = 5.6m
         },
         new TaxEntry
         {
             Description = "Federal Tax",
             Rate        = 8.2m
         }
     });
 }
 public void PlaceOrder_SetUp()
 {
     _customerRepository = MockRepository.GenerateMock<ICustomerRepository>();
     _emailService = MockRepository.GenerateMock<IEmailService>();
     _orderFulfillmentService = MockRepository.GenerateMock<IOrderFulfillmentService>();
     _productRepository = MockRepository.GenerateMock<IProductRepository>();
     _taxRateService = MockRepository.GenerateMock<ITaxRateService>();
 }
Exemplo n.º 43
0
 public TaxService(ITaxZoneService taxZoneService, ITaxRateService taxRateService)
 {
     this.taxZoneService = taxZoneService;
     this.taxRateService = taxRateService;
 }
 public CountryStateZipTaxProvider(ITaxRateService taxRateService,
     TaxRateObjectContext objectContext)
 {
     this._taxRateService = taxRateService;
     this._objectContext = objectContext;
 }
Exemplo n.º 45
0
 public TaxRatesController(ITaxRateService service, ISettingsMapper mapper)
 {
     _taxRateService = service;
     _mapper = mapper;
 }