コード例 #1
0
 public CheckoutSelectionContext(
     PaymentMethodInfo selectedPaymentMethod,
     Address selectedBillingAddress,
     Address selectedShippingAddress,
     int?selectedShippingMethodId,
     CreditCardDetails creditCard,
     ECheckDetails eCheck,
     PayPalExpressDetails payPalExpress,
     AmazonPaymentsDetails amazonPayments,
     PurchaseOrderDetails purchaseOrder,
     AcceptJsDetailsCreditCard acceptJsDetailsCreditCard,
     BraintreeDetails braintree,
     SagePayPiDetails sagePayPi,
     bool termsAndConditionsAccepted,
     bool over13Checked,
     string email)
 {
     SelectedPaymentMethod    = selectedPaymentMethod;
     SelectedBillingAddress   = selectedBillingAddress;
     SelectedShippingAddress  = selectedShippingAddress;
     SelectedShippingMethodId = selectedShippingMethodId;
     CreditCard                 = creditCard;
     ECheck                     = eCheck;
     PayPalExpress              = payPalExpress;
     AmazonPayments             = amazonPayments;
     PurchaseOrder              = purchaseOrder;
     AcceptJsDetailsCreditCard  = acceptJsDetailsCreditCard;
     Braintree                  = braintree;
     SagePayPi                  = sagePayPi;
     TermsAndConditionsAccepted = termsAndConditionsAccepted;
     Over13Checked              = over13Checked;
     Email = email;
 }
コード例 #2
0
 public PreCheckoutRuleContext(CheckoutConfiguration checkoutConfiguration, Customer customer, PersistedCheckoutContext persistedCheckoutContext, CartContext cartContext, PaymentMethodInfo paymentMethodInfo)
 {
     CheckoutConfiguration = checkoutConfiguration;
     Customer = customer;
     PersistedCheckoutContext = persistedCheckoutContext;
     CartContext       = cartContext;
     PaymentMethodInfo = paymentMethodInfo;
 }
コード例 #3
0
 public CheckoutSelectionApplicationResult(
     Customer customer,
     PaymentMethodInfo selectedPaymentMethod,
     PersistedCheckoutContext persistedCheckoutContext)
 {
     Customer = customer;
     SelectedPaymentMethod    = selectedPaymentMethod;
     PersistedCheckoutContext = persistedCheckoutContext;
 }
コード例 #4
0
ファイル: IPaymentOptionProvider.cs プロジェクト: giagiigi/WE
 public PaymentOption(PaymentMethodInfo info, bool available, int displayOrder, string selectionImage, string editUrl, bool isOffsiteForDisplay, bool isEditable, PaymentScriptInfo paymentScriptProvider = null)
 {
     Info                  = info;
     Available             = available;
     DisplayOrder          = displayOrder;
     SelectionImage        = selectionImage;
     EditUrl               = editUrl;
     IsOffsiteForDisplay   = isOffsiteForDisplay;
     IsEditable            = isEditable;
     PaymentScriptProvider = paymentScriptProvider;
 }
コード例 #5
0
 public PaymentOption(PaymentMethodInfo info, bool available, int displayOrder, string selectionImage, string editUrl, bool isOffsiteForDisplay, bool isEditable, string scriptTarget, IEnumerable <string> paymentScripts)
 {
     Info                = info;
     Available           = available;
     DisplayOrder        = displayOrder;
     SelectionImage      = selectionImage;
     EditUrl             = editUrl;
     IsOffsiteForDisplay = isOffsiteForDisplay;
     IsEditable          = isEditable;
     ScriptTarget        = scriptTarget;
     PaymentScripts      = paymentScripts ?? Enumerable.Empty <string>();
 }
コード例 #6
0
ファイル: PaymentOptionProvider.cs プロジェクト: giagiigi/WE
 PaymentOption GetPaymentOption(PaymentOptionConfiguration configuration, PaymentMethodInfo paymentMethodInfo, Customer customer, ShoppingCart cart, int defaultOrderIndex)
 {
     return(new PaymentOption(
                info: paymentMethodInfo,
                available: IsAvailable(paymentMethodInfo, customer, cart),
                displayOrder: PaymentOptionOrdering.ContainsKey(paymentMethodInfo.Name)
                                 ? PaymentOptionOrdering[paymentMethodInfo.Name]
                                 : defaultOrderIndex,
                selectionImage: GetImage(configuration, paymentMethodInfo.Name),
                editUrl: GetEditUrl(paymentMethodInfo),
                isOffsiteForDisplay: OffsitePaymentOptionsForDisplay.Contains(paymentMethodInfo.Name, StringComparer.OrdinalIgnoreCase),
                isEditable: GetEditableState(paymentMethodInfo),
                paymentScriptProvider: GetPaymentScriptProvider(configuration, paymentMethodInfo.Name)));
 }
コード例 #7
0
        string GetEditUrl(PaymentMethodInfo paymentMethod)
        {
            if (paymentMethod == null)
            {
                return(null);
            }

            if (paymentMethod.Location == PaymentMethodLocation.Onsite &&
                paymentMethod.Name == AppLogic.ro_PMCreditCard)
            {
                return(UrlHelper.Action(ActionNames.CreditCard, ControllerNames.CheckoutCreditCard));
            }

            if (paymentMethod.Location == PaymentMethodLocation.Onsite &&
                paymentMethod.Name == AppLogic.ro_PMECheck)
            {
                return(UrlHelper.Action(ActionNames.ECheck, ControllerNames.CheckoutECheck));
            }

            if (paymentMethod.Name == AppLogic.ro_PMPurchaseOrder)
            {
                return(UrlHelper.Action(ActionNames.PurchaseOrder, ControllerNames.CheckoutPurchaseOrder));
            }

            if (paymentMethod.Name == AppLogic.ro_PMPayPalCredit)
            {
                return(UrlHelper.Action(
                           ActionNames.StartPayPalExpress,
                           ControllerNames.PayPalExpress,
                           new RouteValueDictionary
                {
                    { RouteDataKeys.IsPayPalCredit, true }
                }));
            }

            return(UrlHelper.Action(
                       ActionNames.SetPaymentMethod,
                       ControllerNames.CheckoutPaymentMethod,
                       new RouteValueDictionary
            {
                { RouteDataKeys.SelectedPaymentMethod, paymentMethod.Name }
            }));
        }
コード例 #8
0
        public CheckoutSelectionContext GetCheckoutSelection(Customer customer, PaymentMethodInfo selectedPaymentMethod, PersistedCheckoutContext persistedCheckoutContext)
        {
            var validatedBillingAddress  = LoadAddress(customer.PrimaryBillingAddressID);
            var validatedShippingAddress = LoadAddress(customer.PrimaryShippingAddressID);

            // Build up the selections context
            return(new CheckoutSelectionContext(
                       selectedPaymentMethod: selectedPaymentMethod,
                       selectedBillingAddress: validatedBillingAddress,
                       selectedShippingAddress: validatedShippingAddress,
                       selectedShippingMethodId: persistedCheckoutContext.SelectedShippingMethodId,
                       creditCard: persistedCheckoutContext.CreditCard,
                       payPalExpress: persistedCheckoutContext.PayPalExpress,
                       amazonPayments: persistedCheckoutContext.AmazonPayments,
                       purchaseOrder: persistedCheckoutContext.PurchaseOrder,
                       braintree: persistedCheckoutContext.Braintree,
                       termsAndConditionsAccepted: persistedCheckoutContext.TermsAndConditionsAccepted,
                       over13Checked: persistedCheckoutContext.Over13Checked || customer.IsOver13,
                       email: persistedCheckoutContext.Email ?? customer.EMail));
        }
コード例 #9
0
ファイル: PaymentOptionProvider.cs プロジェクト: giagiigi/WE
        bool IsAvailable(PaymentMethodInfo paymentMethod, Customer customer, ShoppingCart cart)
        {
            //Don't display micropay unless a user is logged in and has a sufficient balance.
            if (paymentMethod.Name == AppLogic.ro_PMMicropay)
            {
                if (!customer.IsRegistered)
                {
                    return(false);
                }

                if (customer.MicroPayBalance < cart.Total(true))
                {
                    return(false);
                }
            }

            if (paymentMethod.Name == AppLogic.ro_PMPurchaseOrder)
            {
                return(AppLogic.CustomerLevelAllowsPO(customer.CustomerLevelID));
            }

            return(true);
        }
コード例 #10
0
ファイル: PaymentOptionProvider.cs プロジェクト: giagiigi/WE
 bool GetEditableState(PaymentMethodInfo paymentMethod)
 {
     return(EditablePaymentOptions.Contains(paymentMethod.Name, StringComparer.OrdinalIgnoreCase) &&
            !(paymentMethod.Name == AppLogic.ro_PMCreditCard && AppLogic.ActivePaymentGatewayCleaned() == Gateway.ro_GWTWOCHECKOUT));
 }
コード例 #11
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);
        }