コード例 #1
0
 public CartController(
     ICartService cartService,
     ICheckoutService checkoutService,
     IComposerContext composerContext,
     ICouponViewService couponViewService,
     IShippingMethodViewService shippingMethodService,
     ICartUrlProvider cartUrlProvider,
     IRecurringOrdersSettings recurringOrdersSettings)
 {
     CartService             = cartService ?? throw new ArgumentNullException(nameof(cartService));
     ComposerContext         = composerContext ?? throw new ArgumentNullException(nameof(composerContext));
     CouponViewService       = couponViewService ?? throw new ArgumentNullException(nameof(couponViewService));
     CheckoutService         = checkoutService ?? throw new ArgumentNullException(nameof(checkoutService));
     ShippingMethodService   = shippingMethodService ?? throw new ArgumentNullException(nameof(shippingMethodService));
     CartUrlProvider         = cartUrlProvider ?? throw new ArgumentNullException(nameof(cartUrlProvider));
     RecurringOrdersSettings = recurringOrdersSettings ?? throw new ArgumentNullException(nameof(recurringOrdersSettings));
 }
コード例 #2
0
 public RecurringCartController(
     IRecurringOrderCartsViewService recurringOrderCarstService,
     IComposerContext composerContext,
     IPaymentViewService paymentViewService,
     IRecurringOrderTemplatesViewService recurringOrderTemplatesService,
     IShippingMethodViewService shippingMethodViewService,
     ICartService cartService,
     ICartUrlProvider cartUrlProvider)
 {
     RecurringOrderCartsService     = recurringOrderCarstService ?? throw new ArgumentNullException(nameof(recurringOrderCarstService));
     ComposerContext                = composerContext ?? throw new ArgumentNullException(nameof(composerContext));
     PaymentViewService             = paymentViewService ?? throw new ArgumentNullException(nameof(paymentViewService));;
     RecurringOrderTemplatesService = recurringOrderTemplatesService ?? throw new ArgumentNullException(nameof(recurringOrderTemplatesService));
     ShippingMethodViewService      = shippingMethodViewService ?? throw new ArgumentNullException(nameof(shippingMethodViewService));
     CartService     = cartService ?? throw new ArgumentNullException(nameof(cartService));
     CartUrlProvider = cartUrlProvider ?? throw new ArgumentNullException(nameof(cartUrlProvider));
 }
コード例 #3
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);
        }
コード例 #4
0
        public CartController(
            ICartService cartService,
            ICheckoutService checkoutService,
            IComposerContext composerContext,
            ICouponViewService couponViewService,
            IShippingMethodViewService shippingMethodService,
            ICartUrlProvider cartUrlProvider,
            IRecurringOrdersSettings recurringOrdersSettings)
        {
            if (cartService == null)
            {
                throw new ArgumentNullException("cartService");
            }
            if (composerContext == null)
            {
                throw new ArgumentNullException("composerContext");
            }
            if (couponViewService == null)
            {
                throw new ArgumentNullException("couponViewService");
            }
            if (checkoutService == null)
            {
                throw new ArgumentNullException("checkoutService");
            }
            if (shippingMethodService == null)
            {
                throw new ArgumentNullException("shippingMethodService");
            }
            if (cartUrlProvider == null)
            {
                throw new ArgumentNullException("cartUrlProvider");
            }

            CartService             = cartService;
            ComposerContext         = composerContext;
            CouponViewService       = couponViewService;
            CheckoutService         = checkoutService;
            ShippingMethodService   = shippingMethodService;
            CartUrlProvider         = cartUrlProvider;
            RecurringOrdersSettings = recurringOrdersSettings;
        }
コード例 #5
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)
        {
            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);
        }