Example #1
0
        public CustomOrderProcessingService(
            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,
            // custom
            IWarrantyTaxService warrantyTaxService
            ) : 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)
        {
            _customerActivityService = customerActivityService;
            _customerService         = customerService;
            _discountService         = discountService;
            _eventPublisher          = eventPublisher;
            _localizationService     = localizationService;
            _logger                    = logger;
            _orderService              = orderService;
            _paymentService            = paymentService;
            _priceCalculationService   = priceCalculationService;
            _productAttributeFormatter = productAttributeFormatter;
            _productService            = productService;
            _shippingService           = shippingService;
            _shoppingCartService       = shoppingCartService;
            _taxService                = taxService;
            _paymentSettings           = paymentSettings;

            // custom
            _warrantyTaxService = warrantyTaxService;
        }
        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> >();
            _warehouseRepository      = MockRepository.GenerateMock <IRepository <Warehouse> >();
            _logger          = new NullLogger();
            _shippingService = new ShippingService(_shippingMethodRepository,
                                                   _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>();
            _stateProvinceService = MockRepository.GenerateMock <IStateProvinceService>();
            _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, _logger, _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,
                                                                 _genericAttributeService,
                                                                 _countryService, _stateProvinceService,
                                                                 _shippingSettings, _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings,
                                                                 _currencySettings);
        }
Example #3
0
 public static RewardPointsSettings ToEntity(this RewardPointsSettingsModel model, RewardPointsSettings destination)
 {
     return(model.MapTo(destination));
 }
        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;
        }
Example #5
0
 public CustomerModelFactory(AddressSettings addressSettings,
                             CaptchaSettings captchaSettings,
                             CatalogSettings catalogSettings,
                             CommonSettings commonSettings,
                             CustomerSettings customerSettings,
                             DateTimeSettings dateTimeSettings,
                             ExternalAuthenticationSettings externalAuthenticationSettings,
                             ForumSettings forumSettings,
                             GdprSettings gdprSettings,
                             IAddressModelFactory addressModelFactory,
                             ICountryService countryService,
                             ICustomerAttributeParser customerAttributeParser,
                             ICustomerAttributeService customerAttributeService,
                             IDateTimeHelper dateTimeHelper,
                             IDownloadService downloadService,
                             IExternalAuthenticationService externalAuthenticationService,
                             IGdprService gdprService,
                             IGenericAttributeService genericAttributeService,
                             ILocalizationService localizationService,
                             INewsLetterSubscriptionService newsLetterSubscriptionService,
                             IOrderService orderService,
                             IPictureService pictureService,
                             IReturnRequestService returnRequestService,
                             IStateProvinceService stateProvinceService,
                             IStoreContext storeContext,
                             IStoreMappingService storeMappingService,
                             IUrlRecordService urlRecordService,
                             IWorkContext workContext,
                             MediaSettings mediaSettings,
                             OrderSettings orderSettings,
                             RewardPointsSettings rewardPointsSettings,
                             SecuritySettings securitySettings,
                             TaxSettings taxSettings,
                             VendorSettings vendorSettings)
 {
     this._addressSettings  = addressSettings;
     this._captchaSettings  = captchaSettings;
     this._catalogSettings  = catalogSettings;
     this._commonSettings   = commonSettings;
     this._customerSettings = customerSettings;
     this._dateTimeSettings = dateTimeSettings;
     this._externalAuthenticationSettings = externalAuthenticationSettings;
     this._forumSettings                 = forumSettings;
     this._gdprSettings                  = gdprSettings;
     this._addressModelFactory           = addressModelFactory;
     this._countryService                = countryService;
     this._customerAttributeParser       = customerAttributeParser;
     this._customerAttributeService      = customerAttributeService;
     this._dateTimeHelper                = dateTimeHelper;
     this._downloadService               = downloadService;
     this._externalAuthenticationService = externalAuthenticationService;
     this._gdprService                   = gdprService;
     this._genericAttributeService       = genericAttributeService;
     this._localizationService           = localizationService;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._orderService                  = orderService;
     this._pictureService                = pictureService;
     this._returnRequestService          = returnRequestService;
     this._stateProvinceService          = stateProvinceService;
     this._storeContext                  = storeContext;
     this._storeMappingService           = storeMappingService;
     this._urlRecordService              = urlRecordService;
     this._workContext                   = workContext;
     this._mediaSettings                 = mediaSettings;
     this._orderSettings                 = orderSettings;
     this._rewardPointsSettings          = rewardPointsSettings;
     this._securitySettings              = securitySettings;
     this._taxSettings                   = taxSettings;
     this._vendorSettings                = vendorSettings;
 }
        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);
        }
        public void TestInitialize()
        {
            _securitySettings = new SecuritySettings
            {
                EncryptionKey = "273ece6f97dd844d97dd8f4d"
            };
            _rewardPointsSettings = new RewardPointsSettings
            {
                Enabled = false,
            };

            _encryptionService = new EncryptionService(_securitySettings);

            var customer1 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Hashed,
                Active         = true
            };

            string saltKey  = _encryptionService.CreateSaltKey(5);
            string password = _encryptionService.CreatePasswordHash("password", saltKey);

            customer1.PasswordSalt = saltKey;
            customer1.Password     = password;
            AddCustomerToRegisteredRole(customer1);

            var customer2 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer2);

            var customer3 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                Active         = true
            };

            AddCustomerToRegisteredRole(customer3);

            var customer4 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer4);

            var customer5 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            //trying to recreate

            var eventPublisher = new Mock <IMediator>();

            //eventPublisher.Setup(x => x.PublishAsync(new object()));
            _eventPublisher = eventPublisher.Object;

            _storeService = new Mock <IStoreService>().Object;

            _customerRepo = new Grand.Services.Tests.MongoDBRepositoryTest <Customer>();
            _customerRepo.Insert(customer1);
            _customerRepo.Insert(customer2);
            _customerRepo.Insert(customer3);
            _customerRepo.Insert(customer4);
            _customerRepo.Insert(customer5);

            _customerRoleRepo         = new Mock <IRepository <CustomerRole> >().Object;
            _orderRepo                = new Mock <IRepository <Order> >().Object;
            _forumPostRepo            = new Mock <IRepository <ForumPost> >().Object;
            _forumTopicRepo           = new Mock <IRepository <ForumTopic> >().Object;
            _customerProductPriceRepo = new Mock <IRepository <CustomerProductPrice> >().Object;
            _customerProductRepo      = new Mock <IRepository <CustomerProduct> >().Object;
            _customerHistoryRepo      = new Mock <IRepository <CustomerHistoryPassword> >().Object;
            _customerNoteRepo         = new Mock <IRepository <CustomerNote> >().Object;

            _genericAttributeService       = new Mock <IGenericAttributeService>().Object;
            _newsLetterSubscriptionService = new Mock <INewsLetterSubscriptionService>().Object;
            _localizationService           = new Mock <ILocalizationService>().Object;
            _rewardPointsService           = new Mock <IRewardPointsService>().Object;
            _customerRoleProductRepo       = new Mock <IRepository <CustomerRoleProduct> >().Object;
            _serviceProvider  = new Mock <IServiceProvider>().Object;
            _customerSettings = new CustomerSettings();
            _commonSettings   = new CommonSettings();
            _customerService  = new CustomerService(new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher), _customerRepo, _customerRoleRepo, _customerProductRepo, _customerProductPriceRepo,
                                                    _customerHistoryRepo, _customerRoleProductRepo, _customerNoteRepo, null, _eventPublisher, _serviceProvider);

            _customerRegistrationService = new CustomerRegistrationService(
                _customerService,
                _encryptionService,
                _newsLetterSubscriptionService,
                _localizationService,
                _storeService,
                _eventPublisher,
                _rewardPointsSettings,
                _customerSettings,
                _rewardPointsService);
        }
        public new void SetUp()
        {
            _workContext = null;
            _services    = MockRepository.GenerateMock <ICommonServices>();

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

            var pluginFinder = PluginFinder.Current;

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

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

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

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

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

            _shipmentService = MockRepository.GenerateMock <IShipmentService>();

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

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

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

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

            _rewardPointsSettings = new RewardPointsSettings();

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

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

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

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

            _localizationSettings = new LocalizationSettings();

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

            _orderProcessingService = new OrderProcessingService(_orderService, _webHelper,
                                                                 _localizationService, _languageService,
                                                                 _productService, _paymentService,
                                                                 _orderTotalCalcService, _priceCalcService, _priceFormatter,
                                                                 _productAttributeParser, _productAttributeFormatter,
                                                                 _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                                                                 _shippingService, _shipmentService, _taxService,
                                                                 _customerService, _discountService,
                                                                 _encryptionService, _workContext, _storeContext,
                                                                 _messageFactory, _customerActivityService, _currencyService, _affiliateService,
                                                                 _eventPublisher, _genericAttributeService,
                                                                 _newsLetterSubscriptionService,
                                                                 _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings,
                                                                 _shoppingCartSettings,
                                                                 _catalogSettings);
        }
        public new void SetUp()
        {
            _customerSettings = new CustomerSettings();
            _securitySettings = new SecuritySettings()
            {
                EncryptionKey = "273ece6f97dd844d"
            };
            _rewardPointsSettings = new RewardPointsSettings()
            {
                Enabled = false,
            };

            _encryptionService = new EncryptionService(_securitySettings);
            _customerRepo      = MockRepository.GenerateMock <IRepository <Customer> >();
            var customer1 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Hashed,
                Active         = true
            };

            string saltKey  = _encryptionService.CreateSaltKey(5);
            string password = _encryptionService.CreatePasswordHash("password", saltKey);

            customer1.PasswordSalt = saltKey;
            customer1.Password     = password;
            AddCustomerToRegisteredRole(customer1);

            var customer2 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer2);

            var customer3 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                Active         = true
            };

            AddCustomerToRegisteredRole(customer3);

            var customer4 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer4);

            var customer5 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

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

            _customerRepo.Expect(x => x.Table).Return(new List <Customer>()
            {
                customer1, customer2, customer3, customer4, customer5
            }.AsQueryable());

            _customerRoleRepo        = MockRepository.GenerateMock <IRepository <CustomerRole> >();
            _genericAttributeRepo    = MockRepository.GenerateMock <IRepository <GenericAttribute> >();
            _rewardPointsHistoryRepo = MockRepository.GenerateMock <IRepository <RewardPointsHistory> >();
            _userAgent = MockRepository.GenerateMock <IUserAgent>();

            _genericAttributeService       = MockRepository.GenerateMock <IGenericAttributeService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();

            _storeContext = MockRepository.GenerateMock <IStoreContext>();

            _services = MockRepository.GenerateMock <ICommonServices>();
            _services.Expect(x => x.StoreContext).Return(_storeContext);
            _services.Expect(x => x.RequestCache).Return(NullRequestCache.Instance);
            _services.Expect(x => x.Cache).Return(NullCache.Instance);
            _services.Expect(x => x.EventPublisher).Return(_eventPublisher);

            _messageModelProvider = MockRepository.GenerateMock <Lazy <IMessageModelProvider> >();
            _gdprTool             = MockRepository.GenerateMock <Lazy <IGdprTool> >();

            _customerService = new CustomerService(
                _customerRepo,
                _customerRoleRepo,
                _genericAttributeRepo,
                _rewardPointsHistoryRepo,
                _genericAttributeService,
                _rewardPointsSettings,
                _services,
                new FakeHttpContext("~/"),
                _userAgent,
                _messageModelProvider,
                _gdprTool);

            _customerRegistrationService = new CustomerRegistrationService(_customerService,
                                                                           _encryptionService, _newsLetterSubscriptionService, _rewardPointsSettings, _customerSettings, _storeContext, _eventPublisher);
        }
Example #10
0
 public UserStateManagementController(
     IUserStateManagementService userStateManagement,
     ICustomerService customerService,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     IGenericAttributeService genericAttributeService,
     ICustomerRegistrationService customerRegistrationService,
     ICustomerReportService customerReportService,
     IDateTimeHelper dateTimeHelper,
     ILocalizationService localizationService,
     DateTimeSettings dateTimeSettings,
     TaxSettings taxSettings,
     RewardPointsSettings rewardPointsSettings,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     IAddressService addressService,
     CustomerSettings customerSettings,
     ITaxService taxService,
     IWorkContext workContext,
     IVendorService vendorService,
     IStoreContext storeContext,
     IPriceFormatter priceFormatter,
     IOrderService orderService,
     IExportManager exportManager,
     ICustomerActivityService customerActivityService,
     IPriceCalculationService priceCalculationService,
     IProductAttributeFormatter productAttributeFormatter,
     IPermissionService permissionService,
     IQueuedEmailService queuedEmailService,
     EmailAccountSettings emailAccountSettings,
     IEmailAccountService emailAccountService,
     ForumSettings forumSettings,
     IForumService forumService,
     IOpenAuthenticationService openAuthenticationService,
     AddressSettings addressSettings,
     IStoreService storeService,
     ICustomerAttributeParser customerAttributeParser,
     ICustomerAttributeService customerAttributeService,
     IAddressAttributeParser addressAttributeParser,
     IAddressAttributeService addressAttributeService,
     IAddressAttributeFormatter addressAttributeFormatter,
     IAffiliateService affiliateService,
     IWorkflowMessageService workflowMessageService)
     : base(customerService, newsLetterSubscriptionService, genericAttributeService,
            customerRegistrationService, customerReportService, dateTimeHelper,
            localizationService, dateTimeSettings, taxSettings, rewardPointsSettings,
            countryService, stateProvinceService, addressService, customerSettings,
            taxService, workContext, vendorService, storeContext, priceFormatter,
            orderService, exportManager, customerActivityService, priceCalculationService,
            productAttributeFormatter, permissionService, queuedEmailService,
            emailAccountSettings, emailAccountService, forumSettings,
            forumService, openAuthenticationService, addressSettings,
            storeService, customerAttributeParser, customerAttributeService,
            addressAttributeParser, addressAttributeService, addressAttributeFormatter,
            affiliateService, workflowMessageService)
 {
     this._customerService = customerService;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._genericAttributeService       = genericAttributeService;
     this._customerRegistrationService   = customerRegistrationService;
     this._customerReportService         = customerReportService;
     this._dateTimeHelper             = dateTimeHelper;
     this._localizationService        = localizationService;
     this._dateTimeSettings           = dateTimeSettings;
     this._taxSettings                = taxSettings;
     this._rewardPointsSettings       = rewardPointsSettings;
     this._countryService             = countryService;
     this._stateProvinceService       = stateProvinceService;
     this._addressService             = addressService;
     this._customerSettings           = customerSettings;
     this._taxService                 = taxService;
     this._workContext                = workContext;
     this._vendorService              = vendorService;
     this._storeContext               = storeContext;
     this._priceFormatter             = priceFormatter;
     this._orderService               = orderService;
     this._exportManager              = exportManager;
     this._customerActivityService    = customerActivityService;
     this._priceCalculationService    = priceCalculationService;
     this._productAttributeFormatter  = productAttributeFormatter;
     this._permissionService          = permissionService;
     this._queuedEmailService         = queuedEmailService;
     this._emailAccountSettings       = emailAccountSettings;
     this._emailAccountService        = emailAccountService;
     this._forumSettings              = forumSettings;
     this._forumService               = forumService;
     this._openAuthenticationService  = openAuthenticationService;
     this._addressSettings            = addressSettings;
     this._storeService               = storeService;
     this._customerAttributeParser    = customerAttributeParser;
     this._customerAttributeService   = customerAttributeService;
     this._addressAttributeParser     = addressAttributeParser;
     this._addressAttributeService    = addressAttributeService;
     this._addressAttributeFormatter  = addressAttributeFormatter;
     this._affiliateService           = affiliateService;
     this._workflowMessageService     = workflowMessageService;
     this._userStateManagementService = userStateManagement;
 }
        public new void SetUp()
        {
            _settingService = MockRepository.GenerateMock <ISettingService>();
            _workContext    = MockRepository.GenerateMock <IWorkContext>();

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

            _dateTimeSettings = new DateTimeSettings
            {
                AllowCustomersToSetTimeZone = false,
                DefaultStoreTimeZoneId      = ""
            };

            _rewardPointsSettings = new RewardPointsSettings
            {
                Enabled = false,
            };

            var customer1 = new Customer
            {
                Id         = 1,
                TimeZoneId = "Russian Standard Time"    // (GMT+03:00) Moscow, St. Petersburg, Volgograd
            };

            _customerRepo = MockRepository.GenerateMock <IRepository <Customer> >();
            _customerRepo.Expect(x => x.Table).Return(new List <Customer> {
                customer1
            }.AsQueryable());

            _customerRoleRepo        = MockRepository.GenerateMock <IRepository <CustomerRole> >();
            _customerRoleMappingRepo = MockRepository.GenerateMock <IRepository <CustomerRoleMapping> >();
            _genericAttributeRepo    = MockRepository.GenerateMock <IRepository <GenericAttribute> >();
            _rewardPointsHistoryRepo = MockRepository.GenerateMock <IRepository <RewardPointsHistory> >();
            _shoppingCartItemRepo    = MockRepository.GenerateMock <IRepository <ShoppingCartItem> >();
            _userAgent = MockRepository.GenerateMock <IUserAgent>();
            _genericAttributeService = MockRepository.GenerateMock <IGenericAttributeService>();
            _gdprTool = MockRepository.GenerateMock <Lazy <IGdprTool> >();

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

            _services = MockRepository.GenerateMock <ICommonServices>();
            _services.Expect(x => x.StoreContext).Return(_storeContext);
            _services.Expect(x => x.RequestCache).Return(NullRequestCache.Instance);
            _services.Expect(x => x.Cache).Return(NullCache.Instance);
            _services.Expect(x => x.EventPublisher).Return(_eventPublisher);

            _customerService = new CustomerService(
                _customerRepo,
                _customerRoleRepo,
                _customerRoleMappingRepo,
                _genericAttributeRepo,
                _rewardPointsHistoryRepo,
                _shoppingCartItemRepo,
                _genericAttributeService,
                _rewardPointsSettings,
                _services,
                new FakeHttpContext("~/"),
                _userAgent,
                new CustomerSettings(),
                _gdprTool);

            _dateTimeHelper = new DateTimeHelper(_workContext, _settingService, _dateTimeSettings, _customerService);
        }
        public new void SetUp()
        {
            _customerSettings = new CustomerSettings();
            _securitySettings = new SecuritySettings
            {
                EncryptionKey = "273ece6f97dd844d"
            };
            _rewardPointsSettings = new RewardPointsSettings
            {
                Enabled = false,
            };

            _encryptionService = new EncryptionService(_securitySettings);
            _customerRepo      = MockRepository.GenerateMock <IRepository <Customer> >();
            var customer1 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Hashed,
                Active         = true
            };

            string saltKey  = _encryptionService.CreateSaltKey(5);
            string password = _encryptionService.CreatePasswordHash("password", saltKey);

            customer1.PasswordSalt = saltKey;
            customer1.Password     = password;
            AddCustomerToRegisteredRole(customer1);

            var customer2 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer2);

            var customer3 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                Active         = true
            };

            AddCustomerToRegisteredRole(customer3);

            var customer4 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer4);

            var customer5 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

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

            _storeService = MockRepository.GenerateMock <IStoreService>();

            _customerRepo.Expect(x => x.Table).Return(new List <Customer> {
                customer1, customer2, customer3, customer4, customer5
            }.AsQueryable());

            _customerRoleRepo     = MockRepository.GenerateMock <IRepository <CustomerRole> >();
            _genericAttributeRepo = MockRepository.GenerateMock <IRepository <GenericAttribute> >();
            _orderRepo            = MockRepository.GenerateMock <IRepository <Order> >();
            _forumPostRepo        = MockRepository.GenerateMock <IRepository <ForumPost> >();
            _forumTopicRepo       = MockRepository.GenerateMock <IRepository <ForumTopic> >();

            _genericAttributeService       = MockRepository.GenerateMock <IGenericAttributeService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();
            _rewardPointService            = MockRepository.GenerateMock <IRewardPointService>();
            _smsNotificationService        = MockRepository.GenerateMock <ISMSNotificationService>();              //BUGFIX 3.801
            _smsNotificationRepository     = MockRepository.GenerateMock <IRepository <SMSNotificationRecord> >(); //NOP 3.827

            _localizationService = MockRepository.GenerateMock <ILocalizationService>();
            _customerService     = new CustomerService(new NopNullCache(), _customerRepo, _customerRoleRepo,
                                                       _genericAttributeRepo, _orderRepo, _forumPostRepo, _forumTopicRepo,
                                                       null, null, null, null, null,
                                                       _genericAttributeService, null, null, _eventPublisher, _customerSettings, null,
                                                       _smsNotificationRepository); //NOP 3.827
            _customerRegistrationService = new CustomerRegistrationService(_customerService,
                                                                           _encryptionService, _newsLetterSubscriptionService, _localizationService,
                                                                           _storeService, _rewardPointService, _rewardPointsSettings, _customerSettings,
                                                                           _smsNotificationService); //BUGFIX 3.801
        }
 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);
 }
Example #14
0
        public JobSchedulerOrderController(IOrderService orderService,
                                           IShoppingCartService shoppingCartService,
                                           IProductService productService,
                                           IShipmentService shipmentService,
                                           IWorkContext workContext,
                                           ICurrencyService currencyService,
                                           ICustomerService customerService,
                                           IPriceFormatter priceFormatter,
                                           IOrderProcessingService orderProcessingService,
                                           IDateTimeHelper dateTimeHelper,
                                           IPaymentService paymentService,
                                           ILocalizationService localizationService,
                                           IPdfService pdfService,
                                           IShippingService shippingService,
                                           ICountryService countryService,
                                           IProductAttributeParser productAttributeParser,
                                           IWebHelper webHelper,
                                           IDownloadService downloadService,
                                           IAddressAttributeFormatter addressAttributeFormatter,
                                           IStoreContext storeContext,
                                           IOrderTotalCalculationService orderTotalCalculationService,
                                           IRewardPointService rewardPointService,
                                           CatalogSettings catalogSettings,
                                           OrderSettings orderSettings,
                                           TaxSettings taxSettings,
                                           ShippingSettings shippingSettings,
                                           AddressSettings addressSettings,
                                           RewardPointsSettings rewardPointsSettings,
                                           PdfSettings pdfSettings)
        {
            this._shoppingCartService    = shoppingCartService;
            this._productService         = productService;
            this._orderService           = orderService;
            this._shipmentService        = shipmentService;
            this._workContext            = workContext;
            this._currencyService        = currencyService;
            this._priceFormatter         = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper         = dateTimeHelper;
            this._customerService        = customerService;
            this._paymentService         = paymentService;
            this._localizationService    = localizationService;
            this._pdfService             = pdfService;
            this._shippingService        = shippingService;
            this._countryService         = countryService;
            this._productAttributeParser = productAttributeParser;
            this._webHelper                    = webHelper;
            this._downloadService              = downloadService;
            this._addressAttributeFormatter    = addressAttributeFormatter;
            this._storeContext                 = storeContext;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._rewardPointService           = rewardPointService;

            this._catalogSettings      = catalogSettings;
            this._orderSettings        = orderSettings;
            this._taxSettings          = taxSettings;
            this._shippingSettings     = shippingSettings;
            this._addressSettings      = addressSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._pdfSettings          = pdfSettings;
        }
Example #15
0
        public new void SetUp()
        {
            _workContext = null;

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

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

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

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

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

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


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

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

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

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);
        }
Example #16
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;
 }
 public OverriddenShoppingCartModelFactory(AddressSettings addressSettings,
                                           CaptchaSettings captchaSettings,
                                           CatalogSettings catalogSettings,
                                           CommonSettings commonSettings,
                                           CustomerSettings customerSettings,
                                           IAddressService addressService,
                                           IAddressModelFactory addressModelFactory,
                                           ICheckoutAttributeFormatter checkoutAttributeFormatter,
                                           ICheckoutAttributeParser checkoutAttributeParser,
                                           ICheckoutAttributeService checkoutAttributeService,
                                           ICountryService countryService,
                                           ICurrencyService currencyService,
                                           ICustomerService customerService,
                                           IDateTimeHelper dateTimeHelper,
                                           IDiscountService discountService,
                                           IDownloadService downloadService,
                                           IGenericAttributeService genericAttributeService,
                                           IGiftCardService giftCardService,
                                           IHttpContextAccessor httpContextAccessor,
                                           ILocalizationService localizationService,
                                           IOrderProcessingService orderProcessingService,
                                           IOrderTotalCalculationService orderTotalCalculationService,
                                           IPaymentPluginManager paymentPluginManager,
                                           IPaymentService paymentService,
                                           IPermissionService permissionService,
                                           IPictureService pictureService,
                                           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,
                                                                                 dateTimeHelper,
                                                                                 discountService,
                                                                                 downloadService,
                                                                                 genericAttributeService,
                                                                                 giftCardService,
                                                                                 httpContextAccessor,
                                                                                 localizationService,
                                                                                 orderProcessingService,
                                                                                 orderTotalCalculationService,
                                                                                 paymentPluginManager,
                                                                                 paymentService,
                                                                                 permissionService,
                                                                                 pictureService,
                                                                                 priceFormatter,
                                                                                 productAttributeFormatter,
                                                                                 productService,
                                                                                 shippingPluginManager,
                                                                                 shippingService,
                                                                                 shoppingCartService,
                                                                                 stateProvinceService,
                                                                                 cacheManager,
                                                                                 storeContext,
                                                                                 taxService,
                                                                                 urlRecordService,
                                                                                 vendorService,
                                                                                 webHelper,
                                                                                 workContext,
                                                                                 mediaSettings,
                                                                                 orderSettings,
                                                                                 rewardPointsSettings,
                                                                                 shippingSettings,
                                                                                 shoppingCartSettings,
                                                                                 taxSettings,
                                                                                 vendorSettings)
 {
     _addressService               = addressService;
     _countryService               = countryService;
     _currencyService              = currencyService;
     _genericAttributeService      = genericAttributeService;
     _giftCardService              = giftCardService;
     _httpContextAccessor          = httpContextAccessor;
     _orderTotalCalculationService = orderTotalCalculationService;
     _paymentService               = paymentService;
     _priceFormatter               = priceFormatter;
     _productService               = productService;
     _shippingPluginManager        = shippingPluginManager;
     _shoppingCartService          = shoppingCartService;
     _stateProvinceService         = stateProvinceService;
     _storeContext         = storeContext;
     _taxPluginManager     = taxPluginManager;
     _taxService           = taxService;
     _workContext          = workContext;
     _rewardPointsSettings = rewardPointsSettings;
     _shippingSettings     = shippingSettings;
     _taxSettings          = taxSettings;
 }
Example #18
0
 public static RewardPointsSettings ToEntity(this RewardPointsSettingsModel model, RewardPointsSettings entity)
 {
     MapperFactory.Map(model, entity);
     return(entity);
 }
        public new void SetUp()
        {
            _productService = new Mock <IProductService>();

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


            _workContext = null;

            //setup

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

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

            _currencySettings = new CurrencySettings();

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

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

            var pluginService = new FakePluginService(_catalogSettings);

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

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

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

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

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

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

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

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

            _rewardPointsSettings = new RewardPointsSettings();

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

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

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

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

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


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

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

            _localizationSettings = new LocalizationSettings();

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

            _orderProcessingService = new OrderProcessingService(_currencySettings,
                                                                 _addressService.Object,
                                                                 _affiliateService.Object,
                                                                 _checkoutAttributeFormatter.Object,
                                                                 _countryService.Object,
                                                                 _currencyService.Object,
                                                                 _customerActivityService.Object,
                                                                 _customerService.Object,
                                                                 _customNumberFormatter.Object,
                                                                 _discountService.Object,
                                                                 _encryptionService.Object,
                                                                 _eventPublisher.Object,
                                                                 _genericAttributeService.Object,
                                                                 _giftCardService.Object,
                                                                 _languageService.Object,
                                                                 _localizationService.Object,
                                                                 _logger,
                                                                 _orderService,
                                                                 _orderTotalCalcService,
                                                                 _paymentPluginManager,
                                                                 _paymentService.Object,
                                                                 _pdfService.Object,
                                                                 _priceCalcService,
                                                                 _priceFormatter.Object,
                                                                 _productAttributeFormatter.Object,
                                                                 _productAttributeParser.Object,
                                                                 _productService.Object,
                                                                 _rewardPointService.Object,
                                                                 _shipmentService.Object,
                                                                 _shippingService,
                                                                 _shoppingCartService.Object,
                                                                 _stateProvinceService.Object,
                                                                 _taxService,
                                                                 _vendorService.Object,
                                                                 _webHelper.Object,
                                                                 _workContext,
                                                                 _workflowMessageService.Object,
                                                                 _localizationSettings,
                                                                 _orderSettings,
                                                                 _paymentSettings,
                                                                 _rewardPointsSettings,
                                                                 _shippingSettings,
                                                                 _taxSettings);
        }
        public new void SetUp()
        {
            _customerSettings = new CustomerSettings
            {
                UnduplicatedPasswordsNumber = 1,
                HashedPasswordFormat        = "SHA512"
            };
            _securitySettings = new SecuritySettings
            {
                EncryptionKey = "273ece6f97dd844d"
            };
            _rewardPointsSettings = new RewardPointsSettings
            {
                Enabled = false,
            };

            _encryptionService = new EncryptionService(_securitySettings);
            _customerRepo      = MockRepository.GenerateMock <IRepository <Customer> >();
            var customer1 = new Customer
            {
                Id       = 1,
                Username = "******",
                Email    = "*****@*****.**",
                Active   = true
            };

            AddCustomerToRegisteredRole(customer1);

            var customer2 = new Customer
            {
                Id       = 2,
                Username = "******",
                Email    = "*****@*****.**",
                Active   = true
            };

            AddCustomerToRegisteredRole(customer2);

            var customer3 = new Customer
            {
                Id       = 3,
                Username = "******",
                Email    = "*****@*****.**",
                Active   = true
            };

            AddCustomerToRegisteredRole(customer3);

            var customer4 = new Customer
            {
                Id       = 4,
                Username = "******",
                Email    = "*****@*****.**",
                Active   = true
            };

            AddCustomerToRegisteredRole(customer4);

            var customer5 = new Customer
            {
                Id       = 5,
                Username = "******",
                Email    = "*****@*****.**",
                Active   = true
            };

            _customerRepo.Expect(x => x.Table).Return(new List <Customer> {
                customer1, customer2, customer3, customer4, customer5
            }.AsQueryable());

            _customerPasswordRepo = MockRepository.GenerateMock <IRepository <CustomerPassword> >();
            var saltKey   = _encryptionService.CreateSaltKey(5);
            var password  = _encryptionService.CreatePasswordHash("password", saltKey, "SHA512");
            var password1 = new CustomerPassword
            {
                CustomerId     = customer1.Id,
                PasswordFormat = PasswordFormat.Hashed,
                PasswordSalt   = saltKey,
                Password       = password,
                CreatedOnUtc   = DateTime.UtcNow
            };
            var password2 = new CustomerPassword
            {
                CustomerId     = customer2.Id,
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                CreatedOnUtc   = DateTime.UtcNow
            };
            var password3 = new CustomerPassword
            {
                CustomerId     = customer3.Id,
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                CreatedOnUtc   = DateTime.UtcNow
            };
            var password4 = new CustomerPassword
            {
                CustomerId     = customer4.Id,
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                CreatedOnUtc   = DateTime.UtcNow
            };
            var password5 = new CustomerPassword
            {
                CustomerId     = customer5.Id,
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                CreatedOnUtc   = DateTime.UtcNow
            };

            _customerPasswordRepo.Expect(x => x.Table).Return(new[] { password1, password2, password3, password4, password5 }.AsQueryable());

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

            _storeService = MockRepository.GenerateMock <IStoreService>();
            _customerCustomerRoleMappingRepo = MockRepository.GenerateMock <IRepository <CustomerCustomerRoleMapping> >();
            _customerRoleRepo     = MockRepository.GenerateMock <IRepository <CustomerRole> >();
            _genericAttributeRepo = MockRepository.GenerateMock <IRepository <GenericAttribute> >();
            _orderRepo            = MockRepository.GenerateMock <IRepository <Order> >();
            _forumPostRepo        = MockRepository.GenerateMock <IRepository <ForumPost> >();
            _forumTopicRepo       = MockRepository.GenerateMock <IRepository <ForumTopic> >();

            _genericAttributeService       = MockRepository.GenerateMock <IGenericAttributeService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();
            _rewardPointService            = MockRepository.GenerateMock <IRewardPointService>();

            _localizationService    = MockRepository.GenerateMock <ILocalizationService>();
            _workContext            = MockRepository.GenerateMock <IWorkContext>();
            _workflowMessageService = MockRepository.GenerateMock <IWorkflowMessageService>();

            _customerService = new CustomerService(new NopNullCache(), _customerRepo,
                                                   _customerCustomerRoleMappingRepo, _customerPasswordRepo, _customerRoleRepo,
                                                   _genericAttributeRepo, _orderRepo, _forumPostRepo, _forumTopicRepo,
                                                   null, null, null, null, null,
                                                   _genericAttributeService, null, null, _eventPublisher, _customerSettings, null);
            _customerRegistrationService = new CustomerRegistrationService(_customerService,
                                                                           _encryptionService, _newsLetterSubscriptionService, _localizationService,
                                                                           _storeService, _rewardPointService, _workContext, _genericAttributeService,
                                                                           _workflowMessageService, _eventPublisher, _rewardPointsSettings, _customerSettings);
        }
Example #21
0
 public OrderModelFactory(AddressSettings addressSettings,
                          CatalogSettings catalogSettings,
                          IAddressModelFactory addressModelFactory,
                          IAddressService addressService,
                          ICountryService countryService,
                          ICurrencyService currencyService,
                          ICustomerService customerService,
                          IDateTimeHelper dateTimeHelper,
                          IGiftCardService giftCardService,
                          ILocalizationService localizationService,
                          IOrderProcessingService orderProcessingService,
                          IOrderService orderService,
                          IOrderTotalCalculationService orderTotalCalculationService,
                          IPaymentPluginManager paymentPluginManager,
                          IPaymentService paymentService,
                          IPriceFormatter priceFormatter,
                          IProductService productService,
                          IRewardPointService rewardPointService,
                          IShipmentService shipmentService,
                          IStateProvinceService stateProvinceService,
                          IStoreContext storeContext,
                          IUrlRecordService urlRecordService,
                          IVendorService vendorService,
                          IWorkContext workContext,
                          OrderSettings orderSettings,
                          PdfSettings pdfSettings,
                          RewardPointsSettings rewardPointsSettings,
                          ShippingSettings shippingSettings,
                          TaxSettings taxSettings,
                          VendorSettings vendorSettings)
 {
     _addressSettings              = addressSettings;
     _catalogSettings              = catalogSettings;
     _addressModelFactory          = addressModelFactory;
     _addressService               = addressService;
     _countryService               = countryService;
     _currencyService              = currencyService;
     _customerService              = customerService;
     _dateTimeHelper               = dateTimeHelper;
     _giftCardService              = giftCardService;
     _localizationService          = localizationService;
     _orderProcessingService       = orderProcessingService;
     _orderService                 = orderService;
     _orderTotalCalculationService = orderTotalCalculationService;
     _paymentPluginManager         = paymentPluginManager;
     _paymentService               = paymentService;
     _priceFormatter               = priceFormatter;
     _productService               = productService;
     _rewardPointService           = rewardPointService;
     _shipmentService              = shipmentService;
     _stateProvinceService         = stateProvinceService;
     _storeContext                 = storeContext;
     _urlRecordService             = urlRecordService;
     _vendorService                = vendorService;
     _workContext          = workContext;
     _orderSettings        = orderSettings;
     _pdfSettings          = pdfSettings;
     _rewardPointsSettings = rewardPointsSettings;
     _shippingSettings     = shippingSettings;
     _taxSettings          = taxSettings;
     _vendorSettings       = vendorSettings;
 }
 public OrderTotalCalculationService(IWorkContext workContext,
     IStoreContext storeContext,
     IPromosPriceCalculationService promosPriceCalculationService,
     IPriceCalculationService priceCalculationService,
     ITaxService taxService,
     IShippingService shippingService,
     IPaymentService paymentService,
     ICheckoutAttributeParser checkoutAttributeParser,
     IDiscountService discountService,
     IGiftCardService giftCardService,
     IGenericAttributeService genericAttributeService,
     TaxSettings taxSettings,
     RewardPointsSettings rewardPointsSettings,
     ShippingSettings shippingSettings,
     ShoppingCartSettings shoppingCartSettings,
     CatalogSettings catalogSettings,
     IPromoUtilities promoUtilities,
     PromoSettings promoSettings,
     IPromoService promoService,
     IAttributeValueService attributeValueService,
     ITaxServiceExtensions taxServiceExtensions,
     ICurrencyService currencyService)
     : base(workContext,
         storeContext,
         priceCalculationService,
         taxService,
         shippingService,
         paymentService,
         checkoutAttributeParser,
         discountService,
         giftCardService,
         genericAttributeService,
         taxSettings,
         rewardPointsSettings,
         shippingSettings,
         shoppingCartSettings,
         catalogSettings)
 {
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._promosPriceCalculationService = promosPriceCalculationService;
     this._taxService = taxService;
     this._shippingService = shippingService;
     this._paymentService = paymentService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._discountService = discountService;
     this._giftCardService = giftCardService;
     this._genericAttributeService = genericAttributeService;
     this._taxSettings = taxSettings;
     this._rewardPointsSettings = rewardPointsSettings;
     this._shippingSettings = shippingSettings;
     this._shoppingCartSettings = shoppingCartSettings;
     this._catalogSettings = catalogSettings;
     this._promoUtilities = promoUtilities;
     this._promoSettings = promoSettings;
     this._promoService = promoService;
     this._priceCalculationService = priceCalculationService;
     this._attributeValueService = attributeValueService;
     this._taxServiceExtensions = taxServiceExtensions;
     this._currencyService = currencyService;
 }
Example #23
0
        public new void SetUp()
        {
            _customerSettings = new CustomerSettings();
            _securitySettings = new SecuritySettings()
            {
                EncryptionKey = "273ece6f97dd844d"
            };
            _rewardPointsSettings = new RewardPointsSettings()
            {
                Enabled = false,
            };

            _encryptionService = new EncryptionService(_securitySettings);
            _customerRepo      = MockRepository.GenerateMock <IRepository <Customer> >();
            var customer1 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Hashed,
                Active         = true
            };

            string saltKey  = _encryptionService.CreateSaltKey(5);
            string password = _encryptionService.CreatePasswordHash("password", saltKey);

            customer1.PasswordSalt = saltKey;
            customer1.Password     = password;
            AddCustomerToRegisteredRole(customer1);

            var customer2 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer2);

            var customer3 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                Active         = true
            };

            AddCustomerToRegisteredRole(customer3);

            var customer4 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer4);

            var customer5 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

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

            _customerRepo.Expect(x => x.Table).Return(new List <Customer>()
            {
                customer1, customer2, customer3, customer4, customer5
            }.AsQueryable());

            _customerRoleRepo     = MockRepository.GenerateMock <IRepository <CustomerRole> >();
            _genericAttributeRepo = MockRepository.GenerateMock <IRepository <GenericAttribute> >();
            _workContext          = MockRepository.GenerateMock <IWorkContext>();
            _workContext.Expect(x => x.WorkingLanguage.Id).Return(2);
            _genericAttributeService       = MockRepository.GenerateMock <IGenericAttributeService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();

            _localizationService = MockRepository.GenerateMock <ILocalizationService>();
            _customerService     = new CustomerService(new NopNullCache(), _customerRepo, _customerRoleRepo,
                                                       _genericAttributeRepo, _genericAttributeService, _eventPublisher, _customerSettings);
            _customerRegistrationService = new CustomerRegistrationService(_customerService,
                                                                           _encryptionService, _newsLetterSubscriptionService, _localizationService,
                                                                           _rewardPointsSettings, _customerSettings, _workContext);
        }
Example #24
0
 public LoginController(
     ICommonServices services,
     IAdCampaignService adCampaignService,
     IAuthenticationService authenticationService,
     IDateTimeHelper dateTimeHelper,
     DateTimeSettings dateTimeSettings, TaxSettings taxSettings,
     ILocalizationService localizationService,
     IWorkContext workContext, IStoreContext storeContext,
     ICustomerService customerService,
     IGenericAttributeService genericAttributeService,
     ICustomerRegistrationService customerRegistrationService,
     ITaxService taxService, RewardPointsSettings rewardPointsSettings,
     CustomerSettings customerSettings, AddressSettings addressSettings, ForumSettings forumSettings,
     OrderSettings orderSettings, IAddressService addressService,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     IOrderTotalCalculationService orderTotalCalculationService,
     IOrderProcessingService orderProcessingService, IOrderService orderService,
     ICurrencyService currencyService,
     IPaymentService paymentService,
     IPriceFormatter priceFormatter,
     IPictureService pictureService, INewsLetterSubscriptionService newsLetterSubscriptionService,
     IForumService forumService, IShoppingCartService shoppingCartService,
     IOpenAuthenticationService openAuthenticationService,
     IBackInStockSubscriptionService backInStockSubscriptionService,
     IDownloadService downloadService, IWebHelper webHelper,
     ICustomerActivityService customerActivityService,
     ProductUrlHelper productUrlHelper,
     MediaSettings mediaSettings,
     LocalizationSettings localizationSettings,
     //CaptchaSettings captchaSettings,
     ExternalAuthenticationSettings externalAuthenticationSettings,
     PluginMediator pluginMediator,
     IPermissionService permissionService,
     IProductService productService)
 {
     _services = services;
     _authenticationService       = authenticationService;
     _dateTimeHelper              = dateTimeHelper;
     _dateTimeSettings            = dateTimeSettings;
     _taxSettings                 = taxSettings;
     _localizationService         = localizationService;
     _workContext                 = workContext;
     _storeContext                = storeContext;
     _customerService             = customerService;
     _genericAttributeService     = genericAttributeService;
     _customerRegistrationService = customerRegistrationService;
     _taxService                     = taxService;
     _rewardPointsSettings           = rewardPointsSettings;
     _customerSettings               = customerSettings;
     _addressSettings                = addressSettings;
     _forumSettings                  = forumSettings;
     _orderSettings                  = orderSettings;
     _addressService                 = addressService;
     _countryService                 = countryService;
     _stateProvinceService           = stateProvinceService;
     _orderProcessingService         = orderProcessingService;
     _orderTotalCalculationService   = orderTotalCalculationService;
     _orderService                   = orderService;
     _currencyService                = currencyService;
     _paymentService                 = paymentService;
     _priceFormatter                 = priceFormatter;
     _pictureService                 = pictureService;
     _newsLetterSubscriptionService  = newsLetterSubscriptionService;
     _forumService                   = forumService;
     _shoppingCartService            = shoppingCartService;
     _openAuthenticationService      = openAuthenticationService;
     _backInStockSubscriptionService = backInStockSubscriptionService;
     _downloadService                = downloadService;
     _webHelper = webHelper;
     _customerActivityService = customerActivityService;
     _productUrlHelper        = productUrlHelper;
     _adCampaignService       = adCampaignService;
     _mediaSettings           = mediaSettings;
     _localizationSettings    = localizationSettings;
     //_captchaSettings = captchaSettings;
     _externalAuthenticationSettings = externalAuthenticationSettings;
     _pluginMediator    = pluginMediator;
     _permissionService = permissionService;
     _productService    = productService;
 }
        public void TestInitialize()
        {
            new Grand.Services.Tests.ServiceTest().PluginInitializator();

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

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

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

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

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

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

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();
            _currencySettings     = new CurrencySettings();
            _customerService      = new Mock <ICustomerService>().Object;

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

            var tempEventPublisher = new Mock <IMediator>();

            {
                //tempEventPublisher.Setup(x => x.PublishAsync(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();
            _paymentService          = new Mock <IPaymentService>().Object;
            _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>().Object;
            _giftCardService         = new Mock <IGiftCardService>().Object;
            _genericAttributeService = new Mock <IGenericAttributeService>().Object;

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

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

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



            var tempAddressService = new Mock <IAddressService>();

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

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

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService, _genericAttributeService,
                                                                      null, _productService, _currencyService, _taxSettings, _rewardPointsSettings,
                                                                      _shippingSettings, _shoppingCartSettings, _catalogSettings);
        }
        public OrderProcessingService(
            SmartDbContext db,
            IWorkContext workContext,
            IWebHelper webHelper,
            ILocalizationService localizationService,
            ICurrencyService currencyService,
            IPaymentService paymentService,
            IProductService productService,
            IProductAttributeMaterializer productAttributeMaterializer,
            IProductAttributeFormatter productAttributeFormatter,
            IPriceCalculationService2 priceCalculationService,
            IOrderCalculationService orderCalculationService,
            ITaxCalculator taxCalculator,
            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;
            _priceCalculationService       = priceCalculationService;
            _orderCalculationService       = orderCalculationService;
            _taxCalculator                 = taxCalculator;
            _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;
        }
Example #27
0
 public static RewardPointsSettingsModel ToModel(this RewardPointsSettings entity)
 {
     return(Mapper.Map <RewardPointsSettings, RewardPointsSettingsModel>(entity));
 }
 public CustomerViewModelService(
     IExternalAuthenticationService externalAuthenticationService,
     ICustomerAttributeParser customerAttributeParser,
     ICustomerAttributeService customerAttributeService,
     ILocalizationService localizationService,
     IDateTimeHelper dateTimeHelper,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     IWorkContext workContext,
     IStoreContext storeContext,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     IGenericAttributeService genericAttributeService,
     IWorkflowMessageService workflowMessageService,
     IReturnRequestService returnRequestService,
     IStoreMappingService storeMappingService,
     IAddressViewModelService addressViewModelService,
     IOrderService orderService,
     IDownloadService downloadService,
     IPictureService pictureService,
     IProductService productService,
     IAuctionService auctionService,
     INewsletterCategoryService newsletterCategoryService,
     CustomerSettings customerSettings,
     DateTimeSettings dateTimeSettings,
     TaxSettings taxSettings,
     ForumSettings forumSettings,
     ExternalAuthenticationSettings externalAuthenticationSettings,
     SecuritySettings securitySettings,
     CaptchaSettings captchaSettings,
     RewardPointsSettings rewardPointsSettings,
     OrderSettings orderSettings,
     MediaSettings mediaSettings,
     VendorSettings vendorSettings
     )
 {
     this._externalAuthenticationService = externalAuthenticationService;
     this._customerAttributeParser       = customerAttributeParser;
     this._customerAttributeService      = customerAttributeService;
     this._localizationService           = localizationService;
     this._dateTimeHelper = dateTimeHelper;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._workContext                    = workContext;
     this._storeContext                   = storeContext;
     this._countryService                 = countryService;
     this._stateProvinceService           = stateProvinceService;
     this._genericAttributeService        = genericAttributeService;
     this._workflowMessageService         = workflowMessageService;
     this._returnRequestService           = returnRequestService;
     this._storeMappingService            = storeMappingService;
     this._addressViewModelService        = addressViewModelService;
     this._orderService                   = orderService;
     this._downloadService                = downloadService;
     this._pictureService                 = pictureService;
     this._productService                 = productService;
     this._auctionService                 = auctionService;
     this._newsletterCategoryService      = newsletterCategoryService;
     this._customerSettings               = customerSettings;
     this._dateTimeSettings               = dateTimeSettings;
     this._taxSettings                    = taxSettings;
     this._forumSettings                  = forumSettings;
     this._externalAuthenticationSettings = externalAuthenticationSettings;
     this._securitySettings               = securitySettings;
     this._captchaSettings                = captchaSettings;
     this._rewardPointsSettings           = rewardPointsSettings;
     this._orderSettings                  = orderSettings;
     this._mediaSettings                  = mediaSettings;
     this._vendorSettings                 = vendorSettings;
 }
Example #29
0
 public static RewardPointsSettingsModel ToModel(this RewardPointsSettings entity)
 {
     return(entity.MapTo <RewardPointsSettings, RewardPointsSettingsModel>());
 }
        public CustomerRegistrationServiceTests()
        {
            #region customers
            var customer1 = new Customer
            {
                Id       = 1,
                Username = "******",
                Email    = "*****@*****.**",
                Active   = true
            };
            var customer2 = new Customer
            {
                Id       = 2,
                Username = "******",
                Email    = "*****@*****.**",
                Active   = true
            };
            var customer3 = new Customer
            {
                Id       = 3,
                Username = "******",
                Email    = "*****@*****.**",
                Active   = true
            };
            var customer4 = new Customer
            {
                Id       = 4,
                Username = "******",
                Email    = "*****@*****.**",
                Active   = true
            };

            #endregion

            #region passwords
            _securitySettings = new SecuritySettings
            {
                EncryptionKey = "273ece6f97dd844d"
            };

            _encryptionService = new EncryptionService(_securitySettings);

            var saltKey   = _encryptionService.CreateSaltKey(5);
            var password  = _encryptionService.CreatePasswordHash("password", saltKey, "SHA512");
            var password1 = new CustomerPassword
            {
                CustomerId     = customer1.Id,
                PasswordFormat = PasswordFormat.Hashed,
                PasswordSalt   = saltKey,
                Password       = password,
                CreatedOnUtc   = DateTime.UtcNow
            };
            var password2 = new CustomerPassword
            {
                CustomerId     = customer2.Id,
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                CreatedOnUtc   = DateTime.UtcNow
            };
            var password3 = new CustomerPassword
            {
                CustomerId     = customer3.Id,
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                CreatedOnUtc   = DateTime.UtcNow
            };
            var password4 = new CustomerPassword
            {
                CustomerId     = customer4.Id,
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                CreatedOnUtc   = DateTime.UtcNow
            };
            #endregion

            _customerRoleRepo = _fakeDataStore.RegRepository(new[]
            {
                new CustomerRole
                {
                    Id           = 1,
                    Active       = true,
                    IsSystemRole = true,
                    SystemName   = NopCustomerDefaults.RegisteredRoleName
                }
            });
            _customerRepo         = _fakeDataStore.RegRepository(new[] { customer1, customer2, customer3, customer4 });
            _customerPasswordRepo = _fakeDataStore.RegRepository(new[] { password1, password2, password3, password4 });
            _customerCustomerRoleMappingRepository = _fakeDataStore.RegRepository <CustomerCustomerRoleMapping>();

            _customerService = new FakeCustomerService(
                customerCustomerRoleMappingRepository: _customerCustomerRoleMappingRepository,
                customerRepository: _customerRepo,
                customerPasswordRepository: _customerPasswordRepo,
                customerRoleRepository: _customerRoleRepo);

            //AddCustomerToRegisteredRole(customer1);
            //AddCustomerToRegisteredRole(customer2);
            //AddCustomerToRegisteredRole(customer3);
            //AddCustomerToRegisteredRole(customer4);

            _rewardPointsSettings = new RewardPointsSettings
            {
                Enabled = false
            };

            _customerSettings = new CustomerSettings
            {
                UnduplicatedPasswordsNumber = 1,
                HashedPasswordFormat        = "SHA512"
            };

            _storeService = new Mock <IStoreService>();

            _genericAttributeService       = new Mock <IGenericAttributeService>();
            _newsLetterSubscriptionService = new Mock <INewsLetterSubscriptionService>();
            _rewardPointService            = new Mock <IRewardPointService>();

            _localizationService    = new Mock <ILocalizationService>();
            _workContext            = new Mock <IWorkContext>();
            _workflowMessageService = new Mock <IWorkflowMessageService>();

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

            _customerRegistrationService = new CustomerRegistrationService(_customerSettings,
                                                                           _customerService,
                                                                           _encryptionService,
                                                                           _eventPublisher.Object,
                                                                           _genericAttributeService.Object,
                                                                           _localizationService.Object,
                                                                           _newsLetterSubscriptionService.Object,
                                                                           _rewardPointService.Object,
                                                                           _storeService.Object,
                                                                           _workContext.Object,
                                                                           _workflowMessageService.Object,
                                                                           _rewardPointsSettings);
        }
 /// <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,
     IGenericAttributeService genericAttributeService,
     PromoSettings promoSettings,
     IPromoUtilities promoUtilities,
     IPromoOrderService promoOrderService,
     IPromoService promoService,
     IStoreContext storeContext)
     : 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,
                                                 shippingSettings, paymentSettings, rewardPointsSettings, orderSettings, taxSettings,
                                                 localizationSettings, 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;
     this._genericAttributeService = genericAttributeService;
     this._promoSettings = promoSettings;
     this._promoUtilities = promoUtilities;
     this._promoOrderService = promoOrderService;
     this._promoService = promoService;
     this._storeContext = storeContext;
 }
Example #32
0
 public CalculateRewardPointsCommandHandler(RewardPointsSettings rewardPointsSettings)
 {
     _rewardPointsSettings = rewardPointsSettings;
 }