Skip to content

Commit

Permalink
Stripe/PayPal: Add explanatory texts (Z#23127572) (#3826)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Jan 24, 2024
1 parent 0a154dc commit 7f0cf16
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<p>
{% if method == "wallet" %}
{% blocktrans trimmed %}
A PayPal account is required to use this online payment method. Please keep your account information
ready to enter in the next step.
{% endblocktrans %}
{% blocktrans trimmed %}
Please click the "Pay with PayPal" button below to start your payment.
{% endblocktrans %}
Expand Down
29 changes: 29 additions & 0 deletions src/pretix/plugins/stripe/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ class StripeMethod(BasePaymentProvider):
method = ''
redirect_action_handling = 'iframe' # or redirect
confirmation_method = 'manual'
explanation = ''

def __init__(self, event: Event):
super().__init__(event)
Expand Down Expand Up @@ -1174,6 +1175,7 @@ def payment_form_render(self, request) -> str:
'request': request,
'event': self.event,
'settings': self.settings,
'explanation': self.explanation,
}
return template.render(ctx)

Expand Down Expand Up @@ -1204,6 +1206,7 @@ def payment_form_render(self, request, total, order=None) -> str:
'event': self.event,
'total': self._decimal_to_int(total),
'settings': self.settings,
'explanation': self.explanation,
'is_moto': self.is_moto(request)
}
return template.render(ctx)
Expand Down Expand Up @@ -1297,6 +1300,7 @@ def get_invoice_address():
'event': self.event,
'settings': self.settings,
'form': self.payment_form(request),
'explanation': self.explanation,
'email': order.email if order else cs.get('email', '')
}
return template.render(ctx)
Expand Down Expand Up @@ -1429,6 +1433,7 @@ def payment_form_render(self, request, total, order=None) -> str:
'request': request,
'event': self.event,
'total': self._decimal_to_int(total),
'explanation': self.explanation,
'method': self.method,
}
return template.render(ctx)
Expand Down Expand Up @@ -1491,6 +1496,7 @@ def payment_form_render(self, request, total, order=None) -> str:
"event": self.event,
"total": self._decimal_to_int(total),
"method": self.method,
'explanation': self.explanation,
"country": self._detect_country(request, order)
}
return template.render(ctx)
Expand Down Expand Up @@ -1522,6 +1528,7 @@ def payment_form_render(self, request) -> str:
'request': request,
'event': self.event,
'settings': self.settings,
'explanation': self.explanation,
'form': self.payment_form(request)
}
return template.render(ctx)
Expand Down Expand Up @@ -1553,6 +1560,10 @@ class StripeGiropay(StripeRedirectWithAccountNamePaymentIntentMethod):
verbose_name = _('giropay via Stripe')
public_name = _('giropay')
method = 'giropay'
explanation = _(
'giropay is an online payment method available to all customers of most German banks, usually after one-time '
'activation. Please keep your online banking account and login information available.'
)

def _payment_intent_kwargs(self, request, payment):
return {
Expand Down Expand Up @@ -1584,6 +1595,10 @@ class StripeIdeal(StripeRedirectMethod):
verbose_name = _('iDEAL via Stripe')
public_name = _('iDEAL')
method = 'ideal'
explanation = _(
'iDEAL is an online payment method available to customers of Dutch banks. Please keep your online '
'banking account and login information available.'
)

def payment_presale_render(self, payment: OrderPayment) -> str:
pi = payment.info_data or {}
Expand All @@ -1605,6 +1620,10 @@ class StripeAlipay(StripeRedirectMethod):
public_name = _('Alipay')
method = 'alipay'
confirmation_method = 'automatic'
explanation = _(
'This payment method is available to customers of the Chinese payment system Alipay. Please keep '
'your login information available.'
)


class StripeBancontact(StripeRedirectWithAccountNamePaymentIntentMethod):
Expand Down Expand Up @@ -1650,6 +1669,7 @@ def payment_form_render(self, request) -> str:
'request': request,
'event': self.event,
'settings': self.settings,
'explanation': self.explanation,
'form': self.payment_form(request)
}
return template.render(ctx)
Expand Down Expand Up @@ -1750,6 +1770,7 @@ def payment_form_render(self, request) -> str:
'request': request,
'event': self.event,
'settings': self.settings,
'explanation': self.explanation,
'form': self.payment_form(request)
}
return template.render(ctx)
Expand Down Expand Up @@ -1790,6 +1811,10 @@ class StripePrzelewy24(StripeRedirectMethod):
verbose_name = _('Przelewy24 via Stripe')
public_name = _('Przelewy24')
method = 'p24'
explanation = _(
'Przelewy24 is an online payment method available to customers of Polish banks. Please keep your online '
'banking account and login information available.'
)

def _payment_intent_kwargs(self, request, payment):
return {
Expand Down Expand Up @@ -1825,6 +1850,10 @@ class StripeWeChatPay(StripeRedirectMethod):
public_name = _('WeChat Pay')
method = 'wechat_pay'
confirmation_method = 'automatic'
explanation = _(
'This payment method is available to users of the Chinese app WeChat. Please keep your login information '
'available.'
)

@property
def is_enabled(self) -> bool:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% load i18n %}

{% if explanation %}
<p>{{ explanation }}</p>
{% endif %}
<div class="form-horizontal stripe-container">
{% if is_moto %}
<h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{% load i18n %}
{% load bootstrap3 %}

{% if explanation %}
<p>{{ explanation }}</p>
{% endif %}
<div class="form-horizontal stripe-container">
<div class="stripe-errors sr-only">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{% load i18n %}
{% load bootstrap3 %}
{% if explanation %}
<p>{{ explanation }}</p>
{% endif %}
{% bootstrap_form form layout='horizontal' %}
<p>{% blocktrans trimmed %}
<p class="help-block">{% blocktrans trimmed %}
After you submitted your order, we will redirect you to the payment service provider to complete your payment.
You will then be redirected back here to get your tickets.
{% endblocktrans %}</p>
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% load i18n %}
{% load bootstrap3 %}

{% if explanation %}
<p>{{ explanation }}</p>
{% endif %}
<div class="form-horizontal stripe-container">
<div id="stripe-{{ method }}">
<span class="fa fa-spinner fa-spin"></span>
Expand All @@ -10,8 +12,7 @@
<p class="help-block">
{% blocktrans trimmed %}
After you submitted your order, we will redirect you to the payment service provider to complete your
payment.
You will then be redirected back here to get your tickets.
payment. You will then be redirected back here to get your tickets.
{% endblocktrans %}
</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% load i18n %}
<p>{% blocktrans trimmed %}
{% if explanation %}
<p>{{ explanation }}</p>
{% endif %}
<p class="help-block">{% blocktrans trimmed %}
After you submitted your order, we will redirect you to the payment service provider to complete your payment.
You will then be redirected back here to get your tickets.
{% endblocktrans %}</p>

0 comments on commit 7f0cf16

Please sign in to comment.