dinoperovic / django-salesman

Headless e-commerce framework for Django and Wagtail.
https://django-salesman.rtfd.io
BSD 3-Clause "New" or "Revised" License
384 stars 46 forks source link

Modify payment_methods_pool #22

Closed madisvain closed 1 year ago

madisvain commented 1 year ago

We are implementing a multi site Wagtail based store. The store should have the payment methods limited based on the site.

For example for country Germany you should have Stripe but for US we should only allow the PayPal payment method. Currently the payment_methods_pool does not have a setting to override or modify the Pool in any way.

We'd be happy to help build such a feature if an agreement on how this should be done could be described and agreed upon.

dinoperovic commented 1 year ago

Hi @madisvain, would adding something like is_enabled(self, request) method on PaymentMethod class solve your case? That way you could disable payments for a specific request.

This requires adding an optional request param to the pool methods such as get_choices and get_payments and the drawback would be that all URL's for payments are still included (even though they are disabled).

Are there any other advantages to making PaymentMethodPool overridable instead?

madisvain commented 1 year ago

@dinoperovic I think is_enabled is actually a much better idea and would solve all our questions much easier.

dinoperovic commented 1 year ago

@madisvain I will try to implement this soon then.

dinoperovic commented 1 year ago

@madisvain added in v1.1.6