public PluginModelFactory(IAclSupportedModelFactory aclSupportedModelFactory,
                           IAuthenticationPluginManager authenticationPluginManager,
                           IBaseAdminModelFactory baseAdminModelFactory,
                           ICacheKeyService cacheKeyService,
                           ILocalizationService localizationService,
                           ILocalizedModelFactory localizedModelFactory,
                           IPaymentPluginManager paymentPluginManager,
                           IPickupPluginManager pickupPluginManager,
                           IPluginService pluginService,
                           IShippingPluginManager shippingPluginManager,
                           IStaticCacheManager staticCacheManager,
                           IStoreMappingSupportedModelFactory storeMappingSupportedModelFactory,
                           ITaxPluginManager taxPluginManager,
                           IWidgetPluginManager widgetPluginManager,
                           IWorkContext workContext,
                           OfficialFeedManager officialFeedManager)
 {
     _aclSupportedModelFactory    = aclSupportedModelFactory;
     _authenticationPluginManager = authenticationPluginManager;
     _baseAdminModelFactory       = baseAdminModelFactory;
     _cacheKeyService             = cacheKeyService;
     _localizationService         = localizationService;
     _localizedModelFactory       = localizedModelFactory;
     _paymentPluginManager        = paymentPluginManager;
     _pickupPluginManager         = pickupPluginManager;
     _pluginService                     = pluginService;
     _shippingPluginManager             = shippingPluginManager;
     _staticCacheManager                = staticCacheManager;
     _storeMappingSupportedModelFactory = storeMappingSupportedModelFactory;
     _taxPluginManager                  = taxPluginManager;
     _widgetPluginManager               = widgetPluginManager;
     _workContext         = workContext;
     _officialFeedManager = officialFeedManager;
 }
Exemplo n.º 2
0
 public ShippingController(IAddressService addressService,
                           ICountryService countryService,
                           ICustomerActivityService customerActivityService,
                           IDateRangeService dateRangeService,
                           IEventPublisher eventPublisher,
                           ILocalizationService localizationService,
                           ILocalizedEntityService localizedEntityService,
                           INotificationService notificationService,
                           IPermissionService permissionService,
                           IPickupPluginManager pickupPluginManager,
                           ISettingService settingService,
                           IShippingModelFactory shippingModelFactory,
                           IShippingPluginManager shippingPluginManager,
                           IShippingService shippingService,
                           ShippingSettings shippingSettings)
 {
     _addressService          = addressService;
     _countryService          = countryService;
     _customerActivityService = customerActivityService;
     _dateRangeService        = dateRangeService;
     _eventPublisher          = eventPublisher;
     _localizationService     = localizationService;
     _localizedEntityService  = localizedEntityService;
     _notificationService     = notificationService;
     _permissionService       = permissionService;
     _pickupPluginManager     = pickupPluginManager;
     _settingService          = settingService;
     _shippingModelFactory    = shippingModelFactory;
     _shippingPluginManager   = shippingPluginManager;
     _shippingService         = shippingService;
     _shippingSettings        = shippingSettings;
 }
Exemplo n.º 3
0
 public CheckoutModelFactory(AddressSettings addressSettings,
                             CommonSettings commonSettings,
                             IAddressModelFactory addressModelFactory,
                             IAddressService addressService,
                             ICountryService countryService,
                             ICurrencyService currencyService,
                             ICustomerService customerService,
                             IGenericAttributeService genericAttributeService,
                             ILocalizationService localizationService,
                             IOrderProcessingService orderProcessingService,
                             IOrderTotalCalculationService orderTotalCalculationService,
                             IPaymentPluginManager paymentPluginManager,
                             IPaymentService paymentService,
                             IPickupPluginManager pickupPluginManager,
                             IPriceFormatter priceFormatter,
                             IRewardPointService rewardPointService,
                             IShippingPluginManager shippingPluginManager,
                             IShippingService shippingService,
                             IShoppingCartService shoppingCartService,
                             IStateProvinceService stateProvinceService,
                             IStoreContext storeContext,
                             IStoreMappingService storeMappingService,
                             ITaxService taxService,
                             IWorkContext workContext,
                             OrderSettings orderSettings,
                             PaymentSettings paymentSettings,
                             RewardPointsSettings rewardPointsSettings,
                             ShippingSettings shippingSettings,
                             IDateTimeHelper dateTimeHelper)
 {
     _addressSettings              = addressSettings;
     _commonSettings               = commonSettings;
     _addressModelFactory          = addressModelFactory;
     _addressService               = addressService;
     _countryService               = countryService;
     _currencyService              = currencyService;
     _customerService              = customerService;
     _genericAttributeService      = genericAttributeService;
     _localizationService          = localizationService;
     _orderProcessingService       = orderProcessingService;
     _orderTotalCalculationService = orderTotalCalculationService;
     _paymentPluginManager         = paymentPluginManager;
     _paymentService               = paymentService;
     _pickupPluginManager          = pickupPluginManager;
     _priceFormatter               = priceFormatter;
     _rewardPointService           = rewardPointService;
     _shippingPluginManager        = shippingPluginManager;
     _shippingService              = shippingService;
     _shoppingCartService          = shoppingCartService;
     _stateProvinceService         = stateProvinceService;
     _storeContext         = storeContext;
     _storeMappingService  = storeMappingService;
     _taxService           = taxService;
     _workContext          = workContext;
     _orderSettings        = orderSettings;
     _paymentSettings      = paymentSettings;
     _rewardPointsSettings = rewardPointsSettings;
     _shippingSettings     = shippingSettings;
     _dateTimeHelper       = dateTimeHelper;
 }
Exemplo n.º 4
0
        public CalculateDimensionsTests()
        {
            _shippingSettings = new ShippingSettings
            {
                UseCubeRootMethod = true,
                ConsiderAssociatedProductsDimensions = true,
                ShipSeparatelyOneItemEach            = false
            };

            _eventPublisher = new Mock <IEventPublisher>();
            _eventPublisher.Setup(x => x.Publish(It.IsAny <object>()));

            var pluginService = new FakePluginService();

            _pickupPluginManager   = new PickupPluginManager(new Mock <ICustomerService>().Object, pluginService, _shippingSettings);
            _shippingPluginManager = new ShippingPluginManager(new Mock <ICustomerService>().Object, pluginService, _shippingSettings);

            _storeContext = new Mock <IStoreContext>();
            _storeContext.Setup(x => x.CurrentStore).Returns(new Store {
                Id = 1
            });

            _productService = new FakeProductService(
                productRepository: _fakeDataStore.RegRepository <Product>());

            _shippingService = new FakeShippingService(
                eventPublisher: _eventPublisher.Object,
                pickupPluginManager: _pickupPluginManager,
                shippingPluginManager: _shippingPluginManager,
                storeContext: _storeContext.Object,
                shippingSettings: _shippingSettings);
        }
Exemplo n.º 5
0
        public ShippingServiceTests()
        {
            _eventPublisher = new Mock <IEventPublisher>();
            _eventPublisher.Setup(x => x.Publish(It.IsAny <object>()));

            _productRepository = _fakeDataStore.RegRepository(new[] {
                new Product
                {
                    Id     = 1,
                    Weight = 1.5M,
                    Height = 2.5M,
                    Length = 3.5M,
                    Width  = 4.5M
                },
                new Product
                {
                    Id     = 2,
                    Weight = 11.5M,
                    Height = 12.5M,
                    Length = 13.5M,
                    Width  = 14.5M
                }
            });

            _productService = new FakeProductService(productRepository: _productRepository, eventPublisher: _eventPublisher.Object);

            _shippingSettings = new ShippingSettings
            {
                ActiveShippingRateComputationMethodSystemNames = new List <string> {
                    "FixedRateTestShippingRateComputationMethod"
                }
            };

            var pluginService = new FakePluginService();

            _pickupPluginManager   = new PickupPluginManager(pluginService, _shippingSettings);
            _shippingPluginManager = new ShippingPluginManager(pluginService, _shippingSettings);

            _storeContext = new Mock <IStoreContext>();
            _storeContext.Setup(x => x.CurrentStore).Returns(new Store {
                Id = 1
            });

            _shippingService = new FakeShippingService(eventPublisher: _eventPublisher.Object,
                                                       pickupPluginManager: _pickupPluginManager,
                                                       productService: _productService,
                                                       shippingPluginManager: _shippingPluginManager,
                                                       storeContext: _storeContext.Object,
                                                       shippingSettings: _shippingSettings);
        }
Exemplo n.º 6
0
 public ShipmentService(IEventPublisher eventPublisher,
                        IPickupPluginManager pickupPluginManager,
                        IRepository <OrderItem> orderItemRepository,
                        IRepository <Shipment> shipmentRepository,
                        IRepository <ShipmentItem> siRepository,
                        IShippingPluginManager shippingPluginManager)
 {
     _eventPublisher        = eventPublisher;
     _pickupPluginManager   = pickupPluginManager;
     _orderItemRepository   = orderItemRepository;
     _shipmentRepository    = shipmentRepository;
     _siRepository          = siRepository;
     _shippingPluginManager = shippingPluginManager;
 }
Exemplo n.º 7
0
 public PluginController(ExternalAuthenticationSettings externalAuthenticationSettings,
                         IAuthenticationPluginManager authenticationPluginManager,
                         ICustomerActivityService customerActivityService,
                         IEventPublisher eventPublisher,
                         ILocalizationService localizationService,
                         IMultiFactorAuthenticationPluginManager multiFactorAuthenticationPluginManager,
                         INotificationService notificationService,
                         IPermissionService permissionService,
                         IPaymentPluginManager paymentPluginManager,
                         IPickupPluginManager pickupPluginManager,
                         IPluginModelFactory pluginModelFactory,
                         IPluginService pluginService,
                         ISettingService settingService,
                         IShippingPluginManager shippingPluginManager,
                         IUploadService uploadService,
                         IWebHelper webHelper,
                         IWidgetPluginManager widgetPluginManager,
                         IWorkContext workContext,
                         MultiFactorAuthenticationSettings multiFactorAuthenticationSettings,
                         PaymentSettings paymentSettings,
                         ShippingSettings shippingSettings,
                         TaxSettings taxSettings,
                         WidgetSettings widgetSettings)
 {
     _externalAuthenticationSettings = externalAuthenticationSettings;
     _authenticationPluginManager    = authenticationPluginManager;
     _customerActivityService        = customerActivityService;
     _eventPublisher      = eventPublisher;
     _localizationService = localizationService;
     _multiFactorAuthenticationPluginManager = multiFactorAuthenticationPluginManager;
     _notificationService               = notificationService;
     _permissionService                 = permissionService;
     _paymentPluginManager              = paymentPluginManager;
     _pickupPluginManager               = pickupPluginManager;
     _pluginModelFactory                = pluginModelFactory;
     _pluginService                     = pluginService;
     _settingService                    = settingService;
     _shippingPluginManager             = shippingPluginManager;
     _uploadService                     = uploadService;
     _webHelper                         = webHelper;
     _widgetPluginManager               = widgetPluginManager;
     _workContext                       = workContext;
     _multiFactorAuthenticationSettings = multiFactorAuthenticationSettings;
     _paymentSettings                   = paymentSettings;
     _shippingSettings                  = shippingSettings;
     _taxSettings                       = taxSettings;
     _widgetSettings                    = widgetSettings;
 }
Exemplo n.º 8
0
 public FakeShippingService(
     IAddressService addressService   = null,
     ICacheKeyService cacheKeyService = null,
     ICheckoutAttributeParser checkoutAttributeParser = null,
     ICountryService countryService  = null,
     ICustomerService customerSerice = null,
     IEventPublisher eventPublisher  = null,
     IGenericAttributeService genericAttributeService = null,
     ILocalizationService localizationService         = null,
     ILogger logger = null,
     IPickupPluginManager pickupPluginManager         = null,
     IPriceCalculationService priceCalculationService = null,
     IProductAttributeParser productAttributeParser   = null,
     IProductService productService = null,
     IRepository <ShippingMethod> shippingMethodRepository = null,
     IRepository <ShippingMethodCountryMapping> shippingMethodCountryMappingRepository = null,
     IRepository <Warehouse> warehouseRepository  = null,
     IShippingPluginManager shippingPluginManager = null,
     IStateProvinceService stateProvinceService   = null,
     IStoreContext storeContext                = null,
     ShippingSettings shippingSettings         = null,
     ShoppingCartSettings shoppingCartSettings = null) : base(
         addressService ?? new Mock <IAddressService>().Object,
         cacheKeyService ?? new FakeCacheKeyService(),
         checkoutAttributeParser ?? new Mock <ICheckoutAttributeParser>().Object,
         countryService ?? new Mock <ICountryService>().Object,
         customerSerice ?? new Mock <ICustomerService>().Object,
         eventPublisher ?? new Mock <IEventPublisher>().Object,
         genericAttributeService ?? new Mock <IGenericAttributeService>().Object,
         localizationService ?? new Mock <ILocalizationService>().Object,
         logger ?? new NullLogger(),
         pickupPluginManager ?? new Mock <IPickupPluginManager>().Object,
         priceCalculationService ?? new Mock <IPriceCalculationService>().Object,
         productAttributeParser ?? new Mock <IProductAttributeParser>().Object,
         productService ?? new Mock <IProductService>().Object,
         shippingMethodRepository.FakeRepoNullPropagation(),
         shippingMethodCountryMappingRepository.FakeRepoNullPropagation(),
         warehouseRepository.FakeRepoNullPropagation(),
         shippingPluginManager ?? new Mock <IShippingPluginManager>().Object,
         stateProvinceService ?? new Mock <IStateProvinceService>().Object,
         storeContext ?? new Mock <IStoreContext>().Object,
         shippingSettings ?? new ShippingSettings(),
         shoppingCartSettings ?? new ShoppingCartSettings())
 {
 }
Exemplo n.º 9
0
 public ShipmentService(IPickupPluginManager pickupPluginManager,
                        IRepository <Address> addressRepository,
                        IRepository <Order> orderRepository,
                        IRepository <OrderItem> orderItemRepository,
                        IRepository <Product> productRepository,
                        IRepository <Shipment> shipmentRepository,
                        IRepository <ShipmentItem> siRepository,
                        IShippingPluginManager shippingPluginManager)
 {
     _pickupPluginManager   = pickupPluginManager;
     _addressRepository     = addressRepository;
     _orderRepository       = orderRepository;
     _orderItemRepository   = orderItemRepository;
     _productRepository     = productRepository;
     _shipmentRepository    = shipmentRepository;
     _siRepository          = siRepository;
     _shippingPluginManager = shippingPluginManager;
 }
Exemplo n.º 10
0
 public ShippingService(IAddressService addressService,
                        ICacheKeyService cacheKeyService,
                        ICheckoutAttributeParser checkoutAttributeParser,
                        ICountryService countryService,
                        ICustomerService customerService,
                        IEventPublisher eventPublisher,
                        IGenericAttributeService genericAttributeService,
                        ILocalizationService localizationService,
                        ILogger logger,
                        IPickupPluginManager pickupPluginManager,
                        IPriceCalculationService priceCalculationService,
                        IProductAttributeParser productAttributeParser,
                        IProductService productService,
                        IRepository <ShippingMethod> shippingMethodRepository,
                        IRepository <ShippingMethodCountryMapping> shippingMethodCountryMappingRepository,
                        IRepository <Warehouse> warehouseRepository,
                        IShippingPluginManager shippingPluginManager,
                        IStateProvinceService stateProvinceService,
                        IStoreContext storeContext,
                        ShippingSettings shippingSettings,
                        ShoppingCartSettings shoppingCartSettings)
 {
     _addressService          = addressService;
     _cacheKeyService         = cacheKeyService;
     _checkoutAttributeParser = checkoutAttributeParser;
     _countryService          = countryService;
     _customerService         = customerService;
     _eventPublisher          = eventPublisher;
     _genericAttributeService = genericAttributeService;
     _localizationService     = localizationService;
     _logger = logger;
     _pickupPluginManager      = pickupPluginManager;
     _priceCalculationService  = priceCalculationService;
     _productAttributeParser   = productAttributeParser;
     _productService           = productService;
     _shippingMethodRepository = shippingMethodRepository;
     _shippingMethodCountryMappingRepository = shippingMethodCountryMappingRepository;
     _warehouseRepository   = warehouseRepository;
     _shippingPluginManager = shippingPluginManager;
     _stateProvinceService  = stateProvinceService;
     _storeContext          = storeContext;
     _shippingSettings      = shippingSettings;
     _shoppingCartSettings  = shoppingCartSettings;
 }
 public ShippingModelFactory(IAddressService addressService,
                             IBaseAdminModelFactory baseAdminModelFactory,
                             ICountryService countryService,
                             IDateRangeService dateRangeService,
                             ILocalizationService localizationService,
                             ILocalizedModelFactory localizedModelFactory,
                             IPickupPluginManager pickupPluginManager,
                             IShippingPluginManager shippingPluginManager,
                             IShippingService shippingService)
 {
     _addressService        = addressService;
     _baseAdminModelFactory = baseAdminModelFactory;
     _countryService        = countryService;
     _dateRangeService      = dateRangeService;
     _localizationService   = localizationService;
     _localizedModelFactory = localizedModelFactory;
     _pickupPluginManager   = pickupPluginManager;
     _shippingPluginManager = shippingPluginManager;
     _shippingService       = shippingService;
 }
Exemplo n.º 12
0
 public CommonModelFactory(AdminAreaSettings adminAreaSettings,
                           CatalogSettings catalogSettings,
                           CurrencySettings currencySettings,
                           IActionContextAccessor actionContextAccessor,
                           IAuthenticationPluginManager authenticationPluginManager,
                           ICurrencyService currencyService,
                           ICustomerService customerService,
                           IDateTimeHelper dateTimeHelper,
                           INopFileProvider fileProvider,
                           IExchangeRatePluginManager exchangeRatePluginManager,
                           IHttpContextAccessor httpContextAccessor,
                           ILanguageService languageService,
                           ILocalizationService localizationService,
                           IMaintenanceService maintenanceService,
                           IMeasureService measureService,
                           IOrderService orderService,
                           IPaymentPluginManager paymentPluginManager,
                           IPickupPluginManager pickupPluginManager,
                           IPluginService pluginService,
                           IProductService productService,
                           IReturnRequestService returnRequestService,
                           ISearchTermService searchTermService,
                           IShippingPluginManager shippingPluginManager,
                           IStaticCacheManager cacheManager,
                           IStoreContext storeContext,
                           IStoreService storeService,
                           ITaxPluginManager taxPluginManager,
                           IUrlHelperFactory urlHelperFactory,
                           IUrlRecordService urlRecordService,
                           IWebHelper webHelper,
                           IWidgetPluginManager widgetPluginManager,
                           IWorkContext workContext,
                           MeasureSettings measureSettings,
                           NopConfig nopConfig,
                           NopHttpClient nopHttpClient,
                           ProxySettings proxySettings)
 {
     _adminAreaSettings           = adminAreaSettings;
     _catalogSettings             = catalogSettings;
     _currencySettings            = currencySettings;
     _actionContextAccessor       = actionContextAccessor;
     _authenticationPluginManager = authenticationPluginManager;
     _currencyService             = currencyService;
     _customerService             = customerService;
     _dateTimeHelper            = dateTimeHelper;
     _exchangeRatePluginManager = exchangeRatePluginManager;
     _httpContextAccessor       = httpContextAccessor;
     _languageService           = languageService;
     _localizationService       = localizationService;
     _maintenanceService        = maintenanceService;
     _measureService            = measureService;
     _fileProvider          = fileProvider;
     _orderService          = orderService;
     _paymentPluginManager  = paymentPluginManager;
     _pickupPluginManager   = pickupPluginManager;
     _pluginService         = pluginService;
     _productService        = productService;
     _returnRequestService  = returnRequestService;
     _searchTermService     = searchTermService;
     _shippingPluginManager = shippingPluginManager;
     _cacheManager          = cacheManager;
     _storeContext          = storeContext;
     _storeService          = storeService;
     _taxPluginManager      = taxPluginManager;
     _urlHelperFactory      = urlHelperFactory;
     _urlRecordService      = urlRecordService;
     _webHelper             = webHelper;
     _widgetPluginManager   = widgetPluginManager;
     _workContext           = workContext;
     _measureSettings       = measureSettings;
     _nopConfig             = nopConfig;
     _nopHttpClient         = nopHttpClient;
     _proxySettings         = proxySettings;
 }
Exemplo n.º 13
0
        public new void SetUp()
        {
            _productService = new Mock <IProductService>();

            _discountService          = new Mock <IDiscountService>();
            _categoryService          = new Mock <ICategoryService>();
            _manufacturerService      = new Mock <IManufacturerService>();
            _productAttributeParser   = new Mock <IProductAttributeParser>();
            _eventPublisher           = new Mock <IEventPublisher>();
            _localizationService      = new Mock <ILocalizationService>();
            _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >();
            _warehouseRepository      = new Mock <IRepository <Warehouse> >();
            _shipmentService          = new Mock <IShipmentService>();
            _paymentService           = new Mock <IPaymentService>();
            _checkoutAttributeParser  = new Mock <ICheckoutAttributeParser>();
            _giftCardService          = new Mock <IGiftCardService>();
            _genericAttributeService  = new Mock <IGenericAttributeService>();
            _geoLookupService         = new Mock <IGeoLookupService>();
            _countryService           = new Mock <ICountryService>();
            _stateProvinceService     = new Mock <IStateProvinceService>();
            _eventPublisher           = new Mock <IEventPublisher>();
            _addressService           = new Mock <IAddressService>();
            _rewardPointService       = new Mock <IRewardPointService>();
            _webHelper                  = new Mock <IWebHelper>();
            _languageService            = new Mock <ILanguageService>();
            _priceFormatter             = new Mock <IPriceFormatter>();
            _productAttributeFormatter  = new Mock <IProductAttributeFormatter>();
            _shoppingCartService        = new Mock <IShoppingCartService>();
            _checkoutAttributeFormatter = new Mock <ICheckoutAttributeFormatter>();
            _customerService            = new Mock <ICustomerService>();
            _encryptionService          = new Mock <IEncryptionService>();
            _workflowMessageService     = new Mock <IWorkflowMessageService>();
            _customerActivityService    = new Mock <ICustomerActivityService>();
            _currencyService            = new Mock <ICurrencyService>();
            _affiliateService           = new Mock <IAffiliateService>();
            _vendorService              = new Mock <IVendorService>();
            _pdfService                 = new Mock <IPdfService>();
            _customNumberFormatter      = new Mock <ICustomNumberFormatter>();
            _rewardPointService         = new Mock <IRewardPointService>();


            _workContext = null;

            //setup

            _storeContext = new Mock <IStoreContext>();
            _store        = new Store {
                Id = 1
            };
            _storeContext.Setup(x => x.CurrentStore).Returns(_store);

            _catalogSettings = new CatalogSettings();
            var cacheManager = new TestCacheManager();

            _currencySettings = new CurrencySettings();

            //price calculation service
            _priceCalcService = new PriceCalculationService(_catalogSettings, _currencySettings, _categoryService.Object,
                                                            _currencyService.Object, _customerService.Object, _discountService.Object, _manufacturerService.Object, _productAttributeParser.Object,
                                                            _productService.Object, cacheManager, _storeContext.Object, _workContext);

            _eventPublisher.Setup(x => x.Publish(It.IsAny <object>()));

            var pluginService = new FakePluginService(_catalogSettings);

            _paymentPluginManager  = new PaymentPluginManager(pluginService, null, _paymentSettings);
            _pickupPluginManager   = new PickupPluginManager(pluginService, _shippingSettings);
            _shippingPluginManager = new ShippingPluginManager(pluginService, _shippingSettings);
            _taxPluginManager      = new TaxPluginManager(pluginService, _taxSettings);

            _shoppingCartSettings = new ShoppingCartSettings();
            //shipping
            _shippingSettings = new ShippingSettings
            {
                ActiveShippingRateComputationMethodSystemNames = new List <string>()
            };
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");

            _logger           = new NullLogger();
            _customerSettings = new CustomerSettings();
            _addressSettings  = new AddressSettings();

            var shippingMethodCountryMappingRepository = new Mock <IRepository <ShippingMethodCountryMapping> >();

            _shippingService = new ShippingService(_addressService.Object,
                                                   _checkoutAttributeParser.Object,
                                                   _countryService.Object,
                                                   _customerService.Object,
                                                   _eventPublisher.Object,
                                                   _genericAttributeService.Object,
                                                   _localizationService.Object,
                                                   _logger,
                                                   _pickupPluginManager,
                                                   _priceCalcService,
                                                   _productAttributeParser.Object,
                                                   _productService.Object,
                                                   _shippingMethodRepository.Object,
                                                   shippingMethodCountryMappingRepository.Object,
                                                   _warehouseRepository.Object,
                                                   _shippingPluginManager,
                                                   _stateProvinceService.Object,
                                                   _storeContext.Object,
                                                   _shippingSettings,
                                                   _shoppingCartSettings);

            //tax
            _taxSettings = new TaxSettings
            {
                ShippingIsTaxable = true,
                PaymentMethodAdditionalFeeIsTaxable = true,
                DefaultTaxAddressId = 10
            };

            _addressService.Setup(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Returns(new Address {
                Id = _taxSettings.DefaultTaxAddressId
            });

            _taxService = new TaxService(_addressSettings,
                                         _customerSettings,
                                         _addressService.Object,
                                         _countryService.Object,
                                         _customerService.Object,
                                         _genericAttributeService.Object,
                                         _geoLookupService.Object,
                                         _logger,
                                         _stateProvinceService.Object,
                                         _storeContext.Object,
                                         _taxPluginManager,
                                         _webHelper.Object,
                                         _workContext,
                                         _shippingSettings,
                                         _taxSettings);

            _rewardPointsSettings = new RewardPointsSettings();

            _recurringPaymentRepository = new Mock <IRepository <RecurringPayment> >();
            var recurringPayments = new List <RecurringPayment>();

            _recurringPaymentRepository.Setup(r => r.Insert(It.IsAny <RecurringPayment>())).Callback((RecurringPayment rph) => recurringPayments.Add(rph));
            _recurringPaymentRepository.Setup(r => r.Table).Returns(recurringPayments.AsQueryable());

            _recurringPaymentHistoryRepository = new Mock <IRepository <RecurringPaymentHistory> >();
            var recurringPaymentHistory = new List <RecurringPaymentHistory>();

            _recurringPaymentHistoryRepository.Setup(r => r.Insert(It.IsAny <RecurringPaymentHistory>())).Callback((RecurringPaymentHistory rph) => recurringPaymentHistory.Add(rph));
            _recurringPaymentHistoryRepository.Setup(r => r.Table).Returns(recurringPaymentHistory.AsQueryable());

            _orderService = new OrderService(_eventPublisher.Object, null, null, null, null, null, null, null, null, _recurringPaymentRepository.Object, _recurringPaymentHistoryRepository.Object, _shipmentService.Object);


            _orderTotalCalcService = new OrderTotalCalculationService(_catalogSettings,
                                                                      _addressService.Object,
                                                                      _checkoutAttributeParser.Object,
                                                                      _customerService.Object,
                                                                      _discountService.Object,
                                                                      _genericAttributeService.Object,
                                                                      _giftCardService.Object,
                                                                      _orderService,
                                                                      _paymentService.Object,
                                                                      _priceCalcService,
                                                                      _productService.Object,
                                                                      _rewardPointService.Object,
                                                                      _shippingPluginManager,
                                                                      _shippingService,
                                                                      _shoppingCartService.Object,
                                                                      _storeContext.Object,
                                                                      _taxService,
                                                                      _workContext,
                                                                      _rewardPointsSettings,
                                                                      _shippingSettings,
                                                                      _shoppingCartSettings,
                                                                      _taxSettings);

            _paymentSettings = new PaymentSettings
            {
                ActivePaymentMethodSystemNames = new List <string>
                {
                    "Payments.TestMethod"
                }
            };
            _orderSettings = new OrderSettings();

            _localizationSettings = new LocalizationSettings();

            _eventPublisher.Setup(x => x.Publish(It.IsAny <object>()));

            _orderProcessingService = new OrderProcessingService(_currencySettings,
                                                                 _addressService.Object,
                                                                 _affiliateService.Object,
                                                                 _checkoutAttributeFormatter.Object,
                                                                 _countryService.Object,
                                                                 _currencyService.Object,
                                                                 _customerActivityService.Object,
                                                                 _customerService.Object,
                                                                 _customNumberFormatter.Object,
                                                                 _discountService.Object,
                                                                 _encryptionService.Object,
                                                                 _eventPublisher.Object,
                                                                 _genericAttributeService.Object,
                                                                 _giftCardService.Object,
                                                                 _languageService.Object,
                                                                 _localizationService.Object,
                                                                 _logger,
                                                                 _orderService,
                                                                 _orderTotalCalcService,
                                                                 _paymentPluginManager,
                                                                 _paymentService.Object,
                                                                 _pdfService.Object,
                                                                 _priceCalcService,
                                                                 _priceFormatter.Object,
                                                                 _productAttributeFormatter.Object,
                                                                 _productAttributeParser.Object,
                                                                 _productService.Object,
                                                                 _rewardPointService.Object,
                                                                 _shipmentService.Object,
                                                                 _shippingPluginManager,
                                                                 _shippingService,
                                                                 _shoppingCartService.Object,
                                                                 _stateProvinceService.Object,
                                                                 _storeContext.Object,
                                                                 _taxService,
                                                                 _vendorService.Object,
                                                                 _webHelper.Object,
                                                                 _workContext,
                                                                 _workflowMessageService.Object,
                                                                 _localizationSettings,
                                                                 _orderSettings,
                                                                 _paymentSettings,
                                                                 _rewardPointsSettings,
                                                                 _shippingSettings,
                                                                 _taxSettings);
        }
Exemplo n.º 14
0
        public new void SetUp()
        {
            _shippingSettings = new ShippingSettings
            {
                UseCubeRootMethod = true,
                ConsiderAssociatedProductsDimensions = true,
                ShipSeparatelyOneItemEach            = false
            };

            _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >();
            _warehouseRepository      = new Mock <IRepository <Warehouse> >();
            _logger = new NullLogger();
            _productAttributeParser  = new Mock <IProductAttributeParser>();
            _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>();

            var cacheManager = new TestCacheManager();

            _productService = new Mock <IProductService>();

            _eventPublisher = new Mock <IEventPublisher>();
            _eventPublisher.Setup(x => x.Publish(It.IsAny <object>()));

            var customerService = new Mock <ICustomerService>();
            var loger           = new Mock <ILogger>();
            var webHelper       = new Mock <IWebHelper>();

            _catalogSettings = new CatalogSettings();
            var pluginService = new PluginService(_catalogSettings, customerService.Object, loger.Object, CommonHelper.DefaultFileProvider, webHelper.Object);

            _pickupPluginManager   = new PickupPluginManager(pluginService, _shippingSettings);
            _shippingPluginManager = new ShippingPluginManager(pluginService, _shippingSettings);

            _localizationService     = new Mock <ILocalizationService>();
            _addressService          = new Mock <IAddressService>();
            _genericAttributeService = new Mock <IGenericAttributeService>();
            _priceCalcService        = new Mock <IPriceCalculationService>();

            _store = new Store {
                Id = 1
            };
            _storeContext = new Mock <IStoreContext>();
            _storeContext.Setup(x => x.CurrentStore).Returns(_store);

            _shoppingCartSettings = new ShoppingCartSettings();

            _shippingService = new ShippingService(_addressService.Object,
                                                   cacheManager,
                                                   _checkoutAttributeParser.Object,
                                                   _eventPublisher.Object,
                                                   _genericAttributeService.Object,
                                                   _localizationService.Object,
                                                   _logger,
                                                   _pickupPluginManager,
                                                   _priceCalcService.Object,
                                                   _productAttributeParser.Object,
                                                   _productService.Object,
                                                   _shippingMethodRepository.Object,
                                                   _warehouseRepository.Object,
                                                   _shippingPluginManager,
                                                   _storeContext.Object,
                                                   _shippingSettings,
                                                   _shoppingCartSettings);
        }
Exemplo n.º 15
0
        public new void SetUp()
        {
            _shippingSettings = new ShippingSettings
            {
                ActiveShippingRateComputationMethodSystemNames = new List <string>()
            };
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");

            _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >();
            _warehouseRepository      = new Mock <IRepository <Warehouse> >();
            _logger = new NullLogger();
            _productAttributeParser  = new Mock <IProductAttributeParser>();
            _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>();

            var cacheManager = new TestCacheManager();

            _productService = new Mock <IProductService>();

            _eventPublisher = new Mock <IEventPublisher>();
            _eventPublisher.Setup(x => x.Publish(It.IsAny <object>()));

            var customerService = new Mock <ICustomerService>();
            var loger           = new Mock <ILogger>();
            var webHelper       = new Mock <IWebHelper>();

            _catalogSettings = new CatalogSettings();
            var pluginService = new PluginService(_catalogSettings, customerService.Object, loger.Object, CommonHelper.DefaultFileProvider, webHelper.Object);

            _pickupPluginManager   = new PickupPluginManager(pluginService, _shippingSettings);
            _shippingPluginManager = new ShippingPluginManager(pluginService, _shippingSettings);

            _localizationService     = new Mock <ILocalizationService>();
            _addressService          = new Mock <IAddressService>();
            _genericAttributeService = new Mock <IGenericAttributeService>();
            _priceCalcService        = new Mock <IPriceCalculationService>();

            _store = new Store {
                Id = 1
            };
            _storeContext = new Mock <IStoreContext>();
            _storeContext.Setup(x => x.CurrentStore).Returns(_store);

            _shoppingCartSettings = new ShoppingCartSettings();

            _shippingService = new ShippingService(_addressService.Object,
                                                   cacheManager,
                                                   _checkoutAttributeParser.Object,
                                                   _eventPublisher.Object,
                                                   _genericAttributeService.Object,
                                                   _localizationService.Object,
                                                   _logger,
                                                   _pickupPluginManager,
                                                   _priceCalcService.Object,
                                                   _productAttributeParser.Object,
                                                   _productService.Object,
                                                   _shippingMethodRepository.Object,
                                                   _warehouseRepository.Object,
                                                   _shippingPluginManager,
                                                   _storeContext.Object,
                                                   _shippingSettings,
                                                   _shoppingCartSettings);
        }