mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Add flag testmode_supported to sales channels (#1455)
* Add testmode-support-flag to SalesChannels * Make saleschannels/testmode-warnings even more dangerous! * Add warning for payment-methods that do support testmode but are being used in a non-testmode order caused by a saleschannel in a testmode-shop. * Remove redundant testmode_supported-flag for WebshopSalesChannel * Raise error on API when sales_channel does not support testmode * Tests * Fix style issue after merge
This commit is contained in:
committed by
Raphael Michel
parent
e8a2f7e349
commit
2b18621c76
@@ -401,7 +401,7 @@ class CartAdd(EventViewMixin, CartActionMixin, AsyncAction, View):
|
||||
items = self._items_from_post_data()
|
||||
if items:
|
||||
return self.do(self.request.event.id, items, cart_id, translation.get_language(),
|
||||
self.invoice_address.pk, widget_data, self.request.sales_channel)
|
||||
self.invoice_address.pk, widget_data, self.request.sales_channel.identifier)
|
||||
else:
|
||||
if 'ajax' in self.request.GET or 'ajax' in self.request.POST:
|
||||
return JsonResponse({
|
||||
@@ -424,7 +424,7 @@ class RedeemView(NoSearchIndexViewMixin, EventViewMixin, TemplateView):
|
||||
|
||||
# Fetch all items
|
||||
items, display_add_to_cart = get_grouped_items(self.request.event, self.subevent,
|
||||
voucher=self.voucher, channel=self.request.sales_channel)
|
||||
voucher=self.voucher, channel=self.request.sales_channel.identifier)
|
||||
|
||||
# Calculate how many options the user still has. If there is only one option, we can
|
||||
# check the box right away ;)
|
||||
|
||||
@@ -294,7 +294,7 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
|
||||
if not self.request.event.has_subevents or self.subevent:
|
||||
# Fetch all items
|
||||
items, display_add_to_cart = get_grouped_items(self.request.event, self.subevent,
|
||||
channel=self.request.sales_channel)
|
||||
channel=self.request.sales_channel.identifier)
|
||||
context['itemnum'] = len(items)
|
||||
|
||||
# Regroup those by category
|
||||
@@ -335,7 +335,7 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
|
||||
|
||||
ebd = defaultdict(list)
|
||||
add_subevents_for_days(
|
||||
filter_qs_by_attr(self.request.event.subevents_annotated(self.request.sales_channel).using(settings.DATABASE_REPLICA), self.request),
|
||||
filter_qs_by_attr(self.request.event.subevents_annotated(self.request.sales_channel.identifier).using(settings.DATABASE_REPLICA), self.request),
|
||||
before, after, ebd, set(), self.request.event,
|
||||
kwargs.get('cart_namespace')
|
||||
)
|
||||
@@ -345,7 +345,7 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
|
||||
context['years'] = range(now().year - 2, now().year + 3)
|
||||
else:
|
||||
context['subevent_list'] = self.request.event.subevents_sorted(
|
||||
filter_qs_by_attr(self.request.event.subevents_annotated(self.request.sales_channel).using(settings.DATABASE_REPLICA), self.request)
|
||||
filter_qs_by_attr(self.request.event.subevents_annotated(self.request.sales_channel.identifier).using(settings.DATABASE_REPLICA), self.request)
|
||||
)
|
||||
|
||||
context['show_cart'] = (
|
||||
|
||||
@@ -393,7 +393,7 @@ class WidgetAPIProductList(EventListMixin, View):
|
||||
else:
|
||||
if hasattr(self.request, 'event'):
|
||||
evs = self.request.event.subevents_sorted(
|
||||
filter_qs_by_attr(self.request.event.subevents_annotated(self.request.sales_channel), self.request)
|
||||
filter_qs_by_attr(self.request.event.subevents_annotated(self.request.sales_channel.identifier), self.request)
|
||||
)
|
||||
tz = pytz.timezone(request.event.settings.timezone)
|
||||
data['events'] = [
|
||||
|
||||
Reference in New Issue
Block a user