Fixed a bug concerning the FreeOrderProvider

This commit is contained in:
Raphael Michel
2016-03-10 00:42:58 +01:00
parent 2f72fddd3d
commit 10233071c4
2 changed files with 5 additions and 8 deletions

View File

@@ -162,7 +162,8 @@ class BasePaymentProvider:
"""
You can use this method to disable this payment provider for certain groups
of users, products or other criteria. If this method returns ``False``, the
user will not be able to select this payment method.
user will not be able to select this payment method. This will only be called
during checkout, not on retrying.
The default implementation always returns ``True``.
"""
@@ -405,9 +406,7 @@ class FreeOrderProvider(BasePaymentProvider):
pass
def payment_is_valid_session(self, request: HttpRequest) -> bool:
return CartPosition.objects.filter(
Q(cart_id=request.session.session_key) & Q(event=request.event)
).aggregate(sum=Sum('price'))['sum'] == 0
return True
@property
def verbose_name(self) -> str: