+1-888-365-2779
Try Now
More in this section

Forums / Ecommerce / Limiting payment methods to specific user roles.

Limiting payment methods to specific user roles.

3 posts, 0 answered
  1. Chris Ray
    Chris Ray avatar
    4 posts
    Registered:
    20 Apr 2012
    27 Jun 2014
    Link to this post

    Hi, is there a way to limit a user's choice of payment methods in checkout based on their user role?

  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    06 Dec 2016
    01 Jul 2014
    Link to this post
    Hi,

    You could achieve the desired functionality by replacing the EcommercePaymentMethodService. This service implements an interface IEcommercePaymentMethodService and it has one very important method GetApplicablePaymentMethods(CheckoutState checkoutState, CartOrder cartOrder). This method returns which are the payment methods for a particular client. In this method you could add a filter by role. After you extend it you need to override our default implementation by adding the following code in Global.asax file in your project:

    private void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
    {
                if (e.CommandName == "Bootstrapped")
                {
                    // Register the new Type of the IEcommercePaymentMethodService
      
                   ObjectFactory.Container.RegisterType
                    <IEcommercePaymentMethodService, CustomBensEcommercePaymentMethodService>(new ContainerControlledLifetimeManager(), new InjectionConstructor());
                }
    }

    To summarize you need to do is create a new class extending our and override GetApplicablePaymentMethods method and add replace the default IEcommercePaymentMethodService using the information above so the system could use the extended method.

    Regards,
    Stefani Tacheva
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Chris Ray
    Chris Ray avatar
    4 posts
    Registered:
    20 Apr 2012
    05 Jul 2014 in reply to Stefani Tacheva
    Link to this post

    That worked quite well thank you.

3 posts, 0 answered