forked from CGM_Public/pretix_original
Add "Pay by bank" option for UK customers via Stripe (#5648)
* Add support for 'Pay by bank (UK)' payment method via Stripe * Add 'Pay by bank' payment provider to Stripe integration * Enhance Stripe integration: Allow UK bank payments and update imports * Remove UK-specific payment method options from StripePayByBank integration * Remove some UK references --------- Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
committed by
GitHub
parent
b895d9bbca
commit
0e41353a0e
@@ -412,6 +412,18 @@ class StripeSettingsHolder(BasePaymentProvider):
|
||||
'before they work properly.'),
|
||||
required=False,
|
||||
)),
|
||||
('method_pay_by_bank',
|
||||
forms.BooleanField(
|
||||
label=_('Pay by bank'),
|
||||
disabled=self.event.currency not in ['EUR', 'GBP'],
|
||||
help_text=' '.join([
|
||||
str(_('Some payment methods might need to be enabled in the settings of your Stripe account '
|
||||
'before they work properly.')),
|
||||
str(_('Currently only available for charges in GBP and customers with UK bank accounts, and '
|
||||
'in private preview for France and Germany.'))
|
||||
]),
|
||||
required=False,
|
||||
)),
|
||||
('method_wechatpay',
|
||||
forms.BooleanField(
|
||||
label=_('WeChat Pay'),
|
||||
@@ -1810,6 +1822,32 @@ class StripeRevolutPay(StripeRedirectMethod):
|
||||
}
|
||||
|
||||
|
||||
class StripePayByBank(StripeRedirectMethod):
|
||||
identifier = 'stripe_pay_by_bank'
|
||||
verbose_name = _('Pay by bank via Stripe')
|
||||
public_name = _('Pay by bank')
|
||||
method = 'pay_by_bank'
|
||||
redirect_in_widget_allowed = False
|
||||
confirmation_method = 'automatic'
|
||||
explanation = _(
|
||||
'Pay by bank allows you to authorize a secure Open Banking payment from your banking app. Currently available '
|
||||
'only with a UK bank account.'
|
||||
)
|
||||
|
||||
def is_allowed(self, request: HttpRequest, total: Decimal=None) -> bool:
|
||||
return super().is_allowed(request, total) and self.event.currency == 'GBP'
|
||||
|
||||
def _payment_intent_kwargs(self, request, payment):
|
||||
return {
|
||||
"payment_method_data": {
|
||||
"type": "pay_by_bank",
|
||||
"billing_details": {
|
||||
"email": payment.order.email,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class StripePayPal(StripeRedirectMethod):
|
||||
identifier = 'stripe_paypal'
|
||||
verbose_name = _('PayPal via Stripe')
|
||||
|
||||
@@ -46,15 +46,15 @@ def register_payment_provider(sender, **kwargs):
|
||||
from .payment import (
|
||||
StripeAffirm, StripeAlipay, StripeBancontact, StripeCC, StripeEPS,
|
||||
StripeGiropay, StripeIdeal, StripeKlarna, StripeMobilePay,
|
||||
StripeMultibanco, StripePayPal, StripePrzelewy24, StripeRevolutPay,
|
||||
StripeSEPADirectDebit, StripeSettingsHolder, StripeSofort, StripeSwish,
|
||||
StripeTwint, StripeWeChatPay,
|
||||
StripeMultibanco, StripePayByBank, StripePayPal, StripePrzelewy24,
|
||||
StripeRevolutPay, StripeSEPADirectDebit, StripeSettingsHolder,
|
||||
StripeSofort, StripeSwish, StripeTwint, StripeWeChatPay,
|
||||
)
|
||||
|
||||
return [
|
||||
StripeSettingsHolder, StripeCC, StripeGiropay, StripeIdeal, StripeAlipay, StripeBancontact,
|
||||
StripeSofort, StripeEPS, StripeMultibanco, StripePrzelewy24, StripeRevolutPay, StripeWeChatPay,
|
||||
StripeSEPADirectDebit, StripeAffirm, StripeKlarna, StripePayPal, StripeSwish, StripeTwint, StripeMobilePay
|
||||
StripeSEPADirectDebit, StripeAffirm, StripeKlarna, StripePayByBank, StripePayPal, StripeSwish, StripeTwint, StripeMobilePay
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user