Пример #1
0
 public CheckoutAttributeController(ICheckoutAttributeService checkoutAttributeService,
     ICheckoutAttributeParser checkoutAttributeParser,
     ILanguageService languageService, 
     ILocalizedEntityService localizedEntityService,
     ILocalizationService localizationService,
     ITaxCategoryService taxCategoryService,
     IWorkContext workContext, 
     ICurrencyService currencyService, 
     ICustomerActivityService customerActivityService, 
     CurrencySettings currencySettings,
     IMeasureService measureService, 
     MeasureSettings measureSettings,
     IPermissionService permissionService,
     IStoreService storeService,
     IStoreMappingService storeMappingService)
 {
     this._checkoutAttributeService = checkoutAttributeService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._languageService = languageService;
     this._localizedEntityService = localizedEntityService;
     this._localizationService = localizationService;
     this._taxCategoryService = taxCategoryService;
     this._workContext = workContext;
     this._currencyService = currencyService;
     this._customerActivityService = customerActivityService;
     this._currencySettings = currencySettings;
     this._measureService = measureService;
     this._measureSettings = measureSettings;
     this._permissionService = permissionService;
     this._storeService = storeService;
     this._storeMappingService = storeMappingService;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="workContext">Work context</param>
 /// <param name="storeContext">Store context</param>
 /// <param name="priceCalculationService">Price calculation service</param>
 /// <param name="taxService">Tax service</param>
 /// <param name="shippingService">Shipping service</param>
 /// <param name="paymentService">Payment service</param>
 /// <param name="checkoutAttributeParser">Checkout attribute parser</param>
 /// <param name="discountService">Discount service</param>
 /// <param name="giftCardService">Gift card service</param>
 /// <param name="genericAttributeService">Generic attribute service</param>
 /// <param name="taxSettings">Tax settings</param>
 /// <param name="rewardPointsSettings">Reward points settings</param>
 /// <param name="shippingSettings">Shipping settings</param>
 /// <param name="shoppingCartSettings">Shopping cart settings</param>
 /// <param name="catalogSettings">Catalog settings</param>
 public OrderTotalCalculationService(IWorkContext workContext,
     IStoreContext storeContext,
     IPriceCalculationService priceCalculationService,
     ITaxService taxService,
     IShippingService shippingService,
     IPaymentService paymentService,
     ICheckoutAttributeParser checkoutAttributeParser,
     IDiscountService discountService,
     IGiftCardService giftCardService,
     IGenericAttributeService genericAttributeService,
     TaxSettings taxSettings,
     RewardPointsSettings rewardPointsSettings,
     ShippingSettings shippingSettings,
     ShoppingCartSettings shoppingCartSettings,
     CatalogSettings catalogSettings)
 {
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._priceCalculationService = priceCalculationService;
     this._taxService = taxService;
     this._shippingService = shippingService;
     this._paymentService = paymentService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._discountService = discountService;
     this._giftCardService = giftCardService;
     this._genericAttributeService = genericAttributeService;
     this._taxSettings = taxSettings;
     this._rewardPointsSettings = rewardPointsSettings;
     this._shippingSettings = shippingSettings;
     this._shoppingCartSettings = shoppingCartSettings;
     this._catalogSettings = catalogSettings;
 }
Пример #3
0
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="cacheManager">Cache manager</param>
        /// <param name="shippingMethodRepository">Shipping method repository</param>
        /// <param name="logger">Logger</param>
        /// <param name="productAttributeParser">Product attribute parser</param>
        /// <param name="productService">Product service</param>
        /// <param name="checkoutAttributeParser">Checkout attribute parser</param>
        /// <param name="genericAttributeService">Generic attribute service</param>
        /// <param name="localizationService">Localization service</param>
        /// <param name="shippingSettings">Shipping settings</param>
        /// <param name="pluginFinder">Plugin finder</param>
        /// <param name="eventPublisher">Event published</param>
        /// <param name="shoppingCartSettings">Shopping cart settings</param>
        /// <param name="settingService">Setting service</param>
        public ShippingService(ICacheManager cacheManager, 
            IRepository<ShippingMethod> shippingMethodRepository,
            ILogger logger,
            IProductAttributeParser productAttributeParser,
			IProductService productService,
            ICheckoutAttributeParser checkoutAttributeParser,
			IGenericAttributeService genericAttributeService,
            ILocalizationService localizationService,
            ShippingSettings shippingSettings,
            IPluginFinder pluginFinder,
            IEventPublisher eventPublisher,
            ShoppingCartSettings shoppingCartSettings,
			ISettingService settingService,
			IProviderManager providerManager)
        {
            this._cacheManager = cacheManager;
            this._shippingMethodRepository = shippingMethodRepository;
            this._logger = logger;
            this._productAttributeParser = productAttributeParser;
            this._productService = productService;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._genericAttributeService = genericAttributeService;
            this._localizationService = localizationService;
            this._shippingSettings = shippingSettings;
            this._pluginFinder = pluginFinder;
            this._eventPublisher = eventPublisher;
            this._shoppingCartSettings = shoppingCartSettings;
            this._settingService = settingService;
            this._providerManager = providerManager;
        }
        public CheckoutAttributeFormatter(IWorkContext workContext,
            ICheckoutAttributeService checkoutAttributeService,
            ICheckoutAttributeParser checkoutAttributeParser,
            ICurrencyService currencyService,
            ITaxService taxService,
            IPriceFormatter priceFormatter,
            IDownloadService downloadService,
            IWebHelper webHelper,
            PromoSettings promoSettings,
            IPromoUtilities qixolPromoUtilities,
            IAttributeValueService attributeValueService)
            : base(workContext, checkoutAttributeService, checkoutAttributeParser,
                    currencyService, taxService, priceFormatter,
                    downloadService, webHelper)
        {
            this._workContext = workContext;
            this._checkoutAttributeService = checkoutAttributeService;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._currencyService = currencyService;
            this._taxService = taxService;
            this._priceFormatter = priceFormatter;
            this._downloadService = downloadService;
            this._webHelper = webHelper;

            this._promoSettings = promoSettings;
            this._qixolPromoUtilities = qixolPromoUtilities;
            this._attributeValueService = attributeValueService;
        }
Пример #5
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="sciRepository">Shopping cart repository</param>
 /// <param name="workContext">Work context</param>
 /// <param name="currencyService">Currency service</param>
 /// <param name="productService">Product settings</param>
 /// <param name="localizationService">Localization service</param>
 /// <param name="productAttributeParser">Product attribute parser</param>
 /// <param name="checkoutAttributeService">Checkout attribute service</param>
 /// <param name="checkoutAttributeParser">Checkout attribute parser</param>
 /// <param name="priceFormatter">Price formatter</param>
 /// <param name="customerService">Customer service</param>
 /// <param name="shoppingCartSettings">Shopping cart settings</param>
 /// <param name="eventPublisher">Event publisher</param>
 /// <param name="permissionService">Permission service</param>
 /// <param name="aclService">ACL service</param>
 public ShoppingCartService(IRepository<ShoppingCartItem> sciRepository,
     IWorkContext workContext, ICurrencyService currencyService,
     IProductService productService, ILocalizationService localizationService,
     IProductAttributeParser productAttributeParser,
     ICheckoutAttributeService checkoutAttributeService,
     ICheckoutAttributeParser checkoutAttributeParser,
     IPriceFormatter priceFormatter,
     ICustomerService customerService,
     ShoppingCartSettings shoppingCartSettings,
     IEventPublisher eventPublisher,
     IPermissionService permissionService, 
     IAclService aclService)
 {
     this._sciRepository = sciRepository;
     this._workContext = workContext;
     this._currencyService = currencyService;
     this._productService = productService;
     this._localizationService = localizationService;
     this._productAttributeParser = productAttributeParser;
     this._checkoutAttributeService = checkoutAttributeService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._priceFormatter = priceFormatter;
     this._customerService = customerService;
     this._shoppingCartSettings = shoppingCartSettings;
     this._eventPublisher = eventPublisher;
     this._permissionService = permissionService;
     this._aclService = aclService;
 }
Пример #6
0
        public ShoppingCartController(IProductService productService, IWorkContext workContext,
            IShoppingCartService shoppingCartService, IPictureService pictureService,
            ILocalizationService localizationService, IProductAttributeFormatter productAttributeFormatter,
            ITaxService taxService, ICurrencyService currencyService, 
            IPriceCalculationService priceCalculationService, IPriceFormatter priceFormatter,
            ICheckoutAttributeParser checkoutAttributeParser, ICheckoutAttributeFormatter checkoutAttributeFormatter, 
            IOrderProcessingService orderProcessingService,
            IDiscountService discountService,ICustomerService customerService, 
            IGiftCardService giftCardService, ICountryService countryService,
            IStateProvinceService stateProvinceService, IShippingService shippingService, 
            IOrderTotalCalculationService orderTotalCalculationService,
            ICheckoutAttributeService checkoutAttributeService, IPaymentService paymentService,
            IWorkflowMessageService workflowMessageService,
            IPermissionService permissionService, 
            IDownloadService downloadService,
            MediaSettings mediaSetting, ShoppingCartSettings shoppingCartSettings,
            CatalogSettings catalogSettings, OrderSettings orderSettings,
            ShippingSettings shippingSettings, TaxSettings taxSettings,
            CaptchaSettings captchaSettings)
        {
            this._productService = productService;
            this._workContext = workContext;
            this._shoppingCartService = shoppingCartService;
            this._pictureService = pictureService;
            this._localizationService = localizationService;
            this._productAttributeFormatter = productAttributeFormatter;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceCalculationService = priceCalculationService;
            this._priceFormatter = priceFormatter;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
            this._orderProcessingService = orderProcessingService;
            this._discountService = discountService;
            this._customerService = customerService;
            this._giftCardService = giftCardService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._checkoutAttributeService = checkoutAttributeService;
            this._paymentService = paymentService;
            this._workflowMessageService = workflowMessageService;
            this._permissionService = permissionService;
            this._downloadService = downloadService;

            this._mediaSetting = mediaSetting;
            this._shoppingCartSettings = shoppingCartSettings;
            this._catalogSettings = catalogSettings;
            this._orderSettings = orderSettings;
            this._shippingSettings = shippingSettings;
            this._taxSettings = taxSettings;
            this._captchaSettings = captchaSettings;
        }
 public CheckoutAttributeFormatter(IWorkContext workContext,
     ICheckoutAttributeService checkoutAttributeService,
     ICheckoutAttributeParser checkoutAttributeParser,
     ICurrencyService currencyService,
     ITaxService taxService,
     IPriceFormatter priceFormatter)
 {
     this._workContext = workContext;
     this._checkoutAttributeService = checkoutAttributeService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._currencyService = currencyService;
     this._taxService = taxService;
     this._priceFormatter = priceFormatter;
 }
 public PayPalStandardPaymentProcessor(PayPalStandardPaymentSettings paypalStandardPaymentSettings,
     ISettingService settingService, ICurrencyService currencyService,
     CurrencySettings currencySettings, IWebHelper webHelper,
     ICheckoutAttributeParser checkoutAttributeParser, ITaxService taxService,
     HttpContextBase httpContext)
 {
     this._paypalStandardPaymentSettings = paypalStandardPaymentSettings;
     this._settingService = settingService;
     this._currencyService = currencyService;
     this._currencySettings = currencySettings;
     this._webHelper = webHelper;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._taxService = taxService;
     this._httpContext = httpContext;
 }
 public YenePayPaymentProcessor(YenePayPaymentSettings yenePayPaymentSettings,
     ISettingService settingService, ICurrencyService currencyService,
     CurrencySettings currencySettings, IWebHelper webHelper,
     ICheckoutAttributeParser checkoutAttributeParser, ITaxService taxService, 
     IOrderTotalCalculationService orderTotalCalculationService, HttpContextBase httpContext)
 {
     this._yenePayPaymentSettings = yenePayPaymentSettings;
     this._settingService = settingService;
     this._currencyService = currencyService;
     this._currencySettings = currencySettings;
     this._webHelper = webHelper;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._taxService = taxService;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._httpContext = httpContext;
 }
Пример #10
0
        public new void SetUp()
        {
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");

            _shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
            _deliveryDateRepository = MockRepository.GenerateMock<IRepository<DeliveryDate>>();
            _warehouseRepository = MockRepository.GenerateMock<IRepository<Warehouse>>();
            _logger = new NullLogger();
            _productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
            _checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();

            var cacheManager = new NopNullCache();

            var pluginFinder = new PluginFinder();
            _productService = MockRepository.GenerateMock<IProductService>();

            _eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));

            _localizationService = MockRepository.GenerateMock<ILocalizationService>();
            _addressService = MockRepository.GenerateMock<IAddressService>();
            _genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();

            _store = new Store { Id = 1 };
            _storeContext = MockRepository.GenerateMock<IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            _shoppingCartSettings = new ShoppingCartSettings();
            _shippingService = new ShippingService(_shippingMethodRepository,
                _deliveryDateRepository,
                _warehouseRepository,
                _logger,
                _productService,
                _productAttributeParser,
                _checkoutAttributeParser,
                _genericAttributeService,
                _localizationService,
                _addressService,
                _shippingSettings, 
                pluginFinder,
                _storeContext,
                _eventPublisher,
                _shoppingCartSettings,
                cacheManager);
        }
Пример #11
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="cacheManager">Cache manager</param>
 /// <param name="shippingMethodRepository">Shipping method repository</param>
 /// <param name="logger">Logger</param>
 /// <param name="productAttributeParser">Product attribute parser</param>
 /// <param name="checkoutAttributeParser">Checkout attribute parser</param>
 /// <param name="shippingSettings">Shipping settings</param>
 /// <param name="pluginFinder">Plugin finder</param>
 /// <param name="eventPublisher"></param>
 public ShippingService(ICacheManager cacheManager, 
     IRepository<ShippingMethod> shippingMethodRepository,
     ILogger logger,
     IProductAttributeParser productAttributeParser,
     ICheckoutAttributeParser checkoutAttributeParser,
     ShippingSettings shippingSettings,
     IPluginFinder pluginFinder,
     IEventPublisher eventPublisher)
 {
     _cacheManager = cacheManager;
     _shippingMethodRepository = shippingMethodRepository;
     _logger = logger;
     _productAttributeParser = productAttributeParser;
     _checkoutAttributeParser = checkoutAttributeParser;
     _shippingSettings = shippingSettings;
     _pluginFinder = pluginFinder;
     _eventPublisher = eventPublisher;
 }
Пример #12
0
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="sciRepository">Shopping cart repository</param>
        /// <param name="workContext">Work context</param>
        /// <param name="storeContext">Store context</param>
        /// <param name="currencyService">Currency service</param>
        /// <param name="productService">Product settings</param>
        /// <param name="localizationService">Localization service</param>
        /// <param name="productAttributeParser">Product attribute parser</param>
        /// <param name="checkoutAttributeService">Checkout attribute service</param>
        /// <param name="checkoutAttributeParser">Checkout attribute parser</param>
        /// <param name="priceFormatter">Price formatter</param>
        /// <param name="customerService">Customer service</param>
        /// <param name="shoppingCartSettings">Shopping cart settings</param>
        /// <param name="eventPublisher">Event publisher</param>
        /// <param name="permissionService">Permission service</param>
        /// <param name="aclService">ACL service</param>
        /// <param name="storeMappingService">Store mapping service</param>
        /// <param name="genericAttributeService">Generic attribute service</param>
        public ShoppingCartService(
			IRepository<ShoppingCartItem> sciRepository,
			IWorkContext workContext, 
			IStoreContext storeContext, 
			ICurrencyService currencyService,
            IProductService productService, ILocalizationService localizationService,
            IProductAttributeParser productAttributeParser,
			IProductAttributeService productAttributeService,
            ICheckoutAttributeService checkoutAttributeService,
            ICheckoutAttributeParser checkoutAttributeParser,
            IPriceFormatter priceFormatter,
            ICustomerService customerService,
            ShoppingCartSettings shoppingCartSettings,
            IEventPublisher eventPublisher,
            IPermissionService permissionService, 
            IAclService aclService,
			IStoreMappingService storeMappingService,
			IGenericAttributeService genericAttributeService,
			IDownloadService downloadService,
			CatalogSettings catalogSettings)
        {
            this._sciRepository = sciRepository;
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._currencyService = currencyService;
            this._productService = productService;
            this._localizationService = localizationService;
            this._productAttributeParser = productAttributeParser;
            this._productAttributeService = productAttributeService;
            this._checkoutAttributeService = checkoutAttributeService;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._priceFormatter = priceFormatter;
            this._customerService = customerService;
            this._shoppingCartSettings = shoppingCartSettings;
            this._eventPublisher = eventPublisher;
            this._permissionService = permissionService;
            this._aclService = aclService;
            this._storeMappingService = storeMappingService;
            this._genericAttributeService = genericAttributeService;
            this._downloadService = downloadService;
            this._catalogSettings = catalogSettings;
        }
		private readonly ILocalizationService _localizationService;	// codehint: sm-add
		#endregion

		#region Ctor

		public PayPalStandardPaymentProcessor(PayPalStandardPaymentSettings paypalStandardPaymentSettings,
			ISettingService settingService, ICurrencyService currencyService,
			CurrencySettings currencySettings, IWebHelper webHelper,
			ICheckoutAttributeParser checkoutAttributeParser, ITaxService taxService,
			IOrderTotalCalculationService orderTotalCalculationService, HttpContextBase httpContext,
			ILocalizationService localizationService)
		{
			this._paypalStandardPaymentSettings = paypalStandardPaymentSettings;
			this._settingService = settingService;
			this._currencyService = currencyService;
			this._currencySettings = currencySettings;
			this._webHelper = webHelper;
			this._checkoutAttributeParser = checkoutAttributeParser;
			this._taxService = taxService;
			this._orderTotalCalculationService = orderTotalCalculationService;
			this._httpContext = httpContext;
			this._localizationService = localizationService;	// codehint: sm-add

			_helper = new PluginHelperBase("Payments.PayPalStandard");	// codehint: sm-add
		}
Пример #14
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="sciRepository">Shopping cart repository</param>
 /// <param name="workContext">Work context</param>
 /// <param name="storeContext">Store context</param>
 /// <param name="currencyService">Currency service</param>
 /// <param name="productService">Product settings</param>
 /// <param name="localizationService">Localization service</param>
 /// <param name="productAttributeParser">Product attribute parser</param>
 /// <param name="checkoutAttributeService">Checkout attribute service</param>
 /// <param name="checkoutAttributeParser">Checkout attribute parser</param>
 /// <param name="priceFormatter">Price formatter</param>
 /// <param name="customerService">Customer service</param>
 /// <param name="shoppingCartSettings">Shopping cart settings</param>
 /// <param name="eventPublisher">Event publisher</param>
 /// <param name="permissionService">Permission service</param>
 /// <param name="aclService">ACL service</param>
 /// <param name="storeMappingService">Store mapping service</param>
 /// <param name="genericAttributeService">Generic attribute service</param>
 /// <param name="productAttributeService">Product attribute service</param>
 /// <param name="dateTimeHelper">Datetime helper</param>
 public ShoppingCartService(
     IWorkContext workContext, 
     IStoreContext storeContext,
     ICurrencyService currencyService,
     IProductService productService, 
     ILocalizationService localizationService,
     IProductAttributeParser productAttributeParser,
     ICheckoutAttributeService checkoutAttributeService,
     ICheckoutAttributeParser checkoutAttributeParser,
     IPriceFormatter priceFormatter,
     ICustomerService customerService,
     ShoppingCartSettings shoppingCartSettings,
     IEventPublisher eventPublisher,
     IPermissionService permissionService, 
     IAclService aclService,
     IStoreMappingService storeMappingService,
     IGenericAttributeService genericAttributeService,
     IProductAttributeService productAttributeService,
     IDateTimeHelper dateTimeHelper)
 {
     //this._sciRepository = sciRepository;
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._currencyService = currencyService;
     this._productService = productService;
     this._localizationService = localizationService;
     this._productAttributeParser = productAttributeParser;
     this._checkoutAttributeService = checkoutAttributeService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._priceFormatter = priceFormatter;
     this._customerService = customerService;
     this._shoppingCartSettings = shoppingCartSettings;
     this._eventPublisher = eventPublisher;
     this._permissionService = permissionService;
     this._aclService = aclService;
     this._storeMappingService = storeMappingService;
     this._genericAttributeService = genericAttributeService;
     this._productAttributeService = productAttributeService;
     this._dateTimeHelper = dateTimeHelper;
 }
        public new void SetUp()
        {
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");

            _shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
            _logger = new NullLogger();
            _productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
			_productService = MockRepository.GenerateMock<IProductService>();
            _checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();

            var cacheManager = new NullCache();

            var pluginFinder = new PluginFinder();

            _eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));

            _localizationService = MockRepository.GenerateMock<ILocalizationService>();
			_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
			_settingService = MockRepository.GenerateMock<ISettingService>();

            _shoppingCartSettings = new ShoppingCartSettings();
            _shippingService = new ShippingService(cacheManager, 
                _shippingMethodRepository, 
                _logger,
                _productAttributeParser,
				_productService,
                _checkoutAttributeParser,
				_genericAttributeService,
                _localizationService,
                _shippingSettings, pluginFinder, _eventPublisher,
                _shoppingCartSettings,
				_settingService, 
				this.ProviderManager);
        }
Пример #16
0
        public void TestInitialize()
        {
            //plugin initialization
            new Grand.Services.Tests.ServiceTest().PluginInitializator();

            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");

            _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >().Object;
            _deliveryDateRepository   = new Mock <IRepository <DeliveryDate> >().Object;
            _warehouseRepository      = new Mock <IRepository <Warehouse> >().Object;
            _logger = new NullLogger();
            _productAttributeParser  = new Mock <IProductAttributeParser>().Object;
            _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>().Object;
            _pickupPointRepository   = new Mock <IRepository <PickupPoint> >().Object;

            var cacheManager = new GrandNullCache();

            var pluginFinder = new PluginFinder();

            _productService = new Mock <IProductService>().Object;

            var tempEventPublisher = new Mock <IEventPublisher>();

            {
                tempEventPublisher.Setup(x => x.Publish(It.IsAny <object>()));
                _eventPublisher = tempEventPublisher.Object;
            }

            _localizationService     = new Mock <ILocalizationService>().Object;
            _addressService          = new Mock <IAddressService>().Object;
            _genericAttributeService = new Mock <IGenericAttributeService>().Object;

            _store = new Store {
                Id = "1"
            };
            var tempStoreContext = new Mock <IStoreContext>();

            {
                tempStoreContext.Setup(x => x.CurrentStore).Returns(_store);
                _storeContext = tempStoreContext.Object;
            }

            _shoppingCartSettings = new ShoppingCartSettings();
            _shippingService      = new ShippingService(_shippingMethodRepository,
                                                        _deliveryDateRepository,
                                                        _warehouseRepository,
                                                        _pickupPointRepository,
                                                        _logger,
                                                        _productService,
                                                        _productAttributeParser,
                                                        _checkoutAttributeParser,
                                                        _genericAttributeService,
                                                        _localizationService,
                                                        _addressService,
                                                        _shippingSettings,
                                                        pluginFinder,
                                                        _storeContext,
                                                        _eventPublisher,
                                                        _shoppingCartSettings,
                                                        cacheManager,
                                                        null);
        }
        public new void SetUp()
        {
            _workContext = null;
            _services    = MockRepository.GenerateMock <ICommonServices>();

            _store = new Store()
            {
                Id = 1
            };
            _storeContext = MockRepository.GenerateMock <IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            var pluginFinder = PluginFinder.Current;

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();

            //price calculation service
            _discountService         = MockRepository.GenerateMock <IDiscountService>();
            _categoryService         = MockRepository.GenerateMock <ICategoryService>();
            _manufacturerService     = MockRepository.GenerateMock <IManufacturerService>();
            _productAttributeParser  = MockRepository.GenerateMock <IProductAttributeParser>();
            _productAttributeService = MockRepository.GenerateMock <IProductAttributeService>();
            _genericAttributeService = MockRepository.GenerateMock <IGenericAttributeService>();
            _eventPublisher          = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _localizationService = MockRepository.GenerateMock <ILocalizationService>();
            _settingService      = MockRepository.GenerateMock <ISettingService>();
            _cartRuleProvider    = MockRepository.GenerateMock <ICartRuleProvider>();

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = MockRepository.GenerateMock <IRepository <ShippingMethod> >();
            _storeMappingRepository   = MockRepository.GenerateMock <IRepository <StoreMapping> >();

            _shippingService = new ShippingService(
                _shippingMethodRepository,
                _storeMappingRepository,
                _productAttributeParser,
                _productService,
                _checkoutAttributeParser,
                _genericAttributeService,
                _shippingSettings,
                _settingService,
                this.ProviderManager,
                _services,
                _cartRuleProvider);

            _shipmentService = MockRepository.GenerateMock <IShipmentService>();

            _paymentService          = MockRepository.GenerateMock <IPaymentService>();
            _providerManager         = MockRepository.GenerateMock <IProviderManager>();
            _checkoutAttributeParser = MockRepository.GenerateMock <ICheckoutAttributeParser>();
            _giftCardService         = MockRepository.GenerateMock <IGiftCardService>();

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = 10;

            _addressService = MockRepository.GenerateMock <IAddressService>();
            _addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address()
            {
                Id = _taxSettings.DefaultTaxAddressId
            });
            _downloadService  = MockRepository.GenerateMock <IDownloadService>();
            _httpRequestBase  = MockRepository.GenerateMock <HttpRequestBase>();
            _geoCountryLookup = MockRepository.GenerateMock <IGeoCountryLookup>();

            _taxService = new TaxService(_addressService, _workContext, _taxSettings, _shoppingCartSettings, pluginFinder, _geoCountryLookup, this.ProviderManager);

            _rewardPointsSettings = new RewardPointsSettings();

            _priceCalcService = new PriceCalculationService(_discountService, _categoryService, _manufacturerService, _productAttributeParser, _productService,
                                                            _catalogSettings, _productAttributeService, _downloadService, _services, _httpRequestBase, _taxService, _taxSettings);

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _providerManager,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService, _genericAttributeService, _paymentService, _currencyService, _productAttributeParser,
                                                                      _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);

            _orderService                  = MockRepository.GenerateMock <IOrderService>();
            _webHelper                     = MockRepository.GenerateMock <IWebHelper>();
            _languageService               = MockRepository.GenerateMock <ILanguageService>();
            _productService                = MockRepository.GenerateMock <IProductService>();
            _priceFormatter                = MockRepository.GenerateMock <IPriceFormatter>();
            _productAttributeFormatter     = MockRepository.GenerateMock <IProductAttributeFormatter>();
            _shoppingCartService           = MockRepository.GenerateMock <IShoppingCartService>();
            _checkoutAttributeFormatter    = MockRepository.GenerateMock <ICheckoutAttributeFormatter>();
            _customerService               = MockRepository.GenerateMock <ICustomerService>();
            _encryptionService             = MockRepository.GenerateMock <IEncryptionService>();
            _messageFactory                = MockRepository.GenerateMock <IMessageFactory>();
            _customerActivityService       = MockRepository.GenerateMock <ICustomerActivityService>();
            _currencyService               = MockRepository.GenerateMock <ICurrencyService>();
            _affiliateService              = MockRepository.GenerateMock <IAffiliateService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();
            _affiliateService              = MockRepository.GenerateMock <IAffiliateService>();
            _checkoutAttributeParser       = MockRepository.GenerateMock <ICheckoutAttributeParser>();
            _downloadService               = MockRepository.GenerateMock <IDownloadService>();

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

            _localizationSettings = new LocalizationSettings();

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _orderProcessingService = new OrderProcessingService(_orderService, _webHelper,
                                                                 _localizationService, _languageService,
                                                                 _productService, _paymentService,
                                                                 _orderTotalCalcService, _priceCalcService, _priceFormatter,
                                                                 _productAttributeParser, _productAttributeFormatter,
                                                                 _giftCardService, _shoppingCartService, _checkoutAttributeFormatter, _checkoutAttributeParser,
                                                                 _shippingService, _shipmentService, _taxService,
                                                                 _customerService, _discountService,
                                                                 _encryptionService, _workContext, _storeContext,
                                                                 _messageFactory, _customerActivityService, _currencyService, _affiliateService,
                                                                 _eventPublisher, _genericAttributeService,
                                                                 _newsLetterSubscriptionService, _downloadService,
                                                                 _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings,
                                                                 _shoppingCartSettings,
                                                                 _catalogSettings);
        }
        public new void SetUp()
        {
            _workContext = MockRepository.GenerateMock<IWorkContext>();

            _store = new Store() { Id = 1 };
            _storeContext = MockRepository.GenerateMock<IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            var pluginFinder = new PluginFinder();
            var cacheManager = new NopNullCache();

            //price calculation service
            _discountService = MockRepository.GenerateMock<IDiscountService>();
            _categoryService = MockRepository.GenerateMock<ICategoryService>();
            _productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings = new CatalogSettings();

            _priceCalcService = new PriceCalculationService(_workContext, _discountService,
                _categoryService, _productAttributeParser, _shoppingCartSettings, _catalogSettings);

            _eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));

            _localizationService = MockRepository.GenerateMock<ILocalizationService>();

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
            _logger = new NullLogger();
            _shippingService = new ShippingService(cacheManager,
                _shippingMethodRepository,
                _logger,
                _productAttributeParser,
                _checkoutAttributeParser,
                _genericAttributeService,
                _localizationService,
                _shippingSettings, pluginFinder,
                _eventPublisher, _shoppingCartSettings);

            _paymentService = MockRepository.GenerateMock<IPaymentService>();
            _checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();
            _giftCardService = MockRepository.GenerateMock<IGiftCardService>();
            _genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();

            _eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = 10;
            _addressService = MockRepository.GenerateMock<IAddressService>();
            _addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address() { Id = _taxSettings.DefaultTaxAddressId });
            _taxService = new TaxService(_addressService, _workContext, _taxSettings, pluginFinder);

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                _priceCalcService, _taxService, _shippingService, _paymentService,
                _checkoutAttributeParser, _discountService, _giftCardService, _genericAttributeService,
                _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);
        }
Пример #19
0
 public GetShoppingCartHandler(
     IPaymentService paymentService,
     IProductService productService,
     IPictureService pictureService,
     IProductAttributeParser productAttributeParser,
     ITranslationService translationService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     ICurrencyService currencyService,
     IDiscountService discountService,
     ICheckoutAttributeService checkoutAttributeService,
     IPermissionService permissionService,
     ITaxService taxService,
     IPriceFormatter priceFormatter,
     ICheckoutAttributeParser checkoutAttributeParser,
     IDownloadService downloadService,
     ICountryService countryService,
     IWarehouseService warehouseService,
     IProductAttributeFormatter productAttributeFormatter,
     IPricingService priceCalculationService,
     IDateTimeService dateTimeService,
     IVendorService vendorService,
     IGroupService groupService,
     IMediator mediator,
     IShoppingCartValidator shoppingCartValidator,
     IHttpContextAccessor httpContextAccessor,
     LinkGenerator linkGenerator,
     MediaSettings mediaSettings,
     OrderSettings orderSettings,
     ShoppingCartSettings shoppingCartSettings,
     CatalogSettings catalogSettings,
     ShippingSettings shippingSettings,
     CommonSettings commonSettings)
 {
     _paymentService             = paymentService;
     _productService             = productService;
     _pictureService             = pictureService;
     _productAttributeParser     = productAttributeParser;
     _translationService         = translationService;
     _checkoutAttributeFormatter = checkoutAttributeFormatter;
     _currencyService            = currencyService;
     _discountService            = discountService;
     _checkoutAttributeService   = checkoutAttributeService;
     _permissionService          = permissionService;
     _taxService                = taxService;
     _priceFormatter            = priceFormatter;
     _checkoutAttributeParser   = checkoutAttributeParser;
     _downloadService           = downloadService;
     _countryService            = countryService;
     _warehouseService          = warehouseService;
     _productAttributeFormatter = productAttributeFormatter;
     _pricingService            = priceCalculationService;
     _dateTimeService           = dateTimeService;
     _vendorService             = vendorService;
     _groupService              = groupService;
     _mediator = mediator;
     _shoppingCartValidator = shoppingCartValidator;
     _httpContextAccessor   = httpContextAccessor;
     _linkGenerator         = linkGenerator;
     _mediaSettings         = mediaSettings;
     _orderSettings         = orderSettings;
     _shoppingCartSettings  = shoppingCartSettings;
     _catalogSettings       = catalogSettings;
     _shippingSettings      = shippingSettings;
     _commonSettings        = commonSettings;
 }
        public new void SetUp()
        {
            _workContext = null;

            _store = new Store() { Id = 1 };
            _storeContext = MockRepository.GenerateMock<IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            var pluginFinder = new PluginFinder();

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings = new CatalogSettings();

            var cacheManager = new NopNullCache();

            _productService = MockRepository.GenerateMock<IProductService>();

            //price calculation service
            _discountService = MockRepository.GenerateMock<IDiscountService>();
            _categoryService = MockRepository.GenerateMock<ICategoryService>();
            _productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
            _priceCalcService = new PriceCalculationService(_workContext, _storeContext,
                _discountService, _categoryService,
                _productAttributeParser, _productService,
                cacheManager, _shoppingCartSettings, _catalogSettings);

            _eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));

            _localizationService = MockRepository.GenerateMock<ILocalizationService>();

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
            _deliveryDateRepository = MockRepository.GenerateMock<IRepository<DeliveryDate>>();
            _warehouseRepository = MockRepository.GenerateMock<IRepository<Warehouse>>();
            _logger = new NullLogger();
            _shippingService = new ShippingService(_shippingMethodRepository,
                _deliveryDateRepository,
                _warehouseRepository,
                _logger,
                _productService,
                _productAttributeParser,
                _checkoutAttributeParser,
                _genericAttributeService,
                _localizationService,
                _addressService,
                _shippingSettings,
                pluginFinder,
                _storeContext,
                _eventPublisher,
                _shoppingCartSettings,
                cacheManager);
            _shipmentService = MockRepository.GenerateMock<IShipmentService>();

            _paymentService = MockRepository.GenerateMock<IPaymentService>();
            _checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();
            _giftCardService = MockRepository.GenerateMock<IGiftCardService>();
            _genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = 10;
            _addressService = MockRepository.GenerateMock<IAddressService>();
            _addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address() { Id = _taxSettings.DefaultTaxAddressId });
            _taxService = new TaxService(_addressService, _workContext, _taxSettings, pluginFinder);

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                _priceCalcService, _taxService, _shippingService, _paymentService,
                _checkoutAttributeParser, _discountService, _giftCardService,
                _genericAttributeService,
                _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);

            _orderService = MockRepository.GenerateMock<IOrderService>();
            _webHelper = MockRepository.GenerateMock<IWebHelper>();
            _languageService = MockRepository.GenerateMock<ILanguageService>();
            _priceFormatter= MockRepository.GenerateMock<IPriceFormatter>();
            _productAttributeFormatter= MockRepository.GenerateMock<IProductAttributeFormatter>();
            _shoppingCartService= MockRepository.GenerateMock<IShoppingCartService>();
            _checkoutAttributeFormatter= MockRepository.GenerateMock<ICheckoutAttributeFormatter>();
            _customerService= MockRepository.GenerateMock<ICustomerService>();
            _encryptionService = MockRepository.GenerateMock<IEncryptionService>();
            _workflowMessageService = MockRepository.GenerateMock<IWorkflowMessageService>();
            _customerActivityService = MockRepository.GenerateMock<ICustomerActivityService>();
            _currencyService = MockRepository.GenerateMock<ICurrencyService>();
            _affiliateService = MockRepository.GenerateMock<IAffiliateService>();
            _vendorService = MockRepository.GenerateMock<IVendorService>();
            _pdfService = MockRepository.GenerateMock<IPdfService>();

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

            _localizationSettings = new LocalizationSettings();

            _eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));

            _currencySettings = new CurrencySettings();

            _orderProcessingService = new OrderProcessingService(_orderService, _webHelper,
                _localizationService, _languageService,
                _productService, _paymentService, _logger,
                _orderTotalCalcService, _priceCalcService, _priceFormatter,
                _productAttributeParser, _productAttributeFormatter,
                _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                _shippingService, _shipmentService, _taxService,
                _customerService, _discountService,
                _encryptionService, _workContext,
                _workflowMessageService, _vendorService,
                _customerActivityService, _currencyService, _affiliateService,
                _eventPublisher,_pdfService, _paymentSettings, _rewardPointsSettings,
                _orderSettings, _taxSettings, _localizationSettings,
                _currencySettings);
        }
Пример #21
0
 public OverriddenShoppingCartModelFactory(AddressSettings addressSettings,
                                           CaptchaSettings captchaSettings,
                                           CatalogSettings catalogSettings,
                                           CommonSettings commonSettings,
                                           CustomerSettings customerSettings,
                                           IAddressModelFactory addressModelFactory,
                                           ICheckoutAttributeFormatter checkoutAttributeFormatter,
                                           ICheckoutAttributeParser checkoutAttributeParser,
                                           ICheckoutAttributeService checkoutAttributeService,
                                           ICountryService countryService,
                                           ICurrencyService currencyService,
                                           ICustomerService customerService,
                                           IDiscountService discountService,
                                           IDownloadService downloadService,
                                           IGenericAttributeService genericAttributeService,
                                           IGiftCardService giftCardService,
                                           IHttpContextAccessor httpContextAccessor,
                                           ILocalizationService localizationService,
                                           IOrderProcessingService orderProcessingService,
                                           IOrderTotalCalculationService orderTotalCalculationService,
                                           IPaymentService paymentService,
                                           IPermissionService permissionService,
                                           IPictureService pictureService,
                                           IPriceCalculationService priceCalculationService,
                                           IPriceFormatter priceFormatter,
                                           IProductAttributeFormatter productAttributeFormatter,
                                           IProductService productService,
                                           IShippingService shippingService,
                                           IShoppingCartService shoppingCartService,
                                           IStateProvinceService stateProvinceService,
                                           IStaticCacheManager cacheManager,
                                           IStoreContext storeContext,
                                           ITaxService taxService,
                                           IUrlRecordService urlRecordService,
                                           IVendorService vendorService,
                                           IWebHelper webHelper,
                                           IWorkContext workContext,
                                           MediaSettings mediaSettings,
                                           OrderSettings orderSettings,
                                           RewardPointsSettings rewardPointsSettings,
                                           ShippingSettings shippingSettings,
                                           ShoppingCartSettings shoppingCartSettings,
                                           TaxSettings taxSettings,
                                           VendorSettings vendorSettings) : base(addressSettings,
                                                                                 captchaSettings,
                                                                                 catalogSettings,
                                                                                 commonSettings,
                                                                                 customerSettings,
                                                                                 addressModelFactory,
                                                                                 checkoutAttributeFormatter,
                                                                                 checkoutAttributeParser,
                                                                                 checkoutAttributeService,
                                                                                 countryService,
                                                                                 currencyService,
                                                                                 customerService,
                                                                                 discountService,
                                                                                 downloadService,
                                                                                 genericAttributeService,
                                                                                 giftCardService,
                                                                                 httpContextAccessor,
                                                                                 localizationService,
                                                                                 orderProcessingService,
                                                                                 orderTotalCalculationService,
                                                                                 paymentService,
                                                                                 permissionService,
                                                                                 pictureService,
                                                                                 priceCalculationService,
                                                                                 priceFormatter,
                                                                                 productAttributeFormatter,
                                                                                 productService,
                                                                                 shippingService,
                                                                                 shoppingCartService,
                                                                                 stateProvinceService,
                                                                                 cacheManager,
                                                                                 storeContext,
                                                                                 taxService,
                                                                                 urlRecordService,
                                                                                 vendorService,
                                                                                 webHelper,
                                                                                 workContext,
                                                                                 mediaSettings,
                                                                                 orderSettings,
                                                                                 rewardPointsSettings,
                                                                                 shippingSettings,
                                                                                 shoppingCartSettings,
                                                                                 taxSettings,
                                                                                 vendorSettings)
 {
     this._countryService               = countryService;
     this._currencyService              = currencyService;
     this._genericAttributeService      = genericAttributeService;
     this._giftCardService              = giftCardService;
     this._httpContextAccessor          = httpContextAccessor;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._paymentService               = paymentService;
     this._priceCalculationService      = priceCalculationService;
     this._priceFormatter               = priceFormatter;
     this._shoppingCartService          = shoppingCartService;
     this._stateProvinceService         = stateProvinceService;
     this._storeContext         = storeContext;
     this._taxService           = taxService;
     this._workContext          = workContext;
     this._rewardPointsSettings = rewardPointsSettings;
     this._shippingSettings     = shippingSettings;
     this._taxSettings          = taxSettings;
 }
Пример #22
0
        public void TestInitialize()
        {
            _workContext = null;

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

            var pluginFinder = new PluginFinder(_serviceProvider);

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();

            var tempEventPublisher = new Mock <IMediator>();
            {
                //tempEventPublisher.Setup(x => x.PublishAsync(It.IsAny<object>()));
                _eventPublisher = tempEventPublisher.Object;
            }
            var cacheManager = new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher);

            _productService = new Mock <IProductService>().Object;

            //price calculation service
            _discountService           = new Mock <IDiscountService>().Object;
            _categoryService           = new Mock <ICategoryService>().Object;
            _manufacturerService       = new Mock <IManufacturerService>().Object;
            _customerService           = new Mock <ICustomerService>().Object;
            _productReservationService = new Mock <IProductReservationService>().Object;
            _currencyService           = new Mock <ICurrencyService>().Object;
            _auctionService            = new Mock <IAuctionService>().Object;
            _serviceProvider           = new Mock <IServiceProvider>().Object;
            _stateProvinceService      = new Mock <IStateProvinceService>().Object;

            _productAttributeParser = new Mock <IProductAttributeParser>().Object;
            _priceCalcService       = new PriceCalculationService(_workContext, _storeContext,
                                                                  _discountService, _categoryService, _manufacturerService,
                                                                  _productAttributeParser, _productService, _customerService,
                                                                  cacheManager, _vendorService, _currencyService, _shoppingCartSettings, _catalogSettings);



            _localizationService = new Mock <ILocalizationService>().Object;

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >().Object;
            _deliveryDateRepository   = new Mock <IRepository <DeliveryDate> >().Object;
            _warehouseRepository      = new Mock <IRepository <Warehouse> >().Object;

            _logger          = new NullLogger();
            _shippingService = new ShippingService(_shippingMethodRepository,
                                                   _deliveryDateRepository,
                                                   _warehouseRepository,
                                                   null,
                                                   _logger,
                                                   _productService,
                                                   _productAttributeParser,
                                                   _checkoutAttributeParser,
                                                   _localizationService,
                                                   _addressService,
                                                   _countryService,
                                                   _stateProvinceService,
                                                   pluginFinder,
                                                   _storeContext,
                                                   _eventPublisher,
                                                   _currencyService,
                                                   cacheManager,
                                                   null,
                                                   _shoppingCartSettings,
                                                   _shippingSettings);
            _shipmentService = new Mock <IShipmentService>().Object;

            tempPaymentService = new Mock <IPaymentService>();
            {
                _paymentService = tempPaymentService.Object;
            }
            _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>().Object;
            _giftCardService         = new Mock <IGiftCardService>().Object;
            _genericAttributeService = new Mock <IGenericAttributeService>().Object;

            _geoLookupService = new Mock <IGeoLookupService>().Object;
            _countryService   = new Mock <ICountryService>().Object;
            _customerSettings = new CustomerSettings();
            _addressSettings  = new AddressSettings();

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

            var tempAddressService = new Mock <IAddressService>();

            {
                tempAddressService.Setup(x => x.GetAddressByIdSettings(_taxSettings.DefaultTaxAddressId))
                .ReturnsAsync(new Address {
                    Id = _taxSettings.DefaultTaxAddressId
                });
                _addressService = tempAddressService.Object;
            }

            _taxService = new TaxService(_addressService, _workContext, _taxSettings,
                                         pluginFinder, _geoLookupService, _countryService, _serviceProvider, _logger, _customerSettings, _addressSettings);

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      _genericAttributeService, null, _productService, _currencyService,
                                                                      _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);

            _orderService               = new Mock <IOrderService>().Object;
            _webHelper                  = new Mock <IWebHelper>().Object;
            _languageService            = new Mock <ILanguageService>().Object;
            _priceFormatter             = new Mock <IPriceFormatter>().Object;
            _productAttributeFormatter  = new Mock <IProductAttributeFormatter>().Object;
            _shoppingCartService        = new Mock <IShoppingCartService>().Object;
            _checkoutAttributeFormatter = new Mock <ICheckoutAttributeFormatter>().Object;
            _encryptionService          = new Mock <IEncryptionService>().Object;
            _workflowMessageService     = new Mock <IWorkflowMessageService>().Object;
            _customerActivityService    = new Mock <ICustomerActivityService>().Object;
            _currencyService            = new Mock <ICurrencyService>().Object;
            _affiliateService           = new Mock <IAffiliateService>().Object;
            _vendorService              = new Mock <IVendorService>().Object;
            _pdfService                 = new Mock <IPdfService>().Object;

            _paymentSettings = new PaymentSettings
            {
                ActivePaymentMethodSystemNames = new List <string>
                {
                    "Payments.TestMethod"
                }
            };
            _orderSettings        = new OrderSettings();
            _localizationSettings = new LocalizationSettings();
            ICustomerActionEventService tempICustomerActionEventService = new Mock <ICustomerActionEventService>().Object;

            _orderProcessingService = new OrderProcessingService(_orderService, _webHelper,
                                                                 _localizationService, _languageService,
                                                                 _productService, _paymentService, _logger,
                                                                 _orderTotalCalcService, _priceCalcService, _priceFormatter,
                                                                 _productAttributeParser, _productAttributeFormatter,
                                                                 _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                                                                 _shippingService, _shipmentService, _taxService,
                                                                 _customerService, _discountService,
                                                                 _encryptionService, _workContext,
                                                                 _workflowMessageService, _vendorService,
                                                                 _customerActivityService, tempICustomerActionEventService,
                                                                 _currencyService, _affiliateService,
                                                                 _eventPublisher, _pdfService, null, null, _storeContext, _productReservationService, _auctionService, _genericAttributeService, _serviceProvider,
                                                                 _shippingSettings, _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings);
        }
        public new void SetUp()
        {
            #region Test data

            //color (dropdownlist)
            ca1 = new CheckoutAttribute
            {
                Id                   = 1,
                Name                 = "Color",
                TextPrompt           = "Select color:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.DropdownList,
                DisplayOrder         = 1
            };
            cav1_1 = new CheckoutAttributeValue
            {
                Id                  = 11,
                Name                = "Green",
                DisplayOrder        = 1,
                CheckoutAttribute   = ca1,
                CheckoutAttributeId = ca1.Id
            };
            cav1_2 = new CheckoutAttributeValue
            {
                Id                  = 12,
                Name                = "Red",
                DisplayOrder        = 2,
                CheckoutAttribute   = ca1,
                CheckoutAttributeId = ca1.Id
            };
            ca1.CheckoutAttributeValues.Add(cav1_1);
            ca1.CheckoutAttributeValues.Add(cav1_2);

            //custom option (checkboxes)
            ca2 = new CheckoutAttribute
            {
                Id                   = 2,
                Name                 = "Custom option",
                TextPrompt           = "Select custom option:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Checkboxes,
                DisplayOrder         = 2
            };
            cav2_1 = new CheckoutAttributeValue
            {
                Id                  = 21,
                Name                = "Option 1",
                DisplayOrder        = 1,
                CheckoutAttribute   = ca2,
                CheckoutAttributeId = ca2.Id
            };
            cav2_2 = new CheckoutAttributeValue
            {
                Id                  = 22,
                Name                = "Option 2",
                DisplayOrder        = 2,
                CheckoutAttribute   = ca2,
                CheckoutAttributeId = ca2.Id
            };
            ca2.CheckoutAttributeValues.Add(cav2_1);
            ca2.CheckoutAttributeValues.Add(cav2_2);

            //custom text
            ca3 = new CheckoutAttribute
            {
                Id                   = 3,
                Name                 = "Custom text",
                TextPrompt           = "Enter custom text:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.MultilineTextbox,
                DisplayOrder         = 3
            };


            #endregion

            _checkoutAttributeRepo = new Mock <IRepository <CheckoutAttribute> >();
            _checkoutAttributeRepo.Setup(x => x.Table).Returns(new List <CheckoutAttribute> {
                ca1, ca2, ca3
            }.AsQueryable());
            _checkoutAttributeRepo.Setup(x => x.GetById(ca1.Id)).Returns(ca1);
            _checkoutAttributeRepo.Setup(x => x.GetById(ca2.Id)).Returns(ca2);
            _checkoutAttributeRepo.Setup(x => x.GetById(ca3.Id)).Returns(ca3);

            _checkoutAttributeValueRepo = new Mock <IRepository <CheckoutAttributeValue> >();
            _checkoutAttributeValueRepo.Setup(x => x.Table).Returns(new List <CheckoutAttributeValue> {
                cav1_1, cav1_2, cav2_1, cav2_2
            }.AsQueryable());
            _checkoutAttributeValueRepo.Setup(x => x.GetById(cav1_1.Id)).Returns(cav1_1);
            _checkoutAttributeValueRepo.Setup(x => x.GetById(cav1_2.Id)).Returns(cav1_2);
            _checkoutAttributeValueRepo.Setup(x => x.GetById(cav2_1.Id)).Returns(cav2_1);
            _checkoutAttributeValueRepo.Setup(x => x.GetById(cav2_2.Id)).Returns(cav2_2);

            var cacheManager = new TestCacheManager();

            _storeMappingService = new Mock <IStoreMappingService>();

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

            _checkoutAttributeService = new CheckoutAttributeService(cacheManager, _eventPublisher.Object,
                                                                     _checkoutAttributeRepo.Object, _checkoutAttributeValueRepo.Object, _storeMappingService.Object);

            _checkoutAttributeParser = new CheckoutAttributeParser(_checkoutAttributeService);

            var workingLanguage = new Language();
            _workContext = new Mock <IWorkContext>();
            _workContext.Setup(x => x.WorkingLanguage).Returns(workingLanguage);
            _currencyService     = new Mock <ICurrencyService>();
            _taxService          = new Mock <ITaxService>();
            _priceFormatter      = new Mock <IPriceFormatter>();
            _downloadService     = new Mock <IDownloadService>();
            _webHelper           = new Mock <IWebHelper>();
            _localizationService = TestLocalizationService.Init();

            //_localizationService.Setup(ls=>ls.GetLocalized(It.IsAny<CheckoutAttribute>(), attribute => attribute.Name, It.IsAny<int?>(), true, true)).Returns()

            _checkoutAttributeFormatter = new CheckoutAttributeFormatter(_checkoutAttributeParser,
                                                                         _checkoutAttributeService, _currencyService.Object, _downloadService.Object, _localizationService,
                                                                         _priceFormatter.Object, _taxService.Object, _webHelper.Object, _workContext.Object);
        }
        public new void SetUp()
        {
            #region Test data

            //color (dropdownlist)
            ca1 = new CheckoutAttribute
            {
                Id                   = 1,
                Name                 = "Color",
                TextPrompt           = "Select color:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.DropdownList,
                DisplayOrder         = 1,
            };
            cav1_1 = new CheckoutAttributeValue
            {
                Id                  = 11,
                Name                = "Green",
                DisplayOrder        = 1,
                CheckoutAttribute   = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            cav1_2 = new CheckoutAttributeValue
            {
                Id                  = 12,
                Name                = "Red",
                DisplayOrder        = 2,
                CheckoutAttribute   = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            ca1.CheckoutAttributeValues.Add(cav1_1);
            ca1.CheckoutAttributeValues.Add(cav1_2);

            //custom option (checkboxes)
            ca2 = new CheckoutAttribute
            {
                Id                   = 2,
                Name                 = "Custom option",
                TextPrompt           = "Select custom option:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Checkboxes,
                DisplayOrder         = 2,
            };
            cav2_1 = new CheckoutAttributeValue
            {
                Id                  = 21,
                Name                = "Option 1",
                DisplayOrder        = 1,
                CheckoutAttribute   = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            cav2_2 = new CheckoutAttributeValue
            {
                Id                  = 22,
                Name                = "Option 2",
                DisplayOrder        = 2,
                CheckoutAttribute   = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            ca2.CheckoutAttributeValues.Add(cav2_1);
            ca2.CheckoutAttributeValues.Add(cav2_2);

            //custom text
            ca3 = new CheckoutAttribute
            {
                Id                   = 3,
                Name                 = "Custom text",
                TextPrompt           = "Enter custom text:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.MultilineTextbox,
                DisplayOrder         = 3,
            };


            #endregion

            _checkoutAttributeRepo = MockRepository.GenerateMock <IRepository <CheckoutAttribute> >();
            _checkoutAttributeRepo.Expect(x => x.Table).Return(new List <CheckoutAttribute> {
                ca1, ca2, ca3
            }.AsQueryable());
            _checkoutAttributeRepo.Expect(x => x.GetById(ca1.Id)).Return(ca1);
            _checkoutAttributeRepo.Expect(x => x.GetById(ca2.Id)).Return(ca2);
            _checkoutAttributeRepo.Expect(x => x.GetById(ca3.Id)).Return(ca3);

            _checkoutAttributeValueRepo = MockRepository.GenerateMock <IRepository <CheckoutAttributeValue> >();
            _checkoutAttributeValueRepo.Expect(x => x.Table).Return(new List <CheckoutAttributeValue> {
                cav1_1, cav1_2, cav2_1, cav2_2
            }.AsQueryable());
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav1_1.Id)).Return(cav1_1);
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav1_2.Id)).Return(cav1_2);
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav2_1.Id)).Return(cav2_1);
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav2_2.Id)).Return(cav2_2);

            var cacheManager = new SiteNullCache();

            _storeMappingService = MockRepository.GenerateMock <IStoreMappingService>();

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _checkoutAttributeService = new CheckoutAttributeService(cacheManager,
                                                                     _checkoutAttributeRepo,
                                                                     _checkoutAttributeValueRepo,
                                                                     _storeMappingService,
                                                                     _eventPublisher);

            _checkoutAttributeParser = new CheckoutAttributeParser(_checkoutAttributeService);



            var workingLanguage = new Language();
            _workContext = MockRepository.GenerateMock <IWorkContext>();
            _workContext.Expect(x => x.WorkingLanguage).Return(workingLanguage);
            _currencyService = MockRepository.GenerateMock <ICurrencyService>();
            _taxService      = MockRepository.GenerateMock <ITaxService>();
            _priceFormatter  = MockRepository.GenerateMock <IPriceFormatter>();
            _downloadService = MockRepository.GenerateMock <IDownloadService>();
            _webHelper       = MockRepository.GenerateMock <IWebHelper>();

            _checkoutAttributeFormatter = new CheckoutAttributeFormatter(_workContext,
                                                                         _checkoutAttributeService,
                                                                         _checkoutAttributeParser,
                                                                         _currencyService,
                                                                         _taxService,
                                                                         _priceFormatter,
                                                                         _downloadService,
                                                                         _webHelper);
        }
 public KlarnaCheckoutHelper(
     IWorkContext workContext,
     IStoreContext storeContext,
     IOrderTotalCalculationService orderTotalCalculationService,
     ILocalizationService localizationService,
     IProductAttributeParser productAttributeParser,
     ITaxService taxService,
     IPriceCalculationService priceCalculationService,
     ICurrencyService currencyService,
     IGenericAttributeService genericAttributeService,
     ICheckoutAttributeParser checkoutAttributeParser,
     KlarnaCheckoutSettings klarnaSettings
     )
 {
     _workContext = workContext;
     _storeContext = storeContext;
     _orderTotalCalculationService = orderTotalCalculationService;
     _localizationService = localizationService;
     _productAttributeParser = productAttributeParser;
     _taxService = taxService;
     _priceCalculationService = priceCalculationService;
     _currencyService = currencyService;
     _genericAttributeService = genericAttributeService;
     _checkoutAttributeParser = checkoutAttributeParser;
     _klarnaSettings = klarnaSettings;
 }
Пример #26
0
        public void SetUp()
        {
            _workContext = null;

            _store = new Store {
                Id = 1
            };
            _storeContext = MockRepository.GenerateMock <IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            var pluginFinder = new PluginFinder();

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();

            var cacheManager = new NopNullCache();

            _productService = MockRepository.GenerateMock <IProductService>();

            //price calculation service
            _discountService        = MockRepository.GenerateMock <IDiscountService>();
            _categoryService        = MockRepository.GenerateMock <ICategoryService>();
            _productAttributeParser = MockRepository.GenerateMock <IProductAttributeParser>();
            _priceCalcService       = new PriceCalculationService(_workContext, _storeContext,
                                                                  _discountService, _categoryService,
                                                                  _productAttributeParser, _productService,
                                                                  cacheManager, _shoppingCartSettings, _catalogSettings);

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _localizationService = MockRepository.GenerateMock <ILocalizationService>();

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = MockRepository.GenerateMock <IRepository <ShippingMethod> >();
            _deliveryDateRepository   = MockRepository.GenerateMock <IRepository <DeliveryDate> >();
            _warehouseRepository      = MockRepository.GenerateMock <IRepository <Warehouse> >();
            _logger          = new NullLogger();
            _shippingService = new ShippingService(_shippingMethodRepository,
                                                   _deliveryDateRepository,
                                                   _warehouseRepository,
                                                   _logger,
                                                   _productService,
                                                   _productAttributeParser,
                                                   _checkoutAttributeParser,
                                                   _genericAttributeService,
                                                   _localizationService,
                                                   _addressService,
                                                   _shippingSettings,
                                                   pluginFinder,
                                                   _storeContext,
                                                   _eventPublisher,
                                                   _shoppingCartSettings,
                                                   cacheManager);
            _shipmentService = MockRepository.GenerateMock <IShipmentService>();


            _paymentService          = MockRepository.GenerateMock <IPaymentService>();
            _checkoutAttributeParser = MockRepository.GenerateMock <ICheckoutAttributeParser>();
            _giftCardService         = MockRepository.GenerateMock <IGiftCardService>();
            _genericAttributeService = MockRepository.GenerateMock <IGenericAttributeService>();

            _geoLookupService = MockRepository.GenerateMock <IGeoLookupService>();
            _countryService   = MockRepository.GenerateMock <ICountryService>();
            _customerSettings = new CustomerSettings();
            _addressSettings  = new AddressSettings();

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = 10;
            _addressService = MockRepository.GenerateMock <IAddressService>();
            _addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address {
                Id = _taxSettings.DefaultTaxAddressId
            });
            _taxService = new TaxService(_addressService, _workContext, _taxSettings,
                                         pluginFinder, _geoLookupService, _countryService, _customerSettings, _addressSettings);

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      _genericAttributeService,
                                                                      _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);

            _orderService               = MockRepository.GenerateMock <IOrderService>();
            _webHelper                  = MockRepository.GenerateMock <IWebHelper>();
            _languageService            = MockRepository.GenerateMock <ILanguageService>();
            _priceFormatter             = MockRepository.GenerateMock <IPriceFormatter>();
            _productAttributeFormatter  = MockRepository.GenerateMock <IProductAttributeFormatter>();
            _shoppingCartService        = MockRepository.GenerateMock <IShoppingCartService>();
            _checkoutAttributeFormatter = MockRepository.GenerateMock <ICheckoutAttributeFormatter>();
            _customerService            = MockRepository.GenerateMock <ICustomerService>();
            _encryptionService          = MockRepository.GenerateMock <IEncryptionService>();
            _workflowMessageService     = MockRepository.GenerateMock <IWorkflowMessageService>();
            _customerActivityService    = MockRepository.GenerateMock <ICustomerActivityService>();
            _currencyService            = MockRepository.GenerateMock <ICurrencyService>();
            _affiliateService           = MockRepository.GenerateMock <IAffiliateService>();
            _vendorService              = MockRepository.GenerateMock <IVendorService>();
            _pdfService                 = MockRepository.GenerateMock <IPdfService>();

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

            _localizationSettings = new LocalizationSettings();

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _currencySettings = new CurrencySettings();

            _originalOrderProcessingService = new Nop.Services.Orders.OrderProcessingService
                                              (
                _orderService, _webHelper,
                _localizationService, _languageService,
                _productService, _paymentService, _logger,
                _orderTotalCalcService, _priceCalcService, _priceFormatter,
                _productAttributeParser, _productAttributeFormatter,
                _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                _shippingService, _shipmentService, _taxService,
                _customerService, _discountService,
                _encryptionService, _workContext,
                _workflowMessageService, _vendorService,
                _customerActivityService, _currencyService, _affiliateService,
                _eventPublisher, _pdfService,
                _shippingSettings, _paymentSettings, _rewardPointsSettings,
                _orderSettings, _taxSettings, _localizationSettings,
                _currencySettings
                                              );

            _orderProcessingService = new AllSystemsGo.Plugin.FixDownloadableProductOrderStatus.OrderProcessingService
                                      (
                _orderService, _webHelper,
                _localizationService, _languageService,
                _productService, _paymentService, _logger,
                _orderTotalCalcService, _priceCalcService, _priceFormatter,
                _productAttributeParser, _productAttributeFormatter,
                _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                _shippingService, _shipmentService, _taxService,
                _customerService, _discountService,
                _encryptionService, _workContext,
                _workflowMessageService, _vendorService,
                _customerActivityService, _currencyService, _affiliateService,
                _eventPublisher, _pdfService,
                _shippingSettings, _paymentSettings, _rewardPointsSettings,
                _orderSettings, _taxSettings, _localizationSettings,
                _currencySettings
                                      );
        }
 public PostFilters(
     IShoppingCartModelFactory shoppingCartModelFactory,
     IPluginFinder pluginFinder,
     IProductService productService,
     IStoreContext storeContext,
     IWorkContext workContext,
     IShoppingCartService shoppingCartService,
     IPictureService pictureService,
     ILocalizationService localizationService,
     IProductAttributeService productAttributeService,
     IProductAttributeFormatter productAttributeFormatter,
     IProductAttributeParser productAttributeParser,
     ITaxService taxService, ICurrencyService currencyService,
     IPriceCalculationService priceCalculationService,
     IPriceFormatter priceFormatter,
     ICheckoutAttributeParser checkoutAttributeParser,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     IOrderProcessingService orderProcessingService,
     IDiscountService discountService,
     ICustomerService customerService,
     IGiftCardService giftCardService,
     IDateRangeService dateRangeService,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     IShippingService shippingService,
     IOrderTotalCalculationService orderTotalCalculationService,
     ICheckoutAttributeService checkoutAttributeService,
     IPaymentService paymentService,
     IWorkflowMessageService workflowMessageService,
     IPermissionService permissionService,
     IDownloadService downloadService,
     ICacheManager cacheManager,
     IWebHelper webHelper,
     ICustomerActivityService customerActivityService,
     IGenericAttributeService genericAttributeService,
     IAddressAttributeFormatter addressAttributeFormatter,
     HttpContextBase httpContext,
     MediaSettings mediaSettings,
     ShoppingCartSettings shoppingCartSettings,
     CatalogSettings catalogSettings,
     OrderSettings orderSettings,
     ShippingSettings shippingSettings,
     TaxSettings taxSettings,
     CaptchaSettings captchaSettings,
     AddressSettings addressSettings,
     RewardPointsSettings rewardPointsSettings,
     CustomerSettings customerSettings)
 {
     this._storeContext           = storeContext;
     this._pluginFinder           = pluginFinder;
     this._productAttributeParser = productAttributeParser;
     this._productService         = productService;
     this._workContext            = workContext;
     this._shoppingCartModel      = new ShoppingCartModelExtension(
         shoppingCartModelFactory,
         pluginFinder,
         productService,
         storeContext,
         workContext,
         shoppingCartService,
         pictureService,
         localizationService,
         productAttributeService,
         productAttributeFormatter,
         productAttributeParser,
         taxService,
         currencyService,
         priceCalculationService,
         priceFormatter,
         checkoutAttributeParser,
         checkoutAttributeFormatter,
         orderProcessingService,
         discountService,
         customerService,
         giftCardService,
         dateRangeService,
         countryService,
         stateProvinceService,
         shippingService,
         orderTotalCalculationService,
         checkoutAttributeService,
         paymentService,
         workflowMessageService,
         permissionService,
         downloadService,
         cacheManager,
         webHelper,
         customerActivityService,
         genericAttributeService,
         addressAttributeFormatter,
         httpContext,
         mediaSettings,
         shoppingCartSettings,
         catalogSettings,
         orderSettings,
         shippingSettings,
         taxSettings,
         captchaSettings,
         addressSettings,
         rewardPointsSettings,
         customerSettings);
 }
Пример #28
0
        public new void SetUp()
        {
            _workContext = null;

            var pluginFinder = new PluginFinder(new AppDomainTypeFinder());
            var cacheManager = new NopNullCache();

            //price calculation service
            _discountService        = MockRepository.GenerateMock <IDiscountService>();
            _categoryService        = MockRepository.GenerateMock <ICategoryService>();
            _productAttributeParser = MockRepository.GenerateMock <IProductAttributeParser>();

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();

            _priceCalcService = new PriceCalculationService(_workContext, _discountService,
                                                            _categoryService, _productAttributeParser, _shoppingCartSettings, _catalogSettings);

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = MockRepository.GenerateMock <IRepository <ShippingMethod> >();
            _logger          = new NullLogger();
            _shippingService = new ShippingService(cacheManager,
                                                   _shippingMethodRepository,
                                                   _logger,
                                                   _productAttributeParser,
                                                   _checkoutAttributeParser,
                                                   _shippingSettings, pluginFinder, _eventPublisher);


            _paymentService          = MockRepository.GenerateMock <IPaymentService>();
            _checkoutAttributeParser = MockRepository.GenerateMock <ICheckoutAttributeParser>();
            _giftCardService         = MockRepository.GenerateMock <IGiftCardService>();

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = 10;
            _addressService = MockRepository.GenerateMock <IAddressService>();
            _addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address()
            {
                Id = _taxSettings.DefaultTaxAddressId
            });
            _taxService = new TaxService(_addressService, _workContext, _taxSettings, pluginFinder, _eventPublisher);

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);
        }
        public void TestInitialize()
        {
            new Grand.Services.Tests.ServiceTest().PluginInitializator();

            _workContext = new Mock <IWorkContext>().Object;

            _store = new Store {
                Id = "1"
            };
            var tempStoreContext = new Mock <IStoreContext>();

            {
                tempStoreContext.Setup(x => x.CurrentStore).Returns(_store);
                _storeContext = tempStoreContext.Object;
            }

            _productService = new Mock <IProductService>().Object;

            var pluginFinder = new PluginFinder();
            var cacheManager = new NopNullCache();

            _discountService        = new Mock <IDiscountService>().Object;
            _categoryService        = new Mock <ICategoryService>().Object;
            _manufacturerService    = new Mock <IManufacturerService>().Object;
            _productAttributeParser = new Mock <IProductAttributeParser>().Object;
            _vendorService          = new Mock <IVendorService>().Object;
            _storeService           = new Mock <IStoreService>().Object;

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();

            _priceCalcService = new PriceCalculationService(_workContext, _storeContext,
                                                            _discountService, _categoryService,
                                                            _manufacturerService, _productAttributeParser,
                                                            _productService, cacheManager, _vendorService, _storeService,
                                                            _shoppingCartSettings, _catalogSettings);

            var tempEventPublisher = new Mock <IEventPublisher>();

            {
                tempEventPublisher.Setup(x => x.Publish(It.IsAny <object>()));
                _eventPublisher = tempEventPublisher.Object;
            }

            _localizationService = new Mock <ILocalizationService>().Object;

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >().Object;
            _deliveryDateRepository   = new Mock <IRepository <DeliveryDate> >().Object;
            _warehouseRepository      = new Mock <IRepository <Warehouse> >().Object;
            _pickupPointRepository    = new Mock <IRepository <PickupPoint> >().Object;

            _logger          = new NullLogger();
            _shippingService = new ShippingService(_shippingMethodRepository,
                                                   _deliveryDateRepository,
                                                   _warehouseRepository,
                                                   _pickupPointRepository,
                                                   _logger,
                                                   _productService,
                                                   _productAttributeParser,
                                                   _checkoutAttributeParser,
                                                   _genericAttributeService,
                                                   _localizationService,
                                                   _addressService,
                                                   _shippingSettings,
                                                   pluginFinder,
                                                   _storeContext,
                                                   _eventPublisher,
                                                   _shoppingCartSettings,
                                                   cacheManager,
                                                   null);


            _paymentService          = new Mock <IPaymentService>().Object;
            _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>().Object;
            _giftCardService         = new Mock <IGiftCardService>().Object;
            _genericAttributeService = new Mock <IGenericAttributeService>().Object;

            _geoLookupService = new Mock <IGeoLookupService>().Object;
            _countryService   = new Mock <ICountryService>().Object;
            _customerSettings = new CustomerSettings();
            _addressSettings  = new AddressSettings();

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = "10";

            var tempAddressService = new Mock <IAddressService>();

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

            _taxService = new TaxService(_addressService, _workContext, _taxSettings,
                                         pluginFinder, _geoLookupService, _countryService, _logger, _customerSettings, _addressSettings);

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService, _genericAttributeService,
                                                                      null, _taxSettings, _rewardPointsSettings,
                                                                      _shippingSettings, _shoppingCartSettings, _catalogSettings);
        }
Пример #30
0
 public GetShoppingCartHandler(
     ICacheManager cacheManager,
     IPaymentService paymentService,
     IProductService productService,
     IPictureService pictureService,
     IProductAttributeParser productAttributeParser,
     ILocalizationService localizationService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     ICurrencyService currencyService,
     IDiscountService discountService,
     IShoppingCartService shoppingCartService,
     ICheckoutAttributeService checkoutAttributeService,
     IPermissionService permissionService,
     ITaxService taxService,
     IPriceFormatter priceFormatter,
     ICheckoutAttributeParser checkoutAttributeParser,
     IDownloadService downloadService,
     ICountryService countryService,
     IWarehouseService warehouseService,
     IProductAttributeFormatter productAttributeFormatter,
     IPriceCalculationService priceCalculationService,
     IDateTimeHelper dateTimeHelper,
     IVendorService vendorService,
     IMediator mediator,
     MediaSettings mediaSettings,
     OrderSettings orderSettings,
     ShoppingCartSettings shoppingCartSettings,
     CatalogSettings catalogSettings,
     ShippingSettings shippingSettings,
     CommonSettings commonSettings)
 {
     _cacheManager               = cacheManager;
     _paymentService             = paymentService;
     _productService             = productService;
     _pictureService             = pictureService;
     _productAttributeParser     = productAttributeParser;
     _localizationService        = localizationService;
     _checkoutAttributeFormatter = checkoutAttributeFormatter;
     _currencyService            = currencyService;
     _discountService            = discountService;
     _shoppingCartService        = shoppingCartService;
     _checkoutAttributeService   = checkoutAttributeService;
     _permissionService          = permissionService;
     _taxService                = taxService;
     _priceFormatter            = priceFormatter;
     _checkoutAttributeParser   = checkoutAttributeParser;
     _downloadService           = downloadService;
     _countryService            = countryService;
     _warehouseService          = warehouseService;
     _productAttributeFormatter = productAttributeFormatter;
     _priceCalculationService   = priceCalculationService;
     _dateTimeHelper            = dateTimeHelper;
     _vendorService             = vendorService;
     _mediator             = mediator;
     _mediaSettings        = mediaSettings;
     _orderSettings        = orderSettings;
     _shoppingCartSettings = shoppingCartSettings;
     _catalogSettings      = catalogSettings;
     _shippingSettings     = shippingSettings;
     _commonSettings       = commonSettings;
 }
        public new void SetUp()
        {
            #region Test data

            //color (dropdownlist)
            ca1 = new CheckoutAttribute
            {
                Id = 1,
                Name= "Color",
                TextPrompt = "Select color:",
                IsRequired = true,
                AttributeControlType = AttributeControlType.DropdownList,
                DisplayOrder = 1,
            };
            cav1_1 = new CheckoutAttributeValue
            {
                Id = 11,
                Name = "Green",
                DisplayOrder = 1,
                CheckoutAttribute = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            cav1_2 = new CheckoutAttributeValue
            {
                Id = 12,
                Name = "Red",
                DisplayOrder = 2,
                CheckoutAttribute = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            ca1.CheckoutAttributeValues.Add(cav1_1);
            ca1.CheckoutAttributeValues.Add(cav1_2);

            //custom option (checkboxes)
            ca2 = new CheckoutAttribute
            {
                Id = 2,
                Name = "Custom option",
                TextPrompt = "Select custom option:",
                IsRequired = true,
                AttributeControlType = AttributeControlType.Checkboxes,
                DisplayOrder = 2,
            };
            cav2_1 = new CheckoutAttributeValue
            {
                Id = 21,
                Name = "Option 1",
                DisplayOrder = 1,
                CheckoutAttribute = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            cav2_2 = new CheckoutAttributeValue
            {
                Id = 22,
                Name = "Option 2",
                DisplayOrder = 2,
                CheckoutAttribute = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            ca2.CheckoutAttributeValues.Add(cav2_1);
            ca2.CheckoutAttributeValues.Add(cav2_2);

            //custom text
            ca3 = new CheckoutAttribute
            {
                Id = 3,
                Name = "Custom text",
                TextPrompt = "Enter custom text:",
                IsRequired = true,
                AttributeControlType = AttributeControlType.MultilineTextbox,
                DisplayOrder = 3,
            };

            #endregion

            _checkoutAttributeRepo = MockRepository.GenerateMock<IRepository<CheckoutAttribute>>();
            _checkoutAttributeRepo.Expect(x => x.Table).Return(new List<CheckoutAttribute> { ca1, ca2, ca3 }.AsQueryable());
            _checkoutAttributeRepo.Expect(x => x.GetById(ca1.Id)).Return(ca1);
            _checkoutAttributeRepo.Expect(x => x.GetById(ca2.Id)).Return(ca2);
            _checkoutAttributeRepo.Expect(x => x.GetById(ca3.Id)).Return(ca3);

            _checkoutAttributeValueRepo = MockRepository.GenerateMock<IRepository<CheckoutAttributeValue>>();
            _checkoutAttributeValueRepo.Expect(x => x.Table).Return(new List<CheckoutAttributeValue> { cav1_1, cav1_2, cav2_1, cav2_2 }.AsQueryable());
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav1_1.Id)).Return(cav1_1);
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav1_2.Id)).Return(cav1_2);
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav2_1.Id)).Return(cav2_1);
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav2_2.Id)).Return(cav2_2);

            var cacheManager = new NopNullCache();

            _storeMappingService = MockRepository.GenerateMock<IStoreMappingService>();

            _eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));

            _checkoutAttributeService = new CheckoutAttributeService(cacheManager,
                _checkoutAttributeRepo,
                _checkoutAttributeValueRepo,
                _storeMappingService,
                _eventPublisher);

            _checkoutAttributeParser = new CheckoutAttributeParser(_checkoutAttributeService);

            var workingLanguage = new Language();
            _workContext = MockRepository.GenerateMock<IWorkContext>();
            _workContext.Expect(x => x.WorkingLanguage).Return(workingLanguage);
            _currencyService = MockRepository.GenerateMock<ICurrencyService>();
            _taxService = MockRepository.GenerateMock<ITaxService>();
            _priceFormatter = MockRepository.GenerateMock<IPriceFormatter>();
            _downloadService = MockRepository.GenerateMock<IDownloadService>();
            _webHelper = MockRepository.GenerateMock<IWebHelper>();

            _checkoutAttributeFormatter = new CheckoutAttributeFormatter(_workContext,
                _checkoutAttributeService,
                _checkoutAttributeParser,
                _currencyService,
                _taxService,
                _priceFormatter,
                _downloadService,
                _webHelper);
        }
        public new void SetUp()
        {
            _workContext = MockRepository.GenerateMock<IWorkContext>();

            _store = new Store { Id = 1 };
            _storeContext = MockRepository.GenerateMock<IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            var pluginFinder = new PluginFinder();

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings = new CatalogSettings();

            //price calculation service
            _discountService = MockRepository.GenerateMock<IDiscountService>();
            _categoryService = MockRepository.GenerateMock<ICategoryService>();
            _productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
            _productService = MockRepository.GenerateMock<IProductService>();
            _productAttributeService = MockRepository.GenerateMock<IProductAttributeService>();
            _genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
            _eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));

            _settingService = MockRepository.GenerateMock<ISettingService>();
            _typeFinder = MockRepository.GenerateMock<ITypeFinder>();

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
            _logger = new NullLogger();

            _shippingService = new ShippingService(
                _shippingMethodRepository,
                _logger,
                _productAttributeParser,
                _productService,
                _checkoutAttributeParser,
                _genericAttributeService,
                _shippingSettings,
                _eventPublisher,
                _shoppingCartSettings,
                _settingService,
                this.ProviderManager,
                _typeFinder);

            _providerManager = MockRepository.GenerateMock<IProviderManager>();
            _checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();
            _giftCardService = MockRepository.GenerateMock<IGiftCardService>();

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.PricesIncludeTax = false;
            _taxSettings.TaxDisplayType = TaxDisplayType.IncludingTax;
            _taxSettings.DefaultTaxAddressId = 10;

            _addressService = MockRepository.GenerateMock<IAddressService>();
            _addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address { Id = _taxSettings.DefaultTaxAddressId });
            _downloadService = MockRepository.GenerateMock<IDownloadService>();
            _services = MockRepository.GenerateMock<ICommonServices>();
            _httpRequestBase = MockRepository.GenerateMock<HttpRequestBase>();
            _geoCountryLookup = MockRepository.GenerateMock<IGeoCountryLookup>();

            _taxService = new TaxService(_addressService, _workContext, _taxSettings, _shoppingCartSettings, pluginFinder, _geoCountryLookup, this.ProviderManager);

            _rewardPointsSettings = new RewardPointsSettings();

            _priceCalcService = new PriceCalculationService(_discountService, _categoryService, _productAttributeParser, _productService, _shoppingCartSettings, _catalogSettings,
                _productAttributeService, _downloadService, _services, _httpRequestBase, _taxService);

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                _priceCalcService, _taxService, _shippingService, _providerManager,
                _checkoutAttributeParser, _discountService, _giftCardService, _genericAttributeService, _productAttributeParser,
                _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);
        }
Пример #33
0
        public ShoppingCartController(IProductService productService,
			IWorkContext workContext, IStoreContext storeContext,
            IShoppingCartService shoppingCartService, IPictureService pictureService,
            ILocalizationService localizationService, 
            IProductAttributeService productAttributeService, IProductAttributeFormatter productAttributeFormatter,
            IProductAttributeParser productAttributeParser,
            ITaxService taxService, ICurrencyService currencyService, 
            IPriceCalculationService priceCalculationService, IPriceFormatter priceFormatter,
            ICheckoutAttributeParser checkoutAttributeParser, ICheckoutAttributeFormatter checkoutAttributeFormatter, 
            IOrderProcessingService orderProcessingService,
            IDiscountService discountService,ICustomerService customerService, 
            IGiftCardService giftCardService, ICountryService countryService,
            IStateProvinceService stateProvinceService, IShippingService shippingService, 
            IOrderTotalCalculationService orderTotalCalculationService,
            ICheckoutAttributeService checkoutAttributeService, IPaymentService paymentService,
            IWorkflowMessageService workflowMessageService,
            IPermissionService permissionService, IDeliveryTimeService deliveryTimeService,
            IDownloadService downloadService, ICacheManager cacheManager,
            IWebHelper webHelper, ICustomerActivityService customerActivityService,
			IGenericAttributeService genericAttributeService,
            MediaSettings mediaSettings, ShoppingCartSettings shoppingCartSettings,
            CatalogSettings catalogSettings, OrderSettings orderSettings,
            ShippingSettings shippingSettings, TaxSettings taxSettings,
            CaptchaSettings captchaSettings, AddressSettings addressSettings,
			HttpContextBase httpContext, PluginMediator pluginMediator,
            IQuantityUnitService quantityUnitService)
        {
            this._productService = productService;
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._shoppingCartService = shoppingCartService;
            this._pictureService = pictureService;
            this._localizationService = localizationService;
            this._productAttributeService = productAttributeService;
            this._productAttributeFormatter = productAttributeFormatter;
            this._productAttributeParser = productAttributeParser;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceCalculationService = priceCalculationService;
            this._priceFormatter = priceFormatter;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
            this._orderProcessingService = orderProcessingService;
            this._discountService = discountService;
            this._customerService = customerService;
            this._giftCardService = giftCardService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._checkoutAttributeService = checkoutAttributeService;
            this._paymentService = paymentService;
            this._workflowMessageService = workflowMessageService;
            this._permissionService = permissionService;
            this._downloadService = downloadService;
            this._cacheManager = cacheManager;
            this._webHelper = webHelper;
            this._customerActivityService = customerActivityService;
            this._genericAttributeService = genericAttributeService;
            this._deliveryTimeService = deliveryTimeService;
            this._httpContext = httpContext;
            this._mediaSettings = mediaSettings;
            this._shoppingCartSettings = shoppingCartSettings;
            this._catalogSettings = catalogSettings;
            this._orderSettings = orderSettings;
            this._shippingSettings = shippingSettings;
            this._taxSettings = taxSettings;
            this._captchaSettings = captchaSettings;
            this._addressSettings = addressSettings;
            this._pluginMediator = pluginMediator;
            this._quantityUnitService = quantityUnitService;
        }
 public OrderTotalCalculationService(IWorkContext workContext,
     IStoreContext storeContext,
     IPromosPriceCalculationService promosPriceCalculationService,
     IPriceCalculationService priceCalculationService,
     ITaxService taxService,
     IShippingService shippingService,
     IPaymentService paymentService,
     ICheckoutAttributeParser checkoutAttributeParser,
     IDiscountService discountService,
     IGiftCardService giftCardService,
     IGenericAttributeService genericAttributeService,
     TaxSettings taxSettings,
     RewardPointsSettings rewardPointsSettings,
     ShippingSettings shippingSettings,
     ShoppingCartSettings shoppingCartSettings,
     CatalogSettings catalogSettings,
     IPromoUtilities promoUtilities,
     PromoSettings promoSettings,
     IPromoService promoService,
     IAttributeValueService attributeValueService,
     ITaxServiceExtensions taxServiceExtensions,
     ICurrencyService currencyService)
     : base(workContext,
         storeContext,
         priceCalculationService,
         taxService,
         shippingService,
         paymentService,
         checkoutAttributeParser,
         discountService,
         giftCardService,
         genericAttributeService,
         taxSettings,
         rewardPointsSettings,
         shippingSettings,
         shoppingCartSettings,
         catalogSettings)
 {
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._promosPriceCalculationService = promosPriceCalculationService;
     this._taxService = taxService;
     this._shippingService = shippingService;
     this._paymentService = paymentService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._discountService = discountService;
     this._giftCardService = giftCardService;
     this._genericAttributeService = genericAttributeService;
     this._taxSettings = taxSettings;
     this._rewardPointsSettings = rewardPointsSettings;
     this._shippingSettings = shippingSettings;
     this._shoppingCartSettings = shoppingCartSettings;
     this._catalogSettings = catalogSettings;
     this._promoUtilities = promoUtilities;
     this._promoSettings = promoSettings;
     this._promoService = promoService;
     this._priceCalculationService = priceCalculationService;
     this._attributeValueService = attributeValueService;
     this._taxServiceExtensions = taxServiceExtensions;
     this._currencyService = currencyService;
 }
Пример #35
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="shippingMethodRepository">Shipping method repository</param>
 /// <param name="deliveryDateRepository">Delivery date repository</param>
 /// <param name="warehouseRepository">Warehouse repository</param>
 /// <param name="logger">Logger</param>
 /// <param name="productService">Product service</param>
 /// <param name="productAttributeParser">Product attribute parser</param>
 /// <param name="checkoutAttributeParser">Checkout attribute parser</param>
 /// <param name="genericAttributeService">Generic attribute service</param>
 /// <param name="localizationService">Localization service</param>
 /// <param name="addressService">Address service</param>
 /// <param name="shippingSettings">Shipping settings</param>
 /// <param name="pluginFinder">Plugin finder</param>
 /// <param name="storeContext">Store context</param>
 /// <param name="eventPublisher">Event published</param>
 /// <param name="shoppingCartSettings">Shopping cart settings</param>
 /// <param name="cacheManager">Cache manager</param>
 public ShippingService(IRepository<ShippingMethod> shippingMethodRepository,
     IRepository<DeliveryDate> deliveryDateRepository,
     IRepository<Warehouse> warehouseRepository,
     ILogger logger,
     IProductService productService,
     IProductAttributeParser productAttributeParser,
     ICheckoutAttributeParser checkoutAttributeParser,
     IGenericAttributeService genericAttributeService,
     ILocalizationService localizationService,
     IAddressService addressService,
     ShippingSettings shippingSettings,
     IPluginFinder pluginFinder,
     IStoreContext storeContext,
     IEventPublisher eventPublisher,
     ShoppingCartSettings shoppingCartSettings,
     ICacheManager cacheManager)
 {
     this._shippingMethodRepository = shippingMethodRepository;
     this._deliveryDateRepository = deliveryDateRepository;
     this._warehouseRepository = warehouseRepository;
     this._logger = logger;
     this._productService = productService;
     this._productAttributeParser = productAttributeParser;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._genericAttributeService = genericAttributeService;
     this._localizationService = localizationService;
     this._addressService = addressService;
     this._shippingSettings = shippingSettings;
     this._pluginFinder = pluginFinder;
     this._storeContext = storeContext;
     this._eventPublisher = eventPublisher;
     this._shoppingCartSettings = shoppingCartSettings;
     this._cacheManager = cacheManager;
 }
        public ShoppingCartController(IProductService productService,
            IStoreContext storeContext,
            IWorkContext workContext,
            IShoppingCartService shoppingCartService,
            IPictureService pictureService,
            ILocalizationService localizationService,
            IProductAttributeService productAttributeService,
            IProductAttributeFormatter productAttributeFormatter,
            IProductAttributeParser productAttributeParser,
            ITaxService taxService, ICurrencyService currencyService,
            IPriceCalculationService priceCalculationService,
            IPromosPriceCalculationService promosPriceCalculationService,
            IPriceFormatter priceFormatter,
            ICheckoutAttributeParser checkoutAttributeParser,
            ICheckoutAttributeFormatter checkoutAttributeFormatter,
            IOrderProcessingService orderProcessingService,
            IDiscountService discountService,
            ICustomerService customerService,
            IGiftCardService giftCardService,
            ICountryService countryService,
            IStateProvinceService stateProvinceService,
            IShippingService shippingService,
            IOrderTotalCalculationService orderTotalCalculationService,
            ICheckoutAttributeService checkoutAttributeService,
            IPaymentService paymentService,
            IWorkflowMessageService workflowMessageService,
            IPermissionService permissionService,
            IDownloadService downloadService,
            ICacheManager cacheManager,
            IWebHelper webHelper,
            ICustomerActivityService customerActivityService,
            IGenericAttributeService genericAttributeService,
            IAddressAttributeFormatter addressAttributeFormatter,
            HttpContextBase httpContext,
            MediaSettings mediaSettings,
            ShoppingCartSettings shoppingCartSettings,
            CatalogSettings catalogSettings,
            OrderSettings orderSettings,
            ShippingSettings shippingSettings,
            TaxSettings taxSettings,
            CaptchaSettings captchaSettings,
            AddressSettings addressSettings,
            RewardPointsSettings rewardPointsSettings,
            PromoSettings promoSettings,
            IPromoService promoService,
            IPromoUtilities promoUtilities)
            : base(productService, storeContext, workContext,
                    shoppingCartService, pictureService, localizationService,
                    productAttributeService, productAttributeFormatter,
                    productAttributeParser, taxService, currencyService,
                    priceCalculationService, priceFormatter, checkoutAttributeParser,
                    checkoutAttributeFormatter, orderProcessingService, discountService,
                    customerService, giftCardService, countryService,
                    stateProvinceService, shippingService, orderTotalCalculationService,
                    checkoutAttributeService, paymentService, workflowMessageService,
                    permissionService, downloadService, cacheManager, webHelper,
                    customerActivityService, genericAttributeService,
                    addressAttributeFormatter, httpContext, mediaSettings,
                    shoppingCartSettings, catalogSettings, orderSettings, shippingSettings,
                    taxSettings, captchaSettings, addressSettings,
                    rewardPointsSettings)
        {
            this._productService = productService;
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._shoppingCartService = shoppingCartService;
            this._pictureService = pictureService;
            this._localizationService = localizationService;
            this._productAttributeService = productAttributeService;
            this._productAttributeFormatter = productAttributeFormatter;
            this._productAttributeParser = productAttributeParser;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceCalculationService = priceCalculationService;
            this._promosPriceCalculationService = promosPriceCalculationService;
            this._priceFormatter = priceFormatter;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
            this._orderProcessingService = orderProcessingService;
            this._discountService = discountService;
            this._customerService = customerService;
            this._giftCardService = giftCardService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._checkoutAttributeService = checkoutAttributeService;
            this._paymentService = paymentService;
            this._workflowMessageService = workflowMessageService;
            this._permissionService = permissionService;
            this._downloadService = downloadService;
            this._cacheManager = cacheManager;
            this._webHelper = webHelper;
            this._customerActivityService = customerActivityService;
            this._genericAttributeService = genericAttributeService;
            this._addressAttributeFormatter = addressAttributeFormatter;
            this._httpContext = httpContext;

            this._mediaSettings = mediaSettings;
            this._shoppingCartSettings = shoppingCartSettings;
            this._catalogSettings = catalogSettings;
            this._orderSettings = orderSettings;
            this._shippingSettings = shippingSettings;
            this._taxSettings = taxSettings;
            this._captchaSettings = captchaSettings;
            this._addressSettings = addressSettings;
            this._rewardPointsSettings = rewardPointsSettings;

            this._promoSettings = promoSettings;
            this._promoService = promoService;
            this._promoUtilities = promoUtilities;
        }
        public CustomShoppingCartController(
            CaptchaSettings captchaSettings,
            CustomerSettings customerSettings,
            ICheckoutAttributeParser checkoutAttributeParser,
            ICheckoutAttributeService checkoutAttributeService,
            ICurrencyService currencyService,
            ICustomerActivityService customerActivityService,
            ICustomerService customerService,
            IDiscountService discountService,
            IDownloadService downloadService,
            IGenericAttributeService genericAttributeService,
            IGiftCardService giftCardService,
            ILocalizationService localizationService,
            INopFileProvider fileProvider,
            INotificationService notificationService,
            IPermissionService permissionService,
            IPictureService pictureService,
            IPriceFormatter priceFormatter,
            IProductAttributeParser productAttributeParser,
            IProductAttributeService productAttributeService,
            IProductService productService,
            IShippingService shippingService,
            IShoppingCartModelFactory shoppingCartModelFactory,
            IShoppingCartService shoppingCartService,
            IStaticCacheManager staticCacheManager,
            IStoreContext storeContext,
            ITaxService taxService,
            IUrlRecordService urlRecordService,
            IWebHelper webHelper,
            IWorkContext workContext,
            IWorkflowMessageService workflowMessageService,
            MediaSettings mediaSettings,
            OrderSettings orderSettings,
            ShoppingCartSettings shoppingCartSettings,
            ShippingSettings shippingSettings,
            // custom
            IAttributeUtilities attributeUtilities,
            IRepository <CustomerShopMapping> customerShopMappingRepository,
            IBackendStockService backendStockService,
            IProductAbcDescriptionService productAbcDescriptionService,
            IWidgetPluginManager widgetPluginManager
            ) : base(captchaSettings, customerSettings, checkoutAttributeParser, checkoutAttributeService,
                     currencyService, customerActivityService, customerService, discountService,
                     downloadService, genericAttributeService, giftCardService, localizationService,
                     fileProvider, notificationService, permissionService, pictureService,
                     priceFormatter, productAttributeParser, productAttributeService, productService,
                     shippingService, shoppingCartModelFactory, shoppingCartService, staticCacheManager,
                     storeContext, taxService, urlRecordService, webHelper,
                     workContext, workflowMessageService, mediaSettings, orderSettings,
                     shoppingCartSettings, shippingSettings)
        {
            _customerActivityService = customerActivityService;
            _localizationService     = localizationService;
            _productAttributeParser  = productAttributeParser;
            _productAttributeService = productAttributeService;
            _productService          = productService;
            _shoppingCartService     = shoppingCartService;
            _shoppingCartSettings    = shoppingCartSettings;
            _storeContext            = storeContext;
            _urlRecordService        = urlRecordService;
            _workContext             = workContext;

            _attributeUtilities            = attributeUtilities;
            _customerShopMappingRepository = customerShopMappingRepository;
            _backendStockService           = backendStockService;
            _productAbcDescriptionService  = productAbcDescriptionService;
            _widgetPluginManager           = widgetPluginManager;
        }
        public void TestInitialize()
        {
            //color choosing via DropDownList
            ca1 = new CheckoutAttribute {
                Id                   = "1",
                Name                 = "Color",
                TextPrompt           = "Select color:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.DropdownList,
                DisplayOrder         = 1,
            };
            cav1_1 = new CheckoutAttributeValue {
                Id           = "11",
                Name         = "Green",
                DisplayOrder = 1,
                //CheckoutAttribute = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            cav1_2 = new CheckoutAttributeValue {
                Id           = "12",
                Name         = "Red",
                DisplayOrder = 2,
                //CheckoutAttribute = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            ca1.CheckoutAttributeValues.Add(cav1_1);
            ca1.CheckoutAttributeValues.Add(cav1_2);

            //choosing via CheckBox'es
            ca2 = new CheckoutAttribute {
                Id                   = "2",
                Name                 = "Custom option",
                TextPrompt           = "Select custom option:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Checkboxes,
                DisplayOrder         = 2,
                //CheckoutAttributeValues
            };

            cav2_1 = new CheckoutAttributeValue {
                Id           = "21",
                Name         = "Option 1",
                DisplayOrder = 1,
                //CheckoutAttribute = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            cav2_2 = new CheckoutAttributeValue {
                Id           = "22",
                Name         = "Option 2",
                DisplayOrder = 2,
                //CheckoutAttribute = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            ca2.CheckoutAttributeValues.Add(cav2_1);
            ca2.CheckoutAttributeValues.Add(cav2_2);

            //via MultiTextBoxes
            ca3 = new CheckoutAttribute {
                Id                   = "3",
                Name                 = "Custom text",
                TextPrompt           = "Enter custom text:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.MultilineTextbox,
                DisplayOrder         = 3,
            };



            var tempCheckoutAttributeRepo = new Mock <IRepository <CheckoutAttribute> >();
            {
                var IMongoCollection = new Mock <IMongoCollection <CheckoutAttribute> >().Object;
                IMongoCollection.InsertOne(ca1);
                IMongoCollection.InsertOne(ca2);
                IMongoCollection.InsertOne(ca3);
                tempCheckoutAttributeRepo.Setup(x => x.Table).Returns(IMongoCollection.AsQueryable());
                tempCheckoutAttributeRepo.Setup(x => x.GetByIdAsync(ca1.Id)).ReturnsAsync(ca1);
                tempCheckoutAttributeRepo.Setup(x => x.GetByIdAsync(ca2.Id)).ReturnsAsync(ca2);
                tempCheckoutAttributeRepo.Setup(x => x.GetByIdAsync(ca3.Id)).ReturnsAsync(ca3);
                _checkoutAttributeRepo = tempCheckoutAttributeRepo.Object;
            }

            var cacheManager = new TestMemoryCacheManager(new Mock <IMemoryCache>().Object);

            _storeMappingService = new Mock <IStoreMappingService>().Object;



            var tempEventPublisher = new Mock <IMediator>();

            {
                //tempEventPublisher.Setup(x => x.PublishAsync(It.IsAny<object>()));
                _eventPublisher = tempEventPublisher.Object;
            }


            _checkoutAttributeService = new CheckoutAttributeService(cacheManager, _checkoutAttributeRepo,
                                                                     _eventPublisher, null, null);

            _checkoutAttributeParser = new CheckoutAttributeParser(_checkoutAttributeService);



            var workingLanguage = new Language();
            var tempWorkContext = new Mock <IWorkContext>();

            {
                tempWorkContext.Setup(x => x.WorkingLanguage).Returns(workingLanguage);
                _workContext = tempWorkContext.Object;
            }
            _currencyService = new Mock <ICurrencyService>().Object;
            _taxService      = new Mock <ITaxService>().Object;
            _priceFormatter  = new Mock <IPriceFormatter>().Object;
            _downloadService = new Mock <IDownloadService>().Object;
            _webHelper       = new Mock <IWebHelper>().Object;

            _checkoutAttributeFormatter = new CheckoutAttributeFormatter(_workContext,
                                                                         _checkoutAttributeService,
                                                                         _checkoutAttributeParser,
                                                                         _currencyService,
                                                                         _taxService,
                                                                         _priceFormatter,
                                                                         _downloadService,
                                                                         _webHelper);
        }