Helpful error messages

This commit is contained in:
Raphael Michel
2019-10-17 16:04:22 +02:00
parent 346f215c50
commit e97ae04581
3 changed files with 10 additions and 2 deletions
+5 -1
View File
@@ -969,7 +969,11 @@ class GiftCardPayment(BasePaymentProvider):
kwargs['cart_namespace'] = request.resolver_match.kwargs['cart_namespace']
return eventreverse(self.event, 'presale:event.checkout', kwargs=kwargs)
except GiftCard.DoesNotExist:
messages.error(request, _("This gift card is not known."))
if self.event.vouchers.filter(code__iexact=request.POST.get("giftcard")).exists():
messages.warning(request, _("You entered a voucher instead of a gift card. Vouchers can only be entered on the first page of the shop below "
"the product selection."))
else:
messages.error(request, _("This gift card is not known."))
except GiftCard.MultipleObjectsReturned:
messages.error(request, _("This gift card can not be redeemed since its code is not unique. Please contact the organizer of this event."))