forked from CGM_Public/pretix_original
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)
|
||||
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')
|
||||
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)
|
||||
else:
|
||||
return ""
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{% compress css %}
|
||||
<link type="text/css" rel="stylesheet" href="{% static "pretixplugins/stripe/pretix-stripe.css" %}">
|
||||
{% 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>
|
||||
{% else %}
|
||||
<script type="text/plain" id="stripe_pubkey">{{ settings.publishable_key }}</script>
|
||||
|
||||
Reference in New Issue
Block a user