forked from CGM_Public/pretix_original
Add total argument to fee calculation signals
This commit is contained in:
@@ -667,7 +667,8 @@ def get_fees(event, request, total, invoice_address, provider):
|
|||||||
tax_rule=payment_fee_tax_rule
|
tax_rule=payment_fee_tax_rule
|
||||||
))
|
))
|
||||||
|
|
||||||
for recv, resp in fee_calculation_for_cart.send(sender=event, request=request, invoice_address=invoice_address):
|
for recv, resp in fee_calculation_for_cart.send(sender=event, request=request, invoice_address=invoice_address,
|
||||||
|
total=total):
|
||||||
fees += resp
|
fees += resp
|
||||||
|
|
||||||
return fees
|
return fees
|
||||||
|
|||||||
@@ -439,8 +439,8 @@ def _get_fees(positions: List[CartPosition], payment_provider: BasePaymentProvid
|
|||||||
fees.append(OrderFee(fee_type=OrderFee.FEE_TYPE_PAYMENT, value=payment_fee,
|
fees.append(OrderFee(fee_type=OrderFee.FEE_TYPE_PAYMENT, value=payment_fee,
|
||||||
internal_type=payment_provider.identifier))
|
internal_type=payment_provider.identifier))
|
||||||
|
|
||||||
for recv, resp in order_fee_calculation.send(sender=event, invoice_address=address,
|
for recv, resp in order_fee_calculation.send(sender=event, invoice_address=address, total=total,
|
||||||
meta_info=meta_info, posiitons=positions):
|
meta_info=meta_info, positions=positions):
|
||||||
fees += resp
|
fees += resp
|
||||||
return fees
|
return fees
|
||||||
|
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ an OrderedDict of (setting name, form field).
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
order_fee_calculation = EventPluginSignal(
|
order_fee_calculation = EventPluginSignal(
|
||||||
providing_args=['request']
|
providing_args=['positions', 'invoice_address', 'meta_info', 'total']
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
This signals allows you to add fees to an order while it is being created. You are expected to
|
This signals allows you to add fees to an order while it is being created. You are expected to
|
||||||
@@ -300,7 +300,9 @@ return a list of ``OrderFee`` objects that are not yet saved to the database
|
|||||||
|
|
||||||
As with all plugin signals, the ``sender`` keyword argument will contain the event. A ``positions``
|
As with all plugin signals, the ``sender`` keyword argument will contain the event. A ``positions``
|
||||||
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. The ``total``
|
||||||
|
keyword argument will contain the total cart sum without any fees. You should not rely on this
|
||||||
|
``total`` value for fee calculations as other fees might interfere.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
order_fee_type_name = EventPluginSignal(
|
order_fee_type_name = EventPluginSignal(
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ argument will contain the request object.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
fee_calculation_for_cart = EventPluginSignal(
|
fee_calculation_for_cart = EventPluginSignal(
|
||||||
providing_args=['request']
|
providing_args=['request', 'invoice_address', 'total']
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
This signals allows you to add fees to a cart. You are expected to return a list of ``OrderFee``
|
This signals allows you to add fees to a cart. You are expected to return a list of ``OrderFee``
|
||||||
@@ -88,7 +88,8 @@ objects that are not yet saved to the database (because there is no order yet).
|
|||||||
|
|
||||||
As with all plugin signals, the ``sender`` keyword argument will contain the event. A ``request``
|
As with all plugin signals, the ``sender`` keyword argument will contain the event. A ``request``
|
||||||
argument will contain the request object and ``invoice_address`` the invoice address (useful for
|
argument will contain the request object and ``invoice_address`` the invoice address (useful for
|
||||||
tax calculation).
|
tax calculation). The ``total`` keyword argument will contain the total cart sum without any fees.
|
||||||
|
You should not rely on this ``total`` value for fee calculations as other fees might interfere.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
contact_form_fields = EventPluginSignal(
|
contact_form_fields = EventPluginSignal(
|
||||||
|
|||||||
Reference in New Issue
Block a user