コード例 #1
0
ファイル: LocationResolver.cs プロジェクト: rtpHarry/OShop
        public void BuildCart(IShoppingCartService ShoppingCartService, ShoppingCart Cart)
        {
            LocationsStateRecord state = null;
            LocationsCountryRecord country = null;

            // Based on user selected location
            Int32 countryId = ShoppingCartService.GetProperty<int>("CountryId");
            if (countryId > 0) {
                country = _locationsService.GetCountry(countryId);
                Int32 stateId = ShoppingCartService.GetProperty<int>("StateId");
                if (stateId > 0) {
                    state = _locationsService.GetState(stateId);
                }
            }
            else {
                // Set default country
                country = _locationsService.GetDefaultCountry();
                if (country != null) {
                    ShoppingCartService.SetProperty<int>("CountryId", country.Id);
                }
            }

            Cart.Properties["BillingCountry"] = country;
            Cart.Properties["BillingState"] = state;
            Cart.Properties["ShippingCountry"] = country;
            Cart.Properties["ShippingState"] = state;
        }
コード例 #2
0
 public CommonController(IPaymentService paymentService, 
     IShippingService shippingService,
     IShoppingCartService shoppingCartService,
     ICurrencyService currencyService,
     IMeasureService measureService,
     ICustomerService customerService,
     IUrlRecordService urlRecordService,
     IWebHelper webHelper,
     CurrencySettings currencySettings,
     MeasureSettings measureSettings,
     IDateTimeHelper dateTimeHelper,
     ILanguageService languageService,
     IWorkContext workContext,
     IStoreContext storeContext,
     IPermissionService permissionService,
     ILocalizationService localizationService)
 {
     this._paymentService = paymentService;
     this._shippingService = shippingService;
     this._shoppingCartService = shoppingCartService;
     this._currencyService = currencyService;
     this._measureService = measureService;
     this._customerService = customerService;
     this._urlRecordService = urlRecordService;
     this._webHelper = webHelper;
     this._currencySettings = currencySettings;
     this._measureSettings = measureSettings;
     this._dateTimeHelper = dateTimeHelper;
     this._languageService = languageService;
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._permissionService = permissionService;
     this._localizationService = localizationService;
 }
コード例 #3
0
        public CheckoutController(IWorkContext workContext,
            IShoppingCartService shoppingCartService, ILocalizationService localizationService,
            ITaxService taxService, ICurrencyService currencyService,
            IPriceFormatter priceFormatter, IOrderProcessingService orderProcessingService,
            ICustomerService customerService,  ICountryService countryService,
            IStateProvinceService stateProvinceService, IShippingService shippingService,
            IPaymentService paymentService, IOrderTotalCalculationService orderTotalCalculationService,
            ILogger logger, IOrderService orderService, IWebHelper webHelper,
            OrderSettings orderSettings, RewardPointsSettings rewardPointsSettings,
            PaymentSettings paymentSettings)
        {
            this._workContext = workContext;
            this._shoppingCartService = shoppingCartService;
            this._localizationService = localizationService;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._customerService = customerService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._paymentService = paymentService;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._logger = logger;
            this._orderService = orderService;
            this._webHelper = webHelper;

            this._orderSettings = orderSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._paymentSettings = paymentSettings;
        }
コード例 #4
0
 public ExternalAuthorizer(IAuthenticationService authenticationService,
     IOpenAuthenticationService openAuthenticationService,
     IGenericAttributeService genericAttributeService,
     ICustomerRegistrationService customerRegistrationService, 
     ICustomerActivityService customerActivityService, 
     ILocalizationService localizationService,
     IWorkContext workContext,
     IStoreContext storeContext,
     CustomerSettings customerSettings,
     ExternalAuthenticationSettings externalAuthenticationSettings,
     IShoppingCartService shoppingCartService,
     IWorkflowMessageService workflowMessageService,
     IEventPublisher eventPublisher,
     LocalizationSettings localizationSettings)
 {
     this._authenticationService = authenticationService;
     this._openAuthenticationService = openAuthenticationService;
     this._genericAttributeService = genericAttributeService;
     this._customerRegistrationService = customerRegistrationService;
     this._customerActivityService = customerActivityService;
     this._localizationService = localizationService;
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._customerSettings = customerSettings;
     this._externalAuthenticationSettings = externalAuthenticationSettings;
     this._shoppingCartService = shoppingCartService;
     this._workflowMessageService = workflowMessageService;
     this._eventPublisher = eventPublisher;
     this._localizationSettings = localizationSettings;
 }
コード例 #5
0
 public ShoppingCartController(IOrchardServices orchardServices, ICatalogService catalogService, IShoppingCartService shoppingCartService)
     : base(orchardServices)
 {
     _orchardServices = orchardServices;
     _catalogService = catalogService;
     _shoppingCartService = shoppingCartService;
 }
コード例 #6
0
ファイル: CustomerResolver.cs プロジェクト: rtpHarry/OShop
        public void BuildOrder(IShoppingCartService ShoppingCartService, IContent Order)
        {
            var customer = _customersService.GetCustomer();

            if (customer == null) {
                return;
            }

            OrderAddressRecord billingAddress = null, shippingAddress = null;
            Int32 billingAddressId = ShoppingCartService.GetProperty<int>("BillingAddressId");
            if (billingAddressId > 0) {
                var customerBillingAddress = customer.Addresses.Where(a => a.Id == billingAddressId).FirstOrDefault();
                if (customerBillingAddress != null) {
                    billingAddress = new OrderAddressRecord();
                    customerBillingAddress.CopyTo(billingAddress);
                }
            }
            Int32 shippingAddressId = ShoppingCartService.GetProperty<int>("ShippingAddressId");
            if (shippingAddressId > 0) {
                if (shippingAddressId == billingAddressId) {
                    shippingAddress = billingAddress;
                }
                else {
                    var customerShippingAddress = customer.Addresses.Where(a => a.Id == shippingAddressId).FirstOrDefault();
                    if (customerShippingAddress != null) {
                        shippingAddress = new OrderAddressRecord();
                        customerShippingAddress.CopyTo(shippingAddress);
                    }
                }
            }

            var customerOrderPart = Order.As<CustomerOrderPart>();
            if (customerOrderPart != null) {
                customerOrderPart.Customer = customer;
            }

            var orderPart = Order.As<OrderPart>();
            if (orderPart != null && billingAddress != null) {
                orderPart.BillingAddress = billingAddress;
            }

            var shippingPart = Order.As<OrderShippingPart>();
            if (shippingPart != null) {
                //  Shipping address
                if (shippingAddress != null) {
                    // Set address
                    shippingPart.ShippingAddress = shippingAddress;

                    // Set shipping zone
                    var workContext = _workContextAccessor.GetContext();
                    if (shippingAddress.State != null && shippingAddress.State.Enabled && shippingAddress.State.ShippingZoneRecord != null) {
                        workContext.SetState("OShop.Orders.ShippingZone", shippingAddress.State.ShippingZoneRecord);
                    }
                    else if (shippingAddress.Country != null && shippingAddress.Country.Enabled && shippingAddress.Country.ShippingZoneRecord != null) {
                        workContext.SetState("OShop.Orders.ShippingZone", shippingAddress.Country.ShippingZoneRecord);
                    }
                }
            }
        }
コード例 #7
0
        public ProductController(
			ICommonServices services,
			IManufacturerService manufacturerService,
			IProductService productService,
			IProductAttributeService productAttributeService,
			IProductAttributeParser productAttributeParser,
			ITaxService taxService,
			ICurrencyService currencyService,
			IPictureService pictureService,
			IPriceCalculationService priceCalculationService, 
			IPriceFormatter priceFormatter,
			ICustomerContentService customerContentService, 
			ICustomerService customerService,
			IShoppingCartService shoppingCartService,
			IRecentlyViewedProductsService recentlyViewedProductsService, 
			IWorkflowMessageService workflowMessageService, 
			IProductTagService productTagService,
			IOrderReportService orderReportService,
			IBackInStockSubscriptionService backInStockSubscriptionService, 
			IAclService aclService,
			IStoreMappingService storeMappingService,
			MediaSettings mediaSettings, 
			CatalogSettings catalogSettings,
			ShoppingCartSettings shoppingCartSettings,
			LocalizationSettings localizationSettings, 
			CaptchaSettings captchaSettings,
			CatalogHelper helper,
            IDownloadService downloadService,
            ILocalizationService localizationService)
        {
            this._services = services;
            this._manufacturerService = manufacturerService;
            this._productService = productService;
            this._productAttributeService = productAttributeService;
            this._productAttributeParser = productAttributeParser;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._pictureService = pictureService;
            this._priceCalculationService = priceCalculationService;
            this._priceFormatter = priceFormatter;
            this._customerContentService = customerContentService;
            this._customerService = customerService;
            this._shoppingCartService = shoppingCartService;
            this._recentlyViewedProductsService = recentlyViewedProductsService;
            this._workflowMessageService = workflowMessageService;
            this._productTagService = productTagService;
            this._orderReportService = orderReportService;
            this._backInStockSubscriptionService = backInStockSubscriptionService;
            this._aclService = aclService;
            this._storeMappingService = storeMappingService;
            this._mediaSettings = mediaSettings;
            this._catalogSettings = catalogSettings;
            this._shoppingCartSettings = shoppingCartSettings;
            this._localizationSettings = localizationSettings;
            this._captchaSettings = captchaSettings;
            this._helper = helper;
            this._downloadService = downloadService;
            this._localizationService = localizationService;
        }
コード例 #8
0
		public CustomerOrderServiceImpl(Func<IOrderRepository> orderRepositoryFactory, IOperationNumberGenerator operationNumberGenerator, IEventPublisher<OrderChangeEvent> eventPublisher, IShoppingCartService shoppingCartService, IItemService productService)
		{
			_repositoryFactory = orderRepositoryFactory;
			_shoppingCartService = shoppingCartService;
			_operationNumberGenerator = operationNumberGenerator;
			_eventPublisher = eventPublisher;
			_productService = productService;
		}
コード例 #9
0
ファイル: ShippingVatResolver.cs プロジェクト: rtpHarry/OShop
 public void BuildCart(IShoppingCartService ShoppingCartService, ShoppingCart Cart)
 {
     var shippingPrice = Cart.Shipping as IPrice;
     var shippingVat = (Cart.Shipping as IContent).GetVatRate();
     if (shippingPrice != null && shippingVat != null && shippingPrice.Price != 0) {
         Cart.AddTax(shippingVat, shippingPrice.Price);
     }
 }
コード例 #10
0
		public CheckoutController(IShoppingCartService shoppingCartService, ICatalogService catalogService, IFinanceService financeService, IErpService erpService, ApplicationUserManager userManager)
		{
			this.shoppingCartService = shoppingCartService;
			this.catalogService = catalogService;
			this.financeService = financeService;
			this.erpService = erpService;
			this.userManager = userManager;
		}
コード例 #11
0
 public ShoppingCartController(IProductService productService, IPictureService pictureService,
     IShoppingCartService shoppingCartService, SystemSetting sysSetting, IUserContext userContext)
 {
     _productService = productService;
     _shoppingCartService = shoppingCartService;
     _userContext = userContext;
     _pictureService = pictureService;
     _sysSetting = sysSetting;
 }
コード例 #12
0
ファイル: ItemsVatResolver.cs プロジェクト: rtpHarry/OShop
 public void BuildCart(IShoppingCartService ShoppingCartService, ShoppingCart Cart)
 {
     foreach (var entry in Cart.Items) {
         var vat = entry.Item.GetVatRate();
         if (vat != null && entry.SubTotal() != 0) {
             Cart.AddTax(vat, entry.SubTotal());
         }
     }
 }
コード例 #13
0
 public HomeController(
     IShoppingCartService shoppingCartService,
     ICustomerService customerService,
     ICatalogueService catalogueService)
 {
     _shoppingCartService = shoppingCartService;
     _customerService = customerService;
     _catalogueService = catalogueService;
 }
コード例 #14
0
        public CheckoutController(IWorkContext workContext,
            IStoreContext storeContext,
            IStoreMappingService storeMappingService,
            IShoppingCartService shoppingCartService, 
            ILocalizationService localizationService, 
            ITaxService taxService, 
            ICurrencyService currencyService, 
            IPriceFormatter priceFormatter, 
            IOrderProcessingService orderProcessingService,
            ICustomerService customerService, 
            IGenericAttributeService genericAttributeService,
            ICountryService countryService,
            IStateProvinceService stateProvinceService,
            IShippingService shippingService, 
            IPaymentService paymentService,
            IPluginFinder pluginFinder,
            IOrderTotalCalculationService orderTotalCalculationService,
            ILogger logger,
            IOrderService orderService,
            IWebHelper webHelper,
            HttpContextBase httpContext,
            IMobileDeviceHelper mobileDeviceHelper,
            OrderSettings orderSettings, 
            RewardPointsSettings rewardPointsSettings,
            PaymentSettings paymentSettings,
            ShippingSettings shippingSettings,
            AddressSettings addressSettings)
        {
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._storeMappingService = storeMappingService;
            this._shoppingCartService = shoppingCartService;
            this._localizationService = localizationService;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._customerService = customerService;
            this._genericAttributeService = genericAttributeService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._paymentService = paymentService;
            this._pluginFinder = pluginFinder;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._logger = logger;
            this._orderService = orderService;
            this._webHelper = webHelper;
            this._httpContext = httpContext;
            this._mobileDeviceHelper = mobileDeviceHelper;

            this._orderSettings = orderSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._paymentSettings = paymentSettings;
            this._shippingSettings = shippingSettings;
            this._addressSettings = addressSettings;
        }
コード例 #15
0
        public void Startup() {
            _cartRepository = new TestShoppingCartRepository();
            _catalogRepository = new TestCatalogRepository();
            _userRepository = new TestUserRepository();

            cartService = new ShoppingCartService(_cartRepository);
            catalogService = new CatalogService(_catalogRepository);
            userService = new UserService(_userRepository);

        }
コード例 #16
0
 public OrderController(IShoppingCartService shoppingCartService,
                         ITicketsService ticketsService,
                         IDelliveryAddressesService delliveryAddressesService,
                         IOrdersService ordersService)
 {
     this.shoppingCartService = shoppingCartService;
     this.ticketsService = ticketsService;
     this.delliveryAddressesService = delliveryAddressesService;
     this.ordersService = ordersService;
 }
コード例 #17
0
        public ShoppingCartController(IProductService productService, IWorkContext workContext,
            IShoppingCartService shoppingCartService, IPictureService pictureService,
            ILocalizationService localizationService, IProductAttributeFormatter productAttributeFormatter,
            ITaxService taxService, ICurrencyService currencyService, 
            IPriceCalculationService priceCalculationService, IPriceFormatter priceFormatter,
            ICheckoutAttributeParser checkoutAttributeParser, ICheckoutAttributeFormatter checkoutAttributeFormatter, 
            IOrderProcessingService orderProcessingService,
            IDiscountService discountService,ICustomerService customerService, 
            IGiftCardService giftCardService, ICountryService countryService,
            IStateProvinceService stateProvinceService, IShippingService shippingService, 
            IOrderTotalCalculationService orderTotalCalculationService,
            ICheckoutAttributeService checkoutAttributeService, IPaymentService paymentService,
            IWorkflowMessageService workflowMessageService,
            IPermissionService permissionService, 
            IDownloadService downloadService,
            MediaSettings mediaSetting, ShoppingCartSettings shoppingCartSettings,
            CatalogSettings catalogSettings, OrderSettings orderSettings,
            ShippingSettings shippingSettings, TaxSettings taxSettings,
            CaptchaSettings captchaSettings)
        {
            this._productService = productService;
            this._workContext = workContext;
            this._shoppingCartService = shoppingCartService;
            this._pictureService = pictureService;
            this._localizationService = localizationService;
            this._productAttributeFormatter = productAttributeFormatter;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceCalculationService = priceCalculationService;
            this._priceFormatter = priceFormatter;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
            this._orderProcessingService = orderProcessingService;
            this._discountService = discountService;
            this._customerService = customerService;
            this._giftCardService = giftCardService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._checkoutAttributeService = checkoutAttributeService;
            this._paymentService = paymentService;
            this._workflowMessageService = workflowMessageService;
            this._permissionService = permissionService;
            this._downloadService = downloadService;

            this._mediaSetting = mediaSetting;
            this._shoppingCartSettings = shoppingCartSettings;
            this._catalogSettings = catalogSettings;
            this._orderSettings = orderSettings;
            this._shippingSettings = shippingSettings;
            this._taxSettings = taxSettings;
            this._captchaSettings = captchaSettings;
        }
コード例 #18
0
        public void TestInit()
        {
            var mockTickets = new Mock<ITicketsService>();
            mockTickets.Setup(x => x.HasQuantity(It.IsAny<int>(), 1)).Returns(true);

            var mockSession = new MockHttpSession();

            var sessionAdapter = new Mock<ISessionAdapter>();
            sessionAdapter.Setup(x => x.Session).Returns(mockSession);

            this.shoppingCart = new ShoppingCartService(mockTickets.Object, sessionAdapter.Object);
        }
コード例 #19
0
        public void BuildCart(IShoppingCartService ShoppingCartService, ShoppingCart Cart)
        {
            var country = Cart.Properties["ShippingCountry"] as LocationsCountryRecord;
            var state = Cart.Properties["ShippingState"] as LocationsStateRecord;

            if (state != null && state.Enabled && state.ShippingZoneRecord != null) {
                Cart.Properties["ShippingZone"] = state.ShippingZoneRecord;
            }
            else if (country != null && country.Enabled && country.ShippingZoneRecord != null) {
                Cart.Properties["ShippingZone"] = country.ShippingZoneRecord;
            }
        }
コード例 #20
0
 public AccountController(IShoppingCartService shoppingCartService,
                          IAuthenticationService authenticationService,
                          IPersonalizationService personalizationService,
                          IUserRepository userRepository,
                          IAuthorizationService authorizationService)
 {
     _shoppingCartService = shoppingCartService;
     _authenticationService = authenticationService;
     _personalizationService = personalizationService;
     _userRepository = userRepository;
     _authorizationService = authorizationService;
 }
コード例 #21
0
ファイル: OrderVatResolver.cs プロジェクト: rtpHarry/OShop
 public void BuildOrder(IShoppingCartService ShoppingCartService, IContent Order)
 {
     // Attach VAT infos to OrderDetails
     var orderPart = Order.As<OrderPart>();
     if (orderPart != null) {
         var vatParts = _contentManager.GetMany<VatPart>(orderPart.Details.Select(d => d.ContentId), VersionOptions.Published, QueryHints.Empty);
         foreach(var vatDetailPair in orderPart.Details.Join(vatParts, od => od.ContentId, vat => vat.Id, (od, vat) => new { Detail = od, Vat = vat})) {
             if (vatDetailPair.Vat.VatRate != null) {
                 vatDetailPair.Detail.SetProperty("VAT", new Tax(vatDetailPair.Vat.VatRate));
             }
         }
     }
 }
コード例 #22
0
 public ShoppingCartController(
     IShoppingCartService shoppingCartService,
     IEnumerable<ICheckoutProvider> checkoutProviders,
     IShapeFactory shapeFactory,
     ILocationsService locationService = null,
     IShippingService shippingService = null)
 {
     _shoppingCartService = shoppingCartService;
     _checkoutProviders = checkoutProviders;
     _shapeFactory = shapeFactory;
     _locationService = locationService;
     _shippingService = shippingService;
 }
コード例 #23
0
 public CustomerOrderServiceImpl(Func<IOrderRepository> orderRepositoryFactory, IUniqueNumberGenerator uniqueNumberGenerator, IEventPublisher<OrderChangeEvent> eventPublisher, IShoppingCartService shoppingCartService, IItemService productService, 
                               IDynamicPropertyService dynamicPropertyService, ISettingsManager settingManager, IShippingMethodsService shippingMethodsService, IPaymentMethodsService paymentMethodsService)
 {
     _repositoryFactory = orderRepositoryFactory;
     _shoppingCartService = shoppingCartService;
     _uniqueNumberGenerator = uniqueNumberGenerator;
     _eventPublisher = eventPublisher;
     _productService = productService;
     _dynamicPropertyService = dynamicPropertyService;
     _settingManager = settingManager;
     _shippingMethodsService = shippingMethodsService;
     _paymentMethodsService = paymentMethodsService;
 }
コード例 #24
0
ファイル: ProductResolver.cs プロジェクト: rtpHarry/OShop
        public void BuildOrder(IShoppingCartService ShoppingCartService, IContent Order)
        {
            var orderPart = Order.As<OrderPart>();
            if (orderPart != null) {
                var cartRecords = ShoppingCartService.ListItems();
                var products = ListProducts(cartRecords);
                foreach (var cartRecord in cartRecords.Where(cr => cr.ItemType == ProductPart.PartItemType)) {
                    var product = products.Where(p => p.Id == cartRecord.ItemId).FirstOrDefault();

                    if (product != null) {
                        orderPart.Details.Add(new OrderDetail(product, cartRecord.Quantity));
                    }
                }
            }
        }
コード例 #25
0
ファイル: ProductResolver.cs プロジェクト: rtpHarry/OShop
        public void BuildCart(IShoppingCartService ShoppingCartService, ShoppingCart Cart)
        {
            var cartRecords = ShoppingCartService.ListItems();
            var products = ListProducts(cartRecords);

            foreach (var cartRecord in cartRecords.Where(cr => cr.ItemType == ProductPart.PartItemType)) {
                var product = products.Where(p => p.Id == cartRecord.ItemId).FirstOrDefault();

                if (product != null) {
                    Cart.Items.Add(new ShoppingCartItem {
                        Id = cartRecord.Id,
                        Item = product,
                        Quantity = cartRecord.Quantity
                    });
                }
            }
        }
コード例 #26
0
 public CustomerController(
     IShoppingCartService shoppingCartService,
     IOrderService orderService,
     IMetricsService metricsService,
     ILoggingService loggingService,
     ICustomerService customerService,
     ICatalogueService catalogueService,
     IAuthenticationService authenticationService)
     : base(shoppingCartService,
         orderService,
         metricsService,
         loggingService,
         customerService,
         catalogueService,
         authenticationService)
 {
 }
コード例 #27
0
 public ControllerBase(
     IShoppingCartService shoppingCartService,
     IOrderService orderService,
     IMetricsService metricsService,
     ILoggingService loggingService,
     ICustomerService customerService,
     ICatalogueService catalogueService,
     IAuthenticationService authenticationService)
 {
     _shoppingCartService = shoppingCartService;
     _orderService = orderService;
     _metricsService = metricsService;
     _loggingService = loggingService;
     _customerService = customerService;
     _catalogueService = catalogueService;
     _authenticationService = authenticationService;
 }
コード例 #28
0
 public ToursController(ITourService tourService, IExperienceQueryService experienceQueryService, IShoppingCartService shoppingCartService, IOrderService orderService, IRegistrationService registrationService, IUserService userService, ILogger logger, IDiscountCodeValidator discountCodeValidator, IUserMailer userMailer, IOrderConfirmationMailer orderConfirmationMailer, ICategoryService categoryService, IPerspectiveService perspectiveService, ISEOToolStaticPageQueryService seoToolStaticPageQueryService, IStudentInquiryMailer mailer)
 {
     _tourService = tourService;
     _experienceQueryService = experienceQueryService;
     _shoppingCartService = shoppingCartService;
     _orderService = orderService;
     _registrationService = registrationService;
     _userService = userService;
     _userMailer = userMailer;
     _orderConfirmationMailer = orderConfirmationMailer;
     _logger = logger;
     _discountCodeValidator = discountCodeValidator;
     _categoryQueryService = categoryService;
     _perspectiveService = perspectiveService;
     _seoToolStaticPageQueryService = seoToolStaticPageQueryService;
     _mailer = mailer;
 }
コード例 #29
0
        public void BuildCart(IShoppingCartService ShoppingCartService, ShoppingCart Cart)
        {
            var cartRecords = ShoppingCartService.ListItems();
            var shippingParts = ListShippingParts(cartRecords);

            if (shippingParts.Any()) {
                var shippingInfos = Cart.Properties["ShippingInfos"] as IList<Tuple<int, IShippingInfo>> ?? new List<Tuple<int, IShippingInfo>>();
                foreach (var cartRecord in cartRecords) {
                    var shippingPart = shippingParts.Where(p => p.Id == cartRecord.ItemId).FirstOrDefault();

                    if (shippingPart != null) {
                        shippingInfos.Add(new Tuple<int, IShippingInfo>(cartRecord.Quantity, shippingPart));
                    }
                }
                Cart.Properties["ShippingInfos"] = shippingInfos;
            }
        }
コード例 #30
0
ファイル: CheckoutController.cs プロジェクト: rtpHarry/OShop
 public CheckoutController(
     ICustomersService customersService,
     IShoppingCartService shoppingCartService,
     IOrdersService ordersService,
     IOrchardServices services,
     IShapeFactory shapeFactory,
     IEnumerable<IPaymentProvider> paymentProviders,
     IShippingService shippingService = null)
 {
     _customersService = customersService;
     _shoppingCartService = shoppingCartService;
     _ordersService = ordersService;
     _shapeFactory = shapeFactory;
     _shippingService = shippingService;
     _paymentProviders = paymentProviders.OrderByDescending(p => p.Priority);
     Services = services;
     T = NullLocalizer.Instance;
 }
コード例 #31
0
ファイル: Login.cshtml.cs プロジェクト: tajwal/Marketplace
 public LoginModel(SignInManager <MarketplaceUser> signInManager, ILogger <LoginModel> logger, IShoppingCartService shoppingCartService)
 {
     _signInManager           = signInManager;
     _logger                  = logger;
     this.shoppingCartService = shoppingCartService;
 }
コード例 #32
0
 public HomeController(IProductService productService, IApplicationUserManager userManager, IShoppingCartService shoppingCartService,
                       IUnitOfWork unitOfWork)
 {
     _productService      = productService;
     _shoppingCartService = shoppingCartService;
     _unitOfWork          = unitOfWork;
     _userManager         = userManager;
 }
コード例 #33
0
 public void Setup()
 {
     _service    = new ShoppingCartServiceFake();
     _controller = new ShoppingCartController(_service);
 }
コード例 #34
0
 public CheckoutService(ICustomerRepository customerRepository, IShippingRepository shippingRepository, IOrderRepository orderRepository, IShoppingCartService shoppingCartService, IHttpContextAccessor httpContextAccessor)
 {
     _customerRepository  = customerRepository;
     _shippingRepository  = shippingRepository;
     _orderRepository     = orderRepository;
     _shoppingCartService = shoppingCartService;
     _httpContextAccessor = httpContextAccessor;
     _storeDB             = new StoreDbContext();
 }
コード例 #35
0
 public CheckoutController(IOrchardServices orchardServices, IShoppingCartService shoppingCartService, IOrderService orderService)
     : base(orchardServices)
 {
     _shoppingCartService = shoppingCartService;
     _orderService        = orderService;
 }
コード例 #36
0
        public void TestInitialize()
        {
            _workContext = null;

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

            var pluginFinder = new PluginFinder(_serviceProvider);

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

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

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

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

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



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

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

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

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

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

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

            var tempAddressService = new Mock <IAddressService>();

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

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

            _rewardPointsSettings = new RewardPointsSettings();

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

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

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

            _orderProcessingService = new OrderProcessingService(_orderService, _webHelper,
                                                                 _localizationService, _languageService,
                                                                 _productService, _paymentService, _logger,
                                                                 _orderTotalCalcService, _priceCalcService, _priceFormatter,
                                                                 _productAttributeParser, _productAttributeFormatter,
                                                                 _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                                                                 _shippingService, _taxService,
                                                                 _customerService, _discountService,
                                                                 _encryptionService, _workContext,
                                                                 _workflowMessageService, _vendorService,
                                                                 _currencyService, _affiliateService,
                                                                 _eventPublisher, _pdfService, null, _storeContext, _productReservationService, _auctionService, _countryService,
                                                                 _shippingSettings, _shoppingCartSettings, _paymentSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings);
        }
コード例 #37
0
 public ShoppingCartManager(IShoppingCartService service)
 {
     _service = service;
 }
コード例 #38
0
 public ShoppingCartControllerTest()
 {
     _service    = new ShoppingCartServiceFake();
     _controller = new ShoppingCartController(_service);
 }
コード例 #39
0
 public ShoppingCartViewComponent(IShoppingCartService shoppingCartService)
 {
     this.shoppingCartService = shoppingCartService;
 }
コード例 #40
0
 public ProductController(
     ICommonServices services,
     IManufacturerService manufacturerService,
     IProductService productService,
     IProductAttributeService productAttributeService,
     IProductAttributeParser productAttributeParser,
     ITaxService taxService,
     ICurrencyService currencyService,
     IPictureService pictureService,
     IPriceCalculationService priceCalculationService,
     IPriceFormatter priceFormatter,
     ICustomerContentService customerContentService,
     ICustomerService customerService,
     IShoppingCartService shoppingCartService,
     IRecentlyViewedProductsService recentlyViewedProductsService,
     IProductTagService productTagService,
     IOrderReportService orderReportService,
     IBackInStockSubscriptionService backInStockSubscriptionService,
     IAclService aclService,
     IStoreMappingService storeMappingService,
     MediaSettings mediaSettings,
     SeoSettings seoSettings,
     CatalogSettings catalogSettings,
     ShoppingCartSettings shoppingCartSettings,
     LocalizationSettings localizationSettings,
     CaptchaSettings captchaSettings,
     CatalogHelper helper,
     IDownloadService downloadService,
     ILocalizationService localizationService,
     IBreadcrumb breadcrumb,
     Lazy <PrivacySettings> privacySettings,
     Lazy <TaxSettings> taxSettings)
 {
     _services                       = services;
     _manufacturerService            = manufacturerService;
     _productService                 = productService;
     _productAttributeService        = productAttributeService;
     _productAttributeParser         = productAttributeParser;
     _taxService                     = taxService;
     _currencyService                = currencyService;
     _pictureService                 = pictureService;
     _priceCalculationService        = priceCalculationService;
     _priceFormatter                 = priceFormatter;
     _customerContentService         = customerContentService;
     _customerService                = customerService;
     _shoppingCartService            = shoppingCartService;
     _recentlyViewedProductsService  = recentlyViewedProductsService;
     _productTagService              = productTagService;
     _orderReportService             = orderReportService;
     _backInStockSubscriptionService = backInStockSubscriptionService;
     _aclService                     = aclService;
     _storeMappingService            = storeMappingService;
     _mediaSettings                  = mediaSettings;
     _seoSettings                    = seoSettings;
     _catalogSettings                = catalogSettings;
     _shoppingCartSettings           = shoppingCartSettings;
     _localizationSettings           = localizationSettings;
     _captchaSettings                = captchaSettings;
     _helper              = helper;
     _downloadService     = downloadService;
     _localizationService = localizationService;
     _breadcrumb          = breadcrumb;
     _privacySettings     = privacySettings;
     _taxSettings         = taxSettings;
 }
コード例 #41
0
 public GetShoppingCartHandler(
     ICacheManager cacheManager,
     IPaymentService paymentService,
     IProductService productService,
     IPictureService pictureService,
     IProductAttributeParser productAttributeParser,
     ILocalizationService localizationService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     IOrderProcessingService orderProcessingService,
     ICurrencyService currencyService,
     IDiscountService discountService,
     IShoppingCartService shoppingCartService,
     ICheckoutAttributeService checkoutAttributeService,
     IPermissionService permissionService,
     ITaxService taxService,
     IPriceFormatter priceFormatter,
     ICheckoutAttributeParser checkoutAttributeParser,
     IDownloadService downloadService,
     ICountryService countryService,
     IShippingService shippingService,
     IProductAttributeFormatter productAttributeFormatter,
     IPriceCalculationService priceCalculationService,
     IDateTimeHelper dateTimeHelper,
     IVendorService vendorService,
     IMediator mediator,
     MediaSettings mediaSettings,
     OrderSettings orderSettings,
     ShoppingCartSettings shoppingCartSettings,
     CatalogSettings catalogSettings,
     ShippingSettings shippingSettings,
     CommonSettings commonSettings)
 {
     _cacheManager               = cacheManager;
     _paymentService             = paymentService;
     _productService             = productService;
     _pictureService             = pictureService;
     _productAttributeParser     = productAttributeParser;
     _localizationService        = localizationService;
     _checkoutAttributeFormatter = checkoutAttributeFormatter;
     _orderProcessingService     = orderProcessingService;
     _currencyService            = currencyService;
     _discountService            = discountService;
     _shoppingCartService        = shoppingCartService;
     _checkoutAttributeService   = checkoutAttributeService;
     _permissionService          = permissionService;
     _taxService                = taxService;
     _priceFormatter            = priceFormatter;
     _checkoutAttributeParser   = checkoutAttributeParser;
     _downloadService           = downloadService;
     _countryService            = countryService;
     _shippingService           = shippingService;
     _productAttributeFormatter = productAttributeFormatter;
     _priceCalculationService   = priceCalculationService;
     _dateTimeHelper            = dateTimeHelper;
     _vendorService             = vendorService;
     _mediator             = mediator;
     _mediaSettings        = mediaSettings;
     _orderSettings        = orderSettings;
     _shoppingCartSettings = shoppingCartSettings;
     _catalogSettings      = catalogSettings;
     _shippingSettings     = shippingSettings;
     _commonSettings       = commonSettings;
 }
コード例 #42
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BookSummaryViewModel"/> class.
        /// </summary>
        /// <param name="book">The book.</param>
        /// <param name="booksService">The books service.</param>
        /// <param name="shoppingCartService">The shopping cart service.</param>
        /// <param name="authService">The authentication service.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public BookSummaryViewModel(DetailedBookDto book, IBooksService booksService, IShoppingCartService shoppingCartService, IAuthenticationService authService)
        {
            if (book == null)
            {
                throw new ArgumentNullException(nameof(book));
            }

            this.Book                = book;
            this.booksService        = booksService;
            this.shoppingCartService = shoppingCartService;
            this.authService         = authService;
            this.booksService.MyBooks.CollectionChanged += this.MyBooks_CollectionChanged;
        }
コード例 #43
0
 public ShoppingCartController(IShoppingCartService shoppingCartServices, ShoppingCart shoppingCart)
 {
     this.shoppingCartServices = shoppingCartServices;
     this.shoppingCart         = shoppingCart;
 }
コード例 #44
0
ファイル: OrderRepository.cs プロジェクト: xilackvs/DoAn1
 public OrderRepository(MerchShopDbContext context, IShoppingCartService shoppingCartService)
 {
     _merchShopDbContext  = context;
     _shoppingCartService = shoppingCartService;
 }
コード例 #45
0
 public ShoppingCartController(IShoppingCartService ShoppingCartService)
 {
     _ShoppingCartService = ShoppingCartService;
 }
コード例 #46
0
 public IyzicoPaymentProcessor(ISettingService settingService, IPaymentIyzicoService iyzicoService, IyzicoPaymentSettings iyzicoPaymentSettings, IWebHelper webHelper, ILocalizationService localizationService, ICustomerService customerService, IAddressService addressService, IProductService productService, ICategoryService categoryService, IShoppingCartService shoppingCartService, IPriceCalculationService priceCalculationService, IPaymentService paymentService, IHttpContextAccessor httpContextAccessor, IOrderTotalCalculationService orderTotalCalculationService, IWorkContext workContext, IShippingPluginManager shippingPluginManager, IStoreContext storeContext, IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccessor, ITaxService taxService, ICurrencyService currencyService)
 {
     this._settingService               = settingService;
     this._iyzicoService                = iyzicoService;
     this._iyzicoPaymentSettings        = iyzicoPaymentSettings;
     this._webHelper                    = webHelper;
     this._localizationService          = localizationService;
     this._customerService              = customerService;
     this._addressService               = addressService;
     this._productService               = productService;
     this._categoryService              = categoryService;
     this._shoppingCartService          = shoppingCartService;
     this._priceCalculationService      = priceCalculationService;
     this._paymentService               = paymentService;
     this._httpContextAccessor          = httpContextAccessor;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._workContext                  = workContext;
     this._shippingPluginManager        = shippingPluginManager;
     this._storeContext                 = storeContext;
     this._urlHelperFactory             = urlHelperFactory;
     this._actionContextAccessor        = actionContextAccessor;
     this._taxService                   = taxService;
     this._currencyService              = currencyService;
 }
コード例 #47
0
 public PaymentIyzicoController(ISettingService settingService,
                                ILocalizationService localizationService,
                                IPermissionService permissionService,
                                INotificationService notificationService,
                                IyzicoPaymentSettings iyzicoPaymentSettings, IWorkContext workContext, ICustomerService customerService, IShoppingCartService shoppingCartService, TaxSettings taxSettings, ICurrencyService currencyService, IPriceFormatter priceFormatter, IPriceCalculationService priceCalculationService, IOrderTotalCalculationService orderTotalCalculationService)
 {
     _settingService               = settingService;
     _localizationService          = localizationService;
     _permissionService            = permissionService;
     _notificationService          = notificationService;
     _iyzicoPaymentSettings        = iyzicoPaymentSettings;
     _workContext                  = workContext;
     _customerService              = customerService;
     _shoppingCartService          = shoppingCartService;
     _taxSettings                  = taxSettings;
     _currencyService              = currencyService;
     _priceFormatter               = priceFormatter;
     _priceCalculationService      = priceCalculationService;
     _orderTotalCalculationService = orderTotalCalculationService;
 }
コード例 #48
0
        public new void SetUp()
        {
            _workContext = null;
            _services    = MockRepository.GenerateMock <ICommonServices>();

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

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

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

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

            _shipmentService = MockRepository.GenerateMock <IShipmentService>();

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

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

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

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

            _rewardPointsSettings = new RewardPointsSettings();

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

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

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

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

            _localizationSettings = new LocalizationSettings();

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

            _currencySettings = new CurrencySettings();

            _orderProcessingService = new OrderProcessingService(_orderService, _webHelper,
                                                                 _localizationService, _languageService,
                                                                 _productService, _paymentService,
                                                                 _orderTotalCalcService, _priceCalcService, _priceFormatter,
                                                                 _productAttributeParser, _productAttributeFormatter,
                                                                 _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                                                                 _shippingService, _shipmentService, _taxService,
                                                                 _customerService, _discountService,
                                                                 _encryptionService, _workContext, _storeContext,
                                                                 _messageFactory, _customerActivityService, _currencyService, _affiliateService,
                                                                 _eventPublisher, _genericAttributeService,
                                                                 _newsLetterSubscriptionService,
                                                                 _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings,
                                                                 _currencySettings, _shoppingCartSettings,
                                                                 _catalogSettings);
        }
コード例 #49
0
 public ShoppingCartController(UserManager <ApplicationUser> userManager, IShoppingCartService shoppingCartService, IProductService productService)
 {
     _userManager         = userManager;
     _shoppingCartService = shoppingCartService;
     _productService      = productService;
 }
コード例 #50
0
 public void Init()
 {
     StructureMapSetup.Config();
     Services.AutomapperSetup.Config();
     _shoppingCartService = StructureMapSetup.Container.GetInstance <IShoppingCartService>();
 }
コード例 #51
0
 public CartProductCountRule(IShoppingCartService shoppingCartService)
 {
     _shoppingCartService = shoppingCartService;
 }
コード例 #52
0
 public GroupDealsController(
     IProductService productService,
     IProductTemplateService productTemplateService,
     ICategoryService categoryService,
     IManufacturerService manufacturerService,
     ICustomerService customerService,
     IUrlRecordService urlRecordService,
     IWorkContext workContext,
     ILanguageService languageService,
     ILocalizationService localizationService,
     ILocalizedEntityService localizedEntityService,
     ISpecificationAttributeService specificationAttributeService,
     IPictureService pictureService,
     ITaxCategoryService taxCategoryService,
     IProductTagService productTagService,
     ICopyProductService copyProductService,
     IPdfService pdfService,
     IExportManager exportManager,
     IImportManager importManager,
     ICustomerActivityService customerActivityService,
     IPermissionService permissionService,
     IAclService aclService,
     IStoreService storeService,
     IOrderService orderService,
     IStoreMappingService storeMappingService,
     IVendorService vendorService,
     IShippingService shippingService,
     IShipmentService shipmentService,
     ICurrencyService currencyService,
     CurrencySettings currencySettings,
     IMeasureService measureService,
     MeasureSettings measureSettings,
     AdminAreaSettings adminAreaSettings,
     IDateTimeHelper dateTimeHelper,
     IDiscountService discountService,
     IProductAttributeService productAttributeService,
     IBackInStockSubscriptionService backInStockSubscriptionService,
     IShoppingCartService shoppingCartService,
     IProductAttributeFormatter productAttributeFormatter,
     IProductAttributeParser productAttributeParser,
     IDownloadService downloadService,
     IRepository <GroupDeal> groupDealRepo,
     IRepository <GroupdealPicture> groupdealPictureRepo,
     IGroupDealService groupdealService,
     IGenericAttributeService genericAttributeService)
     : base(productService,
            productTemplateService,
            categoryService,
            manufacturerService,
            customerService,
            urlRecordService,
            workContext,
            languageService,
            localizationService,
            localizedEntityService,
            specificationAttributeService,
            pictureService,
            taxCategoryService,
            productTagService,
            copyProductService,
            pdfService,
            exportManager,
            importManager,
            customerActivityService,
            permissionService,
            aclService,
            storeService,
            orderService,
            storeMappingService,
            vendorService,
            shippingService,
            shipmentService,
            currencyService,
            currencySettings,
            measureService,
            measureSettings,
            adminAreaSettings,
            dateTimeHelper,
            discountService,
            productAttributeService,
            backInStockSubscriptionService,
            shoppingCartService,
            productAttributeFormatter,
            productAttributeParser,
            downloadService,
            groupDealRepo,
            groupdealPictureRepo,
            groupdealService,
            genericAttributeService)
 {
 }
コード例 #53
0
 public ShoppingCartController(IShoppingCartService service)
 {
     _service = service;
 }
コード例 #54
0
        public OrderTotalCalculationServiceTests()
        {
            _shippingSettings = new ShippingSettings
            {
                ActiveShippingRateComputationMethodSystemNames = new List <string> {
                    "FixedRateTestShippingRateComputationMethod"
                },
                AllowPickupInStore = true,
                IgnoreAdditionalShippingChargeForPickupInStore = false
            };

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

            var products = new List <Product>
            {
                new Product
                {
                    Id     = 1,
                    Weight = 1.5M,
                    Height = 2.5M,
                    Length = 3.5M,
                    Width  = 4.5M,
                    AdditionalShippingCharge = 5.5M,
                    IsShipEnabled            = true
                },
                new Product
                {
                    Id     = 2,
                    Weight = 11.5M,
                    Height = 12.5M,
                    Length = 13.5M,
                    Width  = 14.5M,
                    AdditionalShippingCharge = 6.5M,
                    IsShipEnabled            = true
                },
                new Product
                {
                    Id     = 3,
                    Weight = 11.5M,
                    Height = 12.5M,
                    Length = 13.5M,
                    Width  = 14.5M,
                    AdditionalShippingCharge = 7.5M,
                    IsShipEnabled            = false
                }
            };

            var productRepository = _fakeDataStore.RegRepository(products);

            _productService = new FakeProductService(productRepository: productRepository);

            var store = new Store {
                Id = 1
            };

            _storeContext.Setup(x => x.CurrentStore).Returns(store);
            _currencyService.Setup(x => x.GetCurrencyById(1)).Returns(new Currency {
                Id = 1, RoundingTypeId = 0
            });
            _addressService.Setup(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Returns(new Address {
                Id = _taxSettings.DefaultTaxAddressId
            });
            _paymentService.Setup(ps => ps.GetAdditionalHandlingFee(It.IsAny <IList <ShoppingCartItem> >(), "test1")).Returns(20);

            _genericAttributeService.Setup(x =>
                                           x.GetAttribute <PickupPoint>(It.IsAny <Customer>(), NopCustomerDefaults.SelectedPickupPointAttribute, _storeContext.Object.CurrentStore.Id, null))
            .Returns(new PickupPoint());
            _genericAttributeService.Setup(x => x.GetAttribute <string>(It.IsAny <Customer>(), NopCustomerDefaults.SelectedPaymentMethodAttribute, _storeContext.Object.CurrentStore.Id, null))
            .Returns("test1");

            _customerRoleRepository = _fakeDataStore.RegRepository(new[]
            {
                new CustomerRole
                {
                    Id           = 1,
                    Active       = true,
                    FreeShipping = true
                },
                new CustomerRole
                {
                    Id           = 2,
                    Active       = true,
                    FreeShipping = false
                }
            });

            var customerRepository = _fakeDataStore.RegRepository(new[] { new Customer()
                                                                          {
                                                                              Id = 1
                                                                          } });

            var customerCustomerRoleMappingRepository = _fakeDataStore.RegRepository <CustomerCustomerRoleMapping>();

            _customerService = new FakeCustomerService(
                customerRepository: customerRepository,
                customerRoleRepository: _customerRoleRepository,
                customerCustomerRoleMappingRepository: customerCustomerRoleMappingRepository,
                storeContext: _storeContext.Object);

            var pluginService = new FakePluginService();

            var pickupPluginManager = new PickupPluginManager(_customerService, pluginService, _shippingSettings);

            _shippingPluginManager = new ShippingPluginManager(_customerService, pluginService, _shippingSettings);
            var taxPluginManager      = new TaxPluginManager(_customerService, pluginService, _taxSettings);
            var discountPluginManager = new DiscountPluginManager(_customerService, pluginService);

            var currencySettings = new CurrencySettings {
                PrimaryStoreCurrencyId = 1
            };

            var discountRepository = _fakeDataStore.RegRepository <Discount>();

            _discountService = new FakeDiscountService(
                customerService: _customerService,
                discountPluginManager: discountPluginManager,
                productService: _productService,
                discountRepository: discountRepository,
                storeContext: _storeContext.Object);

            IPriceCalculationService priceCalculationService = new FakePriceCalculationService(
                currencySettings: currencySettings,
                currencyService: _currencyService.Object,
                customerService: _customerService,
                discountService: _discountService,
                productService: _productService,
                storeContext: _storeContext.Object);

            _shoppingCartService = new FakeShoppingCartService(
                productService: _productService,
                customerService: _customerService,
                genericAttributeService: _genericAttributeService.Object,
                priceCalculationService: priceCalculationService,
                shoppingCartSettings: _shoppingCartSettings);

            IShippingService shippingService = new FakeShippingService(customerSerice: _customerService,
                                                                       genericAttributeService: _genericAttributeService.Object,
                                                                       pickupPluginManager: pickupPluginManager,
                                                                       productService: _productService,
                                                                       shippingPluginManager: _shippingPluginManager,
                                                                       storeContext: _storeContext.Object,
                                                                       shippingSettings: _shippingSettings);

            _taxService = new FakeTaxService(
                addressService: _addressService.Object,
                customerService: _customerService,
                genericAttributeService: _genericAttributeService.Object,
                storeContext: _storeContext.Object,
                taxPluginManager: taxPluginManager,
                shippingSettings: _shippingSettings,
                taxSettings: _taxSettings);

            _orderTotalCalcService = new FakeOrderTotalCalculationService(
                addressService: _addressService.Object,
                customerService: _customerService,
                discountService: _discountService,
                genericAttributeService: _genericAttributeService.Object,
                paymentService: _paymentService.Object,
                priceCalculationService: priceCalculationService,
                productService: _productService,
                shippingPluginManager: _shippingPluginManager,
                shippingService: shippingService,
                shoppingCartService: _shoppingCartService,
                storeContext: _storeContext.Object,
                taxService: _taxService,
                shippingSettings: _shippingSettings,
                taxSettings: _taxSettings,
                rewardPointsSettings: _rewardPointsSettings);

            var serviceProvider = new FakeServiceProvider(_shoppingCartService, _paymentService.Object,
                                                          _genericAttributeService.Object, _orderTotalCalcService, _taxService, _taxSettings);

            var nopEngine = new FakeNopEngine(serviceProvider);

            EngineContext.Replace(nopEngine);
        }
コード例 #55
0
 public HomeAdminController(IShoppingCartService shoppingCartService)
 {
     _shoppingCartService = shoppingCartService;
 }
コード例 #56
0
 public void BuildOrder(IShoppingCartService ShoppingCartService, IContent Order)
 {
     LimitQuantities(ShoppingCartService);
 }
コード例 #57
0
 public ShipmentController(
     IShipmentViewModelService shipmentViewModelService,
     IOrderService orderService,
     IOrderProcessingService orderProcessingService,
     ILocalizationService localizationService,
     IWorkContext workContext,
     IMeasureService measureService,
     IPdfService pdfService,
     IProductService productService,
     IExportManager exportManager,
     IWorkflowMessageService workflowMessageService,
     ICategoryService categoryService,
     IManufacturerService manufacturerService,
     IProductAttributeService productAttributeService,
     IProductAttributeParser productAttributeParser,
     IProductAttributeFormatter productAttributeFormatter,
     IShoppingCartService shoppingCartService,
     IGiftCardService giftCardService,
     IDownloadService downloadService,
     IShipmentService shipmentService,
     IShippingService shippingService,
     IStoreService storeService,
     IVendorService vendorService,
     IAddressAttributeParser addressAttributeParser,
     IAddressAttributeService addressAttributeService,
     IAddressAttributeFormatter addressAttributeFormatter,
     IAffiliateService affiliateService,
     IPictureService pictureService,
     ITaxService taxService,
     IReturnRequestService returnRequestService,
     ICustomerService customerService,
     ICustomerActivityService customerActivityService,
     CurrencySettings currencySettings,
     TaxSettings taxSettings,
     MeasureSettings measureSettings,
     AddressSettings addressSettings,
     ShippingSettings shippingSettings,
     MediaSettings mediaSettings)
 {
     _shipmentViewModelService = shipmentViewModelService;
     _orderService             = orderService;
     _orderProcessingService   = orderProcessingService;
     _localizationService      = localizationService;
     _workContext               = workContext;
     _measureService            = measureService;
     _pdfService                = pdfService;
     _productService            = productService;
     _exportManager             = exportManager;
     _workflowMessageService    = workflowMessageService;
     _categoryService           = categoryService;
     _manufacturerService       = manufacturerService;
     _productAttributeService   = productAttributeService;
     _productAttributeParser    = productAttributeParser;
     _productAttributeFormatter = productAttributeFormatter;
     _shoppingCartService       = shoppingCartService;
     _giftCardService           = giftCardService;
     _downloadService           = downloadService;
     _shipmentService           = shipmentService;
     _shippingService           = shippingService;
     _storeService              = storeService;
     _vendorService             = vendorService;
     _addressAttributeParser    = addressAttributeParser;
     _addressAttributeService   = addressAttributeService;
     _addressAttributeFormatter = addressAttributeFormatter;
     _affiliateService          = affiliateService;
     _pictureService            = pictureService;
     _taxService                = taxService;
     _returnRequestService      = returnRequestService;
     _customerActivityService   = customerActivityService;
     _currencySettings          = currencySettings;
     _taxSettings               = taxSettings;
     _measureSettings           = measureSettings;
     _addressSettings           = addressSettings;
     _shippingSettings          = shippingSettings;
     _customerService           = customerService;
     _mediaSettings             = mediaSettings;
 }
コード例 #58
0
 public void BuildCart(IShoppingCartService ShoppingCartService, ShoppingCart Cart)
 {
     LimitQuantities(ShoppingCartService);
 }
コード例 #59
0
 public ShoppingCartController(IProductService productService, IShoppingCartService shoppingCart)
 {
     _productService = productService;
     _shoppingCart   = shoppingCart;
 }
コード例 #60
0
 public ShoppingCartController(IShoppingCartService shoppingCartService)
 {
     this.shoppingCartService = shoppingCartService;
 }