Fix #74 -- Warn if quota exceeds after payment

This commit is contained in:
Raphael Michel
2017-01-04 19:19:58 +01:00
parent 847997ea9b
commit b23d95b6c3
8 changed files with 74 additions and 12 deletions

View File

@@ -8,7 +8,7 @@ from django.contrib import messages
from django.template.loader import get_template
from django.utils.translation import ugettext as __, ugettext_lazy as _
from pretix.base.models import Quota
from pretix.base.models import Quota, RequiredAction
from pretix.base.payment import BasePaymentProvider
from pretix.base.services.mail import SendMailException
from pretix.base.services.orders import mark_order_paid, mark_order_refunded
@@ -203,6 +203,12 @@ class Paypal(BasePaymentProvider):
mark_order_paid(order, 'paypal', json.dumps(payment.to_dict()))
except Quota.QuotaExceededException as e:
messages.error(request, str(e))
RequiredAction.objects.create(
event=request.event, action_type='pretix.plugins.paypal.overpaid', data=json.dumps({
'order': order.code,
'payment': payment.id
})
)
except SendMailException:
messages.warning(request, _('There was an error sending the confirmation mail.'))
return None