forked from CGM_Public/pretix_original
API: add api_meta to order
This commit is contained in:
committed by
GitHub
parent
9e61f7f978
commit
22e2143623
@@ -85,7 +85,7 @@ from pretix.presale.forms.customer import AuthenticationForm, RegistrationForm
|
||||
from pretix.presale.signals import (
|
||||
checkout_all_optional, checkout_confirm_messages, checkout_flow_steps,
|
||||
contact_form_fields, contact_form_fields_overrides,
|
||||
order_meta_from_request, question_form_fields,
|
||||
order_api_meta_from_request, order_meta_from_request, question_form_fields,
|
||||
question_form_fields_overrides,
|
||||
)
|
||||
from pretix.presale.utils import customer_login
|
||||
@@ -1544,11 +1544,14 @@ class ConfirmStep(CartMixin, AsyncAction, TemplateFlowStep):
|
||||
str(m) for m in self.confirm_messages.values()
|
||||
]
|
||||
}
|
||||
api_meta = {}
|
||||
unlock_hashes = request.session.get('pretix_unlock_hashes', [])
|
||||
if unlock_hashes:
|
||||
meta_info['unlock_hashes'] = unlock_hashes
|
||||
for receiver, response in order_meta_from_request.send(sender=request.event, request=request):
|
||||
meta_info.update(response)
|
||||
for receiver, response in order_api_meta_from_request.send(sender=request.event, request=request):
|
||||
api_meta.update(response)
|
||||
|
||||
return self.do(
|
||||
self.request.event.id,
|
||||
@@ -1562,6 +1565,7 @@ class ConfirmStep(CartMixin, AsyncAction, TemplateFlowStep):
|
||||
shown_total=self.cart_session.get('shown_total'),
|
||||
customer=self.cart_session.get('customer'),
|
||||
override_now_dt=time_machine_now(default=None),
|
||||
api_meta=api_meta,
|
||||
)
|
||||
|
||||
def get_success_message(self, value):
|
||||
|
||||
@@ -170,6 +170,17 @@ You will receive the request triggering the order creation as the ``request`` ke
|
||||
As with all event-plugin signals, the ``sender`` keyword argument will contain the event.
|
||||
"""
|
||||
|
||||
order_api_meta_from_request = EventPluginSignal()
|
||||
"""
|
||||
Arguments: ``request``
|
||||
|
||||
This signal is sent before an order is created through the pretixpresale frontend. It allows you
|
||||
to return a dictionary that will be merged in the api_meta attribute of the order.
|
||||
You will receive the request triggering the order creation as the ``request`` keyword argument.
|
||||
|
||||
As with all event-plugin signals, the ``sender`` keyword argument will contain the event.
|
||||
"""
|
||||
|
||||
checkout_confirm_page_content = EventPluginSignal()
|
||||
"""
|
||||
Arguments: ``request``
|
||||
|
||||
Reference in New Issue
Block a user