public ProductPresenter(IProductView view, INavigationService navigationService, IProductService productService, IBasketService basketService) { _view = view; _navigationService = navigationService; _productService = productService; _basketService = basketService; }
public BasketController( IBasketService basketService, IRepository<Basket> basketRepository) { this.basketService = basketService; this.basketRepository = basketRepository; }
public BasketController(IProductCatalogService productCatalogService, IBasketService basketService, ICookieStorageService cookieStorageService) : base(cookieStorageService, productCatalogService) { _basketService = basketService; _cookieStorageService = cookieStorageService; }
public void SetUp() { countryRepository = MockRepository.GenerateStub<IRepository<Country>>(); userService = MockRepository.GenerateStub<IUserService>(); basketService = new BasketService(countryRepository, userService); user = new User(); userService.Stub(u => u.CurrentUser).Return(user).Repeat.Any(); }
public BasketManager(IBasketService basketService) { if (basketService == null) { throw new ArgumentNullException("basketService"); } this.basketService = basketService; }
public CheckoutController(ICookieStorageService cookieStorageService, IBasketService basketService, ICustomerService customerService, IOrderService orderService, IFormsAuthentication formsAuthentication) : base(cookieStorageService) { _cookieStorageService = cookieStorageService; _basketService = basketService; _customerService = customerService; _orderService = orderService; _formsAuthentication = formsAuthentication; }
public ProductController( IDeepZoomService deepZoomService, ISolrSearchService searchService, IBasketService basketService, IReviewService reviewService) { this.deepZoomService = deepZoomService; this.searchService = searchService; this.basketService = basketService; this.reviewService = reviewService; }
public void Setup() { user = new User { Role = Role.Administrator }; userService = MockRepository.GenerateStub<IUserService>(); userService.Expect(x => x.CurrentUser).Return(user); basketService = MockRepository.GenerateStub<IBasketService>(); basketService.Stub(b => b.GetCurrentBasketForCurrentUser()).Return(new Basket()); binder = new CurrentBasketBinder(userService, basketService); }
public BasketControllerAdapter(IBasketService basketService, CurrencyProvider currencyProvider) { if (basketService == null) { throw new ArgumentNullException("basketService"); } if (currencyProvider == null) { throw new ArgumentNullException("currencyProvider"); } this.basketService = basketService; this.currencyProvider = currencyProvider; }
public BasketController(IBasketService basketService, CurrencyProvider currencyProvider) { if (basketService == null) { throw new ArgumentNullException("basketService"); } if (currencyProvider == null) { throw new ArgumentNullException("currencyProvider"); } this.basketService = basketService; this.currencyProvider = currencyProvider; }
public ExternalLoginModel( SignInManager <ApplicationUser> signInManager, UserManager <ApplicationUser> userManager, ILogger <ExternalLoginModel> logger, IEmailSender emailSender, IOptions <EmailSettings> settings, IMailChimpService mailChimpService, IBasketService basketService) { _signInManager = signInManager; _userManager = userManager; _logger = logger; _emailSender = emailSender; _mailChimpService = mailChimpService; _settings = settings.Value; _basketService = basketService; }
public PayPalController( ILogService logService, IBasketService basketService, IPayPalService payPalService, IShippingService shippingService, IOrderService orderService, ICustomerService customerService, Fashinon dbContext) { this.logService = logService; this.basketService = basketService; this.payPalService = payPalService; this.shippingService = shippingService; this.orderService = orderService; this.customerService = customerService; this.dbContext = dbContext; }
public AccountController( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IEmailSender emailSender, ILogger <AccountController> logger, ApplicationDbContext ctx, IBasketService basketService, IFunctional functional) { _userManager = userManager; _signInManager = signInManager; _emailSender = emailSender; _logger = logger; _context = ctx; _basketService = basketService; _functional = functional; }
public CheckoutStep2Model(IBasketService basketService, IBasketViewModelService basketViewModelService, SignInManager <ApplicationUser> signInManager, UserManager <ApplicationUser> userManager, IAccountService accountService, IOrderService orderService, IEmailSender emailSender, IOptions <EmailSettings> settings) { _basketService = basketService; _basketViewModelService = basketViewModelService; _signInManager = signInManager; _userManager = userManager; _accountService = accountService; _orderService = orderService; _emailSender = emailSender; _settings = settings.Value; }
public OrderService( IDeletableEntityRepository <Order> orderRepository, IBasketService basketService, ITableService tableService, IDishTypeService dishTypeService, IPromoCodeService promoCodeService, IOrderDishService orderDishService, IOrderDrinkService orderDrinkService ) { this.orderRepository = orderRepository; this.basketService = basketService; this.tableService = tableService; this.dishTypeService = dishTypeService; this.promoCodeService = promoCodeService; this.orderDishService = orderDishService; this.orderDrinkService = orderDrinkService; }
public OrderService(IOrderRepository repository, IModeratorService moderatorService, IDispatcherService dispatcherService, IDriverService driverService, ICustomerService customerService, ICargoService cargoService, IRouteService routeService, IBasketService billService) : base(repository) { ModeratorService = moderatorService; DispatcherService = dispatcherService; DriverService = driverService; CargoService = cargoService; CustomerService = customerService; RouteService = routeService; BillService = billService; }
public IndexModel(IWishlistService wishlistService, IAsyncRepository <WishlistItem> wishListItemsRepo, IAsyncRepository <CatalogItem> catalogItemsRepo, IBasketService basketService, IBasketViewModelService basketViewModelService, IWishlistViewModelService wishlistViewModelService, SignInManager <ApplicationUser> signInManager, IAppLogger <WishlistService> logger) { _wishlistService = wishlistService; _signInManager = signInManager; _wishlistViewModelService = wishlistViewModelService; _basketService = basketService; _basketViewModelService = basketViewModelService; _wishListItemsRepo = wishListItemsRepo; _catalogItemsRepo = catalogItemsRepo; _logger = logger; }
public CataloogController(IProductService ps, IBasketService bs, IUserService us, ILanguageService ls) { this.ps = ps; this.bs = bs; this.us = us; this.ls = ls; Cultuur cult1 = new Cultuur() { ID = "en-US" }; Cultuur cult2 = new Cultuur() { ID = "nl-BE" }; Talen.Add(cult1); Talen.Add(cult2); }
public BasketController(IBasketService basketService, ICloudStorageService cloudStorageService, IBasketViewModelService basketViewModelService, IOrderService orderService, IUriComposer uriComposer, SignInManager <ApplicationUser> signInManager, IAppLogger <BasketController> logger, IConfiguration configuration) { _basketService = basketService; _uriComposer = uriComposer; _signInManager = signInManager; _logger = logger; _orderService = orderService; _basketViewModelService = basketViewModelService; _configuration = configuration; _cloudStorageService = cloudStorageService; }
public ClientController(IBasketService basketService, IBasketRepositoryService basketRepositoryService, IOrderService orderService) { if (basketService == null) { throw new ArgumentNullException(nameof(basketService)); } if (basketRepositoryService == null) { throw new ArgumentNullException(nameof(basketRepositoryService)); } if (orderService == null) { throw new ArgumentNullException(nameof(orderService)); } _basketService = basketService; _basketRepositoryService = basketRepositoryService; _orderService = orderService; }
public async Task GetContentOnUserWhoHasNoProducts_ShouldReturnEmpty() { this.Initialize(); this.SeedUsers(); this.SeedProductsIDs(); this.SeedBasketItems(); var mockedService = new Mock <IProductsService>(); this.service = new BasketSerivce(context, mockedService.Object, mapper); for (int i = 1; i < LoopIterations; i++) { var userWithNoProductsInBasket = UserOneName + i; var viewModel = await this.service.GetBasketContentAsync <BasketViewModel>(userWithNoProductsInBasket); Assert.Empty(viewModel); } }
public GamesApiController( IGameService gameService, ICommentService commentService, IGenreService genreService, IPlatformTypeService platformTypeService, IBasketService basketService, IPublisherService publisherService, ILanguageService languageService, ILogger logger) { _gameService = gameService; _commentService = commentService; _genreService = genreService; _platformTypeService = platformTypeService; _basketService = basketService; _publisherService = publisherService; _languageService = languageService; _logger = logger; }
public async Task PassInvalidProductId_ShouldThrowProductExc() { this.Initialize(); this.SeedUser(); this.SeedProductsIDs(); var mockedService = new Mock <IProductsService>(); var invalidProductId = 555; mockedService .Setup(x => x.GetProductByIdAsync <ProductViewModel>(invalidProductId)) .Returns(Task.FromResult((ProductViewModel)null)); this.service = new BasketSerivce(context, mockedService.Object, mapper); await Assert.ThrowsAsync <ProductNotFoundException>(() => this.service.AddProductToBasketAsync(invalidProductId, UserOneName)); }
public OrderService(IUnitOfWorkFactory unitOfWorkFactory, IBasketService basketService, UserManager <User> userManager) { if (unitOfWorkFactory == null) { throw new ArgumentNullException(nameof(unitOfWorkFactory)); } if (basketService == null) { throw new ArgumentNullException(nameof(basketService)); } if (userManager == null) { throw new ArgumentNullException(nameof(userManager)); } _basketService = basketService; _unitOfWorkFactory = unitOfWorkFactory; _userManager = userManager; }
public CheckoutModel(IBasketService basketService, IBasketViewModelService basketViewModelService, UserManager <ApplicationUser> userManager, IOrderService orderService, IEmailSender emailSender, IOptions <AppSettings> settings, IAuthConfigRepository authConfigRepository, IInvoiceService invoiceService, IAsyncRepository <Country> countryRepository) { _basketService = basketService; _userManager = userManager; _orderService = orderService; _basketViewModelService = basketViewModelService; _emailSender = emailSender; _authConfigRepository = authConfigRepository; _invoiceService = invoiceService; _countryRepository = countryRepository; _settings = settings.Value; }
public ProductController(IProductService productService, ICategoryService categoryService, ISeasonService seasonService, IBasketService basketService, IOrderService orderService, IUserService userService) { try { if (productService == null) { throw new ArgumentNullException("productService"); } if (basketService == null) { throw new ArgumentNullException("basketService"); } if (categoryService == null) { throw new ArgumentNullException("categoryService"); } if (seasonService == null) { throw new ArgumentNullException("seasonService"); } if (orderService == null) { throw new ArgumentNullException("orderService"); } if (userService == null) { throw new ArgumentNullException("userService"); } _productService = productService; _categoryService = categoryService; _seasonService = seasonService; _basketService = basketService; _orderService = orderService; _userService = userService; } catch (NullReferenceException) { View("Create"); } }
public CustomizeViewModelService( IRepository <Category> categoryRepository, IRepository <CatalogItem> catalogRepository, IRepository <CatalogType> catalogTypeRepository, IRepository <CustomizeOrder> customizeRepository, IEmailSender emailSender, IOptions <EmailSettings> settings, IUriComposer uriComposer, TelemetryClient telemetry, IBasketService basketService) { _categoryRepository = categoryRepository; _catalogRepository = catalogRepository; _catalogTypeRepository = catalogTypeRepository; _customizeOrderRepository = customizeRepository; _emailSender = emailSender; _settings = settings.Value; _uriComposer = uriComposer; _telemetry = telemetry; _basketService = basketService; }
protected void CheckoutButton_Click(object sender, EventArgs e) { string basketHash = _Basket.ContentHash; SaveBasket(); if (basketHash != _Basket.GetContentHash()) { IBasketService service = AbleContext.Resolve <IBasketService>(); service.Combine(_Basket); service.Recalculate(_Basket); } if (ValidateInventory()) { Response.Redirect("CreateOrder3.aspx?UID=" + _UserId); } else { // SET THE FLAG SO THAT WE CAN PROCEED TO CHECKOUT AFTER AN INVENTORY ACTION IS SELECTED DummyInventoryAction.Value = "checkout"; } }
//BUILD THE BASKET ON PRERENDER SO THAT WE CAN ACCOUNT //FOR ANY PRODUCTS ADDED DURING THE POSTBACK CYCLE protected void Page_PreRender(object sender, System.EventArgs e) { //PREPARE BASKET FOR DISPLAY Basket basket = AbleContext.Current.User.Basket; IBasketService service = AbleContext.Resolve <IBasketService>(); service.Combine(basket); service.Recalculate(basket); // VALIDATE THE BASKET ValidationResponse response = service.Validate(basket); //DISPLAY ANY WARNING MESSAGES if (!response.Success) { Session["BasketMessage"] = response.WarningMessages; //Redirect to basket page where these error messages will be displayed Response.Redirect("~/Basket.aspx"); } BindBasket(basket); }
public async Task GetContentFromFullBasket_ShouldRetunrFullCollection() { this.Initialize(); this.SeedUsers(); this.SeedProductsIDs(); this.SeedBasketItems(); var mockedService = new Mock <IProductsService>(); this.service = new BasketSerivce(context, mockedService.Object, mapper); var viewModel = await this.service.GetBasketContentAsync <BasketViewModel>(UserOneName); var expectedCount = 10; var firstItem = viewModel.OrderBy(x => x.Product.Id).First(); var lastItem = viewModel.OrderByDescending(x => x.Product.Id).First(); var expectedIdOnLastItem = ProductId + (LoopIterations - 1); Assert.Equal(expectedCount, viewModel.Count()); Assert.Equal(ProductId, firstItem.Product.Id); Assert.Equal(expectedIdOnLastItem, lastItem.Product.Id); }
protected void ShipToAddressList_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Pick") { int addressId = AlwaysConvert.ToInt(e.CommandArgument); User user = AbleContext.Current.User; int index = user.Addresses.IndexOf(addressId); if (index > -1) { // RESET BASKET PACKAGING IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>(); preCheckoutService.Package(user.Basket, true); Address address = user.Addresses[index]; // UPDATE DESTINATION TO SELECTED ADDRESS AND REDIRECT foreach (BasketShipment shipment in user.Basket.Shipments) { shipment.Address = address; } user.Basket.Save(); Response.Redirect("ShipMethod.aspx"); } } else if (e.CommandName == "Edit") { int addressId = AlwaysConvert.ToInt(e.CommandArgument); if (addressId != 0) { ShowEditShipToPanel(addressId); } } else if (e.CommandName == "Del") { int addressId = AlwaysConvert.ToInt(e.CommandArgument); if (addressId != 0) { DeleteAddress(addressId); } } }
protected void ApplyCouponButton_Click(object sender, EventArgs e) { if (Page.IsValid) { IBasketService basketService = AbleContext.Resolve <IBasketService>(); CouponResult result = basketService.ApplyCoupon(AbleContext.Current.User.Basket, CouponCode.Text); if (result.ResultType == CouponResultType.Valid) { ValidCouponMessage.Visible = true; ValidCouponMessage.Text = string.Format(ValidCouponMessage.Text, CouponCode.Text); if (result.RemovedCoupons.Count > 0) { CouponsRemovedMessage.Text = String.Format(CouponsRemovedMessage.Text, string.Join(", ", result.RemovedCoupons.ToArray())); CouponsRemovedMessage.Visible = true; } CouponAppliedHandler(this, e); } else { // handle error switch (result.ResultType) { case CouponResultType.InvalidCode: InvalidCouponMessage.Text = "<p class=\"error\">The coupon code you entered is invalid.</p>"; break; case CouponResultType.AlreadyUsed: InvalidCouponMessage.Text = "<p class=\"error\">The coupon code you entered is already in use.</p>"; break; case CouponResultType.InvalidForOrder: InvalidCouponMessage.Text = "<p class=\"error\">" + result.ErrorMessage + "</p>"; break; } InvalidCouponMessage.Visible = true; } CouponCode.Text = string.Empty; } }
private static void BasketHandler(ShelfItem[] shelfItems, IBasketService basketService) { while (true) { Write("\n ENTER ITEM NUMBER TO ADD IT TO THE BASKET (ENTER 'N' TO CHECKOUT): "); var userInput = ReadKey(); if (!Helper.ValidUserInput(userInput, "PLEASE ENTER ONE OF THE NUMBERS FROM THE ABOVE LIST")) { break; } var shelfItemId = int.Parse(userInput.KeyChar.ToString()); if (shelfItems.All(s => s.Id != shelfItemId)) { WriteLine("\n PLEASE ENTER ONE OF THE NUMBERS FROM THE ABOVE LIST \n"); continue; } var selectedShelfItem = shelfItems.SingleOrDefault(s => s.Id == shelfItemId); if (selectedShelfItem == null) { continue; } Write($"\n ENTER QTY OF {selectedShelfItem.Name.ToUpper()}: "); var qtyUserInput = ReadLine(); if (!Helper.ValidUserInput(qtyUserInput, "QUANTITY MUST BE A WHOLE NUMBER")) { continue; } int.TryParse(qtyUserInput, out var quantity); basketService.AddItemToBasket(selectedShelfItem, quantity); } }
protected void Page_Load(object sender, EventArgs e) { User user = AbleContext.Current.User; if (user.IsAnonymous) { Response.Redirect("~/Checkout/Default.aspx"); return; } // REDIRECT IF SHIP TO MULTIPLE ADDRESSES IS DISABLED if (!AbleContext.Current.Store.Settings.EnableShipToMultipleAddresses) { Response.Redirect(this.ShipAddressPageUrl); } // INIT LOCAL VARIABLES _User = AbleContext.Current.User; _Basket = _User.Basket; IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>(); preCheckoutService.Recalculate(_Basket); if (_Basket.Items.Count == 0) { Response.Redirect(AbleCommerce.Code.NavigationHelper.GetBasketUrl()); } if (!_Basket.Items.HasShippableProducts()) { Response.Redirect("Payment.aspx"); } // DISPLAY ITEMS BasketGrid.DataSource = GetShippableItems(true); BasketGrid.DataBind(); BasketGrid.Columns[3].Visible = TaxHelper.ShowTaxColumn; // BIND SHIPPING ADDRESSES ON INIT SO THEY CAN PARTICIPATE IN POSTBACK EVENTS BindShippingAddresses(); }
protected void RecalculateShippingButton_Click(object sender, EventArgs e) { if (_AmazonProvider != null) { // make sure payment panel is hidden PaymentPanel.Visible = false; // need to get the address where we are shipping User user = AbleContext.Current.User; string purchaseContractId = Request.QueryString["purchaseContractId"]; MethodInfo getAddressMethod = _AmazonProvider.GetType().GetMethod("GetDestinationAddress"); object[] parameters = new object[] { user, purchaseContractId }; Address address = (Address)getAddressMethod.Invoke(_AmazonProvider, parameters); // make sure we have a valid address if (address != null) { // make sure the basket is packaged Basket basket = AbleContext.Current.User.Basket; IBasketService basketService = AbleContext.Resolve <IBasketService>(); basketService.Package(basket); // set all shipments to the right destination foreach (BasketShipment shipment in basket.Shipments) { shipment.Address = address; } basket.Save(); // calculate shipping ShippingMethodPanel.Visible = true; IShipRateQuoteCalculator shippingCalculator = AbleContext.Resolve <IShipRateQuoteCalculator>(); ICollection <ShipRateQuote> rateQuotes = shippingCalculator.QuoteForShipment(AbleContext.Current.User.Basket.Shipments[0]); ShipMethodsList.DataSource = GetShipMethodListDs(rateQuotes); ShipMethodsList.DataBind(); } } }
public BasketController(IBasketService basketListService, IUserService userService, IRoleService roleService, IOrderService orderService) { if (basketListService == null) { throw new NullReferenceException("basketListService"); } if (userService == null) { throw new NullReferenceException("userService"); } if (roleService == null) { throw new NullReferenceException("roleService"); } if (orderService == null) { throw new NullReferenceException("orderService"); } _basketService = basketListService; _userService = userService; _roleService = roleService; _orderService = orderService; }
public async Task AddProductToBasket_ShouldAdd() { this.Initialize(); this.SeedUser(); var mockedService = new Mock <IProductsService>(); mockedService .Setup(x => x.GetProductByIdAsync <ProductViewModel>(ProductId)) .Returns(Task.FromResult(GetTestProductData())); this.service = new BasketSerivce(context, mockedService.Object, mapper); var initialCount = 0; Assert.Equal(initialCount, this.context.BasketItems.Count()); await this.service.AddProductToBasketAsync(ProductId, UserOneName); var expectedCount = 1; Assert.Equal(expectedCount, this.context.BasketItems.Count()); }
protected void SubmitButton_Click(object sender, System.EventArgs e) { ShippingEstimatePopup.Show(); if (Page.IsValid && PostalCodeIsValid()) { // ENSURE THE BASKET IS PACKAGED IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>(); preCheckoutService.Package(_Basket); _ShipmentCount = _Basket.Shipments.Count; // BUILD THE ADDRESS OBJECT TO USE FOR THE RATE ESTIMATE _EstimateAddress = new Address(); _EstimateAddress.CountryCode = Country.SelectedValue; if (phProvinceField.Visible) { _EstimateAddress.Province = Province.SelectedValue; } if (phCityField.Visible) { _EstimateAddress.City = StringHelper.StripHtml(City.Text); } if (phPostalCodeField.Visible) { string safePostalCode = StringHelper.StripHtml(PostalCode.Text); safePostalCode = Regex.Replace(safePostalCode.ToUpperInvariant(), "[^-A-Z0-9]", string.Empty); PostalCode.Text = safePostalCode; _EstimateAddress.PostalCode = safePostalCode; } _EstimateAddress.Residence = _User.IsAnonymous ? !this.AssumeCommercialRates : _BillingAddress.Residence; // PREPARE AND DISPLAY THE RATE QUOTE INFORMATION phResultPanel.Visible = true; MultipleShipmentsMessage.Visible = this.MultiShipmentDisplay; ShipmentList.DataSource = _Basket.Shipments; ShipmentList.DataBind(); } }
public BasketController(IBasketService basketService) { _basketService = basketService; }
public BasketController(IBasketService BasketService, IOrderService orderService) { this.basketService = BasketService; this.OrderService = orderService; }
public Basket(IBasketService basketService) { _basketService = basketService; }
public CurrentBasketBinder(IUserService userService, IBasketService basketService) { this.userService = userService; this.basketService = basketService; }
public BasketController(IBasketService basketService, IProductService productService) { this.basketService = basketService; this.productService = productService; }
public HomeController(IBasketService basketService, ISolrSearchService searchService) { this.basketService = basketService; this.searchService = searchService; }
public BasketController(IBasketService bs, IOrderService os, IUserService us) { this.bs = bs; this.os = os; this.us = us; }
public OrderController(IBasketService basketService, IOrderingService orderingService) { _basketService = basketService; _orderingService = orderingService; }
public BasketController(IBasketService<Product, Basket> basketService, ILogger logger) { _basketService = basketService; _logger = logger; }
public BasketController(IBasketService basketService, IOrderService orderService, IRepository <Customer> customerContext) { this.basketService = basketService; this.orderService = orderService; this.customerContext = customerContext; }
public void SetUp() { basketService = MockRepository.GenerateStub<IBasketService>(); handler = new CreateNewBasketOnOrderConfirm(basketService); }