Exemplo n.º 1
0
 public OrderHistoryViewService(
     IOrderHistoryViewModelFactory orderHistoryViewModelFactory,
     IOrderRepository orderRepository,
     IOrderUrlProvider orderUrlProvider,
     ILookupService lookupService,
     IOrderDetailsViewModelFactory orderDetailsViewModelFactory,
     IImageService imageService,
     IShippingTrackingProviderFactory shippingTrackingProviderFactory,
     ICustomerRepository customerRepository,
     IComposerJsonSerializer composerJsonSerializer,
     ILineItemViewModelFactory lineItemViewModelFactory,
     ICartRepository cartRepository,
     IComposerContext composerContext,
     ICartUrlProvider cartUrlProvider,
     IEditingOrderProvider editingOrderProvider,
     ICheckoutService checkoutService)
 {
     OrderHistoryViewModelFactory = orderHistoryViewModelFactory ?? throw new ArgumentNullException(nameof(orderHistoryViewModelFactory));
     OrderUrlProvider             = orderUrlProvider ?? throw new ArgumentNullException(nameof(orderUrlProvider));
     LookupService   = lookupService ?? throw new ArgumentNullException(nameof(lookupService));
     OrderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
     OrderDetailsViewModelFactory = orderDetailsViewModelFactory ?? throw new ArgumentNullException(nameof(orderDetailsViewModelFactory));
     ImageService = imageService ?? throw new ArgumentNullException(nameof(imageService));
     ShippingTrackingProviderFactory = shippingTrackingProviderFactory ?? throw new ArgumentNullException(nameof(shippingTrackingProviderFactory));
     CustomerRepository       = customerRepository ?? throw new ArgumentNullException(nameof(customerRepository));
     ComposerJsonSerializer   = composerJsonSerializer ?? throw new ArgumentNullException(nameof(composerJsonSerializer));
     LineItemViewModelFactory = lineItemViewModelFactory ?? throw new ArgumentNullException(nameof(lineItemViewModelFactory));
     CartRepository           = cartRepository ?? throw new ArgumentNullException(nameof(cartRepository));
     ComposerContext          = composerContext ?? throw new ArgumentNullException(nameof(composerContext));
     CartUrlProvider          = cartUrlProvider ?? throw new ArgumentNullException(nameof(cartUrlProvider));
     EditingOrderProvider     = editingOrderProvider ?? throw new ArgumentNullException(nameof(editingOrderProvider));
     CheckoutService          = checkoutService ?? throw new ArgumentNullException(nameof(checkoutService));
 }
Exemplo n.º 2
0
        /// <summary>
        /// CheckoutService constructor
        /// </summary>
        /// <param name="cartRepository">The repository for accessing cart data</param>
        /// <param name="cartService"></param>
        /// <param name="composerJsonSerializer">The json serializer</param>
        /// <param name="cartViewModelFactory"></param>
        /// <param name="lookupService"></param>
        /// <param name="addressRepository"></param>
        /// <param name="shippingMethodViewService"></param>
        /// <param name="imageService"></param>
        /// <param name="fulfillmentMethodRepository"></param>
        /// <param name="viewModelMapper"></param>
        /// <param name="lineItemViewModelFactory"></param>
        /// <param name="paymentRepository"></param>
        public CheckoutService(
            ICartRepository cartRepository,
            ICartService cartService,
            IComposerJsonSerializer composerJsonSerializer,
            ICartViewModelFactory cartViewModelFactory,
            ILookupService lookupService,
            IAddressRepository addressRepository,
            IShippingMethodViewService shippingMethodViewService,
            IImageService imageService,
            IFulfillmentMethodRepository fulfillmentMethodRepository,
            IViewModelMapper viewModelMapper,
            ILineItemViewModelFactory lineItemViewModelFactory,
            IPaymentRepository paymentRepository,
            IOrderDetailsViewModelFactory orderDetailsViewModelFactory,
            IOrderUrlProvider orderUrlProvider,
            IStoreRepository storeRepository,
            IInventoryLocationProvider inventoryLocationProvider)
        {
            CartRepository               = cartRepository ?? throw new ArgumentNullException(nameof(cartRepository));
            CartService                  = cartService ?? throw new ArgumentNullException(nameof(cartService));
            ComposerJsonSerializer       = composerJsonSerializer ?? throw new ArgumentNullException(nameof(composerJsonSerializer));
            CartViewModelFactory         = cartViewModelFactory ?? throw new ArgumentNullException(nameof(cartViewModelFactory));
            LookupService                = lookupService ?? throw new ArgumentNullException(nameof(lookupService));
            AddressRepository            = addressRepository ?? throw new ArgumentNullException(nameof(addressRepository));
            ShippingMethodViewService    = shippingMethodViewService ?? throw new ArgumentNullException(nameof(shippingMethodViewService));
            ImageService                 = imageService ?? throw new ArgumentNullException(nameof(imageService));
            FulfillmentMethodRepository  = fulfillmentMethodRepository ?? throw new ArgumentNullException(nameof(fulfillmentMethodRepository));
            ViewModelMapper              = viewModelMapper ?? throw new ArgumentNullException(nameof(viewModelMapper));
            LineItemViewModelFactory     = lineItemViewModelFactory ?? throw new ArgumentNullException(nameof(lineItemViewModelFactory));
            PaymentRepository            = paymentRepository ?? throw new ArgumentNullException(nameof(paymentRepository));
            OrderDetailsViewModelFactory = orderDetailsViewModelFactory ?? throw new ArgumentNullException(nameof(orderDetailsViewModelFactory));
            OrderUrlProvider             = orderUrlProvider ?? throw new ArgumentNullException(nameof(orderUrlProvider));
            StoreRepository              = storeRepository ?? throw new ArgumentNullException(nameof(storeRepository));
            InventoryLocationProvider    = inventoryLocationProvider ?? throw new ArgumentNullException(nameof(inventoryLocationProvider));

            _updateOperations = new Dictionary <string, UpdateOperation>();

            RegisterCartUpdateOperation <AddressViewModel>("ShippingAddress", UpdateShippingAddress, 1);
            RegisterCartUpdateOperation <RegisteredShippingAddressViewModel>("ShippingAddressRegistered", UpdateRegisteredShippingAddress, 1);
            RegisterCartUpdateOperation <PickUpAddressViewModel>("PickUpAddress", UpdatePickUpAddress, 1);
            RegisterCartUpdateOperation <CustomerSummaryViewModel>("GuestCustomerInfo", UpdateCustomer, 2);
            RegisterCartUpdateOperation <BillingAddressViewModel>("BillingAddress", UpdateBillingAddress, 3);
            RegisterCartUpdateOperation <RegisteredBillingAddressViewModel>("BillingAddressRegistered", UpdateRegisteredBillingAddress, 3);
            RegisterCartUpdateOperation <ShippingMethodViewModel>("ShippingMethod", UpdateShippingMethod, 4);
        }
        /// <summary>
        /// CheckoutService constructor
        /// </summary>
        /// <param name="cartRepository">The repository for accessing cart data</param>
        /// <param name="cartService"></param>
        /// <param name="composerJsonSerializer">The json serializer</param>
        /// <param name="cartViewModelFactory"></param>
        /// <param name="lookupService"></param>
        /// <param name="addressRepository"></param>
        /// <param name="shippingMethodViewService"></param>
        /// <param name="imageService"></param>
        /// <param name="fulfillmentMethodRepository"></param>
        /// <param name="viewModelMapper"></param>
        /// <param name="lineItemViewModelFactory"></param>
        /// <param name="paymentRepository"></param>
        public CheckoutService(
            ICartRepository cartRepository,
            ICartService cartService,
            IComposerJsonSerializer composerJsonSerializer,
            ICartViewModelFactory cartViewModelFactory,
            ILookupService lookupService,
            IAddressRepository addressRepository,
            IShippingMethodViewService shippingMethodViewService,
            IImageService imageService,
            IFulfillmentMethodRepository fulfillmentMethodRepository,
            IViewModelMapper viewModelMapper,
            ILineItemViewModelFactory lineItemViewModelFactory,
            IPaymentRepository paymentRepository)
        {
            if (cartRepository == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(cartRepository)));
            }
            if (cartService == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(cartService)));
            }
            if (composerJsonSerializer == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(ComposerJsonSerializer)));
            }
            if (cartViewModelFactory == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(cartViewModelFactory)));
            }
            if (lookupService == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(LookupService)));
            }
            if (addressRepository == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(addressRepository)));
            }
            if (shippingMethodViewService == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(shippingMethodViewService)));
            }
            if (imageService == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(imageService)));
            }
            if (fulfillmentMethodRepository == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(fulfillmentMethodRepository)));
            }
            if (viewModelMapper == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(viewModelMapper)));
            }
            if (lineItemViewModelFactory == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(lineItemViewModelFactory)));
            }
            if (paymentRepository == null)
            {
                throw new ArgumentNullException(ArgumentNullMessageFormatter.FormatErrorMessage(nameof(paymentRepository)));
            }

            CartRepository              = cartRepository;
            CartService                 = cartService;
            ComposerJsonSerializer      = composerJsonSerializer;
            CartViewModelFactory        = cartViewModelFactory;
            LookupService               = lookupService;
            AddressRepository           = addressRepository;
            ShippingMethodViewService   = shippingMethodViewService;
            ImageService                = imageService;
            FulfillmentMethodRepository = fulfillmentMethodRepository;
            ViewModelMapper             = viewModelMapper;
            LineItemViewModelFactory    = lineItemViewModelFactory;
            PaymentRepository           = paymentRepository;

            _updateOperations = new Dictionary <string, UpdateOperation>();

            RegisterCartUpdateOperation <AddressViewModel>("ShippingAddress", UpdateShippingAddress, 1);
            RegisterCartUpdateOperation <RegisteredShippingAddressViewModel>("ShippingAddressRegistered", UpdateRegisteredShippingAddress, 1);
            RegisterCartUpdateOperation <CustomerSummaryViewModel>("GuestCustomerInfo", UpdateCustomer, 2);
            RegisterCartUpdateOperation <BillingAddressViewModel>("BillingAddress", UpdateBillingAddress, 3);
            RegisterCartUpdateOperation <RegisteredBillingAddressViewModel>("BillingAddressRegistered", UpdateRegisteredBillingAddress, 3);
            RegisterCartUpdateOperation <ShippingMethodViewModel>("ShippingMethod", UpdateShippingMethod, 4);
        }