Add total argument to fee calculation signals

This commit is contained in:
Raphael Michel
2018-02-28 21:03:38 +01:00
parent 37f0f7a138
commit d8d00a7e26
4 changed files with 11 additions and 7 deletions

View File

@@ -667,7 +667,8 @@ def get_fees(event, request, total, invoice_address, provider):
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
return fees

View File

@@ -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,
internal_type=payment_provider.identifier))
for recv, resp in order_fee_calculation.send(sender=event, invoice_address=address,
meta_info=meta_info, posiitons=positions):
for recv, resp in order_fee_calculation.send(sender=event, invoice_address=address, total=total,
meta_info=meta_info, positions=positions):
fees += resp
return fees

View File

@@ -291,7 +291,7 @@ an OrderedDict of (setting name, form field).
"""
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
@@ -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``
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(

View File

@@ -80,7 +80,7 @@ argument will contain the request object.
"""
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``
@@ -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``
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(