mirror of
https://github.com/pretix/pretix.git
synced 2026-11-20 02:56:03 +00:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2271d719a4 | ||
|
|
3004c216f6 | ||
|
|
ad5b404b32 | ||
|
|
a9c493f74e | ||
|
|
16c92ac0ac | ||
|
|
cb71c31668 | ||
|
|
16812e1907 | ||
|
|
d3e3cd0fb1 | ||
|
|
60b79caa3d | ||
|
|
0e51859bc8 | ||
|
|
d78fb1a6bb | ||
|
|
ce850787f6 | ||
|
|
dd941ec9f8 | ||
|
|
0a19009743 | ||
|
|
7f046e16a2 |
No files matched your search
@@ -123,7 +123,7 @@ jobs:
|
||||
working-directory: ./src
|
||||
run: make all compress
|
||||
- name: Install Playwright browsers
|
||||
run: playwright install --with-deps
|
||||
run: playwright install chromium --with-deps
|
||||
- name: Run E2E tests
|
||||
working-directory: ./src
|
||||
run: PRETIX_CONFIG_FILE=tests/ci_postgres.cfg py.test tests/e2e/ -v --maxfail=10 --tracing=retain-on-failure
|
||||
|
||||
@@ -57,6 +57,7 @@ seating_plan integer If reserved sea
|
||||
seat_category_mapping object An object mapping categories of the seating plan
|
||||
(strings) to items in the event (integers or ``null``).
|
||||
last_modified datetime Last modification of this object
|
||||
comment string Internal comment for this subevent (or ``null``)
|
||||
===================================== ========================== =======================================================
|
||||
|
||||
.. versionchanged:: 2023.8.0
|
||||
@@ -117,7 +118,10 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {}
|
||||
"meta_data": {},
|
||||
"frontpage_text": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": "internal comment"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -187,7 +191,9 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {}
|
||||
"meta_data": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": ""
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +230,9 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {}
|
||||
"meta_data": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": ""
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +290,9 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {}
|
||||
"meta_data": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": ""
|
||||
}
|
||||
|
||||
:param organizer: The ``slug`` field of a valid organizer
|
||||
@@ -443,7 +453,9 @@ Endpoints
|
||||
}
|
||||
],
|
||||
"variation_price_overrides": [],
|
||||
"meta_data": {}
|
||||
"meta_data": {},
|
||||
"last_modified": "2017-12-01T10:00:30Z",
|
||||
"comment": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+5
-4
@@ -34,7 +34,7 @@ dependencies = [
|
||||
"celery==5.6.*",
|
||||
"chardet==5.2.*",
|
||||
"cryptography>=50.0.2",
|
||||
"css-inline==0.23.*",
|
||||
"css-inline==0.24.*",
|
||||
"defusedcsv>=3.0.0",
|
||||
"dnspython==2.9.*",
|
||||
"Django[argon2]==5.2.*,>=5.2.17",
|
||||
@@ -62,7 +62,7 @@ dependencies = [
|
||||
"geoip2==5.*",
|
||||
"isoweek",
|
||||
"jsonschema",
|
||||
"kombu==5.6.*",
|
||||
"kombu==5.7.*",
|
||||
"libsass==0.23.*",
|
||||
"lxml",
|
||||
"markdown==3.11.2",
|
||||
@@ -91,7 +91,7 @@ dependencies = [
|
||||
"redis==7.4.*",
|
||||
"reportlab==5.1.*",
|
||||
"requests==2.34.*",
|
||||
"sentry-sdk==2.71.*",
|
||||
"sentry-sdk==2.75.*",
|
||||
"sepaxml==2.7.*",
|
||||
"stripe==7.9.*",
|
||||
"text-unidecode==1.*",
|
||||
@@ -123,7 +123,8 @@ dev = [
|
||||
"pytest-sugar",
|
||||
"pytest-xdist==3.8.*",
|
||||
"pytest-playwright",
|
||||
"pytest==9.1.*",
|
||||
"pytest-base-url",
|
||||
"pytest==9.2.*",
|
||||
"playwright",
|
||||
"responses",
|
||||
"pypdfium2"
|
||||
|
||||
@@ -378,6 +378,7 @@ class ItemSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
|
||||
def validate_bundles(self, value):
|
||||
if not self.instance:
|
||||
for b_data in value:
|
||||
ItemBundle.clean_count(b_data.get('count', 1))
|
||||
ItemBundle.clean_itemvar(self.context['event'], b_data.get('bundled_item'), b_data.get('bundled_variation'))
|
||||
return value
|
||||
|
||||
@@ -386,8 +387,8 @@ class ItemSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
|
||||
for addon_data in value:
|
||||
ItemAddOn.clean_categories(self.context['event'], None, self.instance, addon_data['addon_category'])
|
||||
ItemAddOn.clean_min_count(addon_data.get('min_count', 0))
|
||||
ItemAddOn.clean_max_count(addon_data.get('max_count', 0))
|
||||
ItemAddOn.clean_max_min_count(addon_data.get('max_count', 0), addon_data.get('min_count', 0))
|
||||
ItemAddOn.clean_max_count(addon_data.get('max_count', 1))
|
||||
ItemAddOn.clean_max_min_count(addon_data.get('max_count', 1), addon_data.get('min_count', 0))
|
||||
return value
|
||||
|
||||
def validate_program_times(self, value):
|
||||
|
||||
@@ -93,7 +93,7 @@ class Gate(LoggedModel):
|
||||
if instance:
|
||||
qs = qs.exclude(pk=instance.pk)
|
||||
if qs.exists():
|
||||
raise ValidationError(_('This identifier is already used for a different question.'))
|
||||
raise ValidationError(_('This identifier is already used for a different gate.'))
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.identifier:
|
||||
|
||||
@@ -1343,6 +1343,8 @@ class ItemVariation(models.Model):
|
||||
quotacounter[q] += b.count
|
||||
|
||||
for q, n in quotacounter.items():
|
||||
if n == 0:
|
||||
continue
|
||||
a = q.availability(count_waitinglist=count_waitinglist, _cache=_cache)
|
||||
if a[1] is None:
|
||||
continue
|
||||
@@ -1486,8 +1488,8 @@ class ItemAddOn(models.Model):
|
||||
|
||||
@staticmethod
|
||||
def clean_max_count(max_count):
|
||||
if max_count < 0:
|
||||
raise ValidationError(_('The maximum count needs to be equal to or greater than zero.'))
|
||||
if max_count < 1:
|
||||
raise ValidationError(_('The maximum count needs to be greater than zero.'))
|
||||
|
||||
@staticmethod
|
||||
def clean_max_min_count(max_count, min_count):
|
||||
@@ -1568,8 +1570,8 @@ class ItemBundle(models.Model):
|
||||
|
||||
@staticmethod
|
||||
def clean_count(count):
|
||||
if count < 0:
|
||||
raise ValidationError(_('The count needs to be equal to or greater than zero.'))
|
||||
if count < 1:
|
||||
raise ValidationError(_('The count needs to be greater than zero.'))
|
||||
|
||||
|
||||
class Question(LoggedModel):
|
||||
|
||||
@@ -340,7 +340,14 @@ class LinkifyAndCleanExtension(Extension):
|
||||
)
|
||||
|
||||
|
||||
def markdown_compile_email(source, allowed_tags=None, allowed_attributes=ALLOWED_ATTRIBUTES, snippet=False, context=None):
|
||||
class SnippetExtension(markdown.extensions.Extension):
|
||||
def extendMarkdown(self, md, *args, **kwargs):
|
||||
md.parser.blockprocessors.deregister('olist')
|
||||
md.parser.blockprocessors.deregister('ulist')
|
||||
md.parser.blockprocessors.deregister('quote')
|
||||
|
||||
|
||||
def _get_email_markdown(allowed_tags=None, allowed_attributes=ALLOWED_ATTRIBUTES, snippet=False, context=None):
|
||||
if allowed_tags is None:
|
||||
allowed_tags = ALLOWED_TAGS_SNIPPET if snippet else ALLOWED_TAGS
|
||||
|
||||
@@ -381,20 +388,16 @@ def markdown_compile_email(source, allowed_tags=None, allowed_attributes=ALLOWED
|
||||
]
|
||||
if snippet:
|
||||
exts.append(SnippetExtension())
|
||||
return markdown.markdown(
|
||||
source,
|
||||
extensions=exts
|
||||
)
|
||||
|
||||
return markdown.Markdown(extensions=exts)
|
||||
|
||||
|
||||
class SnippetExtension(markdown.extensions.Extension):
|
||||
def extendMarkdown(self, md, *args, **kwargs):
|
||||
md.parser.blockprocessors.deregister('olist')
|
||||
md.parser.blockprocessors.deregister('ulist')
|
||||
md.parser.blockprocessors.deregister('quote')
|
||||
def markdown_compile_email(source, allowed_tags=None, allowed_attributes=ALLOWED_ATTRIBUTES, snippet=False, context=None):
|
||||
md = _get_email_markdown(allowed_tags, allowed_attributes, snippet, context)
|
||||
return md.convert(source)
|
||||
|
||||
|
||||
def markdown_compile(source, linker, snippet=False):
|
||||
def _get_markdown(linker, snippet=False):
|
||||
tags = ALLOWED_TAGS_SNIPPET if snippet else ALLOWED_TAGS
|
||||
exts = [
|
||||
'markdown.extensions.sane_lists',
|
||||
@@ -409,10 +412,13 @@ def markdown_compile(source, linker, snippet=False):
|
||||
]
|
||||
if snippet:
|
||||
exts.append(SnippetExtension())
|
||||
return markdown.markdown(
|
||||
source,
|
||||
extensions=exts
|
||||
)
|
||||
|
||||
return markdown.Markdown(extensions=exts)
|
||||
|
||||
|
||||
def markdown_compile(source, linker, snippet=False):
|
||||
md = _get_markdown(linker, snippet)
|
||||
return md.convert(source)
|
||||
|
||||
|
||||
@register.filter
|
||||
@@ -445,3 +451,25 @@ def rich_text_snippet(text: str, **kwargs):
|
||||
)
|
||||
body_md = markdown_compile(text, linker, snippet=True)
|
||||
return mark_safe(body_md)
|
||||
|
||||
|
||||
def _md_escape(md: markdown.Markdown, plain: str):
|
||||
escaped_chars = md.ESCAPED_CHARS
|
||||
translation_map = {ord(x): f"\\{x}" for x in escaped_chars}
|
||||
return plain.translate(translation_map)
|
||||
|
||||
|
||||
def markdown_escape(plain: str) -> str:
|
||||
"""
|
||||
Escape formatting characters in markdown with backslash using the default markdown renderer config.
|
||||
"""
|
||||
md = _get_markdown(bleach.Linker())
|
||||
return _md_escape(md, plain)
|
||||
|
||||
|
||||
def markdown_email_escape(plain: str) -> str:
|
||||
"""
|
||||
Escape formatting characters in markdown with backslash using the default email markdown renderer config.
|
||||
"""
|
||||
md = _get_email_markdown(None, False)
|
||||
return _md_escape(md, plain)
|
||||
@@ -1207,6 +1207,11 @@ class ItemAddOnForm(I18nModelForm):
|
||||
}
|
||||
)
|
||||
self.fields['addon_category'].widget.choices = self.fields['addon_category'].choices
|
||||
self.fields['max_count'] = forms.IntegerField(
|
||||
min_value=1,
|
||||
label=self.fields['max_count'].label,
|
||||
widget=forms.NumberInput(attrs={'placeholder': '1'}),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = ItemAddOn
|
||||
@@ -1319,6 +1324,12 @@ class ItemBundleForm(I18nModelForm):
|
||||
self.fields['itemvar'].choices = choices
|
||||
change_decimal_field(self.fields['designated_price'], self.event.currency)
|
||||
|
||||
self.fields['count'] = forms.IntegerField(
|
||||
min_value=1,
|
||||
label=self.fields['count'].label,
|
||||
widget=forms.NumberInput(attrs={'placeholder': '1'}),
|
||||
)
|
||||
|
||||
def clean(self):
|
||||
d = super().clean()
|
||||
if not self.cleaned_data.get('designated_price'):
|
||||
|
||||
@@ -79,8 +79,8 @@ class WaitingListEntryEditForm(I18nModelForm):
|
||||
self.fields['name_parts'] = NamePartsFormField(
|
||||
max_length=255,
|
||||
required=self.event.settings.waiting_list_names_required,
|
||||
scheme=self.event.organizer.settings.name_scheme,
|
||||
titles=self.event.organizer.settings.name_scheme_titles,
|
||||
scheme=self.event.settings.name_scheme,
|
||||
titles=self.event.settings.name_scheme_titles,
|
||||
label=_('Name'),
|
||||
)
|
||||
else:
|
||||
|
||||
@@ -8,8 +8,8 @@ msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-10-28 10:48+0000\n"
|
||||
"PO-Revision-Date: 2026-10-29 17:00+0000\n"
|
||||
"Last-Translator: CVZ-es <damien.bremont@casadevelazquez.org>\n"
|
||||
"PO-Revision-Date: 2026-11-19 18:00+0000\n"
|
||||
"Last-Translator: Tim <plicnetwork@gmail.com>\n"
|
||||
"Language-Team: Spanish <https://translate.pretix.eu/projects/pretix/pretix/"
|
||||
"es/>\n"
|
||||
"Language: es\n"
|
||||
@@ -17,7 +17,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 2026.10.1\n"
|
||||
"X-Generator: Weblate 2026.11.2\n"
|
||||
|
||||
#: pretix/_base_settings.py
|
||||
msgid "English"
|
||||
@@ -29522,7 +29522,7 @@ msgstr ""
|
||||
"Le hemos reembolsado {amount} por su pedido.\n"
|
||||
"\n"
|
||||
"Puede utilizar el código de la tarjeta regalo {giftcard} para pagar futuras "
|
||||
"compras en nuestra tienda.\n"
|
||||
"reservas.\n"
|
||||
"\n"
|
||||
"El equipo de {event}"
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ from pretix.base.forms import I18nMarkdownTextarea
|
||||
from pretix.base.models import InvoiceAddress, Order, OrderPayment, OrderRefund
|
||||
from pretix.base.payment import BasePaymentProvider
|
||||
from pretix.base.templatetags.money import money_filter
|
||||
from pretix.base.templatetags.rich_text import markdown_email_escape
|
||||
from pretix.helpers.payment import generate_payment_qr_codes
|
||||
from pretix.plugins.banktransfer.templatetags.ibanformat import ibanformat
|
||||
from pretix.presale.views.cart import cart_session
|
||||
@@ -308,7 +309,7 @@ class BankTransfer(BasePaymentProvider):
|
||||
(_("Reference"), self._code(order, force=True)),
|
||||
(_("Amount"), money_filter(payment.amount, self.event.currency)),
|
||||
)
|
||||
t += md_nl2br.join([f"**{k}:** {v}" for k, v in bankdetails])
|
||||
t += md_nl2br.join([f"**{markdown_email_escape(k)}:** {markdown_email_escape(v)}" for k, v in bankdetails])
|
||||
if self.settings.get('bank_details', as_type=LazyI18nString):
|
||||
t += md_nl2br
|
||||
t += str(self.settings.get('bank_details', as_type=LazyI18nString))
|
||||
|
||||
@@ -24,14 +24,13 @@ from django.urls import include, re_path
|
||||
from pretix.multidomain import event_url
|
||||
|
||||
from .views import (
|
||||
OrganizerSettingsFormView, ReturnView, ScaReturnView, ScaView,
|
||||
oauth_disconnect, oauth_return, webhook,
|
||||
OrganizerSettingsFormView, ScaReturnView, ScaView, oauth_disconnect,
|
||||
oauth_return, webhook,
|
||||
)
|
||||
|
||||
event_patterns = [
|
||||
re_path(r'^stripe/', include([
|
||||
event_url(r'^webhook/$', webhook, name='webhook', require_live=False),
|
||||
re_path(r'^return/(?P<order>[^/]+)/(?P<hash>[^/]+)/(?P<payment>[0-9]+)/$', ReturnView.as_view(), name='return'),
|
||||
re_path(r'^sca/(?P<order>[^/]+)/(?P<hash>[^/]+)/(?P<payment>[0-9]+)/$', ScaView.as_view(), name='sca'),
|
||||
re_path(r'^sca/(?P<order>[^/]+)/(?P<hash>[^/]+)/(?P<payment>[0-9]+)/return/$',
|
||||
ScaReturnView.as_view(), name='sca.return'),
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#
|
||||
# This file is part of pretix (Community Edition).
|
||||
#
|
||||
# Copyright (C) 2014-2020 Raphael Michel and contributors
|
||||
# Copyright (C) 2020-today pretix GmbH and contributors
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
|
||||
# Public License as published by the Free Software Foundation in version 3 of the License.
|
||||
#
|
||||
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
|
||||
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
|
||||
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
|
||||
# this file, see <https://pretix.eu/about/en/license>.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
@@ -193,10 +193,6 @@ def webhook(request, *args, **kwargs):
|
||||
func = charge_webhook
|
||||
objid = event_json['data']['object']['charge']
|
||||
lookup_ids = [objid]
|
||||
elif event_json['data']['object']['object'] == "source":
|
||||
func = source_webhook
|
||||
objid = event_json['data']['object']['id']
|
||||
lookup_ids = [objid]
|
||||
elif event_json['data']['object']['object'] == "payment_intent":
|
||||
func = paymentintent_webhook
|
||||
objid = event_json['data']['object']['id']
|
||||
@@ -350,79 +346,6 @@ def charge_webhook(event, event_json, charge_id, rso):
|
||||
return HttpResponse(status=200)
|
||||
|
||||
|
||||
def source_webhook(event, event_json, source_id, rso):
|
||||
import stripe
|
||||
|
||||
from pretix.plugins.stripe.payment import StripeCC
|
||||
|
||||
prov = StripeCC(event)
|
||||
prov._init_api()
|
||||
try:
|
||||
src = stripe.Source.retrieve(source_id, **prov.api_kwargs)
|
||||
except stripe.error.StripeError:
|
||||
logger.exception('Stripe error on webhook. Event data: %s' % str(event_json))
|
||||
return HttpResponse('Charge not found', status=500)
|
||||
|
||||
metadata = src['metadata']
|
||||
if 'event' not in metadata:
|
||||
return HttpResponse('Event not given in charge metadata', status=200)
|
||||
|
||||
if int(metadata['event']) != event.pk:
|
||||
return HttpResponse('Not interested in this event', status=200)
|
||||
|
||||
with transaction.atomic():
|
||||
if rso and rso.payment:
|
||||
order = rso.payment.order
|
||||
payment = rso.payment
|
||||
elif rso:
|
||||
order = rso.order
|
||||
payment = None
|
||||
else:
|
||||
try:
|
||||
order = event.orders.get(id=metadata['order'])
|
||||
except Order.DoesNotExist:
|
||||
return HttpResponse('Order not found', status=200)
|
||||
payment = None
|
||||
|
||||
if payment:
|
||||
payment = OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=payment.pk)
|
||||
else:
|
||||
payment = order.payments.filter(
|
||||
info__icontains=src['id'],
|
||||
provider__startswith='stripe',
|
||||
amount=prov._amount_to_decimal(src['amount']) if src['amount'] is not None else order.total,
|
||||
).select_for_update(of=OF_SELF).last()
|
||||
if not payment:
|
||||
payment = order.payments.create(
|
||||
state=OrderPayment.PAYMENT_STATE_CREATED,
|
||||
provider=SOURCE_TYPES.get(src['type'], 'stripe'),
|
||||
amount=prov._amount_to_decimal(src['amount']) if src['amount'] is not None else order.total,
|
||||
info=str(src),
|
||||
)
|
||||
|
||||
if payment.provider != prov.identifier:
|
||||
prov = payment.payment_provider
|
||||
prov._init_api()
|
||||
|
||||
order.log_action('pretix.plugins.stripe.event', data=event_json)
|
||||
go = (event_json['type'] == 'source.chargeable' and
|
||||
payment.state in (OrderPayment.PAYMENT_STATE_PENDING, OrderPayment.PAYMENT_STATE_CREATED) and
|
||||
src.status == 'chargeable')
|
||||
if go:
|
||||
try:
|
||||
prov._charge_source(None, source_id, payment)
|
||||
except PaymentException:
|
||||
logger.exception('Webhook error')
|
||||
elif src.status == 'failed':
|
||||
payment.fail(info=str(src))
|
||||
elif src.status == 'canceled' and payment.state in (OrderPayment.PAYMENT_STATE_PENDING, OrderPayment.PAYMENT_STATE_CREATED):
|
||||
payment.info = str(src)
|
||||
payment.state = OrderPayment.PAYMENT_STATE_CANCELED
|
||||
payment.save()
|
||||
|
||||
return HttpResponse(status=200)
|
||||
|
||||
|
||||
def paymentintent_webhook(event, event_json, paymentintent_id, rso):
|
||||
import stripe
|
||||
|
||||
@@ -496,59 +419,6 @@ class StripeOrderView:
|
||||
}) + ('?paid=yes' if self.order.status == Order.STATUS_PAID else ''))
|
||||
|
||||
|
||||
@method_decorator(xframe_options_exempt, 'dispatch')
|
||||
class ReturnView(StripeOrderView, View):
|
||||
def get(self, request, *args, **kwargs):
|
||||
import stripe
|
||||
|
||||
prov = self.pprov
|
||||
prov._init_api()
|
||||
try:
|
||||
src = stripe.Source.retrieve(request.GET.get('source'), **prov.api_kwargs)
|
||||
except stripe.error.InvalidRequestError:
|
||||
logger.exception('Could not retrieve source')
|
||||
messages.error(self.request, _('Sorry, there was an error in the payment process. Please check the link '
|
||||
'in your emails to continue.'))
|
||||
return redirect_to_url(eventreverse(self.request.event, 'presale:event.index'))
|
||||
|
||||
if src.client_secret != request.GET.get('client_secret'):
|
||||
messages.error(self.request, _('Sorry, there was an error in the payment process. Please check the link '
|
||||
'in your emails to continue.'))
|
||||
return redirect_to_url(eventreverse(self.request.event, 'presale:event.index'))
|
||||
|
||||
with transaction.atomic():
|
||||
self.order.refresh_from_db()
|
||||
self.payment = OrderPayment.objects.select_for_update(of=OF_SELF).get(pk=self.payment.pk)
|
||||
if self.payment.state == OrderPayment.PAYMENT_STATE_CONFIRMED:
|
||||
if 'payment_stripe_token' in request.session:
|
||||
del request.session['payment_stripe_token']
|
||||
return self._redirect_to_order()
|
||||
|
||||
if src.status == 'chargeable':
|
||||
try:
|
||||
prov._charge_source(request, src.id, self.payment)
|
||||
except PaymentException as e:
|
||||
messages.error(request, str(e))
|
||||
return self._redirect_to_order()
|
||||
finally:
|
||||
if 'payment_stripe_token' in request.session:
|
||||
del request.session['payment_stripe_token']
|
||||
elif src.status == 'consumed':
|
||||
# Webhook was faster, wow! ;)
|
||||
if 'payment_stripe_token' in request.session:
|
||||
del request.session['payment_stripe_token']
|
||||
return self._redirect_to_order()
|
||||
elif src.status == 'pending':
|
||||
self.payment.state = OrderPayment.PAYMENT_STATE_PENDING
|
||||
self.payment.info = str(src)
|
||||
self.payment.save()
|
||||
else: # failed or canceled
|
||||
self.payment.fail(info=str(src))
|
||||
messages.error(self.request, _('We had trouble authorizing your card payment. Please try again and '
|
||||
'get in touch with us if this problem persists.'))
|
||||
return self._redirect_to_order()
|
||||
|
||||
|
||||
@method_decorator(xframe_options_exempt, 'dispatch')
|
||||
class ScaView(StripeOrderView, View):
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ class CustomerStep(CartMixin, TemplateFlowStep):
|
||||
else None
|
||||
),
|
||||
prefix='login',
|
||||
request=self.request.event,
|
||||
request=self.request,
|
||||
)
|
||||
for field in f.fields.values():
|
||||
field._show_required = field.required
|
||||
|
||||
@@ -83,7 +83,7 @@ class CheckoutView(View):
|
||||
return self.redirect(previous_step.get_step_url(request) if previous_step else self.get_index_url(request))
|
||||
|
||||
if 'step' not in kwargs:
|
||||
utm_params = {k: v for k, v in request.GET.items() if k.startswith("utm_")}
|
||||
utm_params = {k: v for k, v in request.GET.items() if k.startswith("utm_") or k == "gclid" or k == "_gl"}
|
||||
return self.redirect(step.get_step_url(request) + '?' + urlencode(utm_params))
|
||||
is_selected = (step.identifier == kwargs.get('step', ''))
|
||||
|
||||
|
||||
@@ -152,12 +152,9 @@ export function createWidgetStore (config: {
|
||||
return ''
|
||||
},
|
||||
additionalURLParams (): string {
|
||||
if (!window.location.search.includes('utm_')) {
|
||||
return ''
|
||||
}
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
for (const [key] of params.entries()) {
|
||||
if (!key.startsWith('utm_')) {
|
||||
if (!key.startsWith('utm_') || key !== 'gclid' || key !== '_gl') {
|
||||
params.delete(key)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,6 +872,51 @@ def test_item_create_with_addon(token_client, organizer, event, item, category,
|
||||
with scopes_disabled():
|
||||
assert 2 == Item.objects.all().count()
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/items/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
"category": category.pk,
|
||||
"name": {
|
||||
"en": "Ticket"
|
||||
},
|
||||
"active": True,
|
||||
"description": None,
|
||||
"default_price": "23.00",
|
||||
"free_price": False,
|
||||
"tax_rate": "19.00",
|
||||
"tax_rule": taxrule.pk,
|
||||
"admission": True,
|
||||
"issue_giftcard": False,
|
||||
"position": 0,
|
||||
"picture": None,
|
||||
"available_from": None,
|
||||
"available_until": None,
|
||||
"require_voucher": False,
|
||||
"hide_without_voucher": False,
|
||||
"allow_cancel": True,
|
||||
"min_per_order": None,
|
||||
"max_per_order": None,
|
||||
"checkin_attention": False,
|
||||
"checkin_text": None,
|
||||
"has_variations": True,
|
||||
"addons": [
|
||||
{
|
||||
"addon_category": category.pk,
|
||||
"min_count": 0,
|
||||
"max_count": 0,
|
||||
"position": 0,
|
||||
"multi_allowed": False,
|
||||
"price_included": True
|
||||
}
|
||||
]
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
assert resp.content.decode() == '{"addons":["The maximum count needs to be greater than zero."]}'
|
||||
with scopes_disabled():
|
||||
assert 2 == Item.objects.all().count()
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/items/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
@@ -1098,6 +1143,48 @@ def test_item_create_with_bundle(token_client, organizer, event, item, category,
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
assert resp.content.decode() == '{"bundles":["The chosen variation does not belong to this item."]}'
|
||||
with scopes_disabled():
|
||||
v = item2.variations.create(value="foo")
|
||||
|
||||
resp = token_client.post(
|
||||
'/api/v1/organizers/{}/events/{}/items/'.format(organizer.slug, event.slug),
|
||||
{
|
||||
"category": category.pk,
|
||||
"name": {
|
||||
"en": "Ticket"
|
||||
},
|
||||
"active": True,
|
||||
"description": None,
|
||||
"default_price": "23.00",
|
||||
"free_price": False,
|
||||
"tax_rate": "19.00",
|
||||
"tax_rule": taxrule.pk,
|
||||
"admission": True,
|
||||
"position": 0,
|
||||
"picture": None,
|
||||
"available_from": None,
|
||||
"available_until": None,
|
||||
"require_voucher": False,
|
||||
"hide_without_voucher": False,
|
||||
"allow_cancel": True,
|
||||
"min_per_order": None,
|
||||
"max_per_order": None,
|
||||
"checkin_attention": False,
|
||||
"checkin_text": None,
|
||||
"has_variations": True,
|
||||
"bundles": [
|
||||
{
|
||||
"bundled_item": item.pk,
|
||||
"bundled_variation": None,
|
||||
"count": 0,
|
||||
"designated_price": "3.00",
|
||||
}
|
||||
]
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
assert resp.content.decode() == '{"bundles":["The count needs to be greater than zero."]}'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
Reference in new issue
Block a user