Beispiel #1
0
 public PreCheckoutRuleContext(CheckoutConfiguration checkoutConfiguration, Customer customer, PersistedCheckoutContext persistedCheckoutContext, CartContext cartContext, PaymentMethodInfo paymentMethodInfo)
 {
     CheckoutConfiguration = checkoutConfiguration;
     Customer = customer;
     PersistedCheckoutContext = persistedCheckoutContext;
     CartContext       = cartContext;
     PaymentMethodInfo = paymentMethodInfo;
 }
Beispiel #2
0
        public CartContext LoadCartContext(CheckoutConfiguration configuration, Customer customer, PersistedCheckoutContext persistedCheckoutContext, PaymentMethodInfo selectedPaymentMethod)
        {
            var cartContext = new CartContext(
                cart: CachedShoppingCartProvider.Get(customer, CartTypeEnum.ShoppingCart, AppLogic.StoreID()));

            var preRuleCheckoutContext = new PreCheckoutRuleContext(
                checkoutConfiguration: configuration,
                customer: customer,
                persistedCheckoutContext: persistedCheckoutContext,
                cartContext: cartContext,
                paymentMethodInfo: selectedPaymentMethod);

            foreach (var rule in PreCheckoutRules)
            {
                cartContext = rule.Apply(preRuleCheckoutContext);
            }

            return(cartContext);
        }