Exemplo n.º 1
0
 public CustomOrderProcessingService(
     IPluginFinder pluginFinder,
     IOrderService orderService, IWebHelper webHelper, ILocalizationService localizationService,
     ILanguageService languageService, IProductService productService, IPaymentService paymentService,
     ILogger logger, IOrderTotalCalculationService orderTotalCalculationService,
     IPriceCalculationService priceCalculationService, IPriceFormatter priceFormatter,
     IProductAttributeParser productAttributeParser, IProductAttributeFormatter productAttributeFormatter,
     IGiftCardService giftCardService, IShoppingCartService shoppingCartService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter, IShippingService shippingService,
     IShipmentService shipmentService, ITaxService taxService, ICustomerService customerService,
     IDiscountService discountService, IEncryptionService encryptionService, IWorkContext workContext,
     IWorkflowMessageService workflowMessageService, IVendorService vendorService,
     ICustomerActivityService customerActivityService, ICurrencyService currencyService,
     IAffiliateService affiliateService, IEventPublisher eventPublisher, IPdfService pdfService,
     IRewardPointService rewardPointService, IGenericAttributeService genericAttributeService,
     ICountryService countryService, ShippingSettings shippingSettings, PaymentSettings paymentSettings,
     RewardPointsSettings rewardPointsSettings, OrderSettings orderSettings, TaxSettings taxSettings,
     LocalizationSettings localizationSettings, CurrencySettings currencySettings) :
     base(orderService, webHelper, localizationService, languageService, productService, paymentService, logger,
          orderTotalCalculationService, priceCalculationService, priceFormatter, productAttributeParser,
          productAttributeFormatter, giftCardService, shoppingCartService, checkoutAttributeFormatter,
          shippingService, shipmentService, taxService, customerService, discountService, encryptionService,
          workContext, workflowMessageService, vendorService, customerActivityService, currencyService,
          affiliateService, eventPublisher, pdfService, rewardPointService, genericAttributeService, countryService,
          shippingSettings, paymentSettings, rewardPointsSettings, orderSettings, taxSettings, localizationSettings, currencySettings)
 {
     _pluginFinder = pluginFinder;
 }
Exemplo n.º 2
0
        public OrderProcessingService(
            SmartDbContext db,
            IWorkContext workContext,
            IWebHelper webHelper,
            ILocalizationService localizationService,
            ICurrencyService currencyService,
            IPaymentService paymentService,
            IProductService productService,
            IProductAttributeMaterializer productAttributeMaterializer,
            IProductAttributeFormatter productAttributeFormatter,
            IOrderCalculationService orderCalculationService,
            ITaxService taxService,
            IShoppingCartService shoppingCartService,
            IShoppingCartValidator shoppingCartValidator,
            IShippingService shippingService,
            IGiftCardService giftCardService,
            INewsletterSubscriptionService newsletterSubscriptionService,
            ICheckoutAttributeFormatter checkoutAttributeFormatter,
            IEncryptor encryptor,
            IMessageFactory messageFactory,
            IEventPublisher eventPublisher,
            IActivityLogger activityLogger,
            RewardPointsSettings rewardPointsSettings,
            CatalogSettings catalogSettings,
            OrderSettings orderSettings,
            ShoppingCartSettings shoppingCartSettings,
            LocalizationSettings localizationSettings,
            TaxSettings taxSettings)
        {
            _db                            = db;
            _workContext                   = workContext;
            _webHelper                     = webHelper;
            _localizationService           = localizationService;
            _currencyService               = currencyService;
            _paymentService                = paymentService;
            _productService                = productService;
            _productAttributeMaterializer  = productAttributeMaterializer;
            _productAttributeFormatter     = productAttributeFormatter;
            _orderCalculationService       = orderCalculationService;
            _taxService                    = taxService;
            _shoppingCartService           = shoppingCartService;
            _shoppingCartValidator         = shoppingCartValidator;
            _shippingService               = shippingService;
            _giftCardService               = giftCardService;
            _newsletterSubscriptionService = newsletterSubscriptionService;
            _checkoutAttributeFormatter    = checkoutAttributeFormatter;
            _encryptor                     = encryptor;
            _messageFactory                = messageFactory;
            _eventPublisher                = eventPublisher;
            _activityLogger                = activityLogger;
            _rewardPointsSettings          = rewardPointsSettings;
            _catalogSettings               = catalogSettings;
            _orderSettings                 = orderSettings;
            _shoppingCartSettings          = shoppingCartSettings;
            _localizationSettings          = localizationSettings;
            _taxSettings                   = taxSettings;

            _primaryCurrency = currencyService.PrimaryCurrency;
            _workingCurrency = workContext.WorkingCurrency;
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
        public virtual async Task <IActionResult> CheckoutAttributeChange(IFormCollection form,
                                                                          [FromServices] ICheckoutAttributeParser checkoutAttributeParser,
                                                                          [FromServices] ICheckoutAttributeFormatter checkoutAttributeFormatter)
        {
            var cart = _shoppingCartService.GetShoppingCart(_storeContext.CurrentStore.Id, ShoppingCartType.ShoppingCart, ShoppingCartType.Auctions);

            var attributeXml = await _mediator.Send(new SaveCheckoutAttributesCommand()
            {
                Customer = _workContext.CurrentCustomer,
                Store    = _storeContext.CurrentStore,
                Cart     = cart,
                Form     = form
            });

            var enabledAttributeIds  = new List <string>();
            var disabledAttributeIds = new List <string>();
            var attributes           = await _checkoutAttributeService.GetAllCheckoutAttributes(_storeContext.CurrentStore.Id, !cart.RequiresShipping());

            foreach (var attribute in attributes)
            {
                var conditionMet = await checkoutAttributeParser.IsConditionMet(attribute, attributeXml);

                if (conditionMet.HasValue)
                {
                    if (conditionMet.Value)
                    {
                        enabledAttributeIds.Add(attribute.Id);
                    }
                    else
                    {
                        disabledAttributeIds.Add(attribute.Id);
                    }
                }
            }
            var model = await _mediator.Send(new GetOrderTotals()
            {
                Cart           = cart,
                IsEditable     = true,
                Store          = _storeContext.CurrentStore,
                Currency       = _workContext.WorkingCurrency,
                Customer       = _workContext.CurrentCustomer,
                Language       = _workContext.WorkingLanguage,
                TaxDisplayType = _workContext.TaxDisplayType
            });

            return(Json(new
            {
                enabledattributeids = enabledAttributeIds.ToArray(),
                disabledattributeids = disabledAttributeIds.ToArray(),
                htmlordertotal = await RenderPartialViewToString("Components/OrderTotals/Default", model),
                model = model,
                checkoutattributeinfo = await checkoutAttributeFormatter.FormatAttributes(attributeXml, _workContext.CurrentCustomer),
            }));
        }
Exemplo n.º 5
0
 public OrderController(
     IOrderService orderService,
     IShipmentService shipmentService,
     ICurrencyService currencyService,
     IPriceFormatter priceFormatter,
     IOrderProcessingService orderProcessingService,
     IDateTimeHelper dateTimeHelper,
     IPaymentService paymentService,
     IPdfConverter pdfConverter,
     IShippingService shippingService,
     ICountryService countryService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     IStoreService storeService,
     IProductService productService,
     IProductAttributeFormatter productAttributeFormatter,
     PluginMediator pluginMediator,
     ICommonServices services,
     IQuantityUnitService quantityUnitService,
     ProductUrlHelper productUrlHelper,
     IProductAttributeParser productAttributeParser,
     IPictureService pictureService,
     CatalogSettings catalogSettings,
     MediaSettings mediaSettings,
     ShoppingCartSettings shoppingCartSettings)
 {
     this._orderService               = orderService;
     this._shipmentService            = shipmentService;
     this._currencyService            = currencyService;
     this._priceFormatter             = priceFormatter;
     this._orderProcessingService     = orderProcessingService;
     this._dateTimeHelper             = dateTimeHelper;
     this._paymentService             = paymentService;
     this._pdfConverter               = pdfConverter;
     this._shippingService            = shippingService;
     this._countryService             = countryService;
     this._productService             = productService;
     this._productAttributeFormatter  = productAttributeFormatter;
     this._storeService               = storeService;
     this._checkoutAttributeFormatter = checkoutAttributeFormatter;
     this._pluginMediator             = pluginMediator;
     this._services               = services;
     this._quantityUnitService    = quantityUnitService;
     this._productUrlHelper       = productUrlHelper;
     this._pictureService         = pictureService;
     this._catalogSettings        = catalogSettings;
     this._productAttributeParser = productAttributeParser;
     this._mediaSettings          = mediaSettings;
     this._shoppingCartSettings   = shoppingCartSettings;
 }
Exemplo n.º 6
0
 public ShoppingCartModelMapper(
     SmartDbContext db,
     ICommonServices services,
     ITaxCalculator taxCalculator,
     IProductService productService,
     IPriceCalculationService priceCalculationService,
     IMediaService mediaService,
     IPaymentService paymentService,
     IDiscountService discountService,
     ICurrencyService currencyService,
     IHttpContextAccessor httpContextAccessor,
     IShoppingCartValidator shoppingCartValidator,
     IOrderCalculationService orderCalculationService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     ICheckoutAttributeMaterializer checkoutAttributeMaterializer,
     ShoppingCartSettings shoppingCartSettings,
     CatalogSettings catalogSettings,
     MediaSettings mediaSettings,
     OrderSettings orderSettings,
     MeasureSettings measureSettings,
     ShippingSettings shippingSettings,
     RewardPointsSettings rewardPointsSettings,
     Localizer T)
     : base(services, shoppingCartSettings, catalogSettings, mediaSettings, T)
 {
     _db                            = db;
     _taxCalculator                 = taxCalculator;
     _productService                = productService;
     _priceCalculationService       = priceCalculationService;
     _mediaService                  = mediaService;
     _paymentService                = paymentService;
     _discountService               = discountService;
     _currencyService               = currencyService;
     _httpContextAccessor           = httpContextAccessor;
     _shoppingCartValidator         = shoppingCartValidator;
     _orderCalculationService       = orderCalculationService;
     _checkoutAttributeFormatter    = checkoutAttributeFormatter;
     _checkoutAttributeMaterializer = checkoutAttributeMaterializer;
     _shippingSettings              = shippingSettings;
     _orderSettings                 = orderSettings;
     _measureSettings               = measureSettings;
     _rewardPointsSettings          = rewardPointsSettings;
 }
Exemplo n.º 7
0
        public virtual IActionResult CheckoutAttributeChange(IFormCollection form,
                                                             [FromServices] ICheckoutAttributeParser checkoutAttributeParser,
                                                             [FromServices] ICheckoutAttributeFormatter checkoutAttributeFormatter)
        {
            var cart = _workContext.CurrentCustomer.ShoppingCartItems
                       .Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart || sci.ShoppingCartType == ShoppingCartType.Auctions)
                       .LimitPerStore(_storeContext.CurrentStore.Id)
                       .ToList();

            _shoppingCartViewModelService.ParseAndSaveCheckoutAttributes(cart, form);
            var attributeXml = _workContext.CurrentCustomer.GetAttribute <string>(SystemCustomerAttributeNames.CheckoutAttributes,
                                                                                  _storeContext.CurrentStore.Id);

            var enabledAttributeIds  = new List <string>();
            var disabledAttributeIds = new List <string>();
            var attributes           = _checkoutAttributeService.GetAllCheckoutAttributes(_storeContext.CurrentStore.Id, !cart.RequiresShipping());

            foreach (var attribute in attributes)
            {
                var conditionMet = checkoutAttributeParser.IsConditionMet(attribute, attributeXml);
                if (conditionMet.HasValue)
                {
                    if (conditionMet.Value)
                    {
                        enabledAttributeIds.Add(attribute.Id);
                    }
                    else
                    {
                        disabledAttributeIds.Add(attribute.Id);
                    }
                }
            }

            return(Json(new
            {
                enabledattributeids = enabledAttributeIds.ToArray(),
                disabledattributeids = disabledAttributeIds.ToArray(),
                htmlordertotal = this.RenderPartialViewToString("Components/OrderTotals/Default", _shoppingCartViewModelService.PrepareOrderTotals(cart, true)),
                checkoutattributeinfo = checkoutAttributeFormatter.FormatAttributes(attributeXml, _workContext.CurrentCustomer),
            }));
        }
        public virtual async Task <IActionResult> CheckoutAttributeChange(IFormCollection form,
                                                                          [FromServices] ICheckoutAttributeParser checkoutAttributeParser,
                                                                          [FromServices] ICheckoutAttributeFormatter checkoutAttributeFormatter)
        {
            var cart = _shoppingCartService.GetShoppingCart(_storeContext.CurrentStore.Id, ShoppingCartType.ShoppingCart, ShoppingCartType.Auctions);

            await _shoppingCartViewModelService.ParseAndSaveCheckoutAttributes(cart, form);

            var attributeXml = await _workContext.CurrentCustomer.GetAttribute <string>(_genericAttributeService, SystemCustomerAttributeNames.CheckoutAttributes,
                                                                                        _storeContext.CurrentStore.Id);

            var enabledAttributeIds  = new List <string>();
            var disabledAttributeIds = new List <string>();
            var attributes           = await _checkoutAttributeService.GetAllCheckoutAttributes(_storeContext.CurrentStore.Id, !cart.RequiresShipping());

            foreach (var attribute in attributes)
            {
                var conditionMet = await checkoutAttributeParser.IsConditionMet(attribute, attributeXml);

                if (conditionMet.HasValue)
                {
                    if (conditionMet.Value)
                    {
                        enabledAttributeIds.Add(attribute.Id);
                    }
                    else
                    {
                        disabledAttributeIds.Add(attribute.Id);
                    }
                }
            }

            return(Json(new
            {
                enabledattributeids = enabledAttributeIds.ToArray(),
                disabledattributeids = disabledAttributeIds.ToArray(),
                htmlordertotal = RenderPartialViewToString("Components/OrderTotals/Default", await _shoppingCartViewModelService.PrepareOrderTotals(cart, true)),
                checkoutattributeinfo = await checkoutAttributeFormatter.FormatAttributes(attributeXml, _workContext.CurrentCustomer),
            }));
        }
Exemplo n.º 9
0
        public OrderController(IOrderService orderService,
                               IShipmentService shipmentService, IWorkContext workContext,
                               ICurrencyService currencyService, IPriceFormatter priceFormatter,
                               IOrderProcessingService orderProcessingService, IDateTimeHelper dateTimeHelper,
                               IPaymentService paymentService, ILocalizationService localizationService,
                               IPdfService pdfService, IShippingService shippingService,
                               ICountryService countryService, IWebHelper webHelper,
                               CatalogSettings catalogSettings, OrderSettings orderSettings,
                               TaxSettings taxSettings, PdfSettings pdfSettings,
                               ShippingSettings shippingSettings, AddressSettings addressSettings,
                               ICheckoutAttributeFormatter checkoutAttributeFormatter,
                               IProductService productService,
                               IProductAttributeFormatter productAttributeFormatter,
                               PluginMediator pluginMediator)
        {
            this._orderService           = orderService;
            this._shipmentService        = shipmentService;
            this._workContext            = workContext;
            this._currencyService        = currencyService;
            this._priceFormatter         = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper         = dateTimeHelper;
            this._paymentService         = paymentService;
            this._localizationService    = localizationService;
            this._pdfService             = pdfService;
            this._shippingService        = shippingService;
            this._countryService         = countryService;
            this._webHelper                 = webHelper;
            this._productService            = productService;
            this._productAttributeFormatter = productAttributeFormatter;

            this._catalogSettings            = catalogSettings;
            this._orderSettings              = orderSettings;
            this._taxSettings                = taxSettings;
            this._pdfSettings                = pdfSettings;
            this._shippingSettings           = shippingSettings;
            this._addressSettings            = addressSettings;
            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
            this._pluginMediator             = pluginMediator;
        }
Exemplo n.º 10
0
 public OrderController(
     IOrderService orderService,
     IShipmentService shipmentService,
     ICurrencyService currencyService,
     IPriceFormatter priceFormatter,
     IOrderProcessingService orderProcessingService,
     IDateTimeHelper dateTimeHelper,
     IPaymentService paymentService,
     IPdfConverter pdfConverter,
     IShippingService shippingService,
     ICountryService countryService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     IStoreService storeService,
     IProductService productService,
     IProductAttributeFormatter productAttributeFormatter,
     IProductAttributeParser productAttributeParser,
     Lazy <IPictureService> pictureService,
     PluginMediator pluginMediator,
     ICommonServices services,
     IQuantityUnitService quantityUnitService)
 {
     this._orderService               = orderService;
     this._shipmentService            = shipmentService;
     this._currencyService            = currencyService;
     this._priceFormatter             = priceFormatter;
     this._orderProcessingService     = orderProcessingService;
     this._dateTimeHelper             = dateTimeHelper;
     this._paymentService             = paymentService;
     this._pdfConverter               = pdfConverter;
     this._shippingService            = shippingService;
     this._countryService             = countryService;
     this._productService             = productService;
     this._productAttributeFormatter  = productAttributeFormatter;
     this._productAttributeParser     = productAttributeParser;
     this._storeService               = storeService;
     this._checkoutAttributeFormatter = checkoutAttributeFormatter;
     this._pluginMediator             = pluginMediator;
     this._services            = services;
     this._quantityUnitService = quantityUnitService;
 }
        public OrderController(
			IOrderService orderService, 
            IShipmentService shipmentService,
            ICurrencyService currencyService, 
			IPriceFormatter priceFormatter,
            IOrderProcessingService orderProcessingService, 
			IDateTimeHelper dateTimeHelper,
            IPaymentService paymentService,
			IPdfConverter pdfConverter, 
			IShippingService shippingService,
            ICountryService countryService,
            ICheckoutAttributeFormatter checkoutAttributeFormatter,
			IStoreService storeService,
			IProductService productService,
			IProductAttributeFormatter productAttributeFormatter,
			Lazy<IPictureService> pictureService,
			PluginMediator pluginMediator,
			ICommonServices services,
            IQuantityUnitService quantityUnitService)
        {
            this._orderService = orderService;
            this._shipmentService = shipmentService;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper = dateTimeHelper;
            this._paymentService = paymentService;
			this._pdfConverter = pdfConverter;
            this._shippingService = shippingService;
            this._countryService = countryService;
			this._productService = productService;
			this._productAttributeFormatter = productAttributeFormatter;
			this._storeService = storeService;
            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
			this._pluginMediator = pluginMediator;
			this._services = services;
            this._quantityUnitService = quantityUnitService;
			T = NullLocalizer.Instance;
        }
Exemplo n.º 12
0
        private readonly ICheckoutAttributeFormatter _checkoutAttributeFormatter; //codehint: sm-add
        #endregion

		#region Constructors

        public OrderController(IOrderService orderService, 
            IShipmentService shipmentService, IWorkContext workContext,
            ICurrencyService currencyService, IPriceFormatter priceFormatter,
            IOrderProcessingService orderProcessingService, IDateTimeHelper dateTimeHelper,
            IPaymentService paymentService, ILocalizationService localizationService,
            IPdfService pdfService, IShippingService shippingService,
            ICountryService countryService, IWebHelper webHelper, 
            CatalogSettings catalogSettings, OrderSettings orderSettings,
            TaxSettings taxSettings, PdfSettings pdfSettings,
            ShippingSettings shippingSettings, AddressSettings addressSettings,
            ICheckoutAttributeFormatter checkoutAttributeFormatter,
			IProductService productService,
			IProductAttributeFormatter productAttributeFormatter)
        {
            this._orderService = orderService;
            this._shipmentService = shipmentService;
            this._workContext = workContext;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper = dateTimeHelper;
            this._paymentService = paymentService;
            this._localizationService = localizationService;
            this._pdfService = pdfService;
            this._shippingService = shippingService;
            this._countryService = countryService;
            this._webHelper = webHelper;
			this._productService = productService;
			this._productAttributeFormatter = productAttributeFormatter;

            this._catalogSettings = catalogSettings;
            this._orderSettings = orderSettings;
            this._taxSettings = taxSettings;
            this._pdfSettings = pdfSettings;
            this._shippingSettings = shippingSettings;
            this._addressSettings = addressSettings;

            this._checkoutAttributeFormatter = checkoutAttributeFormatter;  //codehint: sm-add
        }
        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();

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

            _checkoutAttributeService = new CheckoutAttributeService(cacheManager,
                                                                     _checkoutAttributeRepo,
                                                                     _checkoutAttributeValueRepo,
                                                                     _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>();

            _checkoutAttributeFormatter = new CheckoutAttributeFormatter(_workContext,
                                                                         _checkoutAttributeService,
                                                                         _checkoutAttributeParser,
                                                                         _currencyService,
                                                                         _taxService,
                                                                         _priceFormatter);
        }
        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 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 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>();
            _manufacturerService = MockRepository.GenerateMock <IManufacturerService>();

            _productAttributeParser = MockRepository.GenerateMock <IProductAttributeParser>();
            _priceCalcService       = new PriceCalculationService(_workContext, _storeContext,
                                                                  _discountService, _categoryService, _manufacturerService,
                                                                  _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);

            _rewardPointService   = MockRepository.GenerateMock <IRewardPointService>();
            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      _genericAttributeService, _rewardPointService,
                                                                      _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));

            _rewardPointService = MockRepository.GenerateMock <IRewardPointService>();
            _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, _rewardPointService,
                                                                 _shippingSettings, _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings,
                                                                 _currencySettings);
        }
        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,
                                                                     _storeMappingService, _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);
        }
Exemplo n.º 18
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;
        }
Exemplo n.º 19
0
 public OverriddenOrderProcessingService(CurrencySettings currencySettings,
                                         IAffiliateService affiliateService,
                                         ICheckoutAttributeFormatter checkoutAttributeFormatter,
                                         ICountryService countryService,
                                         ICurrencyService currencyService,
                                         ICustomerActivityService customerActivityService,
                                         ICustomerService customerService,
                                         ICustomNumberFormatter customNumberFormatter,
                                         IDiscountService discountService,
                                         IEncryptionService encryptionService,
                                         IEventPublisher eventPublisher,
                                         IGenericAttributeService genericAttributeService,
                                         IGiftCardService giftCardService,
                                         IHttpContextAccessor httpContextAccessor,
                                         ILanguageService languageService,
                                         ILocalizationService localizationService,
                                         ILogger logger,
                                         IOrderService orderService,
                                         IOrderTotalCalculationService orderTotalCalculationService,
                                         IPaymentService paymentService,
                                         IPdfService pdfService,
                                         IPriceCalculationService priceCalculationService,
                                         IPriceFormatter priceFormatter,
                                         IProductAttributeFormatter productAttributeFormatter,
                                         IProductAttributeParser productAttributeParser,
                                         IProductService productService,
                                         IRewardPointService rewardPointService,
                                         IShipmentService shipmentService,
                                         IShippingService shippingService,
                                         IShoppingCartService shoppingCartService,
                                         IStateProvinceService stateProvinceService,
                                         ITaxService taxService,
                                         IVendorService vendorService,
                                         IWebHelper webHelper,
                                         IWorkContext workContext,
                                         IWorkflowMessageService workflowMessageService,
                                         LocalizationSettings localizationSettings,
                                         OrderSettings orderSettings,
                                         PaymentSettings paymentSettings,
                                         RewardPointsSettings rewardPointsSettings,
                                         ShippingSettings shippingSettings,
                                         TaxSettings taxSettings) : base(currencySettings,
                                                                         affiliateService,
                                                                         checkoutAttributeFormatter,
                                                                         countryService,
                                                                         currencyService,
                                                                         customerActivityService,
                                                                         customerService,
                                                                         customNumberFormatter,
                                                                         discountService,
                                                                         encryptionService,
                                                                         eventPublisher,
                                                                         genericAttributeService,
                                                                         giftCardService,
                                                                         languageService,
                                                                         localizationService,
                                                                         logger,
                                                                         orderService,
                                                                         orderTotalCalculationService,
                                                                         paymentService,
                                                                         pdfService,
                                                                         priceCalculationService,
                                                                         priceFormatter,
                                                                         productAttributeFormatter,
                                                                         productAttributeParser,
                                                                         productService,
                                                                         rewardPointService,
                                                                         shipmentService,
                                                                         shippingService,
                                                                         shoppingCartService,
                                                                         stateProvinceService,
                                                                         taxService,
                                                                         vendorService,
                                                                         webHelper,
                                                                         workContext,
                                                                         workflowMessageService,
                                                                         localizationSettings,
                                                                         orderSettings,
                                                                         paymentSettings,
                                                                         rewardPointsSettings,
                                                                         shippingSettings,
                                                                         taxSettings)
 {
     this._currencySettings             = currencySettings;
     this._affiliateService             = affiliateService;
     this._checkoutAttributeFormatter   = checkoutAttributeFormatter;
     this._countryService               = countryService;
     this._currencyService              = currencyService;
     this._customerService              = customerService;
     this._discountService              = discountService;
     this._genericAttributeService      = genericAttributeService;
     this._httpContextAccessor          = httpContextAccessor;
     this._languageService              = languageService;
     this._localizationService          = localizationService;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._paymentService               = paymentService;
     this._priceFormatter               = priceFormatter;
     this._shoppingCartService          = shoppingCartService;
     this._stateProvinceService         = stateProvinceService;
     this._taxService       = taxService;
     this._workContext      = workContext;
     this._orderSettings    = orderSettings;
     this._shippingSettings = shippingSettings;
     this._taxSettings      = taxSettings;
 }
Exemplo n.º 20
0
        public OrderController(IOrderService orderService, 
            IOrderReportService orderReportService, IOrderProcessingService orderProcessingService,
            IDateTimeHelper dateTimeHelper, IPriceFormatter priceFormatter, ILocalizationService localizationService,
            IWorkContext workContext, ICurrencyService currencyService,
            IEncryptionService encryptionService, IPaymentService paymentService,
            IMeasureService measureService,
            IAddressService addressService, ICountryService countryService,
            IStateProvinceService stateProvinceService, IProductService productService,
            IExportManager exportManager, IPermissionService permissionService,
            IWorkflowMessageService workflowMessageService,
            ICategoryService categoryService, IManufacturerService manufacturerService,
            IProductAttributeService productAttributeService, IProductAttributeParser productAttributeParser,
            IProductAttributeFormatter productAttributeFormatter, IShoppingCartService shoppingCartService,
            ICheckoutAttributeFormatter checkoutAttributeFormatter, 
            IGiftCardService giftCardService, IDownloadService downloadService,
			IShipmentService shipmentService, IStoreService storeService,
			ITaxService taxService,
			IPriceCalculationService priceCalculationService,
			IEventPublisher eventPublisher,
			ICustomerService customerService,
			PluginMediator pluginMediator,
			IAffiliateService affiliateService,
            CatalogSettings catalogSettings, CurrencySettings currencySettings, TaxSettings taxSettings,
            MeasureSettings measureSettings, PdfSettings pdfSettings, AddressSettings addressSettings,
            IPdfConverter pdfConverter, ICommonServices services, Lazy<IPictureService> pictureService)
        {
            this._orderService = orderService;
            this._orderReportService = orderReportService;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper = dateTimeHelper;
            this._priceFormatter = priceFormatter;
            this._localizationService = localizationService;
            this._workContext = workContext;
            this._currencyService = currencyService;
            this._encryptionService = encryptionService;
            this._paymentService = paymentService;
            this._measureService = measureService;
            this._addressService = addressService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._productService = productService;
            this._exportManager = exportManager;
            this._permissionService = permissionService;
            this._workflowMessageService = workflowMessageService;
            this._categoryService = categoryService;
            this._manufacturerService = manufacturerService;
            this._productAttributeService = productAttributeService;
            this._productAttributeParser = productAttributeParser;
            this._productAttributeFormatter = productAttributeFormatter;
            this._shoppingCartService = shoppingCartService;
            this._giftCardService = giftCardService;
            this._downloadService = downloadService;
            this._shipmentService = shipmentService;
            this._storeService = storeService;
            this._taxService = taxService;
            this._priceCalculationService = priceCalculationService;
            this._eventPublisher = eventPublisher;
            this._customerService = customerService;
            this._pluginMediator = pluginMediator;
            this._affiliateService = affiliateService;

            this._catalogSettings = catalogSettings;
            this._currencySettings = currencySettings;
            this._taxSettings = taxSettings;
            this._measureSettings = measureSettings;
            this._pdfSettings = pdfSettings;
            this._addressSettings = addressSettings;

            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
            _pdfConverter = pdfConverter;
            _services = services;
            _pictureService = pictureService;
        }
        public ShoppingCartModelExtension(
            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,
            IStaticCacheManager cacheManager,
            IWebHelper webHelper,
            ICustomerActivityService customerActivityService,
            IGenericAttributeService genericAttributeService,
            IAddressAttributeFormatter addressAttributeFormatter,
            MediaSettings mediaSettings,
            ShoppingCartSettings shoppingCartSettings,
            CatalogSettings catalogSettings,
            OrderSettings orderSettings,
            ShippingSettings shippingSettings,
            TaxSettings taxSettings,
            CaptchaSettings captchaSettings,
            AddressSettings addressSettings,
            RewardPointsSettings rewardPointsSettings,
            CustomerSettings customerSettings) : base(
                shoppingCartModelFactory,
                productService,
                storeContext,
                workContext,
                shoppingCartService,
                pictureService,
                localizationService,
                productAttributeService,
                productAttributeParser,
                taxService,
                currencyService,
                priceCalculationService,
                priceFormatter,
                checkoutAttributeParser,
                discountService,
                customerService,
                giftCardService,
                dateRangeService,
                checkoutAttributeService,
                workflowMessageService,
                permissionService,
                downloadService,
                cacheManager,
                webHelper,
                customerActivityService,
                genericAttributeService,
                mediaSettings,
                shoppingCartSettings,
                orderSettings,
                captchaSettings,
                customerSettings
                )
        {
            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._addressAttributeFormatter = addressAttributeFormatter;

            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._customerSettings         = customerSettings;
            this._shoppingCartModelFactory = shoppingCartModelFactory;
        }
Exemplo n.º 22
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;
 }
Exemplo n.º 23
0
 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);
 }
Exemplo n.º 24
0
        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 = new PluginFinder();

            _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>();
            _typeFinder          = MockRepository.GenerateMock <ITypeFinder>();

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

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

            _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,
                                                            _shoppingCartSettings, _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>();

            _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,
                                                                 _orderTotalCalcService, _priceCalcService, _priceFormatter,
                                                                 _productAttributeParser, _productAttributeFormatter,
                                                                 _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                                                                 _shippingService, _shipmentService, _taxService,
                                                                 _customerService, _discountService,
                                                                 _encryptionService, _workContext, _storeContext,
                                                                 _messageFactory, _customerActivityService, _currencyService, _affiliateService,
                                                                 _eventPublisher, _genericAttributeService,
                                                                 _newsLetterSubscriptionService,
                                                                 _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings,
                                                                 _currencySettings, _shoppingCartSettings);
        }
Exemplo n.º 25
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;
 }
Exemplo n.º 26
0
        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,
                CheckoutAttributeId = ca1.Id
            };
            cav1_2 = new CheckoutAttributeValue
            {
                Id                  = 12,
                Name                = "Red",
                DisplayOrder        = 2,
                CheckoutAttributeId = ca1.Id
            };

            //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,
                CheckoutAttributeId = ca2.Id
            };
            cav2_2 = new CheckoutAttributeValue
            {
                Id                  = 22,
                Name                = "Option 2",
                DisplayOrder        = 2,
                CheckoutAttributeId = ca2.Id
            };

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


            #endregion

            _checkoutAttributeRepo = new FakeRepository <CheckoutAttribute>(new List <CheckoutAttribute> {
                ca1, ca2, ca3
            });

            _checkoutAttributeValueRepo = new FakeRepository <CheckoutAttributeValue>(new List <CheckoutAttributeValue> {
                cav1_1, cav1_2, cav2_1, cav2_2
            });

            var staticCacheManager = new TestCacheManager();

            _storeMappingService = new Mock <IStoreMappingService>();

            _checkoutAttributeService = new CheckoutAttributeService(staticCacheManager,
                                                                     _checkoutAttributeRepo, _checkoutAttributeValueRepo, _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()
        {
            _workContext = null;

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

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

            //price calculation service
            _discountService = MockRepository.GenerateMock<IDiscountService>();
            _categoryService = MockRepository.GenerateMock<ICategoryService>();
            _productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
            _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,
                _localizationService,
                _shippingSettings, pluginFinder,
                _eventPublisher, _shoppingCartSettings);
            _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,
                _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>();
            _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>();
            _workflowMessageService = MockRepository.GenerateMock<IWorkflowMessageService>();
            _customerActivityService = MockRepository.GenerateMock<ICustomerActivityService>();
            _currencyService = MockRepository.GenerateMock<ICurrencyService>();

            _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,
                _customerActivityService, _currencyService,
                _eventPublisher, _paymentSettings, _rewardPointsSettings,
                _orderSettings, _taxSettings, _localizationSettings,
                _currencySettings);
        }
 public MmsOrderProcessingOverride(
     CurrencySettings currencySettings,
     IAddressService addressService,
     IAffiliateService affiliateService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     ICountryService countryService,
     ICurrencyService currencyService,
     ICustomerActivityService customerActivityService,
     ICustomerService customerService,
     ICustomNumberFormatter customNumberFormatter,
     IDiscountService discountService,
     IEncryptionService encryptionService,
     IEventPublisher eventPublisher,
     IGenericAttributeService genericAttributeService,
     IGiftCardService giftCardService,
     ILanguageService languageService,
     ILocalizationService localizationService,
     ILogger logger,
     IOrderService orderService,
     IOrderTotalCalculationService orderTotalCalculationService,
     IPaymentPluginManager paymentPluginManager,
     IPaymentService paymentService,
     IPdfService pdfService,
     IPriceCalculationService priceCalculationService,
     IPriceFormatter priceFormatter,
     IProductAttributeFormatter productAttributeFormatter,
     IProductAttributeParser productAttributeParser,
     IProductService productService,
     IRewardPointService rewardPointService,
     IShipmentService shipmentService,
     IShippingService shippingService,
     IShoppingCartService shoppingCartService,
     IStateProvinceService stateProvinceService,
     ITaxService taxService,
     IVendorService vendorService,
     IWebHelper webHelper,
     IWorkContext workContext,
     IWorkflowMessageService workflowMessageService,
     LocalizationSettings localizationSettings,
     OrderSettings orderSettings,
     PaymentSettings paymentSettings,
     RewardPointsSettings rewardPointsSettings,
     ShippingSettings shippingSettings,
     TaxSettings taxSettings,
     MmsAdminService mmsadminService) : base(
         currencySettings,
         addressService,
         affiliateService,
         checkoutAttributeFormatter,
         countryService,
         currencyService,
         customerActivityService,
         customerService,
         customNumberFormatter,
         discountService,
         encryptionService,
         eventPublisher,
         genericAttributeService,
         giftCardService,
         languageService,
         localizationService,
         logger,
         orderService,
         orderTotalCalculationService,
         paymentPluginManager,
         paymentService,
         pdfService,
         priceCalculationService,
         priceFormatter,
         productAttributeFormatter,
         productAttributeParser,
         productService,
         rewardPointService,
         shipmentService,
         shippingService,
         shoppingCartService,
         stateProvinceService,
         taxService,
         vendorService,
         webHelper,
         workContext,
         workflowMessageService,
         localizationSettings,
         orderSettings,
         paymentSettings,
         rewardPointsSettings,
         shippingSettings,
         taxSettings)
 {
     _currencySettings           = currencySettings;
     _addressService             = addressService;
     _affiliateService           = affiliateService;
     _checkoutAttributeFormatter = checkoutAttributeFormatter;
     _countryService             = countryService;
     _currencyService            = currencyService;
     _customerActivityService    = customerActivityService;
     _customerService            = customerService;
     _customNumberFormatter      = customNumberFormatter;
     _discountService            = discountService;
     _encryptionService          = encryptionService;
     _eventPublisher             = eventPublisher;
     _genericAttributeService    = genericAttributeService;
     _giftCardService            = giftCardService;
     _languageService            = languageService;
     _localizationService        = localizationService;
     _logger       = logger;
     _orderService = orderService;
     _orderTotalCalculationService = orderTotalCalculationService;
     _paymentPluginManager         = paymentPluginManager;
     _paymentService            = paymentService;
     _pdfService                = pdfService;
     _priceCalculationService   = priceCalculationService;
     _priceFormatter            = priceFormatter;
     _productAttributeFormatter = productAttributeFormatter;
     _productAttributeParser    = productAttributeParser;
     _productService            = productService;
     _rewardPointService        = rewardPointService;
     _shipmentService           = shipmentService;
     _shippingService           = shippingService;
     _shoppingCartService       = shoppingCartService;
     _stateProvinceService      = stateProvinceService;
     _taxService                = taxService;
     _vendorService             = vendorService;
     _webHelper              = webHelper;
     _workContext            = workContext;
     _workflowMessageService = workflowMessageService;
     _localizationSettings   = localizationSettings;
     _orderSettings          = orderSettings;
     _paymentSettings        = paymentSettings;
     _rewardPointsSettings   = rewardPointsSettings;
     _shippingSettings       = shippingSettings;
     _taxSettings            = taxSettings;
     _mmsadminService        = mmsadminService;
 }
 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,
                                           IPaymentPluginManager paymentPluginManager,
                                           IPaymentService paymentService,
                                           IPermissionService permissionService,
                                           IPictureService pictureService,
                                           IPriceCalculationService priceCalculationService,
                                           IPriceFormatter priceFormatter,
                                           IProductAttributeFormatter productAttributeFormatter,
                                           IProductService productService,
                                           IShippingPluginManager shippingPluginManager,
                                           IShippingService shippingService,
                                           IShoppingCartService shoppingCartService,
                                           IStateProvinceService stateProvinceService,
                                           IStaticCacheManager cacheManager,
                                           IStoreContext storeContext,
                                           ITaxPluginManager taxPluginManager,
                                           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,
                                                                                 paymentPluginManager,
                                                                                 paymentService,
                                                                                 permissionService,
                                                                                 pictureService,
                                                                                 priceCalculationService,
                                                                                 priceFormatter,
                                                                                 productAttributeFormatter,
                                                                                 productService,
                                                                                 shippingPluginManager,
                                                                                 shippingService,
                                                                                 shoppingCartService,
                                                                                 stateProvinceService,
                                                                                 cacheManager,
                                                                                 storeContext,
                                                                                 taxService,
                                                                                 urlRecordService,
                                                                                 vendorService,
                                                                                 webHelper,
                                                                                 workContext,
                                                                                 mediaSettings,
                                                                                 orderSettings,
                                                                                 rewardPointsSettings,
                                                                                 shippingSettings,
                                                                                 shoppingCartSettings,
                                                                                 taxSettings,
                                                                                 vendorSettings)
 {
     _countryService               = countryService;
     _currencyService              = currencyService;
     _genericAttributeService      = genericAttributeService;
     _giftCardService              = giftCardService;
     _httpContextAccessor          = httpContextAccessor;
     _orderTotalCalculationService = orderTotalCalculationService;
     _paymentService               = paymentService;
     _priceCalculationService      = priceCalculationService;
     _priceFormatter               = priceFormatter;
     _shippingPluginManager        = shippingPluginManager;
     _shoppingCartService          = shoppingCartService;
     _stateProvinceService         = stateProvinceService;
     _storeContext         = storeContext;
     _taxPluginManager     = taxPluginManager;
     _taxService           = taxService;
     _workContext          = workContext;
     _rewardPointsSettings = rewardPointsSettings;
     _shippingSettings     = shippingSettings;
     _taxSettings          = taxSettings;
 }
Exemplo n.º 30
0
        public void SetUp()
        {
            _checkoutAttributeParser    = GetService <ICheckoutAttributeParser>();
            _checkoutAttributeFormatter = GetService <ICheckoutAttributeFormatter>();
            _checkoutAttributeService   = GetService <ICheckoutAttributeService>();

            //color (dropdownlist)
            _ca1 = new CheckoutAttribute
            {
                Name                 = "Color",
                TextPrompt           = "Select color:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.DropdownList,
                DisplayOrder         = 1
            };

            _checkoutAttributeService.InsertCheckoutAttribute(_ca1);

            _cav11 = new CheckoutAttributeValue
            {
                Name                = "Green",
                DisplayOrder        = 1,
                CheckoutAttributeId = _ca1.Id
            };
            _cav12 = new CheckoutAttributeValue
            {
                Name                = "Red",
                DisplayOrder        = 2,
                CheckoutAttributeId = _ca1.Id
            };

            _checkoutAttributeService.InsertCheckoutAttributeValue(_cav11);
            _checkoutAttributeService.InsertCheckoutAttributeValue(_cav12);

            //custom option (checkboxes)
            _ca2 = new CheckoutAttribute
            {
                Name                 = "Custom option",
                TextPrompt           = "Select custom option:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Checkboxes,
                DisplayOrder         = 2
            };

            _checkoutAttributeService.InsertCheckoutAttribute(_ca2);

            _cav21 = new CheckoutAttributeValue
            {
                Name                = "Option 1",
                DisplayOrder        = 1,
                CheckoutAttributeId = _ca2.Id
            };
            _cav22 = new CheckoutAttributeValue
            {
                Name                = "Option 2",
                DisplayOrder        = 2,
                CheckoutAttributeId = _ca2.Id
            };

            _checkoutAttributeService.InsertCheckoutAttributeValue(_cav21);
            _checkoutAttributeService.InsertCheckoutAttributeValue(_cav22);

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

            _checkoutAttributeService.InsertCheckoutAttribute(_ca3);
        }
Exemplo n.º 31
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="orderService">Order service</param>
 /// <param name="webHelper">Web helper</param>
 /// <param name="localizationService">Localization service</param>
 /// <param name="languageService">Language service</param>
 /// <param name="productService">Product service</param>
 /// <param name="paymentService">Payment service</param>
 /// <param name="logger">Logger</param>
 /// <param name="orderTotalCalculationService">Order total calculationservice</param>
 /// <param name="priceCalculationService">Price calculation service</param>
 /// <param name="priceFormatter">Price formatter</param>
 /// <param name="productAttributeParser">Product attribute parser</param>
 /// <param name="productAttributeFormatter">Product attribute formatter</param>
 /// <param name="giftCardService">Gift card service</param>
 /// <param name="shoppingCartService">Shopping cart service</param>
 /// <param name="checkoutAttributeFormatter">Checkout attribute service</param>
 /// <param name="shippingService">Shipping service</param>
 /// <param name="shipmentService">Shipment service</param>
 /// <param name="taxService">Tax service</param>
 /// <param name="customerService">Customer service</param>
 /// <param name="discountService">Discount service</param>
 /// <param name="encryptionService">Encryption service</param>
 /// <param name="workContext">Work context</param>
 /// <param name="workflowMessageService">Workflow message service</param>
 /// <param name="vendorService">Vendor service</param>
 /// <param name="customerActivityService">Customer activity service</param>
 /// <param name="currencyService">Currency service</param>
 /// <param name="affiliateService">Affiliate service</param>
 /// <param name="eventPublisher">Event published</param>
 /// <param name="pdfService">PDF service</param>
 /// <param name="paymentSettings">Payment settings</param>
 /// <param name="shippingSettings">Shipping settings</param>
 /// <param name="rewardPointsSettings">Reward points settings</param>
 /// <param name="orderSettings">Order settings</param>
 /// <param name="taxSettings">Tax settings</param>
 /// <param name="localizationSettings">Localization settings</param>
 /// <param name="currencySettings">Currency settings</param>
 public OrderProcessingService(IOrderService orderService,
     IWebHelper webHelper,
     ILocalizationService localizationService,
     ILanguageService languageService,
     IProductService productService,
     IPaymentService paymentService,
     ILogger logger,
     IOrderTotalCalculationService orderTotalCalculationService,
     IPriceCalculationService priceCalculationService,
     IPriceFormatter priceFormatter,
     IProductAttributeParser productAttributeParser,
     IProductAttributeFormatter productAttributeFormatter,
     IGiftCardService giftCardService,
     IShoppingCartService shoppingCartService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     IShippingService shippingService,
     IShipmentService shipmentService,
     ITaxService taxService,
     ICustomerService customerService,
     IDiscountService discountService,
     IEncryptionService encryptionService,
     IWorkContext workContext,
     IWorkflowMessageService workflowMessageService,
     IVendorService vendorService,
     ICustomerActivityService customerActivityService,
     ICurrencyService currencyService,
     IAffiliateService affiliateService,
     IEventPublisher eventPublisher,
     IPdfService pdfService,
     ShippingSettings shippingSettings,
     PaymentSettings paymentSettings,
     RewardPointsSettings rewardPointsSettings,
     OrderSettings orderSettings,
     TaxSettings taxSettings,
     LocalizationSettings localizationSettings,
     CurrencySettings currencySettings)
 {
     this._orderService = orderService;
     this._webHelper = webHelper;
     this._localizationService = localizationService;
     this._languageService = languageService;
     this._productService = productService;
     this._paymentService = paymentService;
     this._logger = logger;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._priceCalculationService = priceCalculationService;
     this._priceFormatter = priceFormatter;
     this._productAttributeParser = productAttributeParser;
     this._productAttributeFormatter = productAttributeFormatter;
     this._giftCardService = giftCardService;
     this._shoppingCartService = shoppingCartService;
     this._checkoutAttributeFormatter = checkoutAttributeFormatter;
     this._workContext = workContext;
     this._workflowMessageService = workflowMessageService;
     this._vendorService = vendorService;
     this._shippingService = shippingService;
     this._shipmentService = shipmentService;
     this._taxService = taxService;
     this._customerService = customerService;
     this._discountService = discountService;
     this._encryptionService = encryptionService;
     this._customerActivityService = customerActivityService;
     this._currencyService = currencyService;
     this._affiliateService = affiliateService;
     this._eventPublisher = eventPublisher;
     this._pdfService = pdfService;
     this._paymentSettings = paymentSettings;
     this._shippingSettings = shippingSettings;
     this._rewardPointsSettings = rewardPointsSettings;
     this._orderSettings = orderSettings;
     this._taxSettings = taxSettings;
     this._localizationSettings = localizationSettings;
     this._currencySettings = currencySettings;
 }
        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();

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

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

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

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

            _productAttributeParser = new Mock <IProductAttributeParser>().Object;
            _priceCalcService       = new PriceCalculationService(_workContext, _storeContext,
                                                                  _discountService, _categoryService, _manufacturerService,
                                                                  _productAttributeParser, _productService, _customerService,
                                                                  cacheManager, _vendorService, _storeService, _currencyService, _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);
            _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))
                .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, _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;

            _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, tempICustomerActionEventService,
                                                                 _currencyService, _affiliateService,
                                                                 _eventPublisher, _pdfService, null, null, _storeContext, _productReservationService, _auctionService,
                                                                 _shippingSettings, _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings);
        }