mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Restrict Payment Providers to Sales Channels (#1481)
* Allow to restrict payment providers to specific sales channels * Fix test * Add `payment_restrictions_supported`-property to SalesChannels
This commit is contained in:
committed by
Raphael Michel
parent
384e7f8fc1
commit
6896682dd1
@@ -392,11 +392,15 @@ class PaymentSettings(EventSettingsViewMixin, EventSettingsFormView):
|
||||
context = super().get_context_data(*args, **kwargs)
|
||||
context['providers'] = sorted(
|
||||
[p for p in self.request.event.get_payment_providers().values()
|
||||
if not p.is_implicit and (p.settings_form_fields or p.settings_content_render(self.request))],
|
||||
if not (p.is_implicit(self.request) if callable(p.is_implicit) else p.is_implicit) and
|
||||
(p.settings_form_fields or p.settings_content_render(self.request))],
|
||||
key=lambda s: s.verbose_name
|
||||
)
|
||||
|
||||
sales_channels = get_all_sales_channels()
|
||||
for p in context['providers']:
|
||||
p.show_enabled = p.is_enabled
|
||||
p.sales_channels = [sales_channels[channel] for channel in p.settings.get('_restrict_to_sales_channels', as_type=list, default=['web'])]
|
||||
if p.is_meta:
|
||||
p.show_enabled = p.settings._enabled in (True, 'True')
|
||||
return context
|
||||
|
||||
Reference in New Issue
Block a user