forked from CGM_Public/pretix_original
Refund process: Allow to specify manual expiry for gift card
This commit is contained in:
@@ -77,7 +77,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4>{% trans "Refund to a different payment method" %}</h4>
|
<h4>{% trans "Refund to a different payment method" %}</h4>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive table-responsive-small-only">
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -130,8 +130,12 @@
|
|||||||
<strong>{% trans "Create a new gift card" %}</strong>
|
<strong>{% trans "Create a new gift card" %}</strong>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="text-muted">
|
<p class="text-muted">
|
||||||
{% trans "The gift card can be used to buy tickets for all events of this organizer." %}
|
{% trans "The gift card can be used to buy tickets for all events of this organizer." %}
|
||||||
|
</p>
|
||||||
|
<div class="pos-relative">
|
||||||
|
<input type="text" name="giftcard-expires" placeholder="{% trans "Expiration date" %}"
|
||||||
|
value="{{ giftcard_expires }}" title="" class="datepickerfield form-control" autocomple="off">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right flip refund-amount">
|
<td class="text-right flip refund-amount">
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ from decimal import Decimal, DecimalException
|
|||||||
from urllib.parse import quote, urlencode
|
from urllib.parse import quote, urlencode
|
||||||
|
|
||||||
import vat_moss.id
|
import vat_moss.id
|
||||||
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
@@ -60,6 +61,7 @@ from django.http import (
|
|||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import formats
|
from django.utils import formats
|
||||||
|
from django.utils.formats import date_format, get_format
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.http import is_safe_url
|
from django.utils.http import is_safe_url
|
||||||
from django.utils.timezone import make_aware, now
|
from django.utils.timezone import make_aware, now
|
||||||
@@ -858,8 +860,22 @@ class OrderRefundView(OrderView):
|
|||||||
else:
|
else:
|
||||||
if giftcard_value:
|
if giftcard_value:
|
||||||
refund_selected += giftcard_value
|
refund_selected += giftcard_value
|
||||||
|
|
||||||
|
if self.request.POST.get('giftcard-expires'):
|
||||||
|
try:
|
||||||
|
expires = forms.DateField().to_python(self.request.POST.get('giftcard-expires'))
|
||||||
|
expires = make_aware(datetime.combine(
|
||||||
|
expires,
|
||||||
|
time(hour=23, minute=59, second=59)
|
||||||
|
), self.request.event.timezone)
|
||||||
|
except ValidationError as e:
|
||||||
|
messages.error(self.request, e.message)
|
||||||
|
is_valid = False
|
||||||
|
else:
|
||||||
|
expires = None
|
||||||
|
|
||||||
giftcard = self.request.organizer.issued_gift_cards.create(
|
giftcard = self.request.organizer.issued_gift_cards.create(
|
||||||
expires=self.request.organizer.default_gift_card_expiry,
|
expires=expires,
|
||||||
currency=self.request.event.currency,
|
currency=self.request.event.currency,
|
||||||
testmode=self.order.testmode
|
testmode=self.order.testmode
|
||||||
)
|
)
|
||||||
@@ -1054,6 +1070,10 @@ class OrderRefundView(OrderView):
|
|||||||
'order': self.order,
|
'order': self.order,
|
||||||
'comment': comment,
|
'comment': comment,
|
||||||
'giftcard_proposal': giftcard_proposal,
|
'giftcard_proposal': giftcard_proposal,
|
||||||
|
'giftcard_expires': (
|
||||||
|
date_format(self.request.organizer.default_gift_card_expiry, get_format('DATE_INPUT_FORMATS')[0])
|
||||||
|
if self.request.organizer.default_gift_card_expiry else ''
|
||||||
|
),
|
||||||
'partial_amount': (
|
'partial_amount': (
|
||||||
self.request.POST.get('start-partial_amount') if self.request.method == 'POST'
|
self.request.POST.get('start-partial_amount') if self.request.method == 'POST'
|
||||||
else self.request.GET.get('start-partial_amount')
|
else self.request.GET.get('start-partial_amount')
|
||||||
|
|||||||
@@ -687,3 +687,12 @@ table td > .checkbox input[type="checkbox"] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: $screen-md-min) {
|
||||||
|
.table-responsive-small-only {
|
||||||
|
overflow-x: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pos-relative {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user