Pass cart positions to fee_calculation_for_cart

This commit is contained in:
Raphael Michel
2019-11-04 11:00:48 +01:00
parent d15e37d93e
commit 8f112f8d9a
5 changed files with 15 additions and 7 deletions

View File

@@ -702,8 +702,9 @@ class FreeOrderProvider(BasePaymentProvider):
def is_allowed(self, request: HttpRequest, total: Decimal=None) -> bool:
from .services.cart import get_fees
cart = get_cart(request)
total = get_cart_total(request)
total += sum([f.value for f in get_fees(self.event, request, total, None, None)])
total += sum([f.value for f in get_fees(self.event, request, total, None, None, cart)])
return total == 0
def order_change_allowed(self, order: Order) -> bool:

View File

@@ -958,12 +958,12 @@ def update_tax_rates(event: Event, cart_id: str, invoice_address: InvoiceAddress
return totaldiff
def get_fees(event, request, total, invoice_address, provider):
def get_fees(event, request, total, invoice_address, provider, positions):
from pretix.presale.views.cart import cart_session
fees = []
for recv, resp in fee_calculation_for_cart.send(sender=event, request=request, invoice_address=invoice_address,
total=total):
total=total, positions=positions):
if resp:
fees += resp