mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Stripe: Fix test mode recognition
This commit is contained in:
@@ -34,7 +34,14 @@ def html_head_presale(sender, request=None, **kwargs):
|
|||||||
url = resolve(request.path_info)
|
url = resolve(request.path_info)
|
||||||
if provider.settings.get('_enabled', as_type=bool) and ("checkout" in url.url_name or "order.pay" in url.url_name):
|
if provider.settings.get('_enabled', as_type=bool) and ("checkout" in url.url_name or "order.pay" in url.url_name):
|
||||||
template = get_template('pretixplugins/stripe/presale_head.html')
|
template = get_template('pretixplugins/stripe/presale_head.html')
|
||||||
ctx = {'event': sender, 'settings': provider.settings}
|
ctx = {
|
||||||
|
'event': sender,
|
||||||
|
'settings': provider.settings,
|
||||||
|
'testmode': (
|
||||||
|
(provider.settings.get('endpoint', 'live') == 'test' or sender.testmode)
|
||||||
|
and provider.settings.publishable_test_key
|
||||||
|
)
|
||||||
|
}
|
||||||
return template.render(ctx)
|
return template.render(ctx)
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
{% compress css %}
|
{% compress css %}
|
||||||
<link type="text/css" rel="stylesheet" href="{% static "pretixplugins/stripe/pretix-stripe.css" %}">
|
<link type="text/css" rel="stylesheet" href="{% static "pretixplugins/stripe/pretix-stripe.css" %}">
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
{% if settings.endpoint == "test" and settings.publishable_test_key %}
|
{% if test_mode %}
|
||||||
<script type="text/plain" id="stripe_pubkey">{{ settings.publishable_test_key }}</script>
|
<script type="text/plain" id="stripe_pubkey">{{ settings.publishable_test_key }}</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<script type="text/plain" id="stripe_pubkey">{{ settings.publishable_key }}</script>
|
<script type="text/plain" id="stripe_pubkey">{{ settings.publishable_key }}</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user