From 58add74b3ab16917315d36c3ccd1ed63ffdf9940 Mon Sep 17 00:00:00 2001 From: Martin Gross Date: Tue, 9 Apr 2024 10:06:58 +0200 Subject: [PATCH] Stripe: Add PayPal (#4049) (Z#23123667) --- src/pretix/plugins/stripe/payment.py | 17 ++++++++++++++++- src/pretix/plugins/stripe/signals.py | 6 +++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/pretix/plugins/stripe/payment.py b/src/pretix/plugins/stripe/payment.py index 8479a41dd6..8dc7f6544e 100644 --- a/src/pretix/plugins/stripe/payment.py +++ b/src/pretix/plugins/stripe/payment.py @@ -149,7 +149,7 @@ logger = logging.getLogger('pretix.plugins.stripe') # - Secure Remote Commerce: ✗ # - Link: ✓ (PaymentRequestButton) # - Cash App Pay: ✗ -# - PayPal: ✗ +# - PayPal: ✓ (No settings UI yet) # - MobilePay: ✗ # - Alipay: ✓ # - WeChat Pay: ✓ @@ -468,6 +468,14 @@ class StripeSettingsHolder(BasePaymentProvider): ]), required=False, )), + # Disabled for now, since we still need to figure out how to make this work on our connect platform + # ('method_paypal', + # forms.BooleanField( + # label=_('PayPal'), + # disabled=self.event.currency not in [ + # 'EUR', 'GBP', 'USD', 'CHF', 'CZK', 'DKK', 'NOK', 'PLN', 'SEK', 'AUD', 'CAD', 'HKD', 'NZD', 'SGD' + # ] + # )), ] + extra_fields + list(super().settings_form_fields.items()) + moto_settings ) if not self.settings.connect_client_id or self.settings.secret_key: @@ -1892,3 +1900,10 @@ class StripeWeChatPay(StripeRedirectMethod): }, } } + + +class StripePayPal(StripeRedirectMethod): + identifier = 'stripe_paypal' + verbose_name = _('PayPal via Stripe') + public_name = _('PayPal') + method = 'paypal' diff --git a/src/pretix/plugins/stripe/signals.py b/src/pretix/plugins/stripe/signals.py index c8a95bce16..e73306e62b 100644 --- a/src/pretix/plugins/stripe/signals.py +++ b/src/pretix/plugins/stripe/signals.py @@ -47,14 +47,14 @@ def register_payment_provider(sender, **kwargs): from .payment import ( StripeAffirm, StripeAlipay, StripeBancontact, StripeCC, StripeEPS, StripeGiropay, StripeIdeal, StripeKlarna, StripeMultibanco, - StripePrzelewy24, StripeSEPADirectDebit, StripeSettingsHolder, - StripeSofort, StripeWeChatPay, + StripePayPal, StripePrzelewy24, StripeSEPADirectDebit, + StripeSettingsHolder, StripeSofort, StripeWeChatPay, ) return [ StripeSettingsHolder, StripeCC, StripeGiropay, StripeIdeal, StripeAlipay, StripeBancontact, StripeSofort, StripeEPS, StripeMultibanco, StripePrzelewy24, StripeWeChatPay, - StripeSEPADirectDebit, StripeAffirm, StripeKlarna, + StripeSEPADirectDebit, StripeAffirm, StripeKlarna, StripePayPal, ]