Deal with cancelling memberships (#2130)

This commit is contained in:
Raphael Michel
2021-06-17 18:10:45 +02:00
committed by GitHub
parent 8ad53256c2
commit 1ef076bb9b
13 changed files with 153 additions and 2 deletions

View File

@@ -599,6 +599,8 @@ class Order(LockModel, LoggedModel):
for gc in op.issued_gift_cards.all():
if gc.value != op.price:
return False
if op.granted_memberships.with_usages().filter(usages__gt=0):
return False
if self.user_cancel_deadline and now() > self.user_cancel_deadline:
return False
if self.status == Order.STATUS_PENDING: