|
3 | 3 |
|
4 | 4 | from django import forms
|
5 | 5 | from django.dispatch import receiver
|
6 |
| -from django.http import HttpRequest |
7 | 6 | from django.template.loader import get_template
|
8 | 7 | from django.urls import resolve, reverse
|
9 | 8 | from django.utils.translation import gettext_lazy as _
|
10 |
| -from paypalhttp import HttpResponse |
11 | 9 |
|
12 | 10 | from pretix.base.forms import SecretKeySettingsField
|
13 |
| -from pretix.base.middleware import _merge_csp, _parse_csp, _render_csp |
14 | 11 | from pretix.base.settings import settings_hierarkey
|
15 | 12 | from pretix.base.signals import (
|
16 | 13 | logentry_display, register_global_settings, register_payment_providers,
|
17 | 14 | )
|
18 | 15 | from pretix.control.signals import nav_organizer
|
| 16 | +from pretix.presale.signals import html_head |
| 17 | + |
19 | 18 | from .forms import StripeKeyValidator
|
20 |
| -from .payment import StripeMethod |
21 |
| -from pretix.presale.signals import html_head, process_response |
22 | 19 |
|
23 | 20 |
|
24 | 21 | @receiver(register_payment_providers, dispatch_uid="payment_stripe")
|
25 | 22 | def register_payment_provider(sender, **kwargs):
|
26 | 23 | from .payment import (
|
27 |
| - StripeAffirm, StripeAlipay, StripeBancontact, StripeCC, StripeEPS, |
28 |
| - StripeGiropay, StripeIdeal, StripeKlarna, StripeMultibanco, |
29 |
| - StripePayPal, StripePrzelewy24, StripeSEPADirectDebit, |
30 |
| - StripeSettingsHolder, StripeSofort, StripeSwish, StripeWeChatPay, |
| 24 | + StripeAffirm, StripeAlipay, StripeBancontact, StripeCreditCard, |
| 25 | + StripeEPS, StripeIdeal, StripeKlarna, StripeMobilePay, |
| 26 | + StripeMultibanco, StripePayPal, StripePrzelewy24, StripeRevolutPay, |
| 27 | + StripeSEPADirectDebit, StripeSettingsHolder, StripeSofort, StripeSwish, |
| 28 | + StripeTwint, StripeWeChatPay, |
31 | 29 | )
|
32 | 30 |
|
33 | 31 | return [
|
34 |
| - StripeSettingsHolder, StripeCC, StripeGiropay, StripeIdeal, StripeAlipay, StripeBancontact, |
| 32 | + StripeSettingsHolder, StripeCreditCard, StripeIdeal, StripeAlipay, StripeBancontact, |
35 | 33 | StripeSofort, StripeEPS, StripeMultibanco, StripePrzelewy24, StripeWeChatPay,
|
36 |
| - StripeSEPADirectDebit, StripeAffirm, StripeKlarna, StripePayPal, StripeSwish |
| 34 | + StripePayPal, StripeRevolutPay, StripeSEPADirectDebit, StripeSwish, StripeTwint, |
| 35 | + StripeMobilePay, StripeAffirm, StripeKlarna |
37 | 36 | ]
|
38 | 37 |
|
39 | 38 |
|
@@ -163,40 +162,3 @@ def nav_o(sender, request, organizer, **kwargs):
|
163 | 162 | 'active': 'settings.connect' in url.url_name,
|
164 | 163 | }]
|
165 | 164 | return []
|
166 |
| - |
167 |
| - |
168 |
| -@receiver(signal=process_response, dispatch_uid="stripe_middleware_resp") |
169 |
| -def signal_process_response(sender, request: HttpRequest, response: HttpResponse, **kwargs): |
170 |
| - provider = StripeMethod(sender) |
171 |
| - url = resolve(request.path_info) |
172 |
| - |
173 |
| - enabled = provider.settings.get('_enabled', as_type=bool) |
174 |
| - relevant_urls = { |
175 |
| - "event.order.pay.change", |
176 |
| - "event.order.pay", |
177 |
| - "event.checkout", |
178 |
| - "plugins:eventyay_stripe:sca", |
179 |
| - "plugins:eventyay_stripe:sca.return" |
180 |
| - } |
181 |
| - |
182 |
| - if enabled and ( |
183 |
| - url.url_name in relevant_urls or |
184 |
| - (url.namespace == "plugins:eventyay_stripe" and url.url_name in ["sca", "sca.return"]) |
185 |
| - ): |
186 |
| - if 'Content-Security-Policy' in response: |
187 |
| - csp_header = _parse_csp(response['Content-Security-Policy']) |
188 |
| - else: |
189 |
| - csp_header = {} |
190 |
| - |
191 |
| - stripe_csps = { |
192 |
| - 'connect-src': ['https://api.stripe.com'], |
193 |
| - 'frame-src': ['https://js.stripe.com', 'https://hooks.stripe.com'], |
194 |
| - 'script-src': ['https://js.stripe.com'], |
195 |
| - } |
196 |
| - |
197 |
| - _merge_csp(csp_header, stripe_csps) |
198 |
| - |
199 |
| - if csp_header: |
200 |
| - response['Content-Security-Policy'] = _render_csp(csp_header) |
201 |
| - |
202 |
| - return response |
0 commit comments