Introduce RequiredAction model

Fix #343 by no longer marking as refunded automatically
This commit is contained in:
Raphael Michel
2017-01-04 15:04:18 +01:00
parent 871011826c
commit aed9382fd7
16 changed files with 303 additions and 11 deletions

View File

@@ -5,7 +5,9 @@ from django.dispatch import receiver
from django.template.loader import get_template
from django.utils.translation import ugettext_lazy as _
from pretix.base.signals import logentry_display, register_payment_providers
from pretix.base.signals import (
logentry_display, register_payment_providers, requiredaction_display,
)
from pretix.presale.signals import html_head
@@ -57,3 +59,14 @@ def pretixcontrol_logentry_display(sender, logentry, **kwargs):
if text:
return _('Stripe reported an event: {}').format(text)
@receiver(signal=requiredaction_display, dispatch_uid="stripe_requiredaction_display")
def pretixcontrol_action_display(sender, action, request, **kwargs):
if action.action_type != 'pretix.plugins.stripe.refund':
return
data = json.loads(action.data)
template = get_template('pretixplugins/stripe/action_refund.html')
ctx = {'data': data, 'event': sender, 'action': action}
return template.render(ctx, request)