/// <summary>
		/// Initializes a new instance of the <see cref="SearchController"/> class.
		/// </summary>
		/// <param name="marketing">The marketing.</param>
		/// <param name="priceListClient">The price list client.</param>
		/// <param name="storeClient">The store client.</param>
		/// <param name="catalogClient">The catalog client.</param>
        public SearchController(MarketingHelper marketing, PriceListClient priceListClient, StoreClient storeClient,
                                CatalogClient catalogClient)
        {
            _marketing = marketing;
            _priceListClient = priceListClient;
            _storeClient = storeClient;
            _catalogClient = catalogClient;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchController" /> class.
 /// </summary>
 /// <param name="marketing">The marketing.</param>
 /// <param name="priceListClient">The price list client.</param>
 /// <param name="storeClient">The store client.</param>
 /// <param name="catalogClient">The catalog client.</param>
 /// <param name="searchFilter">The search filter.</param>
 public SearchController(MarketingHelper marketing, PriceListClient priceListClient, StoreClient storeClient,
                         CatalogClient catalogClient, ISearchFilterService searchFilter)
 {
     _marketing = marketing;
     _priceListClient = priceListClient;
     _storeClient = storeClient;
     _catalogClient = catalogClient;
     _searchFilter = searchFilter;
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheService"/> class.
 /// </summary>
 /// <param name="cacheRepository">The cache repository.</param>
 /// <param name="outputCacheManager">The output cache manager.</param>
 /// <param name="storeClient"></param>
 /// <param name="sessionService"></param>
 public CacheService(ICacheRepository cacheRepository, 
     IReadWriteOutputCacheManager outputCacheManager, 
     ICustomerSessionService sessionService,
     StoreClient storeClient):this()
 {
     _cacheRepository = cacheRepository;
     _outputCacheManager = outputCacheManager;
     _storeClient = storeClient;
     _sessionService = sessionService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckoutController"/> class.
 /// </summary>
 /// <param name="storeClient">The store client.</param>
 /// <param name="paymentClient">The payment client.</param>
 /// <param name="userClient">The user client.</param>
 /// <param name="countryClient">The country client.</param>
 /// <param name="orderClient">The order client.</param>
 /// <param name="paymentOptions">The payment options.</param>
 public CheckoutController(StoreClient storeClient,
                           PaymentClient paymentClient,
                           UserClient userClient,
                           CountryClient countryClient,
                           OrderClient orderClient,
                           IPaymentOption[] paymentOptions)
 {
     _storeClient = storeClient;
     _paymentClient = paymentClient;
     _userClient = userClient;
     _countryClient = countryClient;
     _orderClient = orderClient;
     _paymentOptions = paymentOptions;
 }
		internal static PaymentModel GetNewPaymentModel(Foundation.Orders.Model.Order order, IPaymentMethodRepository repository, StoreClient client)
		{
			var method = repository.PaymentMethods.Where(x => x.Name == "CreditCard").FirstOrDefault();

			var store = client.GetStoreById(order.StoreId);

			var cardTypes = store.CardTypes.Select(x => new ListModel(x.CardType, x.CardType)).ToArray();

			var months = new[]
                {
                    new ListModelInt("01 - January", 1),
                    new ListModelInt("02 - February", 2),
                    new ListModelInt("03 - March", 3),
                    new ListModelInt("04 - April", 4),
                    new ListModelInt("05 - May", 5),
                    new ListModelInt("06 - June", 6),
                    new ListModelInt("07 - July", 7),
                    new ListModelInt("08 - August", 8),
                    new ListModelInt("09 - September", 9),
                    new ListModelInt("10 - October", 10),
                    new ListModelInt("11 - November", 11),
                    new ListModelInt("12 - December", 12)
                };

			var years = new List<ListModelInt>();
			for (var index = DateTime.Now.Year; index <= DateTime.Now.Year + 10; index++)
			{
				years.Add(new ListModelInt(index.ToString(CultureInfo.InvariantCulture), index));
			}

			var result = new PaymentModel
			{
				Months = months,
				Years = years.ToArray(),
				CardTypes = cardTypes
			};

			if (method != null)
			{
				result.NewPayment.PaymentMethodId = method.PaymentMethodId;
				result.NewPayment.PaymentMethodName = method.Name;
			}

			return result;
		}
		public RefundDetailsStepViewModel(CreateRefundModel item, IPaymentMethodRepository repository, StoreClient client)
			: base(item)
		{
			item.NewPaymentSource = GetNewPaymentModel(item.Order, repository, client);

			InnerModel.PropertyChanged += InnerModel_PropertyChanged;
			InnerModel.NewPaymentSource.NewPayment.PropertyChanged += InnerModel_PropertyChanged;
		}
 public StoreSearchFilterService(StoreClient client, ICustomerSessionService customerSession, CatalogClient catalogClient)
 {
     _storeClient = client;
     _customerSession = customerSession;
     _catalogClient = catalogClient;
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StoreController"/> class.
 /// </summary>
 /// <param name="storeClient">The store client.</param>
 public StoreController(StoreClient storeClient)
 {
     _storeClient = storeClient;
 }
        /// <summary>
        /// Validates the items.
        /// </summary>
		private void ValidateItems()
		{
			var orderForms = CurrentOrderGroup.OrderForms.ToArray();
			var lineItems = orderForms.SelectMany(x => x.LineItems.ToArray());
			var validLineItems = lineItems.Where(x => !String.IsNullOrEmpty(x.CatalogItemId) && !x.CatalogItemId.StartsWith("@")).ToArray();

			string catalogId = null;

            // get the store and compare
			if (validLineItems.Any())
			{
                var store = new StoreClient(StoreRepository, CustomerSessionService, CacheRepository).GetStoreById(CurrentOrderGroup.StoreId);
                catalogId = store.Catalog;
			}

            if (!String.IsNullOrEmpty(catalogId))
            {
                var catalogHelper = new CatalogClient(CatalogRepository, null, CustomerSessionService, CacheRepository, InventoryRepository);
                var catalogItemIds = (from i in validLineItems select i.CatalogItemId).ToArray();
                var items = catalogHelper.GetItems(catalogItemIds);

                foreach (var lineItem in validLineItems)
                {
                    var item = items.SingleOrDefault(i => i.ItemId.Equals(lineItem.CatalogItemId, StringComparison.OrdinalIgnoreCase));

                    if (item != null && catalogHelper.GetItemAvailability(item.ItemId, lineItem.FulfillmentCenterId).IsAvailable)
                    {
                        //Inventory Info
                        if (item.TrackInventory)
                        {
                            var inventory = catalogHelper.GetItemInventory(lineItem.CatalogItemId, lineItem.FulfillmentCenterId);
                            PopulateInventoryInfo(inventory, lineItem);
                        }

                        //Variation Info
                        PopulateVariationInfo(item, lineItem);
                    }
                    else // remove item from the list
                    {
                        RemoveLineItem(lineItem);
                    }
                }
            }
            else // since no catalog is associated with a store, remove all items
            {
                RemoveAllLineItems();
            }
		}
		public RmaRequestRefundStepViewModel(ReturnBuilder returnBuilder, IPaymentMethodRepository repository, StoreClient client)
			: base(null, returnBuilder)
		{
			var paymentMethodNames = ReturnBuilder.CurrentOrder.OrderForms[0].Payments.Select(x => x.PaymentMethodName).Distinct();
			PaymentMethods = paymentMethodNames.ToArray();

			NewPaymentSource = CreateRefundViewModel.GetNewPaymentModel(ReturnBuilder.CurrentOrder.InnerItem, repository, client);
		}