Limiting payment methods to specific user roles.

Posted by Community Admin on 05-Aug-2018 21:03

Limiting payment methods to specific user roles.

All Replies

Posted by Community Admin on 27-Jun-2014 00:00

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

Posted by Community Admin on 01-Jul-2014 00:00

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
 

Posted by Community Admin on 05-Jul-2014 00:00

That worked quite well thank you.

This thread is closed