mirror of
https://github.com/pretix/pretix.git
synced 2026-05-17 17:14:04 +00:00
Add PromptPay support (#5)
* Handle PromptPay QR flow * Send billing email for PromptPay * fix isort * Update payment.py * Update signals.py --------- Co-authored-by: Chondaen <chondaen12@1000WA>
This commit is contained in:
@@ -137,7 +137,7 @@ logger = logging.getLogger('pretix.plugins.stripe')
|
||||
# Real-time payments
|
||||
# - Swish: ✓
|
||||
# - PayNow: ✗
|
||||
# - PromptPay: ✗
|
||||
# - PromptPay: ✓
|
||||
# - Pix: ✗
|
||||
#
|
||||
# Vouchers
|
||||
@@ -428,6 +428,14 @@ class StripeSettingsHolder(BasePaymentProvider):
|
||||
'before they work properly.'),
|
||||
required=False,
|
||||
)),
|
||||
('method_promptpay',
|
||||
forms.BooleanField(
|
||||
label='PromptPay',
|
||||
disabled=self.event.currency != 'THB',
|
||||
help_text=_('Some payment methods might need to be enabled in the settings of your Stripe account '
|
||||
'before they work properly.'),
|
||||
required=False,
|
||||
)),
|
||||
('method_swish',
|
||||
forms.BooleanField(
|
||||
label=_('Swish'),
|
||||
@@ -1842,6 +1850,31 @@ class StripeSwish(StripeRedirectMethod):
|
||||
}
|
||||
|
||||
|
||||
class StripePromptPay(StripeRedirectMethod):
|
||||
identifier = 'stripe_promptpay'
|
||||
verbose_name = _('PromptPay via Stripe')
|
||||
public_name = 'PromptPay'
|
||||
method = 'promptpay'
|
||||
confirmation_method = 'automatic'
|
||||
explanation = _(
|
||||
'This payment method is available to PromptPay users in Thailand. Please have your app ready.'
|
||||
)
|
||||
|
||||
def is_allowed(self, request: HttpRequest, total: Decimal=None) -> bool:
|
||||
return super().is_allowed(request, total) and request.event.currency == "THB"
|
||||
|
||||
def _payment_intent_kwargs(self, request, payment):
|
||||
return {
|
||||
"payment_method_data": {
|
||||
"type": "promptpay",
|
||||
"billing_details": {
|
||||
"email": payment.order.email,
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class StripeTwint(StripeRedirectMethod):
|
||||
identifier = 'stripe_twint'
|
||||
verbose_name = _('TWINT via Stripe')
|
||||
|
||||
Reference in New Issue
Block a user