forked from CGM_Public/pretix_original
Helpful error messages
This commit is contained in:
@@ -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."))
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ error_messages = {
|
||||
'seat_forbidden': _('You can not select a seat for this position.'),
|
||||
'seat_unavailable': _('The seat you selected has already been taken. Please select a different seat.'),
|
||||
'seat_multiple': _('You can not select the same seat multiple times.'),
|
||||
'gift_card': _("You entered a gift card instead of a voucher. Gift cards can be entered later on when you're asked for your payment details."),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -478,7 +478,10 @@ class RedeemView(NoSearchIndexViewMixin, EventViewMixin, TemplateView):
|
||||
if v_avail < 1 and not err:
|
||||
err = error_messages['voucher_redeemed_cart'] % self.request.event.settings.reservation_time
|
||||
except Voucher.DoesNotExist:
|
||||
err = error_messages['voucher_invalid']
|
||||
if self.request.event.organizer.accepted_gift_cards.filter(secret__iexact=request.GET.get("voucher")).exists():
|
||||
err = error_messages['gift_card']
|
||||
else:
|
||||
err = error_messages['voucher_invalid']
|
||||
else:
|
||||
return redirect(self.get_index_url())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user