New signals: fee_calculation_for_cart, order_fee_calculation

This commit is contained in:
Raphael Michel
2017-09-07 18:59:21 +02:00
parent de992cecf3
commit 7c4fc7bd0d
7 changed files with 46 additions and 12 deletions

View File

@@ -68,7 +68,6 @@ You will recieve the request triggering the order creation as the ``request`` ke
As with all event-plugin signals, the ``sender`` keyword argument will contain the event.
"""
checkout_confirm_page_content = EventPluginSignal(
providing_args=['request']
)
@@ -80,6 +79,18 @@ As with all plugin signals, the ``sender`` keyword argument will contain the eve
argument will contain the request object.
"""
fee_calculation_for_cart = EventPluginSignal(
providing_args=['request']
)
"""
This signals allows you to add fees to a cart. You are expected to return a list of ``OrderFee``
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).
"""
contact_form_fields = EventPluginSignal(
providing_args=[]
)

View File

@@ -159,7 +159,7 @@
{% for fee in cart.fees %}
<div class="row cart-row">
<div class="col-md-4 col-xs-6">
<strong>{% trans "Payment method fee" %}</strong>
<strong>{{ fee.get_fee_type_display }}</strong>
</div>
<div class="col-md-3 col-xs-6 col-md-offset-5 price">
{% if event.settings.display_net_prices %}

View File

@@ -110,7 +110,7 @@ class CartMixin:
except InvoiceAddress.DoesNotExist:
pass
fees = get_fees(self.request.event, total, ia, self.request.session.get('payment'))
fees = get_fees(self.request.event, self.request, total, ia, self.request.session.get('payment'))
total += sum([f.value for f in fees])
net_total += sum([f.net_value for f in fees])