diff --git a/src/pretix/helpers/payment.py b/src/pretix/helpers/payment.py index 88be6dfaa1..7f58c43aea 100644 --- a/src/pretix/helpers/payment.py +++ b/src/pretix/helpers/payment.py @@ -1,5 +1,27 @@ +# +# 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 . +# +# 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 +# . +# +from urllib.parse import quote, urlencode + import text_unidecode -from urllib.parse import urlencode, quote from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ @@ -84,7 +106,7 @@ def euro_bezahlcode( if event.currency != 'EUR' or not bank_details_sepa_iban: return - qr_data = f"bank://singlepaymentsepa?" + urlencode({ + qr_data = "bank://singlepaymentsepa?" + urlencode({ "name": str(bank_details_sepa_name), "iban": str(bank_details_sepa_iban), "bic": str(bank_details_sepa_bic), @@ -155,7 +177,11 @@ def swiss_qrbill( return { "id": "qrbill", "label": "QR-bill", - "html_prefix": mark_safe(''), + "html_prefix": mark_safe( + '' + '' + '' + ), "qr_data": qr_data, "css_class": "banktransfer-swiss-cross-overlay", } diff --git a/src/tests/helpers/test_payment.py b/src/tests/helpers/test_payment.py index ae72bd2b3e..ef2ff95769 100644 --- a/src/tests/helpers/test_payment.py +++ b/src/tests/helpers/test_payment.py @@ -1,10 +1,31 @@ +# +# 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 . +# +# 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 +# . +# from datetime import timedelta from decimal import Decimal import pytest from django.utils.timezone import now -from pretix.base.models import Organizer, Event +from pretix.base.models import Event, Organizer from pretix.helpers.payment import generate_payment_qr_codes @@ -52,7 +73,8 @@ TESTVERANST-12345 ''' assert codes[1]['label'] == 'BezahlCode' - assert codes[1]['qr_data'] == 'bank://singlepaymentsepa?name=Verein%20f%C3%BCr%20Testzwecke%20e.V.&iban=DE37796500000069799047&bic=BYLADEM1MIL&amount=123%2C00&reason=TESTVERANST-12345¤cy=EUR' + assert codes[1]['qr_data'] == ('bank://singlepaymentsepa?name=Verein%20f%C3%BCr%20Testzwecke%20e.V.&iban=DE37796500000069799047' + '&bic=BYLADEM1MIL&amount=123%2C00&reason=TESTVERANST-12345¤cy=EUR') @pytest.mark.django_db @@ -99,4 +121,4 @@ def test_payment_qr_codes_swiss(env): "", "TESTVERANST-12345", "EPD", - ]) \ No newline at end of file + ])