mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
New signal order_fee_type_name
This commit is contained in:
@@ -19,7 +19,7 @@ Order events
|
|||||||
There are multiple signals that will be sent out in the ordering cycle:
|
There are multiple signals that will be sent out in the ordering cycle:
|
||||||
|
|
||||||
.. automodule:: pretix.base.signals
|
.. automodule:: pretix.base.signals
|
||||||
:members: validate_cart, fee_calculation_for_cart, order_fee_calculation, order_paid, order_placed
|
:members: validate_cart, fee_calculation_for_cart, order_fee_calculation, order_paid, order_placed, order_fee_type_name
|
||||||
|
|
||||||
Frontend
|
Frontend
|
||||||
--------
|
--------
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from pretix.base.models import Event, Item, ItemCategory, Order, OrderPosition
|
from pretix.base.models import Event, Item, ItemCategory, Order, OrderPosition
|
||||||
from pretix.base.models.event import SubEvent
|
from pretix.base.models.event import SubEvent
|
||||||
from pretix.base.models.orders import OrderFee
|
from pretix.base.models.orders import OrderFee
|
||||||
|
from pretix.base.signals import order_fee_type_name
|
||||||
|
|
||||||
|
|
||||||
class DummyObject:
|
class DummyObject:
|
||||||
@@ -199,9 +200,15 @@ def order_overview(event: Event, subevent: SubEvent=None) -> Tuple[List[Tuple[It
|
|||||||
for pprov, total in sorted(num_total.items(), key=lambda i: i[0]):
|
for pprov, total in sorted(num_total.items(), key=lambda i: i[0]):
|
||||||
ppobj = DummyObject()
|
ppobj = DummyObject()
|
||||||
if pprov[0] == OrderFee.FEE_TYPE_PAYMENT:
|
if pprov[0] == OrderFee.FEE_TYPE_PAYMENT:
|
||||||
ppobj.name = '{} - {}'.format(names[OrderFee.FEE_TYPE_PAYMENT], provider_names.get(pprov[1], pprov[1]))
|
ppobj.name = '{} - {}'.format(names[pprov[0]], provider_names.get(pprov[1], pprov[1]))
|
||||||
else:
|
else:
|
||||||
ppobj.name = '{} - {}'.format(names[OrderFee.FEE_TYPE_PAYMENT], pprov[1])
|
name = pprov[1]
|
||||||
|
for r, resp in order_fee_type_name.send(sender=event, fee_type=pprov[0], internal_type=pprov[1]):
|
||||||
|
if resp:
|
||||||
|
name = resp
|
||||||
|
break
|
||||||
|
|
||||||
|
ppobj.name = '{} - {}'.format(names[pprov[0]], name)
|
||||||
ppobj.provider = pprov[1]
|
ppobj.provider = pprov[1]
|
||||||
ppobj.has_variations = False
|
ppobj.has_variations = False
|
||||||
ppobj.num_total = total
|
ppobj.num_total = total
|
||||||
|
|||||||
@@ -250,3 +250,14 @@ As with all plugin signals, the ``sender`` keyword argument will contain the eve
|
|||||||
argument will contain the cart positions and ``invoice_address`` the invoice address (useful for
|
argument will contain the cart positions and ``invoice_address`` the invoice address (useful for
|
||||||
tax calculation). The argument ``meta_info`` contains the order's meta dictionary.
|
tax calculation). The argument ``meta_info`` contains the order's meta dictionary.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
order_fee_type_name = EventPluginSignal(
|
||||||
|
providing_args=['request', 'fee']
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
This signals allows you to return a human-readable description for a fee type based on the ``fee_type``
|
||||||
|
and ``internal_type`` attributes of the ``OrderFee`` model that you get as keyword arguments. You are
|
||||||
|
expected to return a string or None, if you don't know about this fee.
|
||||||
|
|
||||||
|
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
||||||
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user